Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into 5.0
This commit is contained in:
commit
b189e3e394
@ -1340,9 +1340,11 @@ class CommandeFournisseur extends CommonOrder
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $pu_ht_devise Amount in currency
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0)
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0)
|
||||
{
|
||||
global $langs,$mysoc,$conf;
|
||||
|
||||
@ -1511,7 +1513,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->line->total_ttc=$total_ttc;
|
||||
$this->line->product_type=$type;
|
||||
$this->line->special_code=$this->special_code;
|
||||
$this->line->origin=$this->origin;
|
||||
$this->line->origin=$origin;
|
||||
$this->line->origin_id=$origin_id;
|
||||
$this->line->fk_unit=$fk_unit;
|
||||
|
||||
$this->line->date_start=$date_start;
|
||||
|
||||
@ -1068,7 +1068,10 @@ if (empty($reshook))
|
||||
null,
|
||||
null,
|
||||
array(),
|
||||
$lines[$i]->fk_unit
|
||||
$lines[$i]->fk_unit,
|
||||
0,
|
||||
$element,
|
||||
!empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -166,6 +166,7 @@ ALTER TABLE llx_commandedet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER
|
||||
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_propaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_supplier_proposaldet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
ALTER TABLE llx_supplier_proposaldet ADD COLUMN fk_unit integer DEFAULT NULL;
|
||||
ALTER TABLE llx_contratdet ADD COLUMN vat_src_code varchar(10) DEFAULT '' AFTER tva_tx;
|
||||
|
||||
ALTER TABLE llx_c_payment_term change fdm type_cdr tinyint;
|
||||
|
||||
@ -51,5 +51,6 @@ CREATE TABLE llx_supplier_proposaldet (
|
||||
multicurrency_subprice double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0,
|
||||
fk_unit integer DEFAULT NULL -- lien vers table des unités
|
||||
) ENGINE=innodb;
|
||||
@ -354,7 +354,7 @@ if (empty($reshook))
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options);
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->ref_fourn, $lines[$i]->fk_unit);
|
||||
|
||||
if ($result > 0) {
|
||||
$lineid = $result;
|
||||
@ -633,7 +633,8 @@ if (empty($reshook))
|
||||
$buyingprice,
|
||||
$label,
|
||||
$array_options,
|
||||
$ref_fourn
|
||||
$ref_fourn,
|
||||
$fk_unit
|
||||
);
|
||||
//var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit;
|
||||
}
|
||||
@ -683,7 +684,7 @@ if (empty($reshook))
|
||||
$price_base_type = 'HT';
|
||||
}
|
||||
|
||||
$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn);
|
||||
$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit);
|
||||
//$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit);
|
||||
}
|
||||
|
||||
@ -826,7 +827,8 @@ if (empty($reshook))
|
||||
if (! $error) {
|
||||
$db->begin();
|
||||
$ref_fourn = GETPOST('fourn_ref');
|
||||
$result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn);
|
||||
$fk_unit = GETPOST('units');
|
||||
$result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn, $fk_unit);
|
||||
|
||||
if ($result >= 0) {
|
||||
$db->commit();
|
||||
|
||||
@ -355,11 +355,12 @@ class SupplierProposal extends CommonObject
|
||||
* @param string $label ???
|
||||
* @param array $array_option extrafields array
|
||||
* @param string $ref_fourn Supplier price reference
|
||||
* @param int $fk_unit Id of the unit to use.
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @see add_product
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='')
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='', $fk_unit='')
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
@ -460,6 +461,7 @@ class SupplierProposal extends CommonObject
|
||||
$this->line->product_type=$type;
|
||||
$this->line->special_code=$special_code;
|
||||
$this->line->fk_parent_line=$fk_parent_line;
|
||||
$this->line->fk_unit=$fk_unit;
|
||||
|
||||
$this->line->ref_fourn = $this->db->escape($ref_fourn);
|
||||
|
||||
@ -546,9 +548,10 @@ class SupplierProposal extends CommonObject
|
||||
* @param int $type 0/1=Product/service
|
||||
* @param array $array_option extrafields array
|
||||
* @param string $ref_fourn Supplier price reference
|
||||
* @param int $fk_unit Id of the unit to use.
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn='')
|
||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn='', $fk_unit='')
|
||||
{
|
||||
global $conf,$user,$langs, $mysoc;
|
||||
|
||||
@ -634,7 +637,8 @@ class SupplierProposal extends CommonObject
|
||||
$this->line->special_code = $special_code;
|
||||
$this->line->fk_parent_line = $fk_parent_line;
|
||||
$this->line->skip_update_total = $skip_update_total;
|
||||
$this->line->ref_fourn = $ref_fourn;
|
||||
$this->line->ref_fourn = $ref_fourn;
|
||||
$this->line->fk_unit = $fk_unit;
|
||||
|
||||
// infos marge
|
||||
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
|
||||
@ -1195,7 +1199,7 @@ class SupplierProposal extends CommonObject
|
||||
$sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,";
|
||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,';
|
||||
$sql.= ' d.ref_fourn as ref_produit_fourn,';
|
||||
$sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
|
||||
$sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc, d.fk_unit';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposaldet as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
|
||||
$sql.= " WHERE d.fk_supplier_proposal = ".$this->id;
|
||||
@ -1261,6 +1265,7 @@ class SupplierProposal extends CommonObject
|
||||
$line->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
@ -2429,7 +2434,7 @@ class SupplierProposal extends CommonObject
|
||||
$sql.= ' pt.product_type, pt.rang, pt.fk_parent_line,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
|
||||
$sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn';
|
||||
$sql.= ' ,pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc';
|
||||
$sql.= ' ,pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc, pt.fk_unit';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pt';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
|
||||
$sql.= ' WHERE pt.fk_supplier_proposal = '.$this->id;
|
||||
@ -2484,6 +2489,7 @@ class SupplierProposal extends CommonObject
|
||||
$this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||
$this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
$this->lines[$i]->fk_unit = $obj->fk_unit;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -2557,7 +2563,7 @@ class SupplierProposal extends CommonObject
|
||||
* \class SupplierProposalLine
|
||||
* \brief Class to manage supplier_proposal lines
|
||||
*/
|
||||
class SupplierProposalLine extends CommonObject
|
||||
class SupplierProposalLine extends CommonObjectLine
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
@ -2693,7 +2699,7 @@ class SupplierProposalLine extends CommonObject
|
||||
$sql.= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,';
|
||||
$sql.= ' pd.product_type, pd.ref_fourn as ref_produit_fourn,';
|
||||
$sql.= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc';
|
||||
$sql.= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc, pd.fk_unit';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pd';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
|
||||
$sql.= ' WHERE pd.rowid = '.$rowid;
|
||||
@ -2749,6 +2755,7 @@ class SupplierProposalLine extends CommonObject
|
||||
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
@ -2787,7 +2794,8 @@ class SupplierProposalLine extends CommonObject
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
|
||||
|
||||
if (empty($this->fk_unit)) $this->fk_unit=0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
@ -2816,7 +2824,7 @@ class SupplierProposalLine extends CommonObject
|
||||
$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.= ' ref_fourn';
|
||||
$sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc)';
|
||||
$sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, fk_unit)';
|
||||
$sql.= " VALUES (".$this->fk_supplier_proposal.",";
|
||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
||||
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
@ -2849,7 +2857,8 @@ class SupplierProposalLine extends CommonObject
|
||||
$sql.= ", ".$this->multicurrency_total_ht;
|
||||
$sql.= ", ".$this->multicurrency_total_tva;
|
||||
$sql.= ", ".$this->multicurrency_total_ttc;
|
||||
$sql.= ')';
|
||||
$sql.= ", ".$this->fk_unit;
|
||||
$sql.= ')';
|
||||
|
||||
dol_syslog(get_class($this).'::insert', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -2969,7 +2978,8 @@ class SupplierProposalLine extends CommonObject
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
|
||||
|
||||
if (empty($this->fk_unit)) $this->fk_unit=0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
@ -3023,8 +3033,9 @@ class SupplierProposalLine extends CommonObject
|
||||
$sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
|
||||
$sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
|
||||
$sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
|
||||
$sql.= " , fk_unit=".$this->fk_unit;
|
||||
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user