Пример #1
0
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     if (!$this->checkParams($this->modeltype)) {
         sendBack();
     }
     if (parent::save($this->modeltype, '', $errors)) {
         if (strtolower($this->_data['saveform']) == 'save and post') {
             $this->_data['id'] = $this->_data[$this->modeltype]['id'];
             $this->post();
         } else {
             sendTo($this->name, 'view', $this->_modules, array('id' => $this->saved_model->id));
         }
     } else {
         if (!empty($this->_data[$this->modeltype]['id'])) {
             $this->_data['id'] = $this->_data[$this->modeltype]['id'];
         }
         $flash->addErrors($errors);
         $this->refresh();
     }
 }
Пример #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());
 }