function getByCompanyIdArray($company_id, $include_blank = TRUE) { $aplf = new AccrualPolicyListFactory(); $aplf->getByCompanyId($company_id); if ($include_blank == TRUE) { $list[0] = TTi18n::gettext('-- None --'); } foreach ($aplf as $ap_obj) { $list[$ap_obj->getID()] = $ap_obj->getName(); } if (isset($list)) { return $list; } return FALSE; }
foreach ($ids as $id) { $aplf->getByIdAndCompanyId($id, $current_company->getId()); $aplf->StartTransaction(); foreach ($aplf as $ap_obj) { $ap_obj->setDeleted($delete); if ($ap_obj->isValid()) { $ap_obj->Save(); } } $aplf->CommitTransaction(); } Redirect::Page(URLBuilder::getURL(NULL, 'AccrualPolicyList.php')); break; default: $aplf = new AccrualPolicyListFactory(); $aplf->getByCompanyId($current_company->getId()); $pager = new Pager($aplf); $type_options = $aplf->getOptions('type'); $show_no_policy_group_notice = FALSE; foreach ($aplf as $ap_obj) { if ((int) $ap_obj->getColumn('assigned_policy_groups') == 0) { $show_no_policy_group_notice = TRUE; } $policies[] = array('id' => $ap_obj->getId(), 'name' => $ap_obj->getName(), 'type_id' => $ap_obj->getType(), 'type' => $type_options[$ap_obj->getType()], 'assigned_policy_groups' => (int) $ap_obj->getColumn('assigned_policy_groups'), 'deleted' => $ap_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;