function getByCompanyIdArray($company_id, $include_blank = TRUE) { $ppslf = new PayPeriodScheduleListFactory(); $ppslf->getByCompanyId($company_id); if ($include_blank == TRUE) { $list[0] = '--'; } foreach ($ppslf as $pps_obj) { $list[$pps_obj->getID()] = $pps_obj->getName(); } if (isset($list)) { return $list; } return FALSE; }
$cjlf = new CronJobListFactory(); $cjlf->getByName('calcExceptions'); if ($cjlf->getRecordCount() > 0) { foreach ($cjlf as $cj_obj) { $tmp_start_date = $cj_obj->getLastRunDate(); if ($tmp_start_date < $start_date) { $start_date = $tmp_start_date; Debug::text(' CRON Job hasnt run in more then 48hrs, reducing Start Date to: ' . TTDate::getDate('DATE+TIME', $start_date), __FILE__, __LINE__, __METHOD__, 5); } } } unset($cjlf, $cj_obj, $tmp_start_date); //Get maximum shift time for each pay period schedule, so we know how far back //we have to recalculate days at the minimum. $ppslf = new PayPeriodScheduleListFactory(); $ppslf->getByCompanyId($c_obj->getId()); if ($ppslf->getRecordCount() > 0) { foreach ($ppslf as $pps_obj) { $tmp_start_date = TTDate::getMiddleDayEpoch($execution_time) - $pps_obj->getMaximumShiftTime(); if ($tmp_start_date < $start_date) { $start_date = $tmp_start_date; Debug::text(' Maximum Shift Time is greater then 48hrs, reducing Start Date to: ' . TTDate::getDate('DATE+TIME', $start_date), __FILE__, __LINE__, __METHOD__, 5); } } } unset($ppslf, $pps_obj, $tmp_start_date); //Get earliest pre_mature exception in a NON-closed pay period. $elf = new ExceptionListFactory(); $elf->getByCompanyIDAndTypeAndPayPeriodStatus($c_obj->getId(), 5, array(10, 12, 15, 30), 1, NULL, NULL, array('b.date_stamp' => 'asc')); //Limit 1 if ($elf->getRecordCount() > 0) {
break; case 'delete' or 'undelete': if (strtolower($action) == 'delete') { $delete = TRUE; } else { $delete = FALSE; } $ppslf = new PayPeriodScheduleListFactory(); foreach ($ids as $id) { $ppslf->GetByIdAndCompanyId($id, $current_company->getId()); foreach ($ppslf as $pay_period_schedule) { $pay_period_schedule->setDeleted($delete); $pay_period_schedule->Save(); } } Redirect::Page(URLBuilder::getURL(NULL, 'PayPeriodScheduleList.php')); break; default: $ppslf = new PayPeriodScheduleListFactory(); $ppslf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order)); $pager = new Pager($ppslf); foreach ($ppslf as $pay_period_schedule) { $pay_period_schedules[] = array('id' => $pay_period_schedule->getId(), 'company_id' => $pay_period_schedule->getCompany(), 'name' => $pay_period_schedule->getName(), 'description' => $pay_period_schedule->getDescription(), 'type' => Option::getByKey($pay_period_schedule->getType(), $pay_period_schedule->getOptions('type')), 'deleted' => $pay_period_schedule->getDeleted()); } $smarty->assign_by_ref('pay_period_schedules', $pay_period_schedules); $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('payperiod/PayPeriodScheduleList.tpl');