forked from Wavyzz/dolibarr
Fix related to #33449
This commit is contained in:
@@ -1436,8 +1436,8 @@ if (empty($reshook)) {
|
|||||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
|
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
|
$fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num((GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''), '', 2); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
$date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year'));
|
$date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year'));
|
||||||
$date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year'));
|
$date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year'));
|
||||||
@@ -1485,7 +1485,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, (float) $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@@ -1621,8 +1621,8 @@ if (empty($reshook)) {
|
|||||||
$pu_ttc = price2num(GETPOST('price_ttc'), '', 2);
|
$pu_ttc = price2num(GETPOST('price_ttc'), '', 2);
|
||||||
|
|
||||||
// Add buying price
|
// Add buying price
|
||||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
$fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num((GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''), '', 2); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
|
||||||
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
|
||||||
@@ -1746,7 +1746,7 @@ if (empty($reshook)) {
|
|||||||
$price_base_type = 'TTC';
|
$price_base_type = 'TTC';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->updateline(GETPOSTINT('lineid'), (float) $pu, (float) $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, $price_base_type, $info_bits, $special_code, GETPOSTINT('fk_parent_line'), 0, (int) $fournprice, (int) $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOSTINT("units"), (float) $pu_ht_devise);
|
$result = $object->updateline(GETPOSTINT('lineid'), (float) $pu, (float) $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, $price_base_type, $info_bits, $special_code, GETPOSTINT('fk_parent_line'), 0, (int) $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOSTINT("units"), (float) $pu_ht_devise);
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $special_code Special code (also used by externals modules!)
|
* @param int $special_code Special code (also used by externals modules!)
|
||||||
* @param int $fk_parent_line Id of parent line
|
* @param int $fk_parent_line Id of parent line
|
||||||
* @param int $fk_fournprice Id supplier price
|
* @param int $fk_fournprice Id supplier price
|
||||||
* @param float $pa_ht Buying price without tax
|
* @param float[string $pa_ht Buying price without tax ('' to keep PMP unchanged or a float)
|
||||||
* @param string $label ???
|
* @param string $label ???
|
||||||
* @param int|string $date_start Start date of the line
|
* @param int|string $date_start Start date of the line
|
||||||
* @param int|string $date_end End date of the line
|
* @param int|string $date_end End date of the line
|
||||||
@@ -668,7 +668,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
$txlocaltax1 = price2num($txlocaltax1);
|
$txlocaltax1 = price2num($txlocaltax1);
|
||||||
$txlocaltax2 = price2num($txlocaltax2);
|
$txlocaltax2 = price2num($txlocaltax2);
|
||||||
$pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring
|
$pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht is empty string
|
||||||
if ($price_base_type == 'HT') {
|
if ($price_base_type == 'HT') {
|
||||||
$pu = $pu_ht;
|
$pu = $pu_ht;
|
||||||
} else {
|
} else {
|
||||||
@@ -886,7 +886,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
||||||
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
||||||
* @param int $fk_fournprice Id of origin supplier price
|
* @param int $fk_fournprice Id of origin supplier price
|
||||||
* @param float $pa_ht Price (without tax) of product when it was bought
|
* @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param string $label ???
|
* @param string $label ???
|
||||||
* @param int $type 0/1=Product/service
|
* @param int $type 0/1=Product/service
|
||||||
* @param int|string $date_start Start date of the line
|
* @param int|string $date_start Start date of the line
|
||||||
@@ -894,8 +894,8 @@ class Propal extends CommonObject
|
|||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
|
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param float $pu_ht_devise Unit price in currency
|
* @param float $pu_ht_devise Unit price in currency
|
||||||
* @param int $notrigger disable line update trigger
|
* @param int $notrigger Disable line update trigger
|
||||||
* @param int $rang line rank
|
* @param int $rang Line rank
|
||||||
* @return int 0 if OK, <0 if KO
|
* @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 = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 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 = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
|
||||||
|
|||||||
@@ -1192,7 +1192,7 @@ if (empty($reshook)) {
|
|||||||
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
|
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOSTINT('fournprice'.$predef) : 0);
|
$fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOSTINT('fournprice'.$predef) : 0); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
// Prepare a price equivalent for minimum price check
|
// Prepare a price equivalent for minimum price check
|
||||||
@@ -1238,7 +1238,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), $fournprice, (float) $buyingprice, $label, $array_options, $fk_unit, '', 0, (float) $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOSTINT('fk_parent_line'), (int) $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, (float) $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
@@ -1352,7 +1352,7 @@ if (empty($reshook)) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Add buying price
|
// Add buying price
|
||||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
$fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
// Extrafields Lines
|
// Extrafields Lines
|
||||||
@@ -1451,7 +1451,7 @@ if (empty($reshook)) {
|
|||||||
$price_base_type = 'TTC';
|
$price_base_type = 'TTC';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->updateline(GETPOSTINT('lineid'), $description, (float) $pu, (float) $qty, $remise_percent, (float) $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, $info_bits, $date_start, $date_end, $type, GETPOSTINT('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOSTINT('units'), (float) $pu_ht_devise);
|
$result = $object->updateline(GETPOSTINT('lineid'), $description, (float) $pu, (float) $qty, $remise_percent, (float) $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, $info_bits, $date_start, $date_end, $type, GETPOSTINT('fk_parent_line'), 0, (int) $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOSTINT('units'), (float) $pu_ht_devise);
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
||||||
|
|||||||
@@ -1541,7 +1541,7 @@ class Commande extends CommonOrder
|
|||||||
* @param int $special_code Special code (also used by externals modules!)
|
* @param int $special_code Special code (also used by externals modules!)
|
||||||
* @param int $fk_parent_line Parent line
|
* @param int $fk_parent_line Parent line
|
||||||
* @param int $fk_fournprice Id supplier price
|
* @param int $fk_fournprice Id supplier price
|
||||||
* @param float $pa_ht Buying price (without tax)
|
* @param float|string $pa_ht Buying price without tax (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param string $label Label
|
* @param string $label Label
|
||||||
* @param array<string,mixed> $array_options Extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
* @param array<string,mixed> $array_options Extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||||
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
||||||
@@ -3064,7 +3064,7 @@ class Commande extends CommonOrder
|
|||||||
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
||||||
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
||||||
* @param int $fk_fournprice Id of origin supplier price
|
* @param int $fk_fournprice Id of origin supplier price
|
||||||
* @param float $pa_ht Price (without tax) of product when it was bought
|
* @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param string $label Label
|
* @param string $label Label
|
||||||
* @param int $special_code Special code (also used by externals modules!)
|
* @param int $special_code Special code (also used by externals modules!)
|
||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
|
|||||||
@@ -587,20 +587,20 @@ class Account extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Add an entry into table ".MAIN_DB_PREFIX."bank
|
* Add an entry into table ".MAIN_DB_PREFIX."bank
|
||||||
*
|
*
|
||||||
* @param int $date Date operation
|
* @param int $date Date operation
|
||||||
* @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'...
|
* @param string $oper 'VIR','PRE','LIQ','VAD','CB','CHQ'...
|
||||||
* @param string $label Description
|
* @param string $label Description
|
||||||
* @param float $amount Amount
|
* @param float $amount Amount
|
||||||
* @param string $num_chq Numero cheque or transfer
|
* @param string $num_chq Numero cheque or transfer
|
||||||
* @param int $categorie Category id (optional)
|
* @param int $categorie Category id (optional)
|
||||||
* @param User $user User that create
|
* @param User $user User that create
|
||||||
* @param string $emetteur Name of cheque writer
|
* @param string $emetteur Name of cheque writer
|
||||||
* @param string $banque Bank of cheque writer
|
* @param string $banque Bank of cheque writer
|
||||||
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||||
* @param int $datev Date value
|
* @param int $datev Date value
|
||||||
* @param string $num_releve Label of bank receipt for reconciliation
|
* @param string $num_releve Label of bank receipt for reconciliation
|
||||||
* @param float $amount_main_currency Amount
|
* @param float $amount_main_currency Amount
|
||||||
* @return int Rowid of added entry, <0 if KO
|
* @return int Rowid of added entry, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
|
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -715,7 +715,7 @@ if (empty($reshook)) {
|
|||||||
$date_end_fill = GETPOSTINT('date_end_fill');
|
$date_end_fill = GETPOSTINT('date_end_fill');
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
|
$fournprice = (in)(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
@@ -734,7 +734,7 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (int) $fk_unit, 0, $date_start_fill, $date_end_fill, (int) $fournprice, (int) $buyingprice, $fk_parent_line);
|
$result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (int) $fk_unit, 0, $date_start_fill, $date_end_fill, (int) $fournprice, $buyingprice, $fk_parent_line);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
// Define output language and generate document
|
// Define output language and generate document
|
||||||
@@ -833,7 +833,7 @@ if (empty($reshook)) {
|
|||||||
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
|
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
|
||||||
|
|
||||||
// Add buying price
|
// Add buying price
|
||||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
$fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
|
|||||||
@@ -2508,7 +2508,7 @@ if (empty($reshook)) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
|
$fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
|
|
||||||
@@ -2707,7 +2707,7 @@ if (empty($reshook)) {
|
|||||||
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
|
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
|
||||||
|
|
||||||
// Add buying price
|
// Add buying price
|
||||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
$fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
// Prepare a price equivalent for minimum price check
|
// Prepare a price equivalent for minimum price check
|
||||||
@@ -2898,7 +2898,7 @@ if (empty($reshook)) {
|
|||||||
$type,
|
$type,
|
||||||
GETPOSTINT('fk_parent_line'),
|
GETPOSTINT('fk_parent_line'),
|
||||||
0,
|
0,
|
||||||
$fournprice,
|
(int) $fournprice,
|
||||||
$buyingprice,
|
$buyingprice,
|
||||||
$label,
|
$label,
|
||||||
$special_code,
|
$special_code,
|
||||||
|
|||||||
@@ -956,8 +956,8 @@ class FactureRec extends CommonInvoice
|
|||||||
* @param float $pu_ht_devise Unit price in currency
|
* @param float $pu_ht_devise Unit price in currency
|
||||||
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
||||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||||
* @param ?int $fk_fournprice Supplier price id (to calculate margin) or ''
|
* @param ?int|string $fk_fournprice Supplier price id (to calculate margin) or string
|
||||||
* @param float $pa_ht Buying price of line (to calculate margin) or ''
|
* @param float $pa_ht Buying price of line (to calculate margin) (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param int $fk_parent_line Id of parent line
|
* @param int $fk_parent_line Id of parent line
|
||||||
* @return int Return integer <0 if KO, Id of line if OK
|
* @return int Return integer <0 if KO, Id of line if OK
|
||||||
*/
|
*/
|
||||||
@@ -1164,7 +1164,7 @@ class FactureRec extends CommonInvoice
|
|||||||
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
* @param int $date_start_fill 1=Flag to fill start date when generating invoice
|
||||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||||
* @param ?int $fk_fournprice Id of origin supplier price
|
* @param ?int $fk_fournprice Id of origin supplier price
|
||||||
* @param float $pa_ht Price (without tax) of product for margin calculation
|
* @param float|string $pa_ht Price (without tax) of product for margin calculation (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param int $fk_parent_line Id of parent line
|
* @param int $fk_parent_line Id of parent line
|
||||||
* @return int Return integer <0 if KO, Id of line if OK
|
* @return int Return integer <0 if KO, Id of line if OK
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3873,8 +3873,8 @@ class Facture extends CommonInvoice
|
|||||||
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
||||||
* @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 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 int $fk_parent_line Id of parent line
|
* @param int $fk_parent_line Id of parent line
|
||||||
* @param int $fk_fournprice Supplier price id (to calculate margin) or ''
|
* @param int|string $fk_fournprice Supplier price id (to calculate margin) or a string
|
||||||
* @param float|'' $pa_ht Buying price of line (to calculate margin) or ''
|
* @param float|'' $pa_ht Buying price of line (to calculate margin) (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param string $label Label of the line (deprecated, do not use)
|
* @param string $label Label of the line (deprecated, do not use)
|
||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
* @param float $situation_percent Situation advance percentage
|
* @param float $situation_percent Situation advance percentage
|
||||||
@@ -4196,7 +4196,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
||||||
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
||||||
* @param int $fk_fournprice Id of origin supplier price
|
* @param int $fk_fournprice Id of origin supplier price
|
||||||
* @param float $pa_ht Price (without tax) of product when it was bought
|
* @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param string $label Label of the line (deprecated, do not use)
|
* @param string $label Label of the line (deprecated, do not use)
|
||||||
* @param int $special_code Special code (also used by externals modules!)
|
* @param int $special_code Special code (also used by externals modules!)
|
||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
|
|||||||
@@ -1466,7 +1466,7 @@ class Contrat extends CommonObject
|
|||||||
* @param float $pu_ttc Prix unitaire TTC
|
* @param float $pu_ttc Prix unitaire TTC
|
||||||
* @param int $info_bits Bits of type of lines
|
* @param int $info_bits Bits of type of lines
|
||||||
* @param int $fk_fournprice Fourn price id
|
* @param int $fk_fournprice Fourn price id
|
||||||
* @param float $pa_ht Buying price HT
|
* @param float|string $pa_ht Buying price HT (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param int $rang Position
|
* @param int $rang Position
|
||||||
@@ -1691,7 +1691,7 @@ class Contrat extends CommonObject
|
|||||||
* @param string $price_base_type HT or TTC
|
* @param string $price_base_type HT or TTC
|
||||||
* @param int $info_bits Bits of type of lines
|
* @param int $info_bits Bits of type of lines
|
||||||
* @param int $fk_fournprice Fourn price id
|
* @param int $fk_fournprice Fourn price id
|
||||||
* @param float $pa_ht Buying price HT
|
* @param float|string $pa_ht Buying price HT (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param int $rang Position
|
* @param int $rang Position
|
||||||
|
|||||||
@@ -2103,7 +2103,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
|
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param int $origin_id id origin document
|
* @param int $origin_id id origin document
|
||||||
* @param float $pu_devise Amount in currency
|
* @param float $pu_devise Amount in currency
|
||||||
* @param string $ref_supplier Supplier ref
|
* @param string $ref_supplier Supplier ref
|
||||||
* @param int $special_code Special code
|
* @param int $special_code Special code
|
||||||
* @param int $fk_parent_line Parent line id
|
* @param int $fk_parent_line Parent line id
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ if (empty($reshook)) {
|
|||||||
$date_end_fill = GETPOSTINT('date_end_fill');
|
$date_end_fill = GETPOSTINT('date_end_fill');
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
|
$fournprice = (in)(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
// Local Taxes
|
// Local Taxes
|
||||||
|
|||||||
@@ -872,16 +872,16 @@ class Reception extends CommonObject
|
|||||||
* If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS is set, you can add a reception line, with no stock source defined
|
* If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS is set, you can add a reception line, with no stock source defined
|
||||||
* If STOCK_MUST_BE_ENOUGH_FOR_RECEPTION is not set, you can add a reception line, even if not enough into stock
|
* If STOCK_MUST_BE_ENOUGH_FOR_RECEPTION is not set, you can add a reception line, even if not enough into stock
|
||||||
*
|
*
|
||||||
* @param int $entrepot_id Id of warehouse
|
* @param int $entrepot_id Id of warehouse
|
||||||
* @param int $id Id of source line (supplier order line)
|
* @param int $id Id of source line (supplier order line)
|
||||||
* @param float $qty Quantity
|
* @param float $qty Quantity
|
||||||
* @param array<string, mixed> $array_options extrafields array
|
* @param array<string, mixed> $array_options extrafields array
|
||||||
* @param string $comment Comment for stock movement
|
* @param string $comment Comment for stock movement
|
||||||
* @param int $eatby eat-by date
|
* @param int $eatby eat-by date
|
||||||
* @param int $sellby sell-by date
|
* @param int $sellby sell-by date
|
||||||
* @param string $batch Lot number
|
* @param string $batch Lot number
|
||||||
* @param float $cost_price Line cost
|
* @param float|string $cost_price Line cost (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @return int Return integer <0 if KO, index of line if OK
|
* @return int Return integer <0 if KO, index of line if OK
|
||||||
*/
|
*/
|
||||||
public function addline($entrepot_id, $id, $qty, $array_options = [], $comment = '', $eatby = null, $sellby = null, $batch = '', $cost_price = 0)
|
public function addline($entrepot_id, $id, $qty, $array_options = [], $comment = '', $eatby = null, $sellby = null, $batch = '', $cost_price = 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -799,7 +799,7 @@ if (empty($reshook)) {
|
|||||||
min($rank, count($object->lines) + 1),
|
min($rank, count($object->lines) + 1),
|
||||||
0,
|
0,
|
||||||
GETPOSTINT('fk_parent_line'),
|
GETPOSTINT('fk_parent_line'),
|
||||||
$fournprice,
|
(int) $fournprice,
|
||||||
$buyingprice,
|
$buyingprice,
|
||||||
$label,
|
$label,
|
||||||
$array_options,
|
$array_options,
|
||||||
@@ -878,7 +878,7 @@ if (empty($reshook)) {
|
|||||||
-1, // rang
|
-1, // rang
|
||||||
0, // special_code
|
0, // special_code
|
||||||
GETPOSTINT('fk_parent_line'),
|
GETPOSTINT('fk_parent_line'),
|
||||||
$fournprice,
|
(int) $fournprice,
|
||||||
$buyingprice,
|
$buyingprice,
|
||||||
$label,
|
$label,
|
||||||
$array_options,
|
$array_options,
|
||||||
@@ -1004,8 +1004,8 @@ if (empty($reshook)) {
|
|||||||
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2);
|
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2);
|
||||||
|
|
||||||
// Add buying price
|
// Add buying price
|
||||||
$fournprice = (GETPOST('fournprice') ? GETPOSTINT('fournprice') : ''); // foreigh key
|
$fournprice = (int) (GETPOST('fournprice') ? GETPOSTINT('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
|
||||||
$buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
|
$buyingprice = price2num((GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''), '', 2); // If buying_price is '0', we must keep this value
|
||||||
|
|
||||||
// Extrafields Lines
|
// Extrafields Lines
|
||||||
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||||
@@ -1076,7 +1076,7 @@ if (empty($reshook)) {
|
|||||||
GETPOSTINT('fk_parent_line'),
|
GETPOSTINT('fk_parent_line'),
|
||||||
0,
|
0,
|
||||||
(int) $fournprice,
|
(int) $fournprice,
|
||||||
(float) $buyingprice,
|
$buyingprice,
|
||||||
$label,
|
$label,
|
||||||
$type,
|
$type,
|
||||||
$array_options,
|
$array_options,
|
||||||
|
|||||||
@@ -431,8 +431,8 @@ class SupplierProposal extends CommonObject
|
|||||||
* @param int $rang Position of line
|
* @param int $rang Position of line
|
||||||
* @param int $special_code Special code (also used by externals modules!)
|
* @param int $special_code Special code (also used by externals modules!)
|
||||||
* @param int $fk_parent_line Id of parent line
|
* @param int $fk_parent_line Id of parent line
|
||||||
* @param int $fk_fournprice Id supplier price. If 0, we will take best price. If -1 we keep it empty.
|
* @param int|string $fk_fournprice Id supplier price or string. If 0, we will take best price. If -1 we keep it empty.
|
||||||
* @param int $pa_ht Buying price without tax
|
* @param float|string $pa_ht Buying price without tax (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param string $label ???
|
* @param string $label ???
|
||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
* @param string $ref_supplier Supplier price reference
|
* @param string $ref_supplier Supplier price reference
|
||||||
@@ -717,7 +717,7 @@ class SupplierProposal extends CommonObject
|
|||||||
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
||||||
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
||||||
* @param int $fk_fournprice Id of origin supplier price
|
* @param int $fk_fournprice Id of origin supplier price
|
||||||
* @param float $pa_ht Price (without tax) of product when it was bought
|
* @param float|string $pa_ht Price (without tax) of product when it was bought (Can be '' to keep AWP unchanged or a float value)
|
||||||
* @param string $label ???
|
* @param string $label ???
|
||||||
* @param int<0,1> $type 0/1=Product/service
|
* @param int<0,1> $type 0/1=Product/service
|
||||||
* @param array<string,mixed> $array_options extrafields array
|
* @param array<string,mixed> $array_options extrafields array
|
||||||
|
|||||||
Reference in New Issue
Block a user