New hook to print tags defined by module in receiptprinter.php (#29748)

New hook to print tags defined by module in receipt printer configuration page

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Bahfir Abbes 2024-05-24 18:13:00 +02:00 committed by GitHub
parent b6801ba213
commit 2ced3a33df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Abbes Bahfir <contact@ab1consult.com><bafbes@gmail.com>
*
* 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
@ -52,7 +53,7 @@ $templatename = GETPOST('templatename', 'alpha');
$templateid = GETPOSTINT('templateid');
$printer = new dolReceiptPrinter($db);
$hookmanager->initHooks(array('receiptPrinter', 'globalcard'));
if (!$mode) {
$mode = 'config';
}
@ -530,6 +531,10 @@ if ($mode == 'template' && $user->admin) {
print '<td>{'.$key.'}</td><td>'.$langs->trans($val).'</td>';
print '</tr>';
}
$reshook = $hookmanager->executeHooks('listReceiptPrinterTags', array(), $printer, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
print '</table>';
print '</div>';
}