diff --git a/application/classes/model/library.php b/application/classes/model/library.php index 0c78289..c52a62e 100644 --- a/application/classes/model/library.php +++ b/application/classes/model/library.php @@ -132,7 +132,7 @@ class Model_LIBRARY extends ORMTSM { if (! isset($CACHE[__METHOD__])) foreach (ORM::factory('volhistory')->where('TYPE','IN',Kohana::config('config.tsmdbtypes'))->find_all() as $vho) - $CACHE[__METHOD__][$vho->LIBVOLUME ? 'IN' : 'OUT'][] = $vho; + $CACHE[__METHOD__][$vho->LIBVOLUME->LIBRARY_NAME ? 'IN' : 'OUT'][] = $vho; return isset($CACHE[__METHOD__][$inout]) ? $CACHE[__METHOD__][$inout] : array(); } diff --git a/application/classes/model/libvolume.php b/application/classes/model/libvolume.php index 4ed4749..333fe7d 100644 --- a/application/classes/model/libvolume.php +++ b/application/classes/model/libvolume.php @@ -27,13 +27,17 @@ class Model_LIBVOLUME extends ORMTSM { switch (strtolower($this->STATUS)) { case 'scratch': return strtolower($this->STATUS); case 'private': + if ($this->VOLUME->STATUS == 'EMPTY') + return 'empty'; + switch (strtolower($this->LAST_USE)) { case 'dbbackup': case 'data': return strtolower($this->LAST_USE); - default: return ($this->VOLUME->STATUS == 'EMPTY') ? 'empty' : 'unknown'; + default: return 'unkown'; } + default: return 'notcheckedin'; } } @@ -80,7 +84,7 @@ class Model_LIBVOLUME extends ORMTSM { } public function removable() { - return ($this->usage() == 'dbbackup' OR ($this->usage() != 'scratch' AND $this->VOLUME->STGPOOL->POOLTYPE != 'PRIMARY')) ? TRUE : FALSE; + return ($this->usage() == 'dbbackup' OR (! in_array($this->usage(),array('empty','scratch')) AND $this->VOLUME->STGPOOL->POOLTYPE != 'PRIMARY')) ? TRUE : FALSE; } } ?> diff --git a/application/classes/model/volume.php b/application/classes/model/volume.php index 19780f7..488fd78 100644 --- a/application/classes/model/volume.php +++ b/application/classes/model/volume.php @@ -56,7 +56,7 @@ class Model_VOLUME extends ORMTSM { // Age of a volume, based on last read/write access. public function age() { - if (! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE) + if ((! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE) OR $this->STATUS == 'EMPTY') return 0; else return (int)((time()-(strtotime(strtotime($this->LAST_READ_DATE) > strtotime($this->LAST_WRITE_DATE) ? $this->LAST_WRITE_DATE : $this->LAST_READ_DATE)))/86400); diff --git a/application/views/library/detail.php b/application/views/library/detail.php index 25a770f..c9de995 100644 --- a/application/views/library/detail.php +++ b/application/views/library/detail.php @@ -241,7 +241,7 @@ volsnotinlib() as $vo) { ?> - + recycle() ? ' ¹' : ''); ?> STGPOOL_NAME; ?> display('STATUS'),$vo->display('ACCESS')); ?> display('PCT_UTILIZED'); ?>