Debug v16

This commit is contained in:
Laurent Destailleur 2022-07-24 19:58:11 +02:00
parent 60117bbaee
commit a02c0f55fb
5 changed files with 33 additions and 9 deletions

View File

@ -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)) {

View File

@ -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);

View File

@ -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;

View File

@ -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 '<table class="noborder centpercent">';
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';

View File

@ -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;