From 477d681c49ba6620bad1924ffef9c0db68cf2ec2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Apr 2022 17:47:45 +0200 Subject: [PATCH] Fix warnings --- htdocs/admin/commande.php | 5 +++-- htdocs/core/class/commondocgenerator.class.php | 6 ++++++ htdocs/core/modules/commande/mod_commande_saphir.php | 8 ++++++-- htdocs/main.inc.php | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 5c8eb88126c..f4afd27d46b 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -302,6 +302,7 @@ foreach ($dirmodels as $reldir) { $htmltooltip = ''; $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; $commande->type = 0; + $nextval = $module->getNextValue($mysoc, $commande); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip .= ''.$langs->trans("NextValue").': '; @@ -614,7 +615,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print ''; @@ -630,7 +631,7 @@ print "'; print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 8a0ce49ce00..a9536f410ca 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -60,6 +60,12 @@ abstract class CommonDocGenerator */ public $update_main_doc_field; + /** + * @var string The name of constant to use to scan ODT files (Exemple: 'COMMANDE_ADDON_PDF_ODT_PATH') + */ + public $scandir; + + /** * Constructor * diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index ffb53480aa3..36efdcc1d88 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -104,7 +104,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes $old_code_type = $mysoc->typent_code; $mysoc->code_client = 'CCCCCCCCCC'; $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); + $numExample = $this->getNextValue($mysoc, null); $mysoc->code_client = $old_code_client; $mysoc->typent_code = $old_code_type; @@ -138,7 +138,11 @@ class mod_commande_saphir extends ModeleNumRefCommandes // Get entities $entity = getEntity('ordernumber', 1, $object); - $date = ($object->date_commande ? $object->date_commande : $object->date); + if (is_object($object)) { + $date = ($object->date_commande ? $object->date_commande : $object->date); + } else { + $date = dol_now(); + } $numFinal = get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date, 'next', false, null, $entity); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 06cc445294e..11c057152bd 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2498,7 +2498,7 @@ function printDropdownQuickadd() $parameters = array(); $hook_items = $items; $reshook = $hookmanager->executeHooks('menuDropdownQuickaddItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks - if (is_numeric($reshook) && is_array($hookmanager->results)) { + if (is_numeric($reshook) && !empty($hookmanager->results) && is_array($hookmanager->results)) { if ($reshook == 0) { $items['items'] = array_merge($items['items'], $hookmanager->results); // add } else {