public static function deleteGroup() { $result = array(); $deleted = lC_Customer_groups_Admin::delete($_GET['cgid']); if ($deleted) { $result['rpcStatus'] = RPC_STATUS_SUCCESS; } echo json_encode($result); }
public static function batchDelete($batch) { global $lC_Language, $lC_Database; $lC_Language->loadIniFile('customer_groups.php'); $Qgroups = $lC_Database->query('select customers_group_id, customers_group_name from :table_customers_groups where customers_group_id in (":customers_group_id") and language_id = :language_id order by customers_group_name'); $Qgroups->bindTable(':table_customers_groups', TABLE_CUSTOMERS_GROUPS); $Qgroups->bindRaw(':customers_group_id', implode('", "', array_unique(array_filter(array_slice($batch, 0, MAX_DISPLAY_SEARCH_RESULTS), 'is_numeric')))); $Qgroups->bindInt(':language_id', $lC_Language->getID()); $Qgroups->execute(); $names_string = ''; while ($Qgroups->next()) { $Qcustomers = $lC_Database->query('select count(*) as total from :table_customers where customers_group_id = :customers_group_id'); $Qcustomers->bindTable(':table_customers', TABLE_CUSTOMERS); $Qcustomers->bindInt(':customers_group_id', $Qgroups->valueInt('customers_group_id')); $Qcustomers->execute(); if ($Qcustomers->valueInt('total') > 0 || $Qgroups->valueInt('customers_group_id') == DEFAULT_CUSTOMERS_GROUP_ID) { if ($Qcustomers->valueInt('total') > 0) { $names_string .= $Qgroups->value('customers_group_name') . ' (' . $Qcustomers->valueInt('total') . ' ' . $lC_Language->get('customers') . '), '; } if ($Qgroups->valueInt('customers_group_id') == DEFAULT_CUSTOMERS_GROUP_ID) { $names_string .= $Qgroups->value('customers_group_name') . ' (' . $lC_Language->get('default') . ') ,'; } } else { lC_Customer_groups_Admin::delete($Qgroups->valueInt('customers_group_id')); } $Qcustomers->freeResult(); } if (!empty($names_string)) { $names_string = substr($names_string, 0, -2); } $result['namesString'] = $names_string; $Qgroups->freeResult(); return $result; }