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

This commit is contained in:
ldestailleur 2025-04-08 18:18:25 +02:00
commit aa6d3199a0
3 changed files with 20 additions and 22 deletions

View file

@ -572,6 +572,7 @@ if (isModEnabled('margin')) {
$companystatic = new Societe($db);
$projectstatic = new Project($db);
$formcompany = new FormCompany($db);
$userstatic = new User($db);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -891,9 +892,6 @@ if (!$resql) {
exit;
}
$objectstatic = new Propal($db);
$userstatic = new User($db);
if ($socid > 0) {
$soc = new Societe($db);
$soc->fetch($socid);
@ -1782,13 +1780,13 @@ while ($i < $imaxinloop) {
$param .= "&search_option=".urlencode($search_option);
}
$objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref;
$objectstatic->ref_customer = $obj->ref_client;
$objectstatic->note_public = $obj->note_public;
$objectstatic->note_private = $obj->note_private;
$objectstatic->statut = $obj->status;
$objectstatic->status = $obj->status;
$object->id = $obj->rowid;
$object->ref = $obj->ref;
$object->ref_customer = $obj->ref_client;
$object->note_public = $obj->note_public;
$object->note_private = $obj->note_private;
$object->statut = $obj->status;
$object->status = $obj->status;
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
@ -1812,7 +1810,7 @@ while ($i < $imaxinloop) {
$multicurrency_totalInvoicedHT = 0;
$multicurrency_totalInvoicedTTC = 0;
$TInvoiceData = $objectstatic->InvoiceArrayList($obj->rowid);
$TInvoiceData = $object->InvoiceArrayList($object->id);
if (!empty($TInvoiceData)) {
foreach ($TInvoiceData as $invoiceData) {
@ -1832,8 +1830,8 @@ while ($i < $imaxinloop) {
$marginInfo = array();
if ($with_margin_info) {
$objectstatic->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($objectstatic);
$object->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($object);
$total_ht += $obj->total_ht;
$total_margin += $marginInfo['total_margin'];
}
@ -1844,16 +1842,16 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
$objectstatic->thirdparty = $companystatic;
$object->thirdparty = $companystatic;
$userstatic->fetch($obj->fk_user_author);
$arrayofparams = array('selected' => in_array($object->id, $arrayofselected), 'authorlink' => $userstatic->getNomUrl(-2), 'projectlink' => $projectstatic->getNomUrl(2));
print $objectstatic->getKanbanView('', $arrayofparams);
print $object->getKanbanView('', $arrayofparams);
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr data-rowid="'.$objectstatic->id.'" class="oddeven status'.$objectstatic->status.((getDolGlobalInt('MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ? ' opacitymedium' : '').'">';
print '<tr data-rowid="'.$object->id.'" class="oddeven status'.$object->status.((getDolGlobalInt('MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ? ' opacitymedium' : '').'">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
@ -1877,7 +1875,7 @@ while ($i < $imaxinloop) {
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowraponall">';
print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
print $object->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
print '</td>';
// Warning
$warnornote = '';
@ -1894,7 +1892,7 @@ while ($i < $imaxinloop) {
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print $formfile->getDocumentsLink($object->element, $filename, $filedir);
print '</td></tr></table>';
print "</td>\n";
@ -2410,7 +2408,7 @@ while ($i < $imaxinloop) {
// Status
if (!empty($arrayfields['p.fk_statut']['checked'])) {
print '<td class="nowrap center">'.$objectstatic->getLibStatut(5).'</td>';
print '<td class="nowrap center">'.$object->getLibStatut(5).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View file

@ -999,7 +999,7 @@ class ExtraFields
$elementtype = 'commande_fournisseur';
}
if ($elementtype != 'all' && isset($this->attributes[$elementtype]) && $this->attributes[$elementtype]['loaded'] == 1 && !$forceload) {
if ($elementtype != 'all' && isset($this->attributes[$elementtype]) && $this->attributes[$elementtype]['loaded'] == 1 && !$forceload && isset($this->attributes[$elementtype]['label'])) {
return $this->attributes[$elementtype]['label'];
}
@ -2726,7 +2726,7 @@ class ExtraFields
$value_key = dol_mktime(GETPOSTINT("options_".$key."hour"), GETPOSTINT("options_".$key."min"), GETPOSTINT("options_".$key."sec"), GETPOSTINT("options_".$key."month"), GETPOSTINT("options_".$key."day"), GETPOSTINT("options_".$key."year"), 'gmt');
} elseif (in_array($key_type, array('duration'))) {
$value_hours = GETPOSTINT("options_" . $key . "hour");
$value_minutes = GETPOSTINT("options_" . $key . "minute");
$value_minutes = GETPOSTINT("options_" . $key . "min");
$value_key = $value_hours * 3600 + $value_minutes * 60;
} elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) {
$value_arr = GETPOST("options_".$key, 'array'); // check if an array

View file

@ -69,7 +69,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
}
// If field is a computed field, we make computation to get value
if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) {
$objectoffield = $object; // For compatibility with the computed formula
$objectoffield = $object; // For compatibility with the computed formula. $objectoffield is exported by dol_eval().
$value = dol_eval((string) $extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2');
if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) {
$obj->$tmpkey = price2num($value);