Ejemplo n.º 1
0
 public function _new()
 {
     $flash = Flash::Instance();
     parent::_new();
     $expense = $this->_uses[$this->modeltype];
     if ($expense->isLoaded()) {
         $this->_data['employee_id'] = $expense->employee_id;
     }
     if (isset($this->_data['employee_id'])) {
         $employee = DataObjectFactory::Factory('Employee');
         $employee->authorisationPolicy($employee->expense_model());
         $employee->load($this->_data['employee_id']);
         if (!$employee->isLoaded()) {
             $flash->addError('You cannot set up an expense claim for this person');
             sendBack();
         }
         $this->view->set('title', ' for ' . $employee->person->getIdentifierValue());
     }
     $params = DataObjectFactory::Factory('GLParams');
     $this->view->set('base_currency', $params->base_currency());
     $accounts = DataObjectFactory::Factory('GLAccount');
     $accounts = $accounts->getAll();
     $this->view->set('accounts', $accounts);
     $tax_rates = DataObjectFactory::Factory('TaxRate');
     $tax_rates = $tax_rates->getAll();
     $this->view->set('taxrates', $tax_rates);
     if (!$expense->isLoaded() && !empty($this->_data['project_id'])) {
         $expense->project_id = $this->_data['project_id'];
     }
     $this->view->set('tasks', $this->getTaskList($expense->project_id));
     $this->view->set('employee', $employee);
 }
Ejemplo n.º 2
0
 public function decline_request()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     parent::_new();
     $holidayRequest = $this->_uses[$this->modeltype];
     $holidayRequest->status = $holidayRequest->decline();
     $this->view->set('authoriser', $this->get_employee_id());
 }