Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/class/html.formother.class.php
	htdocs/core/customreports.php
This commit is contained in:
Laurent Destailleur
2022-03-01 16:48:29 +01:00
46 changed files with 167 additions and 126 deletions

View File

@@ -877,7 +877,7 @@ class Commande extends CommonOrder
*/
public function create($user, $notrigger = 0)
{
global $conf, $langs;
global $conf, $langs, $mysoc;
$error = 0;
// Clean parameters
@@ -1044,7 +1044,8 @@ class Commande extends CommonOrder
$origintype,
$originid,
0,
$line->ref_ext
$line->ref_ext,
1
);
if ($result < 0) {
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER) {
@@ -1061,6 +1062,8 @@ class Commande extends CommonOrder
}
}
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
// update ref
$initialref = '(PROV'.$this->id.')';
if (!empty($this->ref)) {
@@ -1438,6 +1441,7 @@ class Commande extends CommonOrder
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
* @param double $pu_ht_devise Unit price in currency
* @param string $ref_ext line external reference
* @param int $noupdateafterinsertline No update after insert of line
* @return int >0 if OK, <0 if KO
*
* @see add_product()
@@ -1447,7 +1451,7 @@ class Commande extends CommonOrder
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '')
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '', $noupdateafterinsertline = 0)
{
global $mysoc, $conf, $langs, $user;
@@ -1658,7 +1662,10 @@ class Commande extends CommonOrder
}
// Mise a jour informations denormalisees au niveau de la commande meme
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
if (empty($noupdateafterinsertline)) {
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
}
if ($result > 0) {
$this->db->commit();
return $this->line->id;