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.
This commit is contained in:
Frédéric FRANCE 2020-11-13 20:51:48 +01:00 committed by GitHub
parent 1f69f4ed5d
commit 2f3ff6628d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Copyright (C) 2014-2018 Frederic France <frederic.france@netlogic.fr> * Copyright (C) 2014-2020 Frederic France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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->setPort($this->port);
$ipp->setJobName($file, true); $ipp->setJobName($file, true);
$ipp->setUserName($this->userid); $ipp->setUserName($this->userid);
// Set default number of copy
$ipp->setCopies(1);
if (!empty($this->user)) $ipp->setAuthentication($this->user, $this->password); if (!empty($this->user)) $ipp->setAuthentication($this->user, $this->password);
// select printer uri for module order, propal,... // select printer uri for module order, propal,...
@ -148,10 +150,11 @@ class printing_printipp extends PrintingDriver
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
if ($obj) if ($obj) {
{
dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id); dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id);
$ipp->setPrinterURI($obj->printer_id); $ipp->setPrinterURI($obj->printer_id);
// Set number of copy
$ipp->setCopies($obj->copy);
} else { } else {
if (!empty($conf->global->PRINTIPP_URI_DEFAULT)) if (!empty($conf->global->PRINTIPP_URI_DEFAULT))
{ {
@ -167,8 +170,6 @@ class printing_printipp extends PrintingDriver
dol_print_error($this->db); dol_print_error($this->db);
} }
// Set number of copy
$ipp->setCopies($obj->copy);
$fileprint = $conf->{$module}->dir_output; $fileprint = $conf->{$module}->dir_output;
if ($subdir != '') $fileprint .= '/'.$subdir; if ($subdir != '') $fileprint .= '/'.$subdir;
$fileprint .= '/'.$file; $fileprint .= '/'.$file;