modification de la description produit
This commit is contained in:
parent
cfa0740055
commit
4ad7c9e0a3
@ -431,6 +431,56 @@ class Commande
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute une ligne de commande libre
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function addline_libre($desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
// Nettoyage parametres
|
||||||
|
$qty = ereg_replace(',','.',$qty);
|
||||||
|
$pu = ereg_replace(',','.',$pu);
|
||||||
|
$desc=trim($desc);
|
||||||
|
if (strlen(trim($qty))==0)
|
||||||
|
{
|
||||||
|
$qty=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifs
|
||||||
|
if (! $this->brouillon) return -1;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$remise = 0;
|
||||||
|
$price = round(ereg_replace(',','.',$pu), 2);
|
||||||
|
$subprice = $price;
|
||||||
|
if (trim(strlen($remise_percent)) > 0)
|
||||||
|
{
|
||||||
|
$remise = round(($pu * $remise_percent / 100), 2);
|
||||||
|
$price = $pu - $remise;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet (fk_commande,label,description,fk_product, price,qty,tva_tx, remise_percent, subprice, remise)';
|
||||||
|
$sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "',$fk_product,".price2num($price).", '$qty', $txtva, $remise_percent,'".price2num($subprice)."','".price2num( $remise)."') ;";
|
||||||
|
|
||||||
|
if ( $this->db->query( $sql) )
|
||||||
|
{
|
||||||
|
$this->update_price();
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute un produit dans la commande
|
* Ajoute un produit dans la commande
|
||||||
*
|
*
|
||||||
|
|||||||
@ -150,9 +150,8 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = $commande->addline(
|
$result = $commande->addline_libre(
|
||||||
$_POST['desc'],
|
$_POST['desc'],
|
||||||
$_POST['product_desc'],
|
|
||||||
$_POST['pu'],
|
$_POST['pu'],
|
||||||
$_POST['qty'],
|
$_POST['qty'],
|
||||||
$_POST['tva_tx'],
|
$_POST['tva_tx'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user