Skip to content

Commit

Permalink
Merge pull request Dolibarr#24907 from mc2contributor/fix_element
Browse files Browse the repository at this point in the history
Fix undefined and invalid access issues
  • Loading branch information
eldy authored Jun 7, 2023
2 parents da85ee4 + c7e9993 commit 134b9c7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions htdocs/projet/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,10 @@
for ($i = 0; $i < $num; $i++) {
$tmp = explode('_', $elementarray[$i]);
$idofelement = $tmp[0];

$idofelementuser = isset($tmp[1]) ? $tmp[1] : "";


$element->fetch($idofelement);
if ($idofelementuser) {
$elementuser->fetch($idofelementuser);
Expand All @@ -1191,9 +1193,10 @@

$total_ht_by_third = 0;
$total_ttc_by_third = 0;
}

$saved_third_id = !empty($element->thirdparty->id) ? $element->thirdparty->id : 0;


$qualifiedfortotal = true;
if ($key == 'invoice') {
if (!empty($element->close_code) && $element->close_code == 'replaced') {
Expand Down Expand Up @@ -1239,7 +1242,8 @@

$element_doc = $element->element;
$filename = dol_sanitizeFileName($element->ref);
$filedir = $conf->{$element_doc}->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref);
$path = $conf?->{$element_doc}?->multidir_output[$element->entity] ?? null;
$filedir = $path.'/'.dol_sanitizeFileName($element->ref);

if ($element_doc === 'order_supplier') {
$element_doc = 'commande_fournisseur';
Expand Down Expand Up @@ -1489,7 +1493,8 @@
$total_ht_by_third += $total_ht_by_line;
$total_ttc_by_third += $total_ttc_by_line;

$total_time = $total_time + $total_time_by_line;
if (!isset($total_time)) $total_time = $total_time_by_line;
else $total_time += $total_time_by_line;
}

if (canApplySubtotalOn($tablename)) {
Expand Down

0 comments on commit 134b9c7

Please sign in to comment.