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