Debug::Arr($ids, 'Selected Objects', __FILE__, __LINE__, __METHOD__, 10); $action = Misc::findSubmitButton(); switch ($action) { case 'add': Redirect::Page(URLBuilder::getURL(NULL, 'EditBranch.php')); break; case 'delete' or 'undelete': if (strtolower($action) == 'delete') { $delete = TRUE; } else { $delete = FALSE; } $blf = new BranchListFactory(); if (isset($ids) and is_array($ids)) { foreach ($ids as $id) { $blf->getByIdAndCompanyId($id, $current_company->getId()); foreach ($blf as $branch) { $branch->setDeleted($delete); $branch->Save(); } } } Redirect::Page(URLBuilder::getURL(NULL, 'BranchList.php')); break; default: $sort_array = NULL; if ($sort_column != '') { $sort_array = array(Misc::trimSortPrefix($sort_column) => $sort_order); } $blf = new BranchListFactory(); $blf->GetByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);