Some progress on Printing
This commit is contained in:
parent
608f4a7d7d
commit
df28ce77c0
@ -166,7 +166,7 @@ class printing_printgcp extends PrintingDriver
|
||||
*/
|
||||
function print_file($file, $module, $subdir='')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $user, $db;
|
||||
if ($this->authtoken=='') {
|
||||
$this->GoogleLogin();
|
||||
}
|
||||
@ -174,8 +174,30 @@ class printing_printgcp extends PrintingDriver
|
||||
$fileprint=$conf->{$module}->dir_output;
|
||||
if ($subdir!='') $fileprint.='/'.$subdir;
|
||||
$fileprint.='/'.$file;
|
||||
// select printer uri for module order, propal,...
|
||||
$sql = 'SELECT rowid, printer_id, copy FROM '.MAIN_DB_PREFIX.'printing WHERE module="'.$module.'" AND driver="printgcp" AND userid='.$user->id;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($obj)
|
||||
{
|
||||
$printer_id=$obj->printer_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->global->PRINTIPP_GCP_DEFAULT))
|
||||
{
|
||||
$printer_id=$conf->global->PRINTIPP_GCP_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'NoDefaultPrinterDefined';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->sendPrintToPrinter($conf->global->PRINTING_GCP_DEFAULT, $file, $fileprint, 'application/pdf');
|
||||
$this->sendPrintToPrinter($printer_id, $file, $fileprint, 'application/pdf');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -76,7 +76,7 @@ class printing_printipp extends PrintingDriver
|
||||
*/
|
||||
function print_file($file, $module, $subdir='')
|
||||
{
|
||||
global $conf,$db;
|
||||
global $conf, $user, $db;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
|
||||
@ -89,7 +89,7 @@ class printing_printipp extends PrintingDriver
|
||||
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
|
||||
|
||||
// select printer uri for module order, propal,...
|
||||
$sql = 'SELECT rowid,printer_id,copy FROM '.MAIN_DB_PREFIX.'printing WHERE module="'.$module.'" AND driver="printipp"';
|
||||
$sql = 'SELECT rowid,printer_id,copy FROM '.MAIN_DB_PREFIX.'printing WHERE module="'.$module.'" AND driver="printipp" AND userid='.$user->id;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -225,6 +225,42 @@ if ($mode == 'test' && $user->admin)
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
if ($mode == 'userconf' && $user->admin)
|
||||
{
|
||||
dol_fiche_head($head, $mode, $langs->trans("UserConf"), 0, 'technic');
|
||||
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("User").'</th>';
|
||||
print '<th>'.$langs->trans("PrintModule").'</th>';
|
||||
print '<th>'.$langs->trans("PrintDriver").'</th>';
|
||||
print '<th>'.$langs->trans("Printer").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterLocation").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterId").'</th>';
|
||||
print '<th>'.$langs->trans("NumberOfCopy").'</th>';
|
||||
print "</tr>\n";
|
||||
$sql = 'SELECT p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row=$db->fetch_array($resql)) {
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
print '<td>'.$row['driver'].'</td>';
|
||||
print '<td>'.$row['printer_name'].'</td>';
|
||||
print '<td>'.$row['printer_location'].'</td>';
|
||||
print '<td>'.$row['printer_id'].'</td>';
|
||||
print '<td>'.$row['copy'].'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -50,6 +50,11 @@ function printingadmin_prepare_head()
|
||||
$head[$h][2] = 'test';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=userconf";
|
||||
$head[$h][1] = $langs->trans("UserConf");
|
||||
$head[$h][2] = 'userconf';
|
||||
$h++;
|
||||
|
||||
//$object=new stdClass();
|
||||
|
||||
// Show more tabs from modules
|
||||
|
||||
Loading…
Reference in New Issue
Block a user