$otpf->Save(); Redirect::Page(URLBuilder::getURL(NULL, 'OverTimePolicyList.php')); break; } default: if (isset($id)) { BreadCrumb::setCrumb($title); $otplf = new OverTimePolicyListFactory(); $otplf->getByIdAndCompanyID($id, $current_company->getID()); foreach ($otplf as $otp_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $otp_obj->getId(), 'name' => $otp_obj->getName(), 'type_id' => $otp_obj->getType(), 'trigger_time' => $otp_obj->getTriggerTime(), 'rate' => Misc::removeTrailingZeros($otp_obj->getRate()), 'wage_group_id' => $otp_obj->getWageGroup(), 'accrual_rate' => Misc::removeTrailingZeros($otp_obj->getAccrualRate()), 'accrual_policy_id' => $otp_obj->getAccrualPolicyID(), 'pay_stub_entry_account_id' => $otp_obj->getPayStubEntryAccountId(), 'created_date' => $otp_obj->getCreatedDate(), 'created_by' => $otp_obj->getCreatedBy(), 'updated_date' => $otp_obj->getUpdatedDate(), 'updated_by' => $otp_obj->getUpdatedBy(), 'deleted_date' => $otp_obj->getDeletedDate(), 'deleted_by' => $otp_obj->getDeletedBy()); } } elseif ($action != 'submit') { $data = array('trigger_time' => 0, 'rate' => '1.00', 'accrual_rate' => '1.00'); } $aplf = new AccrualPolicyListFactory(); $accrual_options = $aplf->getByCompanyIDArray($current_company->getId(), TRUE); $psealf = new PayStubEntryAccountListFactory(); $pay_stub_entry_options = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 20, 30, 50)); $wglf = new WageGroupListFactory(); $data['wage_group_options'] = $wglf->getArrayByListFactory($wglf->getByCompanyId($current_company->getId()), TRUE); //Select box options; $data['type_options'] = $otpf->getOptions('type'); $data['accrual_options'] = $accrual_options; $data['pay_stub_entry_options'] = $pay_stub_entry_options; $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('otpf', $otpf); $smarty->display('policy/EditOverTimePolicy.tpl');
} else { $delete = FALSE; } $utlf = new UserTitleListFactory(); foreach ($ids as $id) { $utlf->GetByIdAndCompanyId($id, $current_company->getId()); foreach ($utlf as $title_obj) { $title_obj->setDeleted($delete); $title_obj->Save(); } } Redirect::Page(URLBuilder::getURL(NULL, 'WageGroupList.php')); break; default: $sort_array = NULL; if ($sort_column != '') { $sort_array = array(Misc::trimSortPrefix($sort_column) => $sort_order); } $wglf = new WageGroupListFactory(); $wglf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array); $pager = new Pager($wglf); foreach ($wglf as $group_obj) { $groups[] = array('id' => $group_obj->GetId(), 'name' => $group_obj->getName(), 'deleted' => $group_obj->getDeleted()); } $smarty->assign_by_ref('groups', $groups); $smarty->assign_by_ref('sort_column', $sort_column); $smarty->assign_by_ref('sort_order', $sort_order); $smarty->assign_by_ref('paging_data', $pager->getPageVariables()); break; } $smarty->display('company/WageGroupList.tpl');
function setWageGroup($id) { $id = trim($id); $wglf = new WageGroupListFactory(); if ($id == 0 or $this->Validator->isResultSetWithRows('wage_group', $wglf->getByID($id), TTi18n::gettext('Wage Group is invalid'))) { $this->data['wage_group_id'] = $id; return TRUE; } return FALSE; }
* Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'group_data'))); $wgf = new WageGroupFactory(); $action = Misc::findSubmitButton(); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $wgf->setId($group_data['id']); $wgf->setCompany($current_company->getId()); $wgf->setName($group_data['name']); if ($wgf->isValid()) { $wgf->Save(); Redirect::Page(URLBuilder::getURL(NULL, 'WageGroupList.php')); break; } default: if (isset($id)) { BreadCrumb::setCrumb($title); $wglf = new WageGroupListFactory(); $wglf->GetByIdAndCompanyId($id, $current_company->getId()); foreach ($wglf as $group_obj) { //Debug::Arr($title_obj,'Title Object', __FILE__, __LINE__, __METHOD__,10); $group_data = array('id' => $group_obj->getId(), 'name' => $group_obj->getName(), 'created_date' => $group_obj->getCreatedDate(), 'created_by' => $group_obj->getCreatedBy(), 'updated_date' => $group_obj->getUpdatedDate(), 'updated_by' => $group_obj->getUpdatedBy(), 'deleted_date' => $group_obj->getDeletedDate(), 'deleted_by' => $group_obj->getDeletedBy()); } } $smarty->assign_by_ref('group_data', $group_data); break; } $smarty->assign_by_ref('wgf', $wgf); $smarty->display('company/EditWageGroup.tpl');