From d5ed29c5678312247d170043cd1faae46de941fa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 25 Mar 2018 12:13:29 +0200 Subject: [PATCH 1/5] NEW add "moreHtmlRef" hook --- htdocs/core/lib/functions.lib.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e18a0f111ff..2d20f1bb447 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1292,7 +1292,8 @@ function dol_get_fiche_end($notab=0) */ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='') { - global $conf, $form, $user, $langs; + global $conf, $user, $langs; + global $form, $hookmanager; $error = 0; @@ -1552,6 +1553,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlref.=''; } + $parameters = array(); + $reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $morehtmlref.=$hookmanager->resPrint; + elseif ($reshook > 0) $morehtmlref=$hookmanager->resPrint; + print '
'; print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); print '
'; From 180f2a033627f88c9ab95f0d66e459a175c61e48 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 25 Mar 2018 12:56:43 +0200 Subject: [PATCH 2/5] Fix: multi_dir compatibility --- htdocs/core/lib/functions.lib.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2d20f1bb447..f58d733a4e6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1299,6 +1299,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $maxvisiblephotos=1; $showimage=1; + $entity=(empty($object->entity)?$conf->entity:$object->entity); $showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0); if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; $modulepart='unknown'; @@ -1325,10 +1326,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if ($object->element == 'product') { $width=80; $cssclass='photoref'; - $showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]); + $showimage=$object->is_photo_available($conf->product->multidir_output[$entity]); $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); if ($conf->browser->phone) $maxvisiblephotos=1; - if ($showimage) $morehtmlleft.='
'.$object->show_photos('product', $conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; + if ($showimage) $morehtmlleft.='
'.$object->show_photos('product', $conf->product->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; else { if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { @@ -1344,10 +1345,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r elseif ($object->element == 'ticketsup') { $width=80; $cssclass='photoref'; - $showimage=$object->is_photo_available($conf->ticketsup->dir_output.'/'.$object->track_id); + $showimage=$object->is_photo_available($conf->ticketsup->multidir_output[$entity].'/'.$object->track_id); $maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2); if ($conf->browser->phone) $maxvisiblephotos=1; - if ($showimage) $morehtmlleft.='
'.$object->show_photos('ticketsup', $conf->ticketsup->dir_output,'small',$maxvisiblephotos,0,0,0,$width,0).'
'; + if ($showimage) $morehtmlleft.='
'.$object->show_photos('ticketsup', $conf->ticketsup->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; else { if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) { @@ -1371,7 +1372,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) { $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->$modulepart->dir_output . "/"; + $dir_output = $conf->$modulepart->multidir_output[$entity] . "/"; if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) { $subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref; // the objectref dir is not include into get_exdir when used with level=2, so we add it here From 5a63771c878ed0cd2ecc517ee8ca5c26957db06a Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Tue, 27 Mar 2018 15:11:42 +0200 Subject: [PATCH 3/5] Add date --- htdocs/fourn/commande/dispatch.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 04c039cfbb1..43e70c03013 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -736,7 +736,7 @@ if ($id > 0 || ! empty($ref)) { // List of lines already dispatched $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; - $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; + $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec"; $sql .= " FROM " . MAIN_DB_PREFIX . "product as p,"; $sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e ON cfd.fk_entrepot = e.rowid"; @@ -770,6 +770,7 @@ if ($id > 0 || ! empty($ref)) { print '' . $langs->trans("Comment") . ''; if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) print '' . $langs->trans("Status") . ''; + print '' . $langs->trans("Date") . ''; print "\n"; $var = false; @@ -841,7 +842,9 @@ if ($id > 0 || ! empty($ref)) { } print ''; } - + // date + print '' . dol_print_date($objp->datec) . ''; + print "\n"; $i ++; From 35b6cb750fa4f1052b38624c01a80f7a81b37425 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 27 Mar 2018 17:36:25 +0200 Subject: [PATCH 4/5] Fix: move "moreHtmlRef" hook in "showrefnav" function --- htdocs/core/class/html.form.class.php | 5 +++++ htdocs/core/lib/functions.lib.php | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 466faba295e..d53072efe0a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6444,6 +6444,11 @@ class Form else $morehtmlstatus=$hookmanager->resPrint; if ($morehtmlstatus) $ret.='
'.$morehtmlstatus.'
'; + $parameters = array(); + $reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $morehtmlref.=$hookmanager->resPrint; + elseif ($reshook > 0) $morehtmlref=$hookmanager->resPrint; + // Left part of banner if ($morehtmlleft) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f58d733a4e6..d908f60b35a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1554,11 +1554,6 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlref.=''; } - $parameters = array(); - $reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $morehtmlref.=$hookmanager->resPrint; - elseif ($reshook > 0) $morehtmlref=$hookmanager->resPrint; - print '
'; print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); print '
'; From 2b8fe93fc8d6b81eb68d69a72d0a1af9132015e0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 27 Mar 2018 17:40:17 +0200 Subject: [PATCH 5/5] Fix: remove unused global --- htdocs/core/lib/functions.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d908f60b35a..1d8e80e923c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1292,8 +1292,7 @@ function dol_get_fiche_end($notab=0) */ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='') { - global $conf, $user, $langs; - global $form, $hookmanager; + global $conf, $form, $user, $langs; $error = 0;