public function index()
 {
     $flash = Flash::Instance();
     // Preserve any search criteria selection so that the context is maintained
     $s_data = array();
     if (isset($this->_data['id'])) {
         $s_data['wh_transfer_id'] = $this->_data['id'];
     }
     $this->view->set('clickaction', 'view');
     $whtransfer = new WHTransfer();
     $whtransfer->load($this->_data['id']);
     $this->view->set('whtransfer', $whtransfer);
     $from_store = WHLocation::getStoreLocation($whtransfer->from_whlocation_id);
     $this->view->set('from_store', $from_store);
     $to_store = WHLocation::getStoreLocation($whtransfer->to_whlocation_id);
     $this->view->set('to_store', $to_store);
     $this->setSearch('whtransfersSearch', 'useDefault', $s_data);
     parent::index(new WHTransferlineCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['all'] = array('tag' => 'View All Transfers', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'index')));
     if ($whtransfer->awaitingTransfer()) {
         $sidebarlist['edit'] = array('tag' => 'Edit this Transfer', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'edit', 'id' => $whtransfer->id)));
         $sidebarlist['cancel'] = array('tag' => 'Cancel this Transfer', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'cancel', 'id' => $whtransfer->id)));
     }
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function view()
 {
     $flash = Flash::Instance();
     // Preserve any search criteria selection so that the context is maintained
     $s_data = array();
     if (isset($this->_data['id'])) {
         $s_data['wh_transfer_id'] = $this->_data['id'];
     }
     $whtransfer = new WHTransfer();
     $whtransfer->load($this->_data['id']);
     $this->view->set('whtransfer', $whtransfer);
     $from_store = WHLocation::getStoreLocation($whtransfer->from_whlocation_id);
     $this->view->set('from_store', $from_store);
     $to_store = WHLocation::getStoreLocation($whtransfer->to_whlocation_id);
     $this->view->set('to_store', $to_store);
     $this->setSearch('whtransfersSearch', 'useDefault', $s_data);
     parent::index(new WHTransferlineCollection($this->_templateobject));
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['awaiting'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'selectWHTransfers')), 'tag' => 'View Transfers Awaiting Despatch');
     $sidebarlist['completed'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'viewWHTransfers')), 'tag' => 'View Completed Transfers');
     if ($whtransfer->awaitingTransfer()) {
         $sidebarlist['edit'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'transferStock', 'id' => $whtransfer->id)), 'tag' => 'Action this Transfer');
     }
     if ($whtransfer->transferred()) {
         $sidebarlist['edit'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'printaction', 'printaction' => 'printTransferNote', 'filename' => 'WHT' . $whtransfer->transfer_number, 'id' => $whtransfer->id)), 'tag' => 'Reprint Transfer Note');
     }
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
 public function view()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $transaction = $this->_uses[$this->modeltype];
     $id = $transaction->id;
     $this->view->set('transaction', $transaction);
     $from_store = WHLocation::getStoreLocation($transaction->from_whlocation_id);
     $this->view->set('from_store', $from_store);
     $to_store = WHLocation::getStoreLocation($transaction->to_whlocation_id);
     $this->view->set('to_store', $to_store);
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Show', array('all' => array('tag' => 'All rules for Action', 'link' => array_merge($this->_modules, array('controller' => 'WHActions', 'action' => 'view', 'id' => $transaction->whaction_id)))));
     $sidebar->addList('This Rule', array('edit' => array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id))), 'delete' => array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id, 'whaction_id' => $transaction->whaction_id)))));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }