示例#1
0
 function createUserGroup($company_id, $type, $parent_id = 0)
 {
     $ugf = new UserGroupFactory();
     $ugf->setCompany($company_id);
     switch ($type) {
         case 10:
             $ugf->setParent($parent_id);
             $ugf->setName('Employee Group A');
             break;
         case 20:
             $ugf->setParent($parent_id);
             $ugf->setName('Employee Group A2');
             break;
         case 30:
             $ugf->setParent($parent_id);
             $ugf->setName('Employee Group A3');
             break;
         case 40:
             $ugf->setParent($parent_id);
             $ugf->setName('Employee Group B');
             break;
         case 50:
             $ugf->setParent($parent_id);
             $ugf->setName('Employee Group B2');
             break;
     }
     if ($ugf->isValid()) {
         $insert_id = $ugf->Save();
         Debug::Text('Group ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Pay Period Schedule!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
示例#2
0
             }
             unset($df, $new_department_id, $next_available_manual_id);
         }
     }
     $uf->setDefaultDepartment($tmp_department);
     unset($tmp_department);
 }
 if (isset($mapped_row['group_id']) and $mapped_row['group_id'] != '') {
     if ($create_group === TRUE and !is_numeric($mapped_row['group_id'])) {
         //Check to see if branch exists or not.
         if (array_search($mapped_row['group_id'], $group_options) === FALSE) {
             $ugf = new UserGroupFactory();
             $ugf->setCompany($mapped_row['company_id']);
             $ugf->setParent(0);
             $ugf->setName($mapped_row['group_id']);
             if ($ugf->isValid()) {
                 echo "[CG: " . $mapped_row['group_id'] . "]";
                 $new_group_id = $ugf->Save();
                 $group_options[$new_group_id] = $mapped_row['group_id'];
             }
             unset($ugf, $new_group_id);
         }
     }
     $uf->setGroup(Misc::importCallInputParseFunction('group_id', $mapped_row['group_id'], $filtered_import_map['group_id']['default_value'], $filtered_import_map['group_id']['parse_hint']));
 }
 if (isset($mapped_row['title_id']) and $mapped_row['title_id'] != '') {
     if ($create_title === TRUE and !is_numeric($mapped_row['title_id'])) {
         //Check to see if title exists or not.
         if (array_search($mapped_row['title_id'], $title_options) === FALSE) {
             //Create title
             $utf = new UserTitleFactory();