Task # 186 : Add stock column in sql request to get object lines + display alert icon if stock is too low

This commit is contained in:
Maxime Kohlhaas 2012-10-04 16:26:33 +02:00
parent 5a64e3b1ec
commit 16f82216bf
3 changed files with 7 additions and 3 deletions

View File

@ -2754,7 +2754,7 @@ class Commande extends CommonOrder
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,';
$sql.= ' l.date_start, l.date_end,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, ';
$sql.= ' p.description as product_desc';
$sql.= ' p.description as product_desc, p.stock as stock_reel';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= ' WHERE l.fk_commande = '.$this->id;
@ -2790,6 +2790,7 @@ class Commande extends CommonOrder
$this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->stock = $obj->stock_reel;
$this->lines[$i]->rang = $obj->rang;
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
$this->lines[$i]->date_end = $this->db->jdate($obj->date_end);

View File

@ -106,6 +106,7 @@
<td align="right">
<?php if (($line->info_bits & 2) != 2) { ?>
<?php if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; ?>
<input size="3" type="text" class="flat" name="qty" value="<?php echo $line->qty; ?>">
<?php } else { ?>
&nbsp;

View File

@ -102,8 +102,10 @@
<?php } ?>
<td align="right" nowrap="nowrap">
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
else echo '&nbsp;'; ?>
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
echo $line->qty;
} else echo '&nbsp;'; ?>
</td>
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>