From 06bbdf2a67126ac2f58ef18f9dfc4f612d679505 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Mar 2024 12:25:28 +0100 Subject: [PATCH] Debug v20 --- htdocs/accountancy/bookkeeping/export.php | 66 ++++++++++++++--------- htdocs/core/ajax/ajaxtooltip.php | 2 +- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index cb9e8ea09d4..438b45dc9b8 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -845,7 +845,7 @@ if ($action == 'export_file') { ); } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 390, 700); } // Print form confirm @@ -924,12 +924,15 @@ if ($massactionbutton && $contextpage != 'poslist') { } $moreforfilter = ''; -$moreforfilter .= '
'; -$moreforfilter .= $langs->trans('AccountingCategory').': '; -$moreforfilter .= '
'; -$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0); -$moreforfilter .= '
'; -$moreforfilter .= '
'; + +if (!empty($search_account_category)) { + $moreforfilter .= '
'; + $moreforfilter .= $langs->trans('AccountingCategory').': '; + $moreforfilter .= '
'; + $moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0); + $moreforfilter .= '
'; + $moreforfilter .= '
'; +} $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -939,9 +942,11 @@ if (empty($reshook)) { $moreforfilter = $hookmanager->resPrint; } -print '
'; -print $moreforfilter; -print '
'; +if ($moreforfilter) { + print '
'; + print $moreforfilter; + print '
'; +} print '
'; print ''; @@ -1257,6 +1262,7 @@ while ($i < min($num, $limit)) { // Document ref if (!empty($arrayfields['t.doc_ref']['checked'])) { + $documentlink = ''; if ($line->doc_type == 'customer_invoice') { $langs->loadLangs(array('bills')); @@ -1265,10 +1271,12 @@ while ($i < min($num, $limit)) { $objectstatic->fetch($line->fk_doc); //$modulepart = 'facture'; - $filename = dol_sanitizeFileName($line->doc_ref); - $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; - $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + if ($objectstatic->id > 0) { + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } } elseif ($line->doc_type == 'supplier_invoice') { $langs->loadLangs(array('bills')); @@ -1277,10 +1285,12 @@ while ($i < min($num, $limit)) { $objectstatic->fetch($line->fk_doc); //$modulepart = 'invoice_supplier'; - $filename = dol_sanitizeFileName($line->doc_ref); - $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); - $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); - $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); + if ($objectstatic->id > 0) { + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); + } } elseif ($line->doc_type == 'expense_report') { $langs->loadLangs(array('trips')); @@ -1289,10 +1299,12 @@ while ($i < min($num, $limit)) { $objectstatic->fetch($line->fk_doc); //$modulepart = 'expensereport'; - $filename = dol_sanitizeFileName($line->doc_ref); - $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; - $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + if ($objectstatic->id > 0) { + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } } elseif ($line->doc_type == 'bank') { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $objectstatic = new AccountLine($db); @@ -1304,9 +1316,13 @@ while ($i < min($num, $limit)) { $labeltoshow = ''; $labeltoshowalt = ''; if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') { - $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); - $labeltoshow .= $documentlink; - $labeltoshowalt .= $objectstatic->ref; + if ($objectstatic->id > 0) { + $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); + $labeltoshow .= $documentlink; + $labeltoshowalt .= $objectstatic->ref; + } else { + $labeltoshow = ''.$langs->trans("Deleted").''; + } } elseif ($line->doc_type == 'bank') { $labeltoshow .= $objectstatic->getNomUrl(1); $labeltoshowalt .= $objectstatic->ref; diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 782123ca317..8bc7305d744 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -85,7 +85,7 @@ if (is_object($object)) { if ($object->id > 0 || !empty($object->ref)) { /** @var CommonObject $object */ $html = $object->getTooltipContent($params); - } elseif ($res == 0) { + } elseif ($id > 0) { $html = $langs->trans('Deleted'); } unset($object);