Added drive to library view
This commit is contained in:
@@ -11,17 +11,22 @@
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Database_TSM_Show extends Database_Result {
|
||||
private $data = array();
|
||||
|
||||
public function __construct($result, $sql, $as_object = FALSE, array $params = NULL) {
|
||||
parent::__construct($result, $sql, $as_object, $params);
|
||||
|
||||
$sql = strtolower($sql);
|
||||
|
||||
$start = FALSE;
|
||||
$barcodewarn = FALSE;
|
||||
foreach ($result as $line) {
|
||||
if (! trim($line))
|
||||
continue;
|
||||
|
||||
if (preg_match('/^show slots /',$sql))
|
||||
if (preg_match('/^show slots /',$sql)) {
|
||||
$library = strtoupper(preg_replace('/^show slots /','',$sql));
|
||||
|
||||
if (preg_match('/^Slot /',$line)) {
|
||||
if ($start)
|
||||
$this->_internal_row++;
|
||||
@@ -39,10 +44,20 @@ class Database_TSM_Show extends Database_Result {
|
||||
elseif (preg_match('/^barcode\s+/',$val))
|
||||
$slot['barcode'] = preg_replace('/^barcode /','',$val);
|
||||
|
||||
$slot['library'] = preg_replace('/^show slots /','',$sql);
|
||||
$slot['library'] = $library;
|
||||
$this->_rows[$this->_internal_row] = new Slot($slot);
|
||||
$start = TRUE;
|
||||
|
||||
if (! $barcodewarn AND $slot['status'] == 'Allocated' AND $slot['barcode'] == 'not present') {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Missing Bar Code Labels'),
|
||||
'type'=>'warning',
|
||||
'body'=>sprintf(_('Some allocated slots do not have a bar code label, you may need to run "AUDIT LIBRARY %s CHECKLABEL=BARCODE"'),$library),
|
||||
));
|
||||
|
||||
$barcodewarn = TRUE;
|
||||
}
|
||||
|
||||
} elseif (preg_match('/busy.$/',$line)) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Library is Busy'),
|
||||
@@ -51,11 +66,26 @@ class Database_TSM_Show extends Database_Result {
|
||||
));
|
||||
|
||||
return;
|
||||
|
||||
} elseif (preg_match('/:/',$line)) {
|
||||
$line = str_replace(' ','',$line);
|
||||
list($k,$v) = explode(':',$line,2);
|
||||
|
||||
$this->data[$k] = $v;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_total_rows = $this->_internal_row;
|
||||
$this->_internal_row = 0;
|
||||
}
|
||||
|
||||
public function __get($key) {
|
||||
if (isset($this->data[$key]))
|
||||
return $this->data[$key];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
25
application/classes/model/drive.php
Normal file
25
application/classes/model/drive.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
*
|
||||
* @package PTA
|
||||
* @subpackage Drive
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_DRIVE extends ORMTSM {
|
||||
protected $_table_name = 'DRIVES';
|
||||
protected $_primary_key = 'DRIVE_NAME';
|
||||
protected $_sorting = array(
|
||||
'DRIVE_NAME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
);
|
||||
protected $_has_many = array(
|
||||
'PATH'=>array('foreign_key'=>array('LIBRARY_NAME'=>'LIBRARY_NAME','DRIVE_NAME'=>'DESTINATION_NAME')),
|
||||
);
|
||||
}
|
||||
?>
|
@@ -18,8 +18,8 @@ class Model_FILESPACE extends ORMTSM {
|
||||
);
|
||||
|
||||
protected $_has_many = array(
|
||||
'VOLUMEUSAGE'=>array('foreign_key'=>array('NODE_NAME','FILESPACE_NAME'),'far_key'=>'FILESPACE_NAME'),
|
||||
'OCCUPANCY'=>array('foreign_key'=>array('NODE_NAME','FILESPACE_NAME'),'far_key'=>'FILESPACE_NAME'),
|
||||
'VOLUMEUSAGE'=>array('foreign_key'=>array('NODE_NAME'=>'NODE_NAME','FILESPACE_NAME'=>'FILESPACE_NAME')),
|
||||
'OCCUPANCY'=>array('foreign_key'=>array('NODE_NAME'=>'NODE_NAME','FILESPACE_NAME'=>'FILESPACE_NAME')),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
|
@@ -19,6 +19,7 @@ class Model_LIBRARY extends ORMTSM {
|
||||
protected $_has_one = array(
|
||||
);
|
||||
protected $_has_many = array(
|
||||
'DRIVE'=>array('foreign_key'=>'LIBRARY_NAME','far_key'=>'LIBRARY_NAME'),
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@@ -19,8 +19,8 @@ class Model_MGMTCLASS extends ORMTSM {
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
'COPYGROUP_BU'=>array('foreign_key'=>array('DOMAIN_NAME','SET_NAME','CLASS_NAME')),
|
||||
'COPYGROUP_AR'=>array('foreign_key'=>array('DOMAIN_NAME','SET_NAME','CLASS_NAME')),
|
||||
'COPYGROUP_BU'=>array('foreign_key'=>array('DOMAIN_NAME'=>'DOMAIN_NAME','SET_NAME'=>'SET_NAME','CLASS_NAME'=>'CLASS_NAME')),
|
||||
'COPYGROUP_AR'=>array('foreign_key'=>array('DOMAIN_NAME'=>'DOMAIN_NAME','SET_NAME'=>'SET_NAME','CLASS_NAME'=>'CLASS_NAME')),
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
24
application/classes/model/path.php
Normal file
24
application/classes/model/path.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
*
|
||||
* @package PTA
|
||||
* @subpackage Drive Paths
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_PATH extends ORMTSM {
|
||||
protected $_table_name = 'PATHS';
|
||||
protected $_primary_key = 'DEVICE';
|
||||
protected $_sorting = array(
|
||||
'DESTINATION_NAME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
);
|
||||
protected $_has_many = array(
|
||||
);
|
||||
}
|
||||
?>
|
@@ -16,8 +16,8 @@ class Model_SCHEDULE_CLIENT extends ORMTSM {
|
||||
'SCHEDULE_NAME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_has_many = array(
|
||||
'ASSOCIATION'=>array('foreign_key'=>'SCHEDULE_NAME','far_key'=>'SCHEDULE_NAME'),
|
||||
protected $_has_many = array(
|
||||
'ASSOCIATION'=>array('foreign_key'=>'SCHEDULE_NAME','far_key'=>'SCHEDULE_NAME'),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
|
@@ -34,5 +34,14 @@ class Slot {
|
||||
public function __toString() {
|
||||
return $this->slot;
|
||||
}
|
||||
|
||||
public function barcodelabel() {
|
||||
if ($this->status == 'Allocated' AND $this->barcode == 'not present')
|
||||
return _('No Label');
|
||||
elseif ($this->status == 'Unallocated')
|
||||
return _('Slot Empty');
|
||||
else
|
||||
return $this->barcodelabel;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user