/**
  * Upgrade this module if necessary
  * @param string $old_vers
  * @param string $new_vers
  * @return boolean
  */
 public function upgrade($old_vers, $new_vers)
 {
     /*
      * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the
      * old data from entry and save them to the new form storage.
      */
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateForm("facility_type", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         if (I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"), array("facility_type" => "facility_type", "location" => array("county" => "county", "district" => "district", "country" => "country")))) {
             unset($class_config->iHRIS_Facility->fields->country);
             unset($class_config->iHRIS_Facility->fields->district);
             unset($class_config->iHRIS_Facility->fields->county);
             unset($class_config->iHRIS_Facility->fields->type);
         } else {
             return false;
         }
     } elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.4')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         unset($class_config->iHRIS_Facility->fields->type);
     }
     return parent::upgrade($old_vers, $new_vers);
 }
 /**
  * Migrate the facility contact data from entry to the current storage (magicdata)
  */
 public function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     if (!I2CE_FormStorage::migrateForm("facility_contact", "entry", $user, $migrate_path)) {
         return false;
     }
     return true;
 }
 /**
  * Perform the migrate actions for this module.
  * @return boolean;
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     if (!I2CE_FormStorage::migrateForm("id_type", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateField("person_id", array("id_type" => "id_type"), $migrate_path, $user)) {
         return false;
     }
     return true;
 }
 /**
  * Perform the migrate actions for this module
  * This is for going from pre 3.2 versions where benefit data has
  * been saved to the database.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     if (!I2CE_FormStorage::migrateForm("competency_evaluation", "entry", $user, $migrate_path, "name", array("type"), array(), true)) {
         return false;
     }
     if (!I2CE_FormStorage::migrateField("person_competency", array("competency_evaluation" => "competency_evaluation", "competency" => "competency"), $migrate_path, $user)) {
         return false;
     }
     unset($class_config->iHRIS_PersonCompetency->fields->competency_type);
     return true;
 }
 /**
  * Perform the migrate actions for this module.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/4.1.8";
     if (!I2CE_FormStorage::migrateForm("training_classification", "entry", $user, $migrate_path)) {
         return false;
     }
     if (I2CE_ModuleFactory::instance()->isEnabled("CachedForms")) {
         $cachedForm = new I2CE_CachedForm("training_classification");
         $cachedForm->dropTable();
     }
     if (!I2CE_FormStorage::migrateField("training", array("training_classification" => "training_classification"), $migrate_path, $user)) {
         return false;
     }
     return true;
 }
 /**
  * Perform the migrate actions for this module.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     if (!I2CE_FormStorage::migrateForm("edu_type", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateForm("degree", "entry", $user, $migrate_path, false, array("type"), array("edu_type" => "edu_type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateField("education", array("degree" => "degree"), $migrate_path, $user)) {
         return false;
     }
     unset($class_config->iHRIS_Degree->fields->type);
     unset($class_config->iHRIS_Education->fields->edu_type);
     return true;
 }
 /** 
  * Perform the migrate actions for this module
  * This is for going from pre 3.2 versions where benefit data has
  * been saved to the database.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     $migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
     $constant_prof = array(1 => 'language_proficiency|elementary', 2 => 'language_proficiency|limited', 3 => 'language_proficiency|professional', 4 => 'language_proficiency|full_professional', 5 => 'language_proficiency|fluent');
     foreach ($constant_prof as $old_id => $new_id) {
         $migrate_node->forms->language_proficiency->{$old_id} = $new_id;
     }
     if (!I2CE_FormStorage::migrateForm("language", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateField("person_language", array("language" => "language", "speaking" => "language_proficiency", "reading" => "language_proficiency", "writing" => "language_proficiency"), $migrate_path, $user)) {
         return false;
     }
     return true;
 }
 /**
  * Perform the migrate actions for this module.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     $migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
     $constant_gender = array(1 => 'gender|F', 2 => 'gender|M');
     foreach ($constant_gender as $old_id => $new_id) {
         $migrate_node->forms->gender->{$old_id} = $new_id;
     }
     if (!I2CE_FormStorage::migrateForm("marital_status", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateField("demographic", array("gender" => "gender", "marital_status" => "marital_status"), $migrate_path, $user)) {
         return false;
     }
     return true;
 }
 /**
  * Upgrade this module if necessary
  * @param string $old_vers
  * @param string $new_vers
  * @return boolean
  */
 public function upgrade($old_vers, $new_vers)
 {
     /*
      * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the
      * old data from entry and save them to the new form storage.
      */
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.6')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateForm("competency_type", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         if (!I2CE_FormStorage::migrateForm("competency", "entry", $user, $migrate_path, false, array("type"), array("competency_type" => "competency_type"))) {
             return false;
         }
         // If everything migrated correctly, then remove the unused fields.
         unset($class_config->iHRIS_Competency->fields->type);
     }
     return parent::upgrade($old_vers, $new_vers);
 }
 /**
  * Perform the migrate actions for this module
  * This is for going from pre 3.2 versions where benefit data has
  * been saved to the database.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     if (!I2CE_FormStorage::migrateForm("salary_grade", "entry", $user, $migrate_path, "code", array("type"), array("start" => "currency", "midpoint" => "currency", "end" => "currency"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateForm("cadre", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateForm("classification", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateForm("job", "entry", $user, $migrate_path, "code", array("type"), array("salary_grade" => "salary_grade", "cadre" => "cadre", "classification" => "classification"))) {
         return false;
     }
     // If everything migrated correctly, then remove the unused fields.
     unset($class_config->iHRIS_Job->fields->type);
     unset($class_config->iHRIS_SalaryGrade->fields->type);
     unset($class_config->iHRIS_Classification->fields->type);
     return true;
 }
 /**
  * Perform the migrate actions for this module
  * This is for going from pre 3.2 versions where benefit data has
  * been saved to the database.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     $migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
     $constant_status = array(1 => 'position_status|open', 2 => 'position_status|closed', 3 => 'position_status|discontinued');
     foreach ($constant_status as $old_id => $new_id) {
         $migrate_node->forms->position_status->{$old_id} = $new_id;
     }
     if (!I2CE_FormStorage::migrateForm("pos_change_reason", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateForm("position_type", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateForm("department", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateField("person_position", array("position" => "position", "reason" => "pos_change_reason"), $migrate_path, $user)) {
         return false;
     }
     unset($class_config->iHRIS_Position->fields->status->default_eval);
     if (!I2CE_FormStorage::migrateField("position", array("job" => "job", "source" => "salary_source", "supervisor" => "position", "facility" => "facility", "department" => "department", "pos_type" => "position_type", "proposed_salary" => "currency", "status" => "position_status"), $migrate_path, $user)) {
         return false;
     }
     // If everything migrated correctly, then remove the unused fields.
     unset($class_config->iHRIS_Departent->fields->type);
     unset($class_config->iHRIS_Position->fields->type);
     return true;
 }
 /**
  * Perform the migrate actions for this module
  * This is for going from pre 3.2 versions where benefit data has
  * been saved to the database.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     $migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
     $constant_recur = array(1 => 'benefit_recurrence|once', 2 => 'benefit_recurrence|weekly', 3 => 'benefit_recurrence|monthly', 4 => 'benefit_recurrence|yearly');
     foreach ($constant_recur as $old_id => $new_id) {
         $migrate_node->forms->benefit_recurrence->{$old_id} = $new_id;
     }
     if (!I2CE_FormStorage::migrateForm("benefit_type", "entry", $user, $migrate_path, false, array("type"))) {
         return false;
     }
     if (!I2CE_FormStorage::migrateField("benefit", array("type" => "benefit_type", "source" => "salary_source", "amount" => "currency", "recurrence" => "benefit_recurrence"), $migrate_path, $user)) {
         return false;
     }
     return true;
 }
 /**
  * Upgrade this module if necessary
  * @param string $old_vers
  * @param string $new_vers
  * @return boolean
  */
 public function upgrade($old_vers, $new_vers)
 {
     /*
      * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the
      * old data from entry and save them to the new form storage.
      */
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateForm("training_course_status", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         if (!I2CE_FormStorage::migrateForm("training_course_category", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         if (!I2CE_FormStorage::migrateForm("training_course_evaluation", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         if (!I2CE_FormStorage::migrateForm("training_course_requestor", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         if (!I2CE_FormStorage::migrateField("training_course", array("training_institution" => "training_institution", "training_funder" => "training_funder", "continuing_education_course" => "continuing_education_course", "training_course_status" => "training_course_status", "training_course_category" => "training_course_category"), $migrate_path, $user)) {
             return false;
         }
         if (!I2CE_FormStorage::migrateField("person_scheduled_training_course", array("training_course_evaluation" => "training_course_evaluation", "training_course_requestor" => "training_course_requestor", "scheduled_training_course" => "scheduled_training_course"), $migrate_path, $user)) {
             return false;
         }
         if (!I2CE_FormStorage::migrateField("scheduled_training_course", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) {
             return false;
         }
         unset($class_config->iHRIS_Person_Scheduled_Training_Course->fields->training_course);
         unset($class_config->iHRIS_Scheduled_Training_Course->fields->country);
         unset($class_config->iHRIS_Scheduled_Training_Course->fields->district);
         unset($class_config->iHRIS_Scheduled_Training_Course->fields->county);
     } elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.35')) {
         $user = new I2CE_User(1, false, false, false);
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateField("person_scheduled_training_course", array("scheduled_training_course" => "scheduled_training_course"), $migrate_path, $user)) {
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.18')) {
         $evals = array('pass' => 'Pass', 'fail' => 'Fail', 'incomplete' => 'Incomplete');
         if (!I2CE_Module_Lists::remapFields('training_course_evaluation', $evals, 'person_scheduled_training_course')) {
             return false;
         }
         if (!I2CE_Module_Lists::deleteMappedValues('training_course_evaluation', $evals)) {
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.30')) {
         $evals = array('open' => 'Open', 'closed' => 'Closed');
         if (!I2CE_Module_Lists::remapFields('training_course_status', $evals, 'training_course')) {
             return false;
         }
         if (!I2CE_Module_Lists::deleteMappedValues('training_course_status', $evals)) {
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.32')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateField("scheduled_training_course", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) {
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.63')) {
         if (!$this->moveScheduledTrainingCourseToMap()) {
             return false;
         }
     }
     return parent::upgrade($old_vers, $new_vers);
 }