From 485431a7222ffd806db4fd2858480f0ccc54494a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Feb 2019 09:31:19 +0100 Subject: [PATCH 1/2] Update printgcp.modules.php --- htdocs/core/modules/printing/printgcp.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index ed50ebaa870..d06a77c7174 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2013 Frédéric 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 @@ -234,6 +234,7 @@ class printing_printgcp extends PrintingDriver */ public function getlistAvailablePrinters() { + $ret = array(); // Token storage $storage = new DoliStorage($this->db, $this->conf); // Setup the credentials for the requests From b51432790f0179432c6064f98958d52eb5c66c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Feb 2019 09:39:48 +0100 Subject: [PATCH 2/2] Update printgcp.modules.php --- htdocs/core/modules/printing/printgcp.modules.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index d06a77c7174..d061fc33b7d 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2019 Frédéric 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 @@ -95,7 +95,7 @@ class printing_printgcp extends PrintingDriver $storage = new DoliStorage($this->db, $this->conf); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); // Setup the credentials for the requests - $credentials = new Credentials( + $credentials = new Credentials( $this->google_id, $this->google_secret, $urlwithroot.'/core/modules/oauth/google_oauthcallback.php' @@ -336,8 +336,9 @@ class printing_printgcp extends PrintingDriver return $error; } } + } else { + dol_print_error($this->db); } - else dol_print_error($this->db); $ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype); $this->error = 'PRINTGCP: '.$ret['errormessage']; @@ -359,7 +360,7 @@ class printing_printgcp extends PrintingDriver public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype) { // Check if printer id - if(empty($printerid)) { + if (empty($printerid)) { return array('status' =>0, 'errorcode' =>'','errormessage'=>'No provided printer ID'); } // Open the file which needs to be print