Merge pull request #20831 from atm-gauthier/NEW/can_update_rank_on_api_put_function

NEW Can update rank of invoice, proposal and order lines with API update
This commit is contained in:
Laurent Destailleur 2022-05-12 01:56:21 +02:00 committed by GitHub
commit bffcb42ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 8 deletions

View File

@ -519,7 +519,9 @@ class Proposals extends DolibarrApi
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice,
0,
isset($request_data->rang) ? $request_data->rang : $propalline->rang
);
if ($updateRes > 0) {

View File

@ -806,9 +806,10 @@ class Propal extends CommonObject
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency
* @param int $notrigger disable line update trigger
* @param integer $rang line rank
* @return int 0 if OK, <0 if KO
*/
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.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, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.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, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
{
global $mysoc, $langs;
@ -894,6 +895,7 @@ class Propal extends CommonObject
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
$this->line->rang = $rang;
// Reorder if fk_parent_line change
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {

View File

@ -439,7 +439,8 @@ class Orders extends DolibarrApi
$request_data->fk_unit,
$request_data->multicurrency_subprice,
0,
$request_data->ref_ext
$request_data->ref_ext,
$request_data->rang
);
if ($updateRes > 0) {

View File

@ -3087,9 +3087,10 @@ class Commande extends CommonOrder
* @param double $pu_ht_devise Amount in currency
* @param int $notrigger disable line update trigger
* @param string $ref_ext external reference
* @param integer $rang line rank
* @return int < 0 if KO, > 0 if OK
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '')
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
{
global $conf, $mysoc, $langs, $user;
@ -3214,6 +3215,7 @@ class Commande extends CommonOrder
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
$this->line->rang = $rang;
// Reorder if fk_parent_line change
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {

View File

@ -451,7 +451,8 @@ class Invoices extends DolibarrApi
$request_data->fk_unit,
$request_data->multicurrency_subprice,
0,
$request_data->ref_ext
$request_data->ref_ext,
$request_data->rang
);
if ($updateRes > 0) {

View File

@ -3840,9 +3840,10 @@ class Facture extends CommonInvoice
* @param double $pu_ht_devise Unit price in currency
* @param int $notrigger disable line update trigger
* @param string $ref_ext External reference of the line
* @param integer $rang rank of line
* @return int < 0 if KO, > 0 if OK
*/
public 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 = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '')
public 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 = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
{
global $conf, $user;
// Deprecation warning
@ -3970,6 +3971,7 @@ class Facture extends CommonInvoice
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
$this->line->rang = $rang;
// Reorder if fk_parent_line change
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {

View File

@ -647,7 +647,8 @@ class SupplierInvoices extends DolibarrApi
$request_data->array_options,
$request_data->fk_unit,
$request_data->multicurrency_subprice,
$request_data->ref_supplier
$request_data->ref_supplier,
$request_data->rang
);
if ($updateRes > 0) {

View File

@ -2277,9 +2277,10 @@ class FactureFournisseur extends CommonInvoice
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_devise Amount in currency
* @param string $ref_supplier Supplier ref
* @param integer $rang line rank
* @return int <0 if KO, >0 if OK
*/
public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_devise = 0, $ref_supplier = '')
public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_devise = 0, $ref_supplier = '', $rang = 0)
{
global $mysoc, $langs;
@ -2401,6 +2402,7 @@ class FactureFournisseur extends CommonInvoice
$line->product_type = $product_type;
$line->info_bits = $info_bits;
$line->fk_unit = $fk_unit;
$line->rang = $rang;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
@ -3686,6 +3688,10 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql .= ", info_bits = ".((int) $this->info_bits);
$sql .= ", fk_unit = ".($fk_unit > 0 ? (int) $fk_unit : 'null');
if (!empty($this->rang)) {
$sql .= ", rang=".((int) $this->rang);
}
// Multicurrency
$sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
$sql .= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";