/**
  * Update the position for this to mark it as closed and then save the object.
  */
 public function save()
 {
     if (!$this->hasPermission('task(person_can_edit_child_form_person_position)')) {
         $this->userMessage("You can't change a person's position");
         return false;
     }
     $new_person_position = $this->getPrimary();
     if ($this->post_exists('position_option') && $this->post('position_option') == 'create' && $this->new_position instanceof iHRIS_Position) {
         $this->new_position->setStatus("position_status|closed");
         $this->new_position->save($this->user);
         $new_person_position->getField("position")->setFromDB($this->new_position->getNameId());
         $position = $this->new_position;
     } else {
         $position = $this->factory->createContainer($new_person_position->getField("position")->getDBValue());
         $position->statusOnly();
         $position->closePosition($this->user, $this->getParent()->getId());
     }
     if ($this->getParent()->isActive() && $this->old_position instanceof iHRIS_Position) {
         $this->old_position->statusOnly();
         $this->old_position->save($this->user);
         $person = $this->getParent();
         if ($this->old_person_position instanceof iHRIS_PersonPosition) {
             $this->old_person_position->end_date = $new_person_position->start_date;
             $this->old_person_position->save($this->user);
             I2CE_ModuleFactory::callHooks("make_promotion_save", $this->old_person_position, $new_person_position);
         }
         //$this->getPrimary()->reason = null;
     }
     I2CE_ModuleFactory::callHooks("make_offer_save", $new_person_position);
     foreach ($this->objects[self::EDIT_CHILD] as $obj) {
         if ($obj->getId() == '0') {
             $obj->setParent($new_person_position);
         }
         I2CE_ModuleFactory::callHooks("make_offer_save_" . $obj->getName(), $new_person_position, $obj);
     }
     parent::save();
 }
 /**
  * Update the position for this to mark it as closed and then save the object.
  */
 public function save()
 {
     $this->position->save($this->user);
     if (($personPosition = $this->getPrimary()) instanceof iHRIS_PersonPosition) {
         I2CE_ModuleFactory::callHooks("depart_position_save", $personPosition);
     }
     parent::save();
 }
 /**
  * Save the objects to the database.
  * 
  * Save the default object being edited and return to the view page.
  */
 protected function save()
 {
     if ($this->creatingNewUser()) {
         if (!$this->hasPermission('task(users_can_edit)')) {
             return false;
         }
         if (!$this->userObj instanceof I2CE_User_Form || !($username = $this->userObj->username)) {
             return false;
         }
         $accessMech = I2CE::getUserAccess();
         if ($accessMech->userExists($username, false)) {
             I2CE::raiseError("Trying to recreate existing user : " . $username);
             return false;
         }
         if (I2CE_User::hasDetail('creator')) {
             $this->userObj->creator = $this->user->username;
         }
     }
     return parent::save();
 }
 /**
  * Save the objects to the database.
  * 
  * Save the default object being edited and return to the view page.  If the action needs to be 
  * logged then the {@link log} method is also called.  Any pages overriding this default save method
  * will need to include any logging necessary.
  */
 protected function save()
 {
     parent::save();
     $this->setRedirect("view_training?id=" . $this->getPrimary()->getId());
 }