/**
  * Deletes admins from the database.
  *
  * @param array $array_id - admin id array to delete
  * @return
  */
 function deleteAdmins($array_id)
 {
     if (!is_array($array_id)) {
         return;
     }
     global $application;
     $tables = $this->getTables();
     $a = $tables['admin']['columns'];
     $query = new DB_Delete('admin');
     $query->WhereField($a['id'], DB_IN, "(" . implode(", ", $array_id) . ")");
     $application->db->getDB_Result($query);
 }
 function unsubscribeTempEmails($key, $topics_ids)
 {
     global $application;
     if (empty($topics_ids)) {
         return;
     }
     $tables = Subscriptions::getTables();
     $etable = 'subscription_email';
     $ecolumns =& $tables[$etable]['columns'];
     $ttable = 'subscription_temp';
     $tcolumns =& $tables[$ttable]['columns'];
     $dquery = new DB_Delete($etable);
     $dquery->addUsingTable($etable);
     $dquery->addUsingTable($ttable);
     $dquery->WhereValue($tcolumns['action_key'], DB_EQ, $key);
     $dquery->WhereAND();
     $dquery->Where($ecolumns['topic_id'], DB_IN, DBQuery::arrayToIn($topics_ids));
     $dquery->WhereAND();
     $dquery->WhereField($ecolumns['email_id'], DB_EQ, $tcolumns['email_id']);
     $application->db->getDB_Result($dquery);
 }
 /**
  *
  *
  * @param array $address_id_array -        id
  */
 function deleteRowsFromQuantityDiscount($rate_id_array)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['quantity_discounts_rates_table']['columns'];
     $query = new DB_Delete('quantity_discounts_rates_table');
     $query->WhereField($tr['id'], DB_IN, "('" . implode("', '", $rate_id_array) . "') ");
     $application->db->getDB_Result($query);
 }
 function deleteFsRuleByIdsArray($id_array)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['scc_fs_rules']['columns'];
     $query = new DB_Delete('scc_fs_rules');
     $query->WhereField($tr['id'], DB_IN, "('" . implode("', '", $id_array) . "') ");
     $application->db->getDB_Result($query);
 }
 /**
  *
  *
  * @author Alexandr Girin
  * @param
  * @return
  */
 function DeleteOrders($ordersId)
 {
     modApiFunc('EventsManager', 'throwEvent', 'OrdersWillBeDeleted', $ordersId);
     global $application;
     $tables = $this->getTables();
     $on = $tables['order_notes']['columns'];
     $opd = $tables['order_person_data']['columns'];
     $opr = $tables['order_prices']['columns'];
     $otx = $tables['order_taxes']['columns'];
     $otdo = $tables['order_tax_display_options']['columns'];
     $op = $tables['order_product']['columns'];
     $opca = $tables['order_product_custom_attributes']['columns'];
     $opta = $tables['order_product_to_attributes']['columns'];
     $opot = $tables['order_product_options']['columns'];
     $o = $tables['orders']['columns'];
     $DB_IN_string = "('" . implode("', '", $ordersId) . "')";
     $query = new DB_Select();
     $query->addSelectField($op['id'], 'id');
     $query->WhereField($op['order_id'], DB_IN, $DB_IN_string);
     $order_products_id = $application->db->getDB_Result($query);
     foreach ($order_products_id as $key => $order_product_id) {
         $order_products_id[$key] = $order_product_id['id'];
     }
     $query = new DB_Delete('order_notes');
     $query->WhereField($on['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_person_data');
     $query->WhereField($opd['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_prices');
     $query->WhereField($opr['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_taxes');
     $query->WhereField($otx['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_tax_display_options');
     $query->WhereField($otdo['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_product');
     $query->WhereField($op['order_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_product_custom_attributes');
     $query->WhereField($opca['product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $application->db->getDB_Result($query);
     $query = new DB_Delete('order_product_to_attributes');
     $query->WhereField($opta['product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $application->db->getDB_Result($query);
     $query = new DB_Select();
     $query->addSelectField($opot['option_value'], 'option_value');
     $query->WhereValue($opot['is_file'], DB_EQ, 'Y');
     $query->WhereAND();
     $query->Where($opot['order_product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $__res = $application->db->getDB_Result($query);
     if (count($__res) > 0) {
         foreach ($__res as $oinfo) {
             if ($oinfo['option_value'] != '') {
                 modApiFunc('Shell', 'removeDirectory', dirname($oinfo['option_value']));
             }
         }
     }
     $query = new DB_Delete('order_product_options');
     $query->WhereField($opot['order_product_id'], DB_IN, "('" . implode("', '", $order_products_id) . "')");
     $application->db->getDB_Result($query);
     modApiFunc("PromoCodes", "DeleteOrders", $ordersId);
     modApiFunc("TaxExempts", "DeleteOrders", $ordersId);
     modApiFunc('GiftCertificateApi', 'DeleteOrders', $ordersId);
     $query = new DB_Delete('orders');
     $query->WhereField($o['id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
 }
 /**
  *
  *
  * @param array $address_id_array -        id
  */
 function deleteRowsFromPromoCode($id_array)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['promo_codes_coupons_table']['columns'];
     $query = new DB_Delete('promo_codes_coupons_table');
     $query->WhereField($tr['id'], DB_IN, "('" . implode("', '", $id_array) . "') ");
     $application->db->getDB_Result($query);
 }
 function deleteBannersImageContent($image_ids)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['banners_images']['columns'];
     $query = new DB_Delete('banners_images');
     $query->WhereField($tr['imageid'], DB_IN, "('" . implode("', '", $image_ids) . "') ");
     $application->db->getDB_Result($query);
 }
 function DeleteOrders($ordersId)
 {
     global $application;
     $tables = $this->getTables();
     $opc = $tables['order_gc']['columns'];
     $DB_IN_string = "('" . implode("', '", $ordersId) . "')";
     $query = new DB_Delete('order_gc');
     $query->WhereField($opc['gc_ord_id'], DB_IN, $DB_IN_string);
     $application->db->getDB_Result($query);
 }