} else { $pgf->setMealPolicy(array()); } if (isset($data['break_policy_ids'])) { $pgf->setBreakPolicy($data['break_policy_ids']); } else { $pgf->setBreakPolicy(array()); } if (isset($data['holiday_policy_ids'])) { $pgf->setHolidayPolicy($data['holiday_policy_ids']); } else { $pgf->setHolidayPolicy(array()); } if ($pgf->isValid()) { $pgf->Save(); $pgf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(NULL, 'PolicyGroupList.php')); break; } } $pgf->FailTransaction(); default: if (isset($id)) { BreadCrumb::setCrumb($title); $pglf = new PolicyGroupListFactory(); $pglf->getByIdAndCompanyID($id, $current_company->getID()); foreach ($pglf as $pg_obj) { //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $data = array('id' => $pg_obj->getId(), 'name' => $pg_obj->getName(), 'meal_policy_ids' => $pg_obj->getMealPolicy(), 'break_policy_ids' => $pg_obj->getBreakPolicy(), 'holiday_policy_ids' => $pg_obj->getHolidayPolicy(), 'exception_policy_control_id' => $pg_obj->getExceptionPolicyControlID(), 'user_ids' => $pg_obj->getUser(), 'over_time_policy_ids' => $pg_obj->getOverTimePolicy(), 'premium_policy_ids' => $pg_obj->getPremiumPolicy(), 'round_interval_policy_ids' => $pg_obj->getRoundIntervalPolicy(), 'accrual_policy_ids' => $pg_obj->getAccrualPolicy(), 'created_date' => $pg_obj->getCreatedDate(), 'created_by' => $pg_obj->getCreatedBy(), 'updated_date' => $pg_obj->getUpdatedDate(), 'updated_by' => $pg_obj->getUpdatedBy(), 'deleted_date' => $pg_obj->getDeletedDate(), 'deleted_by' => $pg_obj->getDeletedBy()); } }
function createPolicyGroup($company_id, $meal_policy_ids = NULL, $exception_policy_id = NULL, $holiday_policy_ids = NULL, $over_time_policy_ids = NULL, $premium_policy_ids = NULL, $rounding_policy_ids = NULL, $user_ids = NULL) { $pgf = new PolicyGroupFactory(); $pgf->StartTransaction(); $pgf->setCompany($company_id); $pgf->setName('Default'); if ($exception_policy_id != '') { $pgf->setExceptionPolicyControlID($exception_policy_id); } if ($pgf->isValid()) { $insert_id = $pgf->Save(FALSE); if (is_array($meal_policy_ids)) { $pgf->setMealPolicy($meal_policy_ids); } else { $pgf->setMealPolicy(array()); } if (is_array($over_time_policy_ids)) { $pgf->setOverTimePolicy($over_time_policy_ids); } else { $pgf->setOverTimePolicy(array()); } if (is_array($premium_policy_ids)) { $pgf->setPremiumPolicy($premium_policy_ids); } else { $pgf->setPremiumPolicy(array()); } if (is_array($rounding_policy_ids)) { $pgf->setRoundIntervalPolicy($rounding_policy_ids); } else { $pgf->setRoundIntervalPolicy(array()); } if (is_array($holiday_policy_ids)) { $pgf->setHolidayPolicy($holiday_policy_ids); } else { $pgf->setHolidayPolicy(array()); } if (is_array($user_ids)) { $pgf->setUser($user_ids); } else { $pgf->setUser(array()); } if ($pgf->isValid()) { $pgf->Save(); $pgf->CommitTransaction(); Debug::Text('Creating Policy Group ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10); return TRUE; } } Debug::Text('Failed Creating Policy Group!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }