Example #1
0
 public function _new()
 {
     parent::_new();
     $whaction = new WHAction();
     $this->view->set('backflush_actions', $whaction->getActions('B'));
     $this->view->set('complete_actions', $whaction->getActions('C'));
     $this->view->set('issue_actions', $whaction->getActions('I'));
     $this->view->set('despatch_actions', $whaction->getActions('D'));
 }
Example #2
0
 public function _new()
 {
     parent::_new();
     $whlocation = $this->_uses[$this->modeltype];
     $account = new GLAccount();
     $glaccounts = array('' => 'None');
     $glaccounts += $account->nonControlAccounts();
     $this->view->set('accounts', $glaccounts);
     if (isset($_POST[$this->modeltype]['glaccount_id'])) {
         $default_glaccount_id = $_POST[$this->modeltype]['glaccount_id'];
     } elseif ($whlocation->isLoaded()) {
         $default_glaccount_id = $whlocation->glaccount_id;
     } else {
         $default_glaccount_id = '';
     }
     $this->view->set('centres', $this->getCentres($default_glaccount_id));
 }
Example #3
0
 public function _new()
 {
     parent::_new();
     $whbin = $this->_uses[$this->modeltype];
     if ($whbin->isLoaded()) {
         $whlocation_id = $whbin->whlocation_id;
     } elseif (isset($this->_data['whlocation_id'])) {
         $whlocation_id = $this->_data['whlocation_id'];
     } else {
         $whlocation_id = '';
     }
     if (!empty($whlocation_id)) {
         $transaction = new WHLocation();
         $transaction->load($whlocation_id);
         $this->view->set('whlocation', $transaction->getIdentifierValue());
         $whstore = $transaction->whstore;
     } else {
         $whstore = '';
     }
     $this->view->set('whstore', $whstore);
 }
Example #4
0
 public function _new()
 {
     $flash = Flash::Instance();
     parent::_new();
     $mfcentre = $this->_uses[$this->modeltype];
     $mfdept = new MFDept();
     if ($mfcentre->isLoaded()) {
         $mfdept = $mfcentre->dept_detail;
     } elseif (!empty($this->_data['mfdept_id'])) {
         $mfcentre->mfdept_id = $this->_data['mfdept_id'];
         $mfdept->load($this->_data['mfdept_id']);
         if (!$mfdept->isloaded()) {
             $flash->addError('Cannot load Department');
             sendBack();
         }
     }
     if ($mfdept->isLoaded()) {
         $this->view->set('page_title', $this->getPageName() . ' for Dept. ' . $mfdept->getIdentifierValue());
     }
     $this->view->set('mfdept', $mfdept);
 }
 public function _new()
 {
     parent::_new();
     $transferrule = $this->_uses[$this->modeltype];
     // Get the Action
     $whaction = new WHAction();
     if ($transferrule->isLoaded()) {
         $whaction_id = $transferrule->whaction_id;
     } elseif (isset($this->_data['whaction_id'])) {
         $whaction_id = $this->_data['whaction_id'];
     } else {
         $flash = Flash::Instance();
         $flash->addError('Data invalid for this action');
         $this->sendBack();
     }
     $whaction->load($whaction_id);
     // Get the From Locations list
     $locations = new WHLocationCollection(new WHLocation());
     $cc = new ConstraintChain();
     $names = array('has_balance', 'bin_controlled', 'saleable');
     foreach ($names as $name) {
         $type = $whaction->getFormatted('from_' . $name);
         if ($type != 'All') {
             $cc->add(new Constraint($name, 'is', $type));
         }
     }
     $from_location = $locations->getLocationList($cc);
     $this->view->set('from_location', $from_location);
     // Get the To Locations list
     $locations = new WHLocationCollection(new WHLocation());
     $cc = new ConstraintChain();
     foreach ($names as $name) {
         $type = $whaction->getFormatted('to_' . $name);
         if ($type != 'All') {
             $cc->add(new Constraint($name, 'is', $type));
         }
     }
     $to_location = $locations->getLocationList($cc);
     $this->view->set('to_location', $to_location);
 }
 public function _new()
 {
     parent::_new();
     $mfoperation = $this->_uses[$this->modeltype];
     $stitem = new STItem();
     if ($mfoperation->isLoaded()) {
         $this->_data['stitem_id'] = $mfoperation->stitem_id;
     }
     if (empty($this->_data['stitem_id'])) {
         $stitems = $stitem->getAll();
         $this->view->set('stitems', $stitems);
         $stitem_id = key($stitems);
     } else {
         $stitem_id = $this->_data['stitem_id'];
     }
     $stitem->load($stitem_id);
     if (!empty($this->_data['stitem_id'])) {
         $this->view->set('page_title', $this->getPageName('Operation for ' . $stitem->getIdentifierValue()));
     }
     $this->getItemData($stitem_id);
     $this->view->set('no_ordering', true);
 }
 public function changeStatus()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $transaction = $this->_uses[$this->modeltype];
     if (isset($this->_data['status'])) {
         $transaction->status = $this->_data['status'];
         $this->view->set('status', $transaction->status);
     }
     $this->view->set('transaction', $transaction);
     parent::_new();
 }
Example #8
0
 public function _new()
 {
     parent::_new();
     $this->view->set('addresses', WHStore::getAddresses());
 }
 public function issues_returns()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $transaction = $this->_uses[$this->modeltype];
     $structure = DataObjectFactory::Factory('MFWOStructure');
     $structure->idField = 'ststructure_id';
     $structure->identifierField = 'ststructure';
     $cc = new ConstraintChain();
     $cc->add(new Constraint('work_order_id', '=', $transaction->id));
     $structure_items = $structure->getAll($cc, true, true);
     $this->view->set('structure_items', $structure_items);
     $whaction = DataObjectFactory::Factory('WHAction');
     if (empty($this->_data['type'])) {
         $this->_data['type'] = $whaction->getEnumKey('type', 'Issue');
     }
     $type_text = $whaction->getEnum('type', $this->_data['type']);
     $actions = $whaction->getActions($this->_data['type']);
     if (empty($actions)) {
         $flash = Flash::instance();
         $flash->addError('No ' . $type_text . ' Actions Defined');
         sendBack();
     }
     $this->view->set('actions', $actions);
     $this->getTransferDetails(key($actions), $transaction->id, key($structure_items), $type_text);
     $sttransaction = DataObjectFactory::Factory('STTransaction');
     $this->view->set('process_id', $transaction->id);
     $this->view->set('process_name', 'WO');
     $this->view->set('id', $this->_data['id']);
     $this->view->set('type', $this->_data['type']);
     $this->uses($sttransaction, false);
     parent::_new();
 }