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')); }
public function _new() { $flash = Flash::Instance(); // Get the Action $whaction = new WHAction(); $whactions = $whaction->getActions('T'); $this->view->set('transfer_actions', $whactions); // Display the New/Edit screen parent::_new(); }
public function _new() { parent::_new(); $supplier = $this->_uses[$this->modeltype]; if ($supplier->isLoaded()) { $this->view->set('transaction_count', $supplier->transactions->count()); $emails = $this->getEmailAddresses($supplier->company_id); unset($emails['']); $this->view->set('emails', $emails); } elseif (isset($this->_data['company_id'])) { $supplier->company_id = $this->_data['company_id']; $this->view->set('payee', $supplier->name); } else { $unassigned_list = $supplier->getUnassignedCompanies(); if (count($unassigned_list) > 0) { $this->view->set('company_list', $unassigned_list); $emails = $this->getEmailAddresses(key($unassigned_list)); unset($emails['']); $this->view->set('emails', $emails); $this->view->set('payee', current($unassigned_list)); $supplier->company_id = key($unassigned_list); } else { $flash = Flash::Instance(); $flash->addMessage('All companies are assigned as suppliers'); sendBack(); } } $this->view->set('payment_addresses', $supplier->getRemittanceAddresses()); $this->view->set('receive_actions', WHAction::getReceiveActions()); }
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() { if (!$this->CheckParams('whaction_id')) { sendBack(); } $_whaction_id = $this->_data['whaction_id']; $errors = array(); // $this->displayLocations($whaction_id, $errors); $this->getTransferDetails($_whaction_id); if (count($errors) > 0) { $flash = Flash::Instance(); $flash->addErrors($errors); sendTo('WHActions', 'actionsMenu', $this->_modules); } $whaction = new WHAction(); $whaction->load($_whaction_id); $this->view->set('label', $whaction->label); $this->view->set('sub_title', $whaction->description); $this->view->set('page_title', $this->getPageName($whaction->action_name, '')); parent::_new(); }
public function _new() { parent::_new(); $customer = $this->_uses[$this->modeltype]; if ($customer->isLoaded()) { $this->view->set('transaction_count', $customer->transaction_count()); $emails = $this->getEmailAddresses($customer->company_id); unset($emails['']); $this->view->set('emails', $emails); } elseif (isset($this->_data['company_id'])) { $customer->company_id = $this->_data['company_id']; } else { $unassigned_list = $customer->getUnassignedCompanies(); if (count($unassigned_list) > 0) { $this->view->set('company_list', $unassigned_list); $emails = $this->getEmailAddresses(key($unassigned_list)); unset($emails['']); $this->view->set('emails', $emails); $customer->company_id = key($unassigned_list); } else { $flash = Flash::Instance(); $flash->addMessage('All companies are assigned as customers'); sendBack(); } } $this->view->set('billing_addresses', $customer->getInvoiceAddresses()); $this->view->set('despatch_actions', WHAction::getDespatchActions()); }
public function getDespatchAction($_slmaster_id = '') { // Used by Ajax to return Default Despatch Action after selecting the Supplier if (isset($this->_data['ajax'])) { if (!empty($this->_data['slmaster_id'])) { $_slmaster_id = $this->_data['slmaster_id']; } } $customer = $this->getCustomer($_slmaster_id); $despatch_action = ''; if ($customer) { $despatch_action = $customer->despatch_action; } if (empty($despatch_action)) { $despatch_actions = WHAction::getDespatchActions(); $despatch_action = current(array_keys($despatch_actions)); } if (isset($this->_data['ajax'])) { $this->view->set('value', $despatch_action); $this->setTemplateName('text_inner'); } else { return $despatch_action; } }