if (strtolower($action) == 'delete') { $delete = TRUE; } else { $delete = FALSE; } $aplf = new AccrualPolicyListFactory(); 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()); }