}
 }
 $none_array_option = array('0' => TTi18n::gettext('-- None --'));
 $ulf = new UserListFactory();
 $user_options = $ulf->getByCompanyIDArray($current_company->getId(), FALSE, TRUE);
 $otplf = new OverTimePolicyListFactory();
 $over_time_policy_options = Misc::prependArray($none_array_option, $otplf->getByCompanyIDArray($current_company->getId(), FALSE));
 $pplf = new PremiumPolicyListFactory();
 $premium_policy_options = Misc::prependArray($none_array_option, $pplf->getByCompanyIDArray($current_company->getId(), FALSE));
 $riplf = new RoundIntervalPolicyListFactory();
 $round_interval_policy_options = Misc::prependArray($none_array_option, $riplf->getByCompanyIDArray($current_company->getId(), FALSE));
 $mplf = new MealPolicyListFactory();
 $meal_options = Misc::prependArray($none_array_option, $mplf->getByCompanyIdArray($current_company->getId(), FALSE));
 $bplf = new BreakPolicyListFactory();
 $break_options = Misc::prependArray($none_array_option, $bplf->getByCompanyIdArray($current_company->getId(), FALSE));
 $epclf = new ExceptionPolicyControlListFactory();
 $exception_options = Misc::prependArray($none_array_option, $epclf->getByCompanyIdArray($current_company->getId(), FALSE));
 $hplf = new HolidayPolicyListFactory();
 $holiday_policy_options = Misc::prependArray($none_array_option, $hplf->getByCompanyIdArray($current_company->getId(), FALSE));
 $aplf = new AccrualPolicyListFactory();
 $aplf->getByCompanyIdAndTypeID($current_company->getId(), array(20, 30));
 //Calendar and Hour based.
 $accrual_options = Misc::prependArray($none_array_option, $aplf->getArrayByListFactory($aplf, FALSE));
 //Select box options;
 $data['user_options'] = $user_options;
 $data['over_time_policy_options'] = $over_time_policy_options;
 $data['premium_policy_options'] = $premium_policy_options;
 $data['round_interval_policy_options'] = $round_interval_policy_options;
 $data['accrual_policy_options'] = $accrual_options;
 $data['meal_options'] = $meal_options;
 $data['break_options'] = $break_options;
                 if (isset($exception_data['watch_window']) and $exception_data['watch_window'] != '') {
                     $epf->setWatchWindow($exception_data['watch_window']);
                 }
                 if ($epf->isValid()) {
                     $epf->Save();
                 }
             }
         }
         Redirect::Page(URLBuilder::getURL(NULL, 'ExceptionPolicyControlList.php'));
         break;
     }
 default:
     $type_options = $epf->getTypeOptions($current_company->getProductEdition());
     if (isset($id) and $id != '') {
         BreadCrumb::setCrumb($title);
         $epclf = new ExceptionPolicyControlListFactory();
         $epclf->getByIdAndCompanyID($id, $current_company->getID());
         foreach ($epclf as $epc_obj) {
             //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
             $eplf = new ExceptionPolicyListFactory();
             $eplf->getByExceptionPolicyControlID($id);
             if ($eplf->getRecordCount() > 0) {
                 foreach ($eplf as $ep_obj) {
                     if (isset($type_options[$ep_obj->getType()])) {
                         $ep_objs[$ep_obj->getType()] = $ep_obj;
                     } else {
                         //Delete exceptions that aren't part of the product.
                         Debug::Text('Deleting exception outside product edition: ' . $ep_obj->getID(), __FILE__, __LINE__, __METHOD__, 10);
                         $ep_obj->setDeleted(TRUE);
                         if ($ep_obj->isValid()) {
                             $ep_obj->Save();
 function setExceptionPolicyControlID($id)
 {
     $id = trim($id);
     if ($id == '' or empty($id)) {
         $id = NULL;
     }
     $epclf = new ExceptionPolicyControlListFactory();
     if ($id == NULL or $this->Validator->isResultSetWithRows('exception_policy', $epclf->getByID($id), TTi18n::gettext('Exception Policy is invalid'))) {
         $this->data['exception_policy_control_id'] = $id;
         return TRUE;
     }
     return FALSE;
 }
 function getByCompanyIdArray($company_id, $include_blank = TRUE)
 {
     $epclf = new ExceptionPolicyControlListFactory();
     $epclf->getByCompanyId($company_id);
     if ($include_blank == TRUE) {
         $list[0] = '--';
     }
     foreach ($epclf as $epc_obj) {
         $list[$epc_obj->getID()] = $epc_obj->getName();
     }
     if (isset($list)) {
         return $list;
     }
     return FALSE;
 }
         $delete = FALSE;
     }
     $epclf = new ExceptionPolicyControlListFactory();
     foreach ($ids as $id) {
         $epclf->getByIdAndCompanyId($id, $current_company->getId());
         foreach ($epclf as $epc_obj) {
             $epc_obj->setDeleted($delete);
             if ($epc_obj->isValid()) {
                 $epc_obj->Save();
             }
         }
     }
     Redirect::Page(URLBuilder::getURL(NULL, 'ExceptionPolicyControlList.php'));
     break;
 default:
     $epclf = new ExceptionPolicyControlListFactory();
     $epclf->getByCompanyId($current_company->getId());
     $pager = new Pager($epclf);
     $show_no_policy_group_notice = FALSE;
     foreach ($epclf as $epc_obj) {
         if ((int) $epc_obj->getColumn('assigned_policy_groups') == 0) {
             $show_no_policy_group_notice = TRUE;
         }
         $policies[] = array('id' => $epc_obj->getId(), 'name' => $epc_obj->getName(), 'assigned_policy_groups' => (int) $epc_obj->getColumn('assigned_policy_groups'), 'deleted' => $epc_obj->getDeleted());
     }
     $smarty->assign_by_ref('policies', $policies);
     $smarty->assign_by_ref('show_no_policy_group_notice', $show_no_policy_group_notice);
     $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;