Пример #1
0
 public function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     parent::__construct();
     $this->_page_contents = 'delete.php';
     if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
         if (osC_Countries_Admin::delete($_GET['cID'])) {
             $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
         } else {
             $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
         }
         osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
     }
 }
Пример #2
0
 public function __construct()
 {
     global $osC_Language, $osC_MessageStack;
     parent::__construct();
     if (isset($_POST['batch']) && is_array($_POST['batch']) && !empty($_POST['batch'])) {
         $this->_page_contents = 'batch_delete.php';
         if (isset($_POST['subaction']) && $_POST['subaction'] == 'confirm') {
             $error = false;
             foreach ($_POST['batch'] as $id) {
                 if (!osC_Countries_Admin::delete($id)) {
                     $error = true;
                     break;
                 }
             }
             if ($error === false) {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
             } else {
                 $osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
             }
             osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
         }
     }
 }
 function deleteCountry()
 {
     global $osC_Language, $toC_Json, $osC_Database;
     $error = false;
     $feedback = array();
     $Qcheck = $osC_Database->query('select count(*) as total from :table_address_book where entry_country_id = :entry_country_id');
     $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
     $Qcheck->bindInt(':entry_country_id', $_REQUEST['countries_id']);
     $Qcheck->execute();
     if ($Qcheck->valueInt('total') > 0) {
         $error = true;
         $feedback[] = sprintf($osC_Language->get('delete_warning_country_in_use_address_book'), $Qcheck->valueInt('total'));
     }
     $Qcheck = $osC_Database->query('select count(*) as total from :table_zones_to_geo_zones where zone_country_id = :zone_country_id');
     $Qcheck->bindTable(':table_zones_to_geo_zones', TABLE_ZONES_TO_GEO_ZONES);
     $Qcheck->bindInt(':zone_country_id', $_REQUEST['countries_id']);
     $Qcheck->execute();
     if ($Qcheck->valueInt('total') > 0) {
         $error = true;
         $feedback[] = sprintf($osC_Language->get('delete_warning_country_in_use_tax_zone'), $Qcheck->valueInt('total'));
     }
     if ($error === false) {
         if (osC_Countries_Admin::delete($_REQUEST['countries_id'])) {
             $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
         } else {
             $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
         }
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed') . '<br />' . implode('<br />', $feedback));
     }
     echo $toC_Json->encode($response);
 }