function deleteFPLinksFromCategory($category_id, $fp_ids)
 {
     global $application;
     $tables = $this->getTables();
     $fp_table = $tables['fp_links']['columns'];
     $query = new DB_Delete('fp_links');
     $query->WhereValue($fp_table['category_id'], DB_EQ, $category_id);
     $query->WhereAND();
     $query->Where($fp_table['fp_id'], DB_IN, "(" . implode(", ", $fp_ids) . ")");
     $application->db->PrepareSQL($query);
     return $application->db->DB_Exec();
 }
 function deleteRPLinksFromProduct($product_id, $rp_ids)
 {
     global $application;
     $tables = $this->getTables();
     $rp_table = $tables['rp_links']['columns'];
     $query = new DB_Delete('rp_links');
     $query->WhereValue($rp_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($rp_table['rp_id'], DB_IN, "(" . implode(", ", $rp_ids) . ")");
     $application->db->PrepareSQL($query);
     return $application->db->DB_Exec();
 }
 function __delRateFromCache($from, $to)
 {
     global $application;
     $tables = $this->getTables();
     $rc_table = $tables['cconv_rates_cache']['columns'];
     $query = new DB_Delete('cconv_rates_cache');
     $query->addWhereOpenSection();
     $query->WhereValue($rc_table['from'], DB_EQ, $from);
     $query->WhereAnd();
     $query->WhereValue($rc_table['to'], DB_EQ, $to);
     $query->addWhereCloseSection();
     $query->WhereOR();
     $query->addWhereOpenSection();
     $query->WhereValue($rc_table['from'], DB_EQ, $to);
     $query->WhereAND();
     $query->WhereValue($rc_table['to'], DB_EQ, $from);
     $query->addWhereCloseSection();
     $application->db->getDB_Result($query);
     return;
 }
 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);
 }
 function delImagesFromProduct($product_id, $images_ids, $del_from_server)
 {
     global $application;
     $tables = $this->getTables();
     $imgs_table = $tables['pi_images']['columns'];
     $query = new DB_Select();
     $query->addSelectField($imgs_table['image_path']);
     $query->addSelectField($imgs_table['thumb_path']);
     $query->WhereValue($imgs_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($imgs_table['image_id'], DB_IN, '(\'' . implode('\',\'', $images_ids) . '\')');
     $res = $application->db->getDB_Result($query);
     if (strcmp($del_from_server, 'yes') == 0) {
         $this->unlinkFiles($res);
     }
     $query = new DB_Delete('pi_images');
     $query->deleteMultiLangField($imgs_table['alt_text'], $imgs_table['image_id'], 'Product_Images');
     $query->WhereValue($imgs_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($imgs_table['image_id'], DB_IN, '(\'' . implode('\',\'', $images_ids) . '\')');
     $application->db->getDB_Result($query);
     return;
 }
 function removeCustomField($variantId, $attributeId)
 {
     global $application;
     $tables = $this->getTables();
     $piva = $tables['person_info_variants_to_attributes']['columns'];
     $pa = $tables['person_attributes']['columns'];
     $s = $this->getPersonAttributeData($variantId, $attributeId);
     // removing the field from notification infotags
     // Note: only for Billing and Shipping info
     if ($variantId == '2') {
         modApiFunc('Notifications', 'removeCustomInfoTag', 'Billing' . $s[0]['person_attribute_view_tag']);
     } elseif ($variantId == '3') {
         modApiFunc('Notifications', 'removeCustomInfoTag', 'Shipping' . $s[0]['person_attribute_view_tag']);
     }
     $d = new DB_Delete("person_attributes");
     $d->WhereValue($pa['id'], DB_EQ, $attributeId);
     $application->db->PrepareSQL($d);
     $application->db->DB_Exec();
     $d2 = new DB_Delete("person_info_variants_to_attributes");
     $d2->deleteMultiLangField($piva['name'], $piva['id'], 'Checkout');
     $d2->deleteMultiLangField($piva['descr'], $piva['id'], 'Checkout');
     $d2->WhereValue($piva['variant_id'], DB_EQ, $variantId);
     $d2->WhereAND();
     $d2->WhereValue($piva['attribute_id'], DB_EQ, $attributeId);
     $application->db->PrepareSQL($d2);
     $application->db->DB_Exec();
     if ($s[0]['input_type_id'] > 9) {
         $tables = modApiFunc('Catalog', 'getTables');
         $it = $tables['input_types']['columns'];
         $itv = $tables['input_type_values']['columns'];
         $d3 = new DB_Delete("input_types");
         $d3->WhereValue($it['id'], DB_EQ, $s[0]['input_type_id']);
         $application->db->PrepareSQL($d3);
         $application->db->DB_Exec();
         $d4 = new DB_Delete("input_type_values");
         $d4->deleteMultiLangField($itv['value'], $itv['id'], 'Catalog');
         $d4->WhereValue($itv['it_id'], DB_EQ, $s[0]['input_type_id']);
         $application->db->getDB_Result($d4);
     }
 }
 /**
  *                                            .
  *
  * @param string $event_name
  * @param string $handler_class
  * @param string $handler_method
  */
 function removeEventHandler($event_name, $handler_class, $handler_method)
 {
     global $application;
     $tables = EventsManager::getTables();
     $tbl_events = $tables['events_manager']['columns'];
     $query = new DB_Delete('events_manager');
     $query->WhereValue($tbl_events['event_name'], DB_EQ, $event_name);
     $query->WhereAND();
     $query->WhereValue($tbl_events['handler_class'], DB_EQ, $handler_class);
     $query->WhereAND();
     $query->WhereValue($tbl_events['handler_method'], DB_EQ, $handler_method);
     $application->db->getDB_Result($query);
 }
 /**
  * Clears the table Inventory Tracking for one product.
  * (If necessary, it can be rewritten for clearing the table Inventory
  * Tracking for several products).
  *
  * @param string $parent_entity - entity name
  * @param int $entity_id - ID of the entity the table should be cleared for.
  * @return bool; true if the table is cleared, false otherwise
  */
 function __clearITForEntity($parent_entity, $entity_id)
 {
     global $application;
     $tables = $this->getTables();
     $it_table = $tables['po_inventory']['columns'];
     $query = new DB_Delete('po_inventory');
     $query->WhereValue($it_table['parent_entity'], DB_EQ, $parent_entity);
     $query->WhereAND();
     $query->WhereValue($it_table['entity_id'], DB_EQ, $entity_id);
     $application->db->PrepareSQL($query);
     if ($application->db->DB_Exec()) {
         //            $this->updateOptionsSettingsForEntity($parent_entity,$entity_id,array('IT_ACTUAL'=>'Y'));
         return true;
     } else {
         return false;
     }
 }
 function delFilesFromProduct($product_id, $files_ids)
 {
     global $application;
     $tables = $this->getTables();
     $file_table = $tables['pf_files']['columns'];
     $query = new DB_Select();
     $query->addSelectField($file_table['file_path']);
     $query->WhereValue($file_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($file_table['file_id'], DB_IN, '(\'' . implode('\',\'', $files_ids) . '\')');
     $query->WhereAND();
     $query->WhereValue($file_table['is_uploaded'], DB_EQ, 'Y');
     $res = $application->db->getDB_Result($query);
     $this->unlinkFiles($res);
     $query = new DB_Delete('pf_files');
     $query->WhereValue($file_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($file_table['file_id'], DB_IN, '(\'' . implode('\',\'', $files_ids) . '\')');
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
     return;
 }
Esempio n. 10
0
 /**
  * Deletes old records in the news table.
  * After that <= NEWS_MAX_COUNT records remain.
  */
 function deleteOldNews()
 {
     global $application;
     $tables = $this->getTables();
     $columns = $tables['news']['columns'];
     # select the latest date piece of news among the remain ones in the table...
     $query = new DB_Select('news');
     $query->addSelectField($columns['date'], 'NewsDate');
     $query->SelectOrder($columns['date'], 'DESC');
     $query->SelectLimit($this->settings[NEWS_MAX_COUNT] - 1, 1);
     $result = $application->db->getDB_Result($query);
     if ($result == NULL) {
         return;
     }
     # ...delete all the latest news @ check this line
     $query = new DB_Delete('news');
     $query->WhereValue($columns['date'], DB_LT, $result[0]['NewsDate']);
     $query->WhereAND();
     $query->WhereValue($columns['type'], DB_EQ, 'avactis');
     $application->db->getDB_Result($query);
 }