Update printgcp.modules.php

This commit is contained in:
Frédéric FRANCE 2019-02-24 09:39:48 +01:00 committed by GitHub
parent 485431a722
commit b51432790f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Copyright (C) 2014-2013 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2014-2019 Frédéric 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
@ -95,7 +95,7 @@ class printing_printgcp extends PrintingDriver
$storage = new DoliStorage($this->db, $this->conf); $storage = new DoliStorage($this->db, $this->conf);
//$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
// Setup the credentials for the requests // Setup the credentials for the requests
$credentials = new Credentials( $credentials = new Credentials(
$this->google_id, $this->google_id,
$this->google_secret, $this->google_secret,
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php' $urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
@ -336,8 +336,9 @@ class printing_printgcp extends PrintingDriver
return $error; return $error;
} }
} }
} else {
dol_print_error($this->db);
} }
else dol_print_error($this->db);
$ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype); $ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype);
$this->error = 'PRINTGCP: '.$ret['errormessage']; $this->error = 'PRINTGCP: '.$ret['errormessage'];
@ -359,7 +360,7 @@ class printing_printgcp extends PrintingDriver
public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype) public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype)
{ {
// Check if printer id // Check if printer id
if(empty($printerid)) { if (empty($printerid)) {
return array('status' =>0, 'errorcode' =>'','errormessage'=>'No provided printer ID'); return array('status' =>0, 'errorcode' =>'','errormessage'=>'No provided printer ID');
} }
// Open the file which needs to be print // Open the file which needs to be print