$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(); $utf->setCompany($mapped_row['company_id']); $utf->setName($mapped_row['title_id']); if ($utf->isValid()) { echo "[CT: " . $mapped_row['title_id'] . "]"; $new_title_id = $utf->Save(); $title_options[$new_title_id] = $mapped_row['title_id']; } unset($utf, $new_title_id); } } $uf->setTitle(Misc::importCallInputParseFunction('title_id', $mapped_row['title_id'], $filtered_import_map['title_id']['default_value'], $filtered_import_map['title_id']['parse_hint'])); } if (isset($mapped_row['password']) and $mapped_row['password'] != '') { $uf->setPassword($mapped_row['password']); } else { $uf->setPassword(uniqid()); }
//Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Employee Title')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'title_data'))); $utf = new UserTitleFactory(); $action = Misc::findSubmitButton(); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $utf->setId($title_data['id']); $utf->setCompany($current_company->getId()); $utf->setName($title_data['name']); if ($utf->isValid()) { $utf->Save(); Redirect::Page(URLBuilder::getURL(NULL, 'UserTitleList.php')); break; } default: if (isset($id)) { BreadCrumb::setCrumb($title); $utlf = new UserTitleListFactory(); $utlf->GetByIdAndCompanyId($id, $current_company->getId()); foreach ($utlf as $title_obj) { //Debug::Arr($title_obj,'Title Object', __FILE__, __LINE__, __METHOD__,10); $title_data = array('id' => $title_obj->getId(), 'name' => $title_obj->getName(), 'created_date' => $title_obj->getCreatedDate(), 'created_by' => $title_obj->getCreatedBy(), 'updated_date' => $title_obj->getUpdatedDate(), 'updated_by' => $title_obj->getUpdatedBy(), 'deleted_date' => $title_obj->getDeletedDate(), 'deleted_by' => $title_obj->getDeletedBy()); } }