From 2f3ff6628db3489d1cfed8f462a5a74145801df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 13 Nov 2020 20:51:48 +0100 Subject: [PATCH] The variable $obj does not seem to be defined The variable $obj does not seem to be defined for all execution paths leading up to this point. --- htdocs/core/modules/printing/printipp.modules.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 0a9cb1210ee..5d840cb5ca3 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2020 Frederic France * * 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 @@ -141,6 +141,8 @@ class printing_printipp extends PrintingDriver $ipp->setPort($this->port); $ipp->setJobName($file, true); $ipp->setUserName($this->userid); + // Set default number of copy + $ipp->setCopies(1); if (!empty($this->user)) $ipp->setAuthentication($this->user, $this->password); // select printer uri for module order, propal,... @@ -148,10 +150,11 @@ class printing_printipp extends PrintingDriver $result = $this->db->query($sql); if ($result) { $obj = $this->db->fetch_object($result); - if ($obj) - { + if ($obj) { dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id); $ipp->setPrinterURI($obj->printer_id); + // Set number of copy + $ipp->setCopies($obj->copy); } else { if (!empty($conf->global->PRINTIPP_URI_DEFAULT)) { @@ -167,8 +170,6 @@ class printing_printipp extends PrintingDriver dol_print_error($this->db); } - // Set number of copy - $ipp->setCopies($obj->copy); $fileprint = $conf->{$module}->dir_output; if ($subdir != '') $fileprint .= '/'.$subdir; $fileprint .= '/'.$file;