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

This commit is contained in:
Laurent Destailleur 2024-07-15 00:46:03 +02:00
commit f7936d4378
5 changed files with 33 additions and 17 deletions

View file

@ -212,10 +212,11 @@ if ($result) {
$tabtype = array();
$tabmoreinfo = array();
// Loop on each line into the table llx_bank. For each line, we should set:
// one line for bank record => tabbq
// one line for payment => tabpay
// one line for thirdparty or user record => tabtp
// Loop on each line into the llx_bank table. For each line, we should get:
// one line tabpay = line into bank
// one line for bank record = tabbq
// one line for thirdparty record = tabtp
// Note: tabcompany is used to store the subledger account
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
@ -263,7 +264,8 @@ if ($result) {
);
// Set accountancy code for user
// $obj->accountancy_code is the accountancy_code of table u=user but it is defined only if a link with type 'user' exists)
// $obj->accountancy_code is the accountancy_code of table u=user (but it is defined only if
// a link with type 'user' exists and user as a subledger account)
$compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : '');
$tabuser[$obj->rowid] = array(
@ -374,13 +376,25 @@ if ($result) {
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
$userstatic->statut = $tabuser[$obj->rowid]['status'];
$userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code'];
// For a payment of social contribution, we have a link sc + user.
// but we already fill the $tabpay[$obj->rowid]["soclib"] in the line 'sc'.
// If we fill it here to, we must concat
if ($userstatic->id > 0) {
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
if ($is_sc) {
$tabpay[$obj->rowid]["soclib"] .= ' '.$userstatic->getNomUrl(1, 'accountancy', 0);
} else {
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
}
} else {
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
}
if ($compta_user) {
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
if ($is_sc) {
//$tabcompany[$obj->rowid][$compta_user] += $amounttouse;
} else {
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
}
}
} elseif ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];

View file

@ -1415,7 +1415,9 @@ class Propal extends CommonObject
}
// reset ref_client
$object->ref_client = '';
if (!getDolGlobalString('MAIN_KEEP_REF_CUSTOMER_ON_CLONING')) {
$object->ref_client = '';
}
// TODO Change product price if multi-prices
} else {

View file

@ -847,11 +847,11 @@ class pdf_espadon extends ModelePdfExpedition
$object->volume_units = $object->size_units * 3;
}
if ($totalWeight != '') {
$totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
if (!empty($totalWeight)) {
$totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1);
}
if ($totalVolume != '') {
$totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
if (!empty($totalVolume)) {
$totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1);
}
if ($object->trueWeight) {
$totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);

View file

@ -734,11 +734,11 @@ class pdf_rouget extends ModelePdfExpedition
$object->volume_units = $object->size_units * 3;
}
if ($totalWeight != '') {
$totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
if (!empty($totalWeight)) {
$totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1);
}
if ($totalVolume != '') {
$totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
if (!empty($totalVolume)) {
$totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1);
}
if (!empty($object->trueWeight)) {
$totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);

View file

@ -211,7 +211,7 @@ if (empty($reshook) && $action == 'add') {
if (!$error) {
// Search thirdparty and set it if found to the new created project
$result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', $object->email);
$result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', GETPOST('email'));
if ($result > 0) {
$proj->socid = $thirdparty->id;
} else {