diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 01b5f8b7813..2975115fb92 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -14,7 +14,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2023-2024 Benjamin Falière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2878,8 +2878,6 @@ if ($action == 'create' && $usercancreate) { $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); } - $numlines = count($object->lines); - /* * Form to add new line */ @@ -2919,6 +2917,8 @@ if ($action == 'create' && $usercancreate) { // Note that $action and $object may be modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); if (empty($reshook)) { + $numlines = count($object->lines); + // Reopen a closed order if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) { print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, '');