2
0
forked from Wavyzz/dolibarr

Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0

This commit is contained in:
Laurent Destailleur
2024-08-27 04:46:30 +02:00
4 changed files with 19 additions and 8 deletions

View File

@@ -660,6 +660,7 @@ class PaymentVarious extends CommonObject
// phpcs:enable // phpcs:enable
global $langs; global $langs;
/*
if (empty($status)) { if (empty($status)) {
$status = 0; $status = 0;
} }
@@ -676,6 +677,8 @@ class PaymentVarious extends CommonObject
$statusType = 'status'.$status; $statusType = 'status'.$status;
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
*/
return '';
} }

View File

@@ -6602,11 +6602,11 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
$nbdecimal = dol_strlen($decpart); $nbdecimal = dol_strlen($decpart);
} }
// Si on depasse max // Si on depasse max
$max_nbdecimal = getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'); $max_nbdecimal = (int) str_replace('...', '', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'));
if ($trunc && $nbdecimal > (int) $max_nbdecimal) { if ($trunc && $nbdecimal > $max_nbdecimal) {
$nbdecimal = $max_nbdecimal; $nbdecimal = $max_nbdecimal;
if (preg_match('/\.\.\./i', $nbdecimal)) { if (preg_match('/\.\.\./i', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'))) {
// Si un affichage est tronque, on montre des ... // If output is truncated, we show ...
$end = '...'; $end = '...';
} }
} }
@@ -6614,9 +6614,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
// If force rounding // If force rounding
if ((string) $forcerounding != '-1') { if ((string) $forcerounding != '-1') {
if ($forcerounding === 'MU') { if ($forcerounding === 'MU') {
$nbdecimal = getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'); $nbdecimal = getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT');
} elseif ($forcerounding === 'MT') { } elseif ($forcerounding === 'MT') {
$nbdecimal = getDolGlobalString('MAIN_MAX_DECIMALS_TOT'); $nbdecimal = getDolGlobalInt('MAIN_MAX_DECIMALS_TOT');
} elseif ($forcerounding >= 0) { } elseif ($forcerounding >= 0) {
$nbdecimal = $forcerounding; $nbdecimal = $forcerounding;
} }

View File

@@ -269,6 +269,8 @@ if (empty($reshook)) {
$num = count($objectsrc->lines); $num = count($objectsrc->lines);
$totalqty = 0; $totalqty = 0;
$product_batch_used = array();
for ($i = 0; $i < $num; $i++) { for ($i = 0; $i < $num; $i++) {
$idl = "idl".$i; $idl = "idl".$i;
@@ -306,11 +308,17 @@ if (empty($reshook)) {
//var_dump($sub_qty[$j]['id_batch']); //var_dump($sub_qty[$j]['id_batch']);
//var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']);
if ($is_batch_or_serial == 2 && $sub_qty[$j]['q'] > 1) { if ($is_batch_or_serial == 2 && ($sub_qty[$j]['q'] > 1 || ($sub_qty[$j]['q'] > 0 && in_array($sub_qty[$j]['id_batch'], $product_batch_used)))) {
setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors'); setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors');
$totalqty = 0; $totalqty = 0;
break 2; break 2;
} }
if ($is_batch_or_serial == 2 && $sub_qty[$j]['q'] > 0) {
// we stock the batch id to test later if the same serial is shipped on another line for the same product
$product_batch_used[$j] = $sub_qty[$j]['id_batch'];
}
$j++; $j++;
$batch = "batchl".$i."_".$j; $batch = "batchl".$i."_".$j;
$qty = "qtyl".$i.'_'.$j; $qty = "qtyl".$i.'_'.$j;

View File

@@ -661,7 +661,7 @@ if ($action == 'confirm_generateinvoice') {
// Update lineid into line of timespent // Update lineid into line of timespent
$sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id); $sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id);
$sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).') AND fk_user = '.((int) $userid); $sql .= ' WHERE rowid = '.((int) $timespent_id).' AND fk_user = '.((int) $userid);
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) { if (!$result) {
$error++; $error++;