function updateAction() { // ****************************** UPDATE record ********************************** $media_id = trim($this->_request->getPost('mediaid')); $pool_id = trim($this->_request->getPost('poolid')); $volume_name = trim($this->_request->getPost('volumename')); if (!empty($media_id) && !empty($pool_id)) { $media = new Media(); // remember old value of poolid for this mediaid $old_pool_id = $media->getPoolId($media_id); // update Media record $data = array('poolid' => $pool_id, 'volstatus' => trim($this->_request->getPost('volstatus')), 'volretention' => (int) trim($this->_request->getPost('volretention')) * 86400, 'voluseduration' => (int) trim($this->_request->getPost('voluseduration')), 'recycle' => trim($this->_request->getPost('recycle')), 'slot' => trim($this->_request->getPost('slot')), 'inchanger' => trim($this->_request->getPost('inchanger')), 'maxvoljobs' => trim($this->_request->getPost('maxvoljobs')), 'maxvolfiles' => trim($this->_request->getPost('maxvolfiles')), 'comment' => trim($this->_request->getPost('comment'))); $where = $media->getAdapter()->quoteInto('MediaId = ?', $media_id); $res = $media->update($data, $where); // if Volume moved to another Pool if ($old_pool_id != $pool_id) { // to count Volume count on both Pools $old_volume_count = $media->getVolumeCountByPool($old_pool_id); $volume_count = $media->getVolumeCountByPool($pool_id); $pool = new Pool(); // update old Pool record $data = array('numvols' => $old_volume_count); $where = $pool->getAdapter()->quoteInto('PoolId = ?', $old_pool_id); $res = $pool->update($data, $where); // update new Pool record $data = array('numvols' => $volume_count); $where = $pool->getAdapter()->quoteInto('PoolId = ?', $pool_id); $res = $pool->update($data, $where); } // send email if ($res) { $email = new MyClass_SendEmail(); // $from_email, $from_name, $to_email, $to_name, $subj, $body $email->mySendEmail($this->view->config->webacula->email->from, 'Webacula Volume controller', $this->view->config->webacula->email->to_admin, 'Webacula admin', $this->view->translate->_('Webacula : Updated Volume parameters'), $this->view->translate->_('Media Id') . ': ' . $media_id . "\n" . $this->view->translate->_('Volume Name') . ': ' . $volume_name . "\n\n"); } } $this->_redirect("/volume/detail/mediaid/{$media_id}"); return; }