Better error message
This commit is contained in:
parent
fa413fea76
commit
41ccfc411a
@ -369,7 +369,8 @@ class printing_printgcp extends PrintingDriver
|
|||||||
*/
|
*/
|
||||||
function list_jobs()
|
function list_jobs()
|
||||||
{
|
{
|
||||||
global $conf, $db, $bc;
|
global $conf, $db, $langs, $bc;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$html = '';
|
$html = '';
|
||||||
// Token storage
|
// Token storage
|
||||||
@ -432,20 +433,31 @@ class printing_printgcp extends PrintingDriver
|
|||||||
$var = True;
|
$var = True;
|
||||||
$jobs = $responsedata['jobs'];
|
$jobs = $responsedata['jobs'];
|
||||||
//$html .= '<pre>'.print_r($jobs['0'],true).'</pre>';
|
//$html .= '<pre>'.print_r($jobs['0'],true).'</pre>';
|
||||||
foreach ($jobs as $value )
|
if (is_array($jobs))
|
||||||
{
|
{
|
||||||
$var = !$var;
|
foreach ($jobs as $value)
|
||||||
$html .= '<tr '.$bc[$var].'>';
|
{
|
||||||
$html .= '<td>'.$value['id'].'</td>';
|
$var = !$var;
|
||||||
$html .= '<td>'.$value['ownerId'].'</td>';
|
$html .= '<tr '.$bc[$var].'>';
|
||||||
$html .= '<td>'.$value['printerName'].'</td>';
|
$html .= '<td>'.$value['id'].'</td>';
|
||||||
$html .= '<td>'.$value['title'].'</td>';
|
$html .= '<td>'.$value['ownerId'].'</td>';
|
||||||
$html .= '<td>'.$value['status'].'</td>';
|
$html .= '<td>'.$value['printerName'].'</td>';
|
||||||
$html .= '<td> </td>';
|
$html .= '<td>'.$value['title'].'</td>';
|
||||||
$html .= '</tr>';
|
$html .= '<td>'.$value['status'].'</td>';
|
||||||
|
$html .= '<td> </td>';
|
||||||
|
$html .= '</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$html .= '<tr '.$bc[$var].'>';
|
||||||
|
$html .= '<td colspan="6">'.$langs->trans("None").'</td>';
|
||||||
|
$html .= '</tr>';
|
||||||
}
|
}
|
||||||
$html .= '</table>';
|
$html .= '</table>';
|
||||||
|
|
||||||
$this->resprint = $html;
|
$this->resprint = $html;
|
||||||
|
|
||||||
return $error;
|
return $error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,5 +81,6 @@ STATE_IPP_none=None
|
|||||||
MEDIA_IPP_stationery=Stationery
|
MEDIA_IPP_stationery=Stationery
|
||||||
MEDIA_IPP_thermal=Thermal
|
MEDIA_IPP_thermal=Thermal
|
||||||
IPP_COLOR_print-black=BW Printer
|
IPP_COLOR_print-black=BW Printer
|
||||||
|
DirectPrintingJobsDesc=This page lists printing jobs found for available printers.
|
||||||
GoogleAuthNotConfigured=Google OAuth setup not done. Enable module OAuth and set a Google ID/Secret.
|
GoogleAuthNotConfigured=Google OAuth setup not done. Enable module OAuth and set a Google ID/Secret.
|
||||||
GoogleAuthConfigured=Google OAuth credentials found.
|
GoogleAuthConfigured=Google OAuth credentials found.
|
||||||
@ -29,19 +29,25 @@ llxHeader("",$langs->trans("Printing"));
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("Printing"));
|
print load_fiche_titre($langs->trans("Printing"));
|
||||||
|
|
||||||
|
print $langs->trans("DirectPrintingJobsDesc").'<br><br>';
|
||||||
|
|
||||||
// List Jobs from printing modules
|
// List Jobs from printing modules
|
||||||
$object = new PrintingDriver($db);
|
$object = new PrintingDriver($db);
|
||||||
$result = $object->listDrivers($db, 10);
|
$result = $object->listDrivers($db, 10);
|
||||||
foreach ($result as $driver) {
|
foreach ($result as $driver)
|
||||||
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||||
$classname = 'printing_'.$driver;
|
$classname = 'printing_'.$driver;
|
||||||
$langs->load($driver);
|
$langs->load($driver);
|
||||||
$printer = new $classname($db);
|
$printer = new $classname($db);
|
||||||
if ($conf->global->{$printer->active}) {
|
if ($conf->global->{$printer->active})
|
||||||
|
{
|
||||||
//$printer->list_jobs('commande');
|
//$printer->list_jobs('commande');
|
||||||
if ($printer->list_jobs()==0) {
|
$result = $printer->list_jobs();
|
||||||
print $printer->resprint;
|
print $printer->resprint;
|
||||||
} else {
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user