From 889a716aeee9e78732427d0259be30ea9ece6194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 Nov 2025 12:49:00 +0100 Subject: [PATCH 01/14] add modulepart for direct print capabilities --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 6ab8eaca887..d0d59dcdeaa 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -508,7 +508,7 @@ class FormFile $printer = 0; // The direct print feature is implemented only for such elements - if (in_array($modulepart, array('contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) { + if (in_array($modulepart, array('contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo'))) { $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); } From f757b08f97ef293a4f09978f5fc6b1f9ea9d7fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 Nov 2025 14:50:14 +0100 Subject: [PATCH 02/14] add project --- htdocs/core/class/html.formfile.class.php | 3 ++- htdocs/projet/card.php | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d0d59dcdeaa..1a6d66e60c7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,8 +507,9 @@ class FormFile } $printer = 0; + $modulepartssupported = ['project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; // The direct print feature is implemented only for such elements - if (in_array($modulepart, array('contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo'))) { + if (in_array($modulepart, $modulepartssupported)) { $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e97160987bf..b53a8ee9954 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -614,6 +614,9 @@ if (empty($reshook)) { } } + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + // Actions to send emails $triggersendname = 'PROJECT_SENTBYMAIL'; $paramname = 'id'; From 9ffc224897d1890886db36a6597d9733665b489a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 Nov 2025 14:53:18 +0100 Subject: [PATCH 03/14] add project --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 1a6d66e60c7..fd410086b9a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,9 +507,9 @@ class FormFile } $printer = 0; - $modulepartssupported = ['project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; + $supportedmoduleparts = ['project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; // The direct print feature is implemented only for such elements - if (in_array($modulepart, $modulepartssupported)) { + if (in_array($modulepart, $supportedmoduleparts)) { $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); } From dc85a6756b79d9d4576f02c5687d05b8b4b1d8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 27 Nov 2025 20:55:45 +0100 Subject: [PATCH 04/14] add more --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/ticket/card.php | 2 ++ htdocs/user/card.php | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index fd410086b9a..2ecbef23f41 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,7 +507,7 @@ class FormFile } $printer = 0; - $supportedmoduleparts = ['project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; + $supportedmoduleparts = ['user', 'project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; // The direct print feature is implemented only for such elements if (in_array($modulepart, $supportedmoduleparts)) { $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 4b9c98d7bf0..cf4c724e88f 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -688,6 +688,8 @@ if (empty($reshook)) { $action = 'view'; } + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; $permissiondellink = $user->hasRight('ticket', 'write'); include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 241f56d47ef..a3c307bc880 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -879,6 +879,9 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->user->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; } From 4f3e23516fd2175d71090f9404d268079c57c410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 27 Nov 2025 21:27:59 +0100 Subject: [PATCH 05/14] add ficheuinter --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/fichinter/card.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2ecbef23f41..36b0d175849 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,7 +507,7 @@ class FormFile } $printer = 0; - $supportedmoduleparts = ['user', 'project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; + $supportedmoduleparts = ['ficheinter', 'user', 'project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; // The direct print feature is implemented only for such elements if (in_array($modulepart, $supportedmoduleparts)) { $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 089374b8b6e..280329b3f0b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -66,14 +66,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array('bills', 'companies', 'interventions', 'stocks')); -$id = GETPOSTINT('id'); -$ref = GETPOST('ref', 'alpha'); +$id = GETPOSTINT('id'); +$ref = GETPOST('ref', 'alpha'); $ref_client = GETPOST('ref_client', 'alpha'); $socid = GETPOSTINT('socid'); $contratid = GETPOSTINT('contratid'); -$action = GETPOST('action', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $mesg = GETPOST('msg', 'alpha'); From 180726920242293fe86b4650c52bc0305f8459bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 28 Nov 2025 15:05:13 +0100 Subject: [PATCH 06/14] add another --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/product/stock/card.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index fd410086b9a..db1a28daa51 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,7 +507,7 @@ class FormFile } $printer = 0; - $supportedmoduleparts = ['project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; + $supportedmoduleparts = ['stock', 'project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; // The direct print feature is implemented only for such elements if (in_array($modulepart, $supportedmoduleparts)) { $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 6d37679a266..363f39b3968 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -284,6 +284,8 @@ if (empty($reshook)) { $action = ''; } + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to build doc $upload_dir = $conf->stock->dir_output; From 991b8670477aba67745d873aece6fc0955718d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 28 Nov 2025 15:26:10 +0100 Subject: [PATCH 07/14] add another --- htdocs/core/class/html.formfile.class.php | 22 +++++++++++++++++++++- htdocs/product/card.php | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5fd8b4e34f0..d052e20793e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,7 +507,27 @@ class FormFile } $printer = 0; - $supportedmoduleparts = ['stock', 'ficheinter', 'user', 'project', 'contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket', 'bom', 'mrp:mo']; + $supportedmoduleparts = [ + 'product', + 'stock', + 'ficheinter', + 'user', + 'project', + 'contract', + 'facture', + 'supplier_proposal', + 'propal', + 'proposal', + 'order', + 'commande', + 'expedition', + 'commande_fournisseur', + 'expensereport', + 'delivery', + 'ticket', + 'bom', + 'mrp:mo', + ]; // The direct print feature is implemented only for such elements if (in_array($modulepart, $supportedmoduleparts)) { $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 05868f72fb0..a46d4ca06b9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1342,6 +1342,9 @@ if (empty($reshook)) { } } + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + // Actions to send emails $triggersendname = 'PRODUCT_SENTBYMAIL'; $paramname = 'id'; From 123af6513977047bc89f1039588e9dbd7ac64821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 28 Nov 2025 19:42:56 +0100 Subject: [PATCH 08/14] add more --- htdocs/core/class/html.formfile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d052e20793e..26f0f5eb399 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -508,6 +508,7 @@ class FormFile $printer = 0; $supportedmoduleparts = [ + 'member', 'product', 'stock', 'ficheinter', From 4a42d5d8bcad45f8958509325a1eadf060ba0a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 28 Nov 2025 19:52:10 +0100 Subject: [PATCH 09/14] add more --- htdocs/core/class/html.formfile.class.php | 1 + htdocs/societe/card.php | 47 ++++++++++++----------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 26f0f5eb399..406fef7c6b3 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -508,6 +508,7 @@ class FormFile $printer = 0; $supportedmoduleparts = [ + 'company', 'member', 'product', 'stock', diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b9ca8e591da..7d1ff903a2f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -945,6 +945,9 @@ if (empty($reshook)) { $upload_dir = !empty($conf->societe->multidir_output[$object->entity ?? $conf->entity]) ? $conf->societe->multidir_output[$object->entity ?? $conf->entity] : $conf->societe->dir_output; $permissiontoadd = $user->hasRight('societe', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; } @@ -1094,12 +1097,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } } - $object->phone = GETPOST('phone', 'alpha'); - $object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha'); - $object->fax = GETPOST('fax', 'alpha'); - $object->email = GETPOST('email', 'email'); - $object->url = GETPOST('url', 'url'); - $object->capital = GETPOST('capital'); // can be null or 0 or a float value + $object->phone = GETPOST('phone', 'alpha'); + $object->phone_mobile = (string) GETPOST("phone_mobile", 'alpha'); + $object->fax = GETPOST('fax', 'alpha'); + $object->email = GETPOST('email', 'email'); + $object->url = GETPOST('url', 'url'); + $object->capital = GETPOST('capital'); // can be null or 0 or a float value $paymentTermId = GETPOSTINT('cond_reglement_id'); // can be set by default values on create page and not already in get or post variables if (empty($paymentTermId) && !GETPOSTISSET('cond_reglement_id')) { $paymentTermId = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); @@ -1109,28 +1112,28 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (empty($paymentTypeId) && !GETPOSTISSET('mode_reglement_id')) { $paymentTypeId = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); } - $object->mode_reglement_id = $paymentTypeId; - $object->barcode = GETPOST('barcode', 'alphanohtml'); - $object->idprof1 = GETPOST('idprof1', 'alphanohtml'); - $object->idprof2 = GETPOST('idprof2', 'alphanohtml'); - $object->idprof3 = GETPOST('idprof3', 'alphanohtml'); - $object->idprof4 = GETPOST('idprof4', 'alphanohtml'); - $object->idprof5 = GETPOST('idprof5', 'alphanohtml'); - $object->idprof6 = GETPOST('idprof6', 'alphanohtml'); + $object->mode_reglement_id = $paymentTypeId; + $object->barcode = GETPOST('barcode', 'alphanohtml'); + $object->idprof1 = GETPOST('idprof1', 'alphanohtml'); + $object->idprof2 = GETPOST('idprof2', 'alphanohtml'); + $object->idprof3 = GETPOST('idprof3', 'alphanohtml'); + $object->idprof4 = GETPOST('idprof4', 'alphanohtml'); + $object->idprof5 = GETPOST('idprof5', 'alphanohtml'); + $object->idprof6 = GETPOST('idprof6', 'alphanohtml'); $object->typent_id = GETPOSTINT('typent_id'); - $object->effectif_id = GETPOSTINT('effectif_id'); - $object->civility_id = GETPOST('civility_id', 'alpha'); + $object->effectif_id = GETPOSTINT('effectif_id'); + $object->civility_id = GETPOST('civility_id', 'alpha'); $object->tva_assuj = GETPOSTINT('assujtva_value'); $object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0; $object->status = GETPOSTINT('status'); //Local Taxes - $object->localtax1_assuj = GETPOSTINT('localtax1assuj_value'); - $object->localtax2_assuj = GETPOSTINT('localtax2assuj_value'); + $object->localtax1_assuj = GETPOSTINT('localtax1assuj_value'); + $object->localtax2_assuj = GETPOSTINT('localtax2assuj_value'); - $object->localtax1_value = GETPOST('lt1', 'alpha'); - $object->localtax2_value = GETPOST('lt2', 'alpha'); + $object->localtax1_value = GETPOST('lt1', 'alpha'); + $object->localtax2_value = GETPOST('lt2', 'alpha'); $object->tva_intra = GETPOST('tva_intra', 'alphanohtml'); @@ -1147,7 +1150,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } } if (GETPOSTISSET('accountancy_code_buy')) { - $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); + $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') { $object->accountancy_code_buy = ''; @@ -1159,7 +1162,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $object->logo = (isset($_FILES['photo']) ? dol_sanitizeFileName($_FILES['photo']['name']) : ''); // Company logo management - $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos"; + $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos"; $file_OK = (isset($_FILES['photo']) ? is_uploaded_file($_FILES['photo']['tmp_name']) : false); if ($file_OK) { if (image_format_supported($_FILES['photo']['name'])) { From 2afb048dfbae6b59ca1b99d8e79d5c44fe407dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 28 Nov 2025 19:57:10 +0100 Subject: [PATCH 10/14] add more --- htdocs/core/class/html.formfile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 406fef7c6b3..92f10d73c0c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -524,6 +524,7 @@ class FormFile 'commande', 'expedition', 'commande_fournisseur', + 'facture_fournisseur', 'expensereport', 'delivery', 'ticket', From 15124c1bf3f354175153fedd0eb5694f4f776244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 28 Nov 2025 20:10:00 +0100 Subject: [PATCH 11/14] add more --- htdocs/core/actions_printing.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 52fc3fa27d9..8c204e99039 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014-2024 Frédéric France + * Copyright (C) 2014-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -65,6 +65,7 @@ if ($action == 'print_file' && $user->hasRight('printing', 'read')) { $subdir = ''; $module = GETPOST('printer', 'alpha'); + // TODO make conversion in printing module switch ($module) { case 'livraison': $subdir = 'receipt'; @@ -74,7 +75,7 @@ if ($action == 'print_file' && $user->hasRight('printing', 'read')) { $subdir = 'sending'; break; case 'commande_fournisseur': - $module = 'fournisseur'; + $module = 'commande_fournisseur'; $subdir = 'commande'; break; } From d7597d72d26a15e0a5306ebcff277297294f4440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 28 Nov 2025 20:39:32 +0100 Subject: [PATCH 12/14] add more --- .../modules/printing/modules_printing.php | 3 +-- .../modules/printing/printipp.modules.php | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index e1df70fa5f7..d9aabb51d9a 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -47,7 +47,6 @@ class PrintingDriver */ public $errors = array(); - /** * @var string Name */ diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index f51d105f650..a5df9e35744 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -244,17 +244,20 @@ class printing_printipp extends PrintingDriver */ public function getlistAvailablePrinters() { - global $conf, $db; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; - $ipp = new CupsPrintIPP(); - $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log', 'file', 3); // logging very verbose - $ipp->setHost($this->host); - $ipp->setPort($this->port); - $ipp->setUserName($this->userid); - if (!empty($this->user)) { - $ipp->setAuthentication($this->user, $this->password); + try { + $ipp = new CupsPrintIPP(); + $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log', 'file', 3); // logging very verbose + $ipp->setHost($this->host); + $ipp->setPort($this->port); + $ipp->setUserName($this->userid); + if (!empty($this->user)) { + $ipp->setAuthentication($this->user, $this->password); + } + $ipp->getPrinters(); + } catch (Exception $e) { + setEventMessage($e->getMessage()); } - $ipp->getPrinters(); return $ipp->available_printers; } From b39eb2bc9ee957583ef8c64a37280f4b005babf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 28 Nov 2025 20:43:17 +0100 Subject: [PATCH 13/14] add more --- htdocs/core/modules/printing/printipp.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index a5df9e35744..6568f10549f 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -245,8 +245,8 @@ class printing_printipp extends PrintingDriver public function getlistAvailablePrinters() { include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; + $ipp = new CupsPrintIPP(); try { - $ipp = new CupsPrintIPP(); $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log', 'file', 3); // logging very verbose $ipp->setHost($this->host); $ipp->setPort($this->port); @@ -256,7 +256,7 @@ class printing_printipp extends PrintingDriver } $ipp->getPrinters(); } catch (Exception $e) { - setEventMessage($e->getMessage()); + setEventMessage($e->getMessage(), 'errors'); } return $ipp->available_printers; } From 65af9e2591752ac3e603f344924218c1beac5267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Fri, 28 Nov 2025 20:44:34 +0100 Subject: [PATCH 14/14] add more --- htdocs/core/modules/printing/printipp.modules.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 6568f10549f..17f57351398 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -246,18 +246,19 @@ class printing_printipp extends PrintingDriver { include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; $ipp = new CupsPrintIPP(); + $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log', 'file', 3); // logging very verbose + $ipp->setHost($this->host); + $ipp->setPort($this->port); + $ipp->setUserName($this->userid); + if (!empty($this->user)) { + $ipp->setAuthentication($this->user, $this->password); + } try { - $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log', 'file', 3); // logging very verbose - $ipp->setHost($this->host); - $ipp->setPort($this->port); - $ipp->setUserName($this->userid); - if (!empty($this->user)) { - $ipp->setAuthentication($this->user, $this->password); - } $ipp->getPrinters(); } catch (Exception $e) { setEventMessage($e->getMessage(), 'errors'); } + return $ipp->available_printers; }