Example #1
0
 public function save()
 {
     if (parent::save($this->modeltype)) {
         sendTo($this->name, 'view', $this->_modules, array('id' => $this->saved_model->id));
     }
     $this->refresh();
 }
Example #2
0
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     $db = DB::Instance();
     $db->StartTrans();
     if (isset($this->_data['permission'])) {
         $permissions = $this->_data['permission'];
         unset($this->_data['permission']);
     } else {
         $permissions = array();
     }
     if (isset($this->_data['admin'])) {
         $admin = $this->_data['admin'];
         unset($this->_data['admin']);
     } else {
         $admin = array();
     }
     if (parent::save('Role')) {
         $role = $this->saved_model;
         if (isset($this->_data['Role']['users']) && is_array($this->_data['Role']['users'])) {
             $users = $this->_data['Role']['users'];
             Role::setUsers($role, $users, $errors);
             $flash->addErrors($errors);
         }
         if ($role->setPermissions($permissions, $errors) && $role->setAdmin($admin)) {
             $db->CompleteTrans();
             sendTo('Roles', 'index', array('admin'));
         }
     }
     //	$db->FailTrans();
     //	$db->CompleteTrans();
     $this->refresh();
 }
 public function save()
 {
     if (parent::save('EmployeeTrainingPlan')) {
         sendTo($this->name, 'index', $this->_modules);
     }
     $this->refresh();
 }
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     $partyaddress = $this->_uses[$this->modeltype];
     if (!empty($this->_data[$this->modeltype][$partyaddress->idField])) {
         // This is an update to an existing party address/address
         // so check if the address is used by other parties
         // - update it if address is only used by this party
         // - insert it if the current address is used by other parties and it does not already exist
         // - otherwise, no need to do anything here (but see below)
         if ($partyaddress->load($this->_data[$this->modeltype][$partyaddress->idField])) {
             $partyaddress->checkAddress($this->_data);
         } else {
             $errors[] = 'Error loading current Address details ' . $db->errorMsg();
         }
     }
     if (isset($this->_data['Address'])) {
         // Check if this address exists; if it does, point the PartyAddress to it
         // and remove the input address as it does not need inserting/updating
         $address = DataObjectFactory::Factory('Address');
         $address->check_exists($this->_data['Address']);
         if ($address->isLoaded()) {
             unset($this->_data['Address']);
             $this->_data[$this->modeltype]['address_id'] = $address->{$address->idField};
         }
     }
     if (count($errors) == 0 && parent::save($this->modeltype)) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     } else {
         $flash->addErrors($errors);
         $this->refresh();
     }
 }
Example #5
0
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     $data = $this->_data[$this->modeltype];
     $obj = '';
     if (!empty($data['task_id'])) {
         $obj = new Task();
         $obj->load($data['task_id']);
     } elseif (!empty($data['project_id'])) {
         $obj = new Project();
         $obj->load($data['project_id']);
     }
     if ($obj instanceof DataObject && $obj->isLoaded()) {
         if (fix_date($data['start_date']) < $obj->start_date) {
             $errors['start_date'] = 'Start date before ' . get_class($obj) . ' start date';
         }
         if (fix_date($data['end_date']) > $obj->end_date) {
             $errors['end_date'] = 'End date after ' . get_class($obj) . ' end date';
         }
     }
     if (!empty($data['person_id']) && $data['quantity'] > 1) {
         $errors['person_id'] = 'Quantity must be 1 for a person';
     }
     if (count($errors) == 0 && parent::save($this->modeltype, '', $errors)) {
         sendBack();
     } else {
         $flash->addErrors($errors);
         $this->refresh();
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save($this->modeltype)) {
         sendTo($this->name, 'index', $this->_modules);
     }
     $this->refresh();
 }
Example #7
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('Address')) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     }
     $this->refresh();
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('ComplaintVolume')) {
         sendTo($this->name, 'index', $this->_modules);
     }
     $this->refresh();
 }
 public function save()
 {
     if (parent::save('ProjectIssueLine')) {
         sendTo('projectissues', 'view', array('projects'), array('id' => $this->saved_model->header_id));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
Example #10
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('Campaign')) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('CompanyPermission')) {
         sendTo('CompanyPermissions', 'index', array('admin'));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     if (!$this->checkParams($this->modeltype)) {
         sendBack();
     }
     if (!parent::save($this->modeltype)) {
         $this->refresh();
     }
     sendTo($this->name, 'index', $this->_modules);
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('CalendarEventAttendee')) {
         sendBack();
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     //$this->_data['Holidayextraday']['authorisedby']=EGS_USERNAME;
     if (parent::save($this->modeltype)) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     } else {
         $this->refresh();
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('Resourcetemplate')) {
         sendBack();
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('ProjectIssueHeader')) {
         sendTo('projectissues', 'view', array('projects'), array('id' => $this->saved_model->id));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
Example #17
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('System')) {
         sendTo($this->name, 'index', $this->_modules);
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
Example #18
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save($this->modeltype)) {
         sendTo($this->name, 'view', $this->_modules, array('id' => $this->_data['id']));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('MFWOStructure')) {
         sendTo('Mfworkorders', 'reviewMaterials', $this->_modules, array('id' => $this->_data['MFWOStructure']['work_order_id']));
     }
     $this->_data['work_order_id'] = $this->_data['MFWOStructure']['work_order_id'];
     $this->_data['ststructure_id'] = $this->_data['MFWOStructure']['ststructure_id'];
     $this->refresh();
 }
Example #20
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save($this->modeltype)) {
         sendTo('HasRoles', 'index', array('admin'));
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('Usercompanyaccess')) {
         sendBack();
     } else {
         $this->_new();
         $this->_templateName = $this->getTemplateName('new');
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     if (parent::save($this->modeltype, '', $errors)) {
         sendTo('workschedules', 'view', $this->_modules, array('id' => $this->saved_model->work_schedule_id));
     } else {
         $flash->addErrors($errors);
         $this->refresh();
     }
 }
Example #23
0
 public function save()
 {
     $flash = Flash::Instance();
     $db = DB::Instance();
     $db->StartTrans();
     if (parent::save('STBalance') && $db->CompleteTrans()) {
         return true;
     } else {
         $db->FailTrans();
         $flash->addMessage('Balances save failed');
         return false;
     }
 }
 public function save()
 {
     if (!$this->checkParams($this->modeltype)) {
         sendBack();
     }
     $errors = array();
     //		echo 'SystempolicycontrollistsController::save data<pre>'.print_r($this->_data, true).'</pre><br>';
     //		exit;
     if (count($errors) > 0 || !parent::save($this->modeltype)) {
         $this->refresh();
     }
     sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
 }
Example #25
0
 public function save()
 {
     $flash = Flash::Instance();
     if (parent::save('ARGroup')) {
         if (strtolower($this->_data['saveform']) == 'save') {
             sendTo($this->name, 'index', $this->_modules);
         } else {
             sendTo($this->name, 'new', $this->_modules);
         }
     } else {
         $this->refresh();
     }
 }
 public function save()
 {
     if (!$this->CheckParams($this->modeltype)) {
         sendBack();
     }
     $flash = Flash::Instance();
     $errors = array();
     if (parent::save($this->modeltype, '', $errors)) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     }
     $flash->addErrors($errors);
     $flash->addError('Failed to save ' . $this->modeltype);
     $this->refresh();
 }
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     $data = $this->_data[$this->modeltype];
     if (!empty($data['person_id']) && $data['quantity'] > 1) {
         $errors['person_id'] = 'Quantity must be 1 for a person';
     }
     if (count($errors) == 0 && parent::save($this->modeltype, '', $errors)) {
         sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
     } else {
         $flash->addErrors($errors);
         $this->refresh();
     }
 }
 public function save()
 {
     $flash = Flash::Instance();
     $stitem = new STItem();
     $stitem->load($this->_data['STuomconversion']['stitem_id']);
     if ($stitem->uom_id == $this->_data['STuomconversion']['from_uom_id'] || $stitem->uom_id == $this->_data['STuomconversion']['to_uom_id']) {
         if (parent::save('STuomconversion')) {
             sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
         }
     } else {
         $flash->addError('The From UoM or the To UoM must be the base UoM');
     }
     $this->_data['stitem_id'] = $this->_data['STuomconversion']['stitem_id'];
     $this->refresh();
 }
 public function save()
 {
     $flash = Flash::Instance();
     $errors = array();
     $holidayEntitlement = $this->_templateobject;
     $overlap = $holidayEntitlement->overlap_entitlement($this->_data[$this->modeltype]);
     if ($overlap) {
         $errors[] = 'Your start or end date overlaps with another entitlement';
     } elseif (parent::save($this->modeltype, '', $errors)) {
         $employee = array('id' => $this->_data[$this->modeltype]['employee_id']);
         sendTo('employees', 'view', 'hr', $employee);
     }
     $flash->addErrors($errors);
     $this->refresh();
 }
 public function save()
 {
     $flash = Flash::Instance();
     if (strtolower($this->_data['saveform']) == 'cancel') {
         $flash->addMessage('Action cancelled');
         sendTo($this->name, 'index', $this->_modules);
     }
     if (parent::save('ARTransaction')) {
         if (strtolower($this->_data['saveform']) == 'save') {
             sendTo($this->name, 'index', $this->_modules);
         } else {
             sendTo($this->name, 'new', $this->_modules);
         }
     } else {
         $this->refresh();
     }
 }