Fix [ bug #843 ] Erreur SQL box_stock

fix [ bug #842 ] Erreur SQL Propal
This commit is contained in:
fhenry 2013-04-23 14:02:29 +02:00
parent 624a039eaf
commit ba0e9c0c19
2 changed files with 8 additions and 4 deletions

View File

@ -2631,10 +2631,13 @@ class PropaleLigne
// Insert line into database
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
$sql.= ' (fk_propal, fk_parent_line, label, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' (fk_propal, fk_parent_line, label, description, fk_product, product_type,';
$sql.= ' fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' subprice, remise_percent, ';
$sql.= ' info_bits, ';
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang)';
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2,';
$sql.= ' total_ttc, fk_product_fournisseur_price, buy_price_ht,';
$sql.= ' special_code, rang)';
$sql.= " VALUES (".$this->fk_propal.",";
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
@ -2648,13 +2651,13 @@ class PropaleLigne
$sql.= " ".price2num($this->localtax2_tx).",";
$sql.= " ".($this->subprice?price2num($this->subprice):'null').",";
$sql.= " ".price2num($this->remise_percent).",";
$sql.= " '".$this->info_bits."',";
$sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").",";
$sql.= " ".price2num($this->total_ht).",";
$sql.= " ".price2num($this->total_tva).",";
$sql.= " ".price2num($this->total_localtax1).",";
$sql.= " ".price2num($this->total_localtax2).",";
$sql.= " ".price2num($this->total_ttc).",";
$sql.= " ".(isset($this->fk_fournprice)?"'".$this->fk_fournprice."'":"null").",";
$sql.= " ".(!empty($this->fk_fournprice)?"'".$this->fk_fournprice."'":"null").",";
$sql.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").",";
$sql.= ' '.$this->special_code.',';
$sql.= ' '.$this->rang;

View File

@ -82,6 +82,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$sql.= " AND p.tosell = 1";
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
$sql.= " GROUP BY p.rowid, p.seuil_stock_alerte, s.reel";
$sql.= " HAVING s.reel < p.seuil_stock_alerte";
$sql.= $db->order('s.reel', 'DESC');
$sql.= $db->plimit($max, 0);