diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index fa86d832b73..26268e7c183 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -67,7 +67,11 @@ class PrintingDriver $list = array(); $listoffiles = array(); - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } foreach ($dirmodels as $dir) { $tmpfiles = dol_dir_list(dol_buildpath($dir, 0), 'all', 0, '\.modules.php', '', 'name', SORT_ASC, 0); if (!empty($tmpfiles)) { diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 226ed6c43cd..964558de8df 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -116,8 +116,8 @@ class printing_printgcp extends PrintingDriver 'type'=>'info', ); } else { - $this->google_id = $conf->global->OAUTH_GOOGLE_ID; - $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET; + $this->google_id = getDolGlobalString('OAUTH_GOOGLE_ID'); + $this->google_secret = getDolGlobalString('OAUTH_GOOGLE_SECRET'); // Token storage $storage = new DoliStorage($this->db, $this->conf); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 8bd15b7602e..48b0b78f381 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -141,14 +141,18 @@ class DoliStorage implements TokenStorageInterface dol_syslog("hasAccessToken service=".$service); $sql = "SELECT token FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " WHERE service = '".$this->db->escape($service.($this->keyforprovider?'-'.$this->keyforprovider:''))."'"; + $sql .= " WHERE service = '".$this->db->escape($service.(empty($this->keyforprovider) ? '' : '-'.$this->keyforprovider))."'"; $sql .= " AND entity IN (".getEntity('oauth_token').")"; $resql = $this->db->query($sql); if (! $resql) { dol_print_error($this->db); } $result = $this->db->fetch_array($resql); - $token = unserialize($result['token']); + if ($result) { + $token = unserialize($result['token']); + } else { + $token = ''; + } $this->tokens[$service] = $token; diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index a0849f082e8..cc85407d391 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -135,7 +135,12 @@ if ($mode == 'setup' && $user->admin) { $submit_enabled = 0; if (!empty($driver)) { - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } + foreach ($dirmodels as $dir) { if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) { $classfile = dol_buildpath($dir, 0).$driver.'.modules.php'; @@ -253,7 +258,13 @@ if ($mode == 'config' && $user->admin) { $object = new PrintingDriver($db); $result = $object->listDrivers($db, 10); - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } + foreach ($result as $driver) { foreach ($dirmodels as $dir) { if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) { @@ -296,7 +307,12 @@ if ($mode == 'test' && $user->admin) { print ''; if (!empty($driver)) { - $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + if (!empty($conf->modules_parts['printing'])) { + $dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']); + } else { + $dirmodels = array('/core/modules/printing/'); + } + foreach ($dirmodels as $dir) { if (file_exists(dol_buildpath($dir, 0).$driver.'.modules.php')) { $classfile = dol_buildpath($dir, 0).$driver.'.modules.php'; diff --git a/htdocs/printing/index.php b/htdocs/printing/index.php index 2d20db4ddf7..7ce4399501b 100644 --- a/htdocs/printing/index.php +++ b/htdocs/printing/index.php @@ -59,7 +59,7 @@ foreach ($result as $driver) { $langs->load($driver); $printer = new $classname($db); $keyforprinteractive = $printer->active; - if ($keyforprinteractive && $conf->global->$keyforprinteractive) { + if ($keyforprinteractive && getDolGlobalString($keyforprinteractive)) { //$printer->listJobs('commande'); $result = $printer->listJobs(); print $printer->resprint;