From fbcc463a6f913053a5b9f0c4a8cd2fecec025b6d Mon Sep 17 00:00:00 2001 From: IC-Mathieu <95343351+IC-Mathieu@users.noreply.github.com> Date: Sat, 6 Jul 2024 03:54:33 +0200 Subject: [PATCH 1/3] ADD_HOOK_IN_SITUATION (#30240) * ADD_HOOK_SITUATION * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/card.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 86b6ba5d0fdcb..75d74750b2b35 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2048,6 +2048,15 @@ if ($ret > 0) { $nextSituationInvoice->insertExtraFields(); } + + // Hooks + $parameters = array('origin' => $origin); + $reshook = $hookmanager->executeHooks('createFrom', $parameters, $nextSituationInvoice, $action); // Note that $action and $object may have been + // modified by hook + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $error++; + } } } } From 2f14f9cbaba840e74cad56f1313aa2e579031528 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Jul 2024 04:21:32 +0200 Subject: [PATCH 2/3] Clean code --- htdocs/compta/facture/card.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 75d74750b2b35..13dfab130c46d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1530,11 +1530,12 @@ $element = $subelement = 'expedition'; } - $object->origin = $origin; + $object->origin = $origin; // deprecated + $object->origin_type = $origin; $object->origin_id = $originid; // Possibility to add external linked objects with hooks - $object->linked_objects[$object->origin] = $object->origin_id; + $object->linked_objects[$object->origin_type] = $object->origin_id; // link with order if it is a shipping invoice if ($object->origin == 'shipping') { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; @@ -1903,7 +1904,7 @@ }*/ // Hooks - $parameters = array('objFrom' => $srcobject); + $parameters = array('origin_type' => $object->origin_type, 'origin_id' => $object->origin_id, 'objFrom' => $srcobject); $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been // modified by hook if ($reshook < 0) { @@ -1959,7 +1960,8 @@ if (!empty($origin) && !empty($originid)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - $object->origin = $origin; + $object->origin = $origin; // deprecated + $object->origin_type = $origin; $object->origin_id = $originid; // retained warranty @@ -1981,8 +1983,6 @@ } foreach ($object->lines as $i => &$line) { - $line->origin = $object->origin; - $line->origin_id = $line->id; $line->fk_prev_id = $line->id; $line->fetch_optionals(); if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { @@ -2023,6 +2023,7 @@ $object->note = trim(GETPOST('note', 'restricthtml')); $object->note_private = trim(GETPOST('note', 'restricthtml')); $object->ref_client = GETPOST('ref_client', 'alpha'); + $object->ref_customer = GETPOST('ref_client', 'alpha'); $object->model_pdf = GETPOST('model', 'alpha'); $object->fk_project = GETPOSTINT('projectid'); $object->cond_reglement_id = GETPOSTINT('cond_reglement_id'); @@ -2035,6 +2036,7 @@ // Special properties of replacement invoice $object->situation_counter += 1; + $id = $object->createFromCurrent($user); if ($id <= 0) { $mesg = $object->error; @@ -2050,7 +2052,7 @@ } // Hooks - $parameters = array('origin' => $origin); + $parameters = array('origin_type' => $object->origin_type, 'origin_id' => $object->origin_id); $reshook = $hookmanager->executeHooks('createFrom', $parameters, $nextSituationInvoice, $action); // Note that $action and $object may have been // modified by hook if ($reshook < 0) { From 420704867273d9fc2b70aa7245263fb656d9e3fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Jul 2024 05:07:14 +0200 Subject: [PATCH 3/3] Debug css v20 --- htdocs/core/bookmarks_page.php | 2 +- htdocs/core/search_page.php | 2 +- htdocs/theme/eldy/dropdown.inc.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php index a24918273d833..06b855459ff88 100644 --- a/htdocs/core/bookmarks_page.php +++ b/htdocs/core/bookmarks_page.php @@ -146,7 +146,7 @@ print "\n"; print "\n"; -print '
'; +print '
'; print ''; print '
'."\n"; print $bookmarkList; diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 0f91b78b9edcb..777466527718b 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -192,7 +192,7 @@ // Show all forms print "\n"; print "\n"; -print '
'; +print '
'; print ''; print '
'."\n"; print $searchform; diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index 65a47cceadfb4..b59787308ed04 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -578,13 +578,13 @@ } .tmenu .dropdown-menu, .login_block .dropdown-menu, .topnav .dropdown-menu { - margin-left: 5px; + margin-left: 8px; right: 0; } #topmenu-quickadd-dropdown .dropdown-menu { min-width: 220px; - max-width: 235px; + max-width: 270px; } #topmenu-bookmark-dropdown .dropdown-menu { min-width: 220px; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 94dae7825c5e8..72224fea8d88f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -8291,15 +8291,15 @@ height: 50px; z-index: 202; - min-width: 200px; /* must be width of menu + padding + padding of sidenav */ - max-width: 200px; /* must be width of menu + padding + padding of sidenav */ - width: 200px; /* must be width of menu + padding + padding of sidenav */ + min-width: 245px; /* must be width of menu + padding + padding of sidenav */ + max-width: 245px; /* must be width of menu + padding + padding of sidenav */ + width: 245px; /* must be width of menu + padding + padding of sidenav */ } .loginbuttonexternal { width: 260px; } .side-nav-vert .user-menu .dropdown-menu { - width: 234px !important; + width: 278px !important; /* must be width of menu + padding + padding of sidenav */ } div.login_block_other { margin-right: unset;