function initQuery($params) { $cost_type_id = $params['cost_type_id']; $b_active_only = $params['b_active_only']; $tables = Discounts::getTables(); $tr = $tables['discounts_global_discount_rates_table']['columns']; $this->addSelectField($tr["id"], "id"); $this->addSelectField($tr["rv_from"], "rv_from"); $this->addSelectField($tr["rv_to"], "rv_to"); $this->addSelectField($tr["cost_type_id"], "cost_type_id"); $this->addSelectField($tr["b_active"], "b_active"); $this->addSelectField($tr["cost"], "cost"); $this->WhereValue('', '', '1'); if ($cost_type_id !== NULL) { $this->WhereAnd(); $this->WhereValue($tr["cost_type_id"], DB_EQ, $cost_type_id); } if ($b_active_only === true) { $this->WhereAND(); $this->WhereValue($tr["b_active"], DB_EQ, 1); } $this->SelectOrder($tr['rv_from']); }
/** * Uninstall the module. * . * * uninstall() . * * , , * Discounts::getTables() $this->getTables() */ function uninstall() { $query = new DB_Table_Delete(Discounts::getTables()); global $application; $application->db->getDB_Result($query); }