Widgitized the output
This commit is contained in:
@@ -18,8 +18,10 @@ class Database_TSM_Show extends Database_Result {
|
||||
|
||||
$sql = strtolower($sql);
|
||||
|
||||
$start = FALSE;
|
||||
$barcodewarn = FALSE;
|
||||
$eid = $sid = FALSE;
|
||||
$ec = 0;
|
||||
|
||||
foreach ($result as $line) {
|
||||
if (! trim($line))
|
||||
continue;
|
||||
@@ -28,9 +30,6 @@ class Database_TSM_Show extends Database_Result {
|
||||
$library = strtoupper(preg_replace('/^show slots /','',$sql));
|
||||
|
||||
if (preg_match('/^Slot /',$line)) {
|
||||
if ($start)
|
||||
$this->_internal_row++;
|
||||
|
||||
$slot = array();
|
||||
foreach ((preg_split('/,\s*/',$line,-1)) as $slotkey => $val)
|
||||
if (preg_match('/^element number\s+/',$val))
|
||||
@@ -44,9 +43,34 @@ class Database_TSM_Show extends Database_Result {
|
||||
elseif (preg_match('/^barcode\s+/',$val))
|
||||
$slot['barcode'] = preg_replace('/^barcode /','',$val);
|
||||
|
||||
// We assume that the element numbers are sequential
|
||||
// @todo This routine would miss the first empty slots, there is no way to work this out?
|
||||
if ($eid AND $eid+1 != $slot['element']) {
|
||||
while ($eid+1 != $slot['element']) {
|
||||
if ($ec++ > $this->Slots OR $sid == $slot['slot'])
|
||||
throw new Kohana_Exception('Had a problem calculating EMPTY slots (:ec, :slots, :sid, :slot)',
|
||||
array(':ec'=>$ec,':slots'=>$this->Slots,':sid'=>$sid,':slot'=>$slot['slot'])
|
||||
);
|
||||
|
||||
$eid++;
|
||||
$sid++;
|
||||
$this->_rows[$this->_internal_row++] = new Slot(array(
|
||||
'element'=>"$eid",
|
||||
'slot'=>"$sid",
|
||||
'status'=>'Empty',
|
||||
'barcodelabel'=>'',
|
||||
'barcode'=>'',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$slot['library'] = $library;
|
||||
$this->_rows[$this->_internal_row] = new Slot($slot);
|
||||
$start = TRUE;
|
||||
$this->_rows[$this->_internal_row++] = new Slot($slot);
|
||||
|
||||
// Counters to keep track of empty slots
|
||||
$eid = $slot['element'];
|
||||
$sid = $slot['slot'];
|
||||
$ec++;
|
||||
|
||||
if (! $barcodewarn AND $slot['status'] == 'Allocated' AND $slot['barcode'] == 'not present') {
|
||||
SystemMessage::add(array(
|
||||
|
Reference in New Issue
Block a user