Fix: Can edit qty of an option

This commit is contained in:
Laurent Destailleur 2012-10-12 21:37:06 +02:00
parent 399aaf1459
commit 8b02d9e912
3 changed files with 21 additions and 3 deletions

View File

@ -738,6 +738,11 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
$result = -1 ;
}
// Define special_code for special lines
$special_code=0;
if (empty($_POST['qty'])) $special_code=3;
// Check minimum price
if(! empty($_POST['productid']))
{

View File

@ -980,7 +980,11 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$price_base_type = 'HT';
// Ecrase $pu par celui du produit
// Define special_code for special lines
$special_code=0;
//if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
// Ecrase $base_price_type par celui du produit
@ -1099,7 +1103,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$pu_ttc,
$type,
-1,
0,
$special_code,
'',
0,
GETPOST('fk_parent_line')
@ -1171,6 +1175,11 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
$result = -1 ;
}
// Define special_code for special lines
$special_code=0;
//if (empty($_POST['qty'])) $special_code=3; // Option should not exists onto invoices
// Check minimum price
if (GETPOST('productid'))
{

View File

@ -2017,9 +2017,10 @@ class Facture extends CommonObject
* @param int $type Type of line (0=product, 1=service)
* @param int $fk_parent_line ???
* @param int $skip_update_total ???
* @param int $special_code Special code
* @return int < 0 if KO, > 0 if OK
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0)
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0, $special_code=0)
{
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@ -2100,6 +2101,7 @@ class Facture extends CommonObject
$this->line->product_type = $type;
$this->line->fk_parent_line = $fk_parent_line;
$this->line->skip_update_total = $skip_update_total;
$this->line->special_code = $special_code;
// A ne plus utiliser
//$this->line->price=$price;
@ -3632,6 +3634,7 @@ class FactureLigne
//if (empty($this->remise)) $this->remise=0;
if (empty($this->remise_percent)) $this->remise_percent=0;
if (empty($this->info_bits)) $this->info_bits=0;
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->product_type)) $this->product_type=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
@ -3659,6 +3662,7 @@ class FactureLigne
else { $sql.=',date_end=null'; }
$sql.= ",product_type=".$this->product_type;
$sql.= ",info_bits='".$this->info_bits."'";
$sql.= ",special_code='".$this->special_code."'";
if (empty($this->skip_update_total))
{
$sql.= ",total_ht=".price2num($this->total_ht)."";