Merge pull request #2137 from frederic34/printipp
Printing System which may accept modules
This commit is contained in:
commit
34fe87536b
12
.tx/config
12
.tx/config
@ -236,6 +236,18 @@ source_file = htdocs/langs/en_US/paypal.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.printgcp]
|
||||
file_filter = htdocs/langs/<lang>/printgcp.lang
|
||||
source_file = htdocs/langs/en_US/printgcp.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.printing]
|
||||
file_filter = htdocs/langs/<lang>/printing.lang
|
||||
source_file = htdocs/langs/en_US/printing.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.printipp]
|
||||
file_filter = htdocs/langs/<lang>/printipp.lang
|
||||
source_file = htdocs/langs/en_US/printipp.lang
|
||||
|
||||
@ -550,7 +550,7 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST(
|
||||
}
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -1141,7 +1141,7 @@ else if ($action == 'update_extras') {
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -1690,7 +1690,7 @@ else if ($action == 'remove_file') {
|
||||
}
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer)
|
||||
{
|
||||
|
||||
64
htdocs/core/actions_printing.inc.php
Normal file
64
htdocs/core/actions_printing.inc.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/actions_printing.inc.php
|
||||
* \brief Code for actions print_file to print file with calling trigger
|
||||
*/
|
||||
|
||||
|
||||
// $action must be defined
|
||||
// $db, $user, $conf, $langs must be defined
|
||||
// Filename to print must be provided into 'file' parameter
|
||||
|
||||
// Print file
|
||||
if ($action == 'print_file' and $user->rights->printing->read)
|
||||
{
|
||||
$langs->load("printing");
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';
|
||||
$objectprint = new PrintingDriver($db);
|
||||
$list = $objectprint->listDrivers($db, 10);
|
||||
if (! empty($list)) {
|
||||
$errorprint=0;
|
||||
$printed=0;
|
||||
foreach ($list as $driver) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
$langs->load($driver);
|
||||
$classname = 'printing_'.$driver;
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
|
||||
if (! empty($conf->global->{$printer->active})) {
|
||||
$subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':'');
|
||||
$errorprint = $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'), $subdir);
|
||||
//if ($errorprint < 0) {
|
||||
// setEventMessage($interface->errors, 'errors');
|
||||
//}
|
||||
if ($errorprint=='') {
|
||||
setEventMessage($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->trans("ViaModule").' '.$printer->name);
|
||||
$printed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($printed==0) setEventMessage($langs->trans("NoActivePrintingModuleFound"));
|
||||
} else {
|
||||
setEventMessage($langs->trans("NoModuleFound"), 'warning');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/actions_printipp.inc.php
|
||||
* \brief Code for actions print_file to print file using ipp
|
||||
*/
|
||||
|
||||
|
||||
// $action must be defined
|
||||
// $db, $user, $conf, $langs must be defined
|
||||
// Filename to print must be provided into 'file' parameter
|
||||
|
||||
// Print file
|
||||
if ($action == 'print_file' and $user->rights->printipp->read)
|
||||
{
|
||||
$langs->load("printipp");
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php';
|
||||
$printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD);
|
||||
$result = $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha'));
|
||||
if ($result)
|
||||
{
|
||||
setEventMessage($result,'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))));
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
@ -28,7 +28,7 @@ class dolprintIPP
|
||||
{
|
||||
var $host;
|
||||
var $port;
|
||||
var $userid; /* user login */
|
||||
var $userid; /* user login */
|
||||
var $user;
|
||||
var $password;
|
||||
var $error;
|
||||
|
||||
@ -273,9 +273,9 @@ class FormFile
|
||||
}
|
||||
|
||||
$printer=0;
|
||||
if (in_array($modulepart,array('facture','propal','proposal','order','commande'))) // This feature is implemented only for such elements
|
||||
if (in_array($modulepart,array('facture','propal','proposal','order','commande','expedition'))) // This feature is implemented only for such elements
|
||||
{
|
||||
$printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false;
|
||||
$printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled))?true:false;
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('formfile'));
|
||||
@ -604,8 +604,8 @@ class FormFile
|
||||
$out.= '<td align="right">';
|
||||
if ($delallowed)
|
||||
{
|
||||
$out.= '<a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=remove_file&file='.urlencode($relativepath);
|
||||
$out.= ($param?'&'.$param:'');
|
||||
$out.= '<a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=remove_file&file='.urlencode($relativepath);
|
||||
$out.= ($param?'&'.$param:'');
|
||||
//$out.= '&modulepart='.$modulepart; // TODO obsolete ?
|
||||
//$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?
|
||||
$out.= '">'.img_picto($langs->trans("Delete"), 'delete.png').'</a>';
|
||||
@ -614,9 +614,9 @@ class FormFile
|
||||
if ($printer)
|
||||
{
|
||||
//$out.= '<td align="right">';
|
||||
$out.= ' <a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=print_file&printer='.$modulepart.'&file='.urlencode($relativepath);
|
||||
$out.= ($param?'&'.$param:'');
|
||||
$out.= '">'.img_picto($langs->trans("Print"),'printer.png').'</a>';
|
||||
$out.= ' <a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=print_file&printer='.$modulepart.'&file='.urlencode($relativepath);
|
||||
$out.= ($param?'&'.$param:'');
|
||||
$out.= '">'.img_picto($langs->trans("PrintFile", $relativepath),'printer.png').'</a>';
|
||||
}
|
||||
if ($morepicto)
|
||||
{
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -15,42 +16,41 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** \defgroup printipp Module printipp
|
||||
* \brief Module pour imprimer via CUPS
|
||||
/** \defgroup printing Module printing
|
||||
* \brief Module for activation of printing icon
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/modPrintIPP.class.php
|
||||
* \ingroup printipp
|
||||
* \brief Fichier de description et activation du module OSCommerce2
|
||||
* \file htdocs/core/modules/modPrinting.class.php
|
||||
* \ingroup printing
|
||||
* \brief Fichier de description et activation du module Printing
|
||||
*/
|
||||
include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php");
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \class modPrintIPP
|
||||
* \brief Classe de description et activation du module PrintIPP
|
||||
* \class modPrinting
|
||||
* \brief Classe de description et activation du module Printing
|
||||
*/
|
||||
class modPrintIPP extends DolibarrModules
|
||||
class modPrinting extends DolibarrModules
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db ;
|
||||
$this->numero = 54000;
|
||||
$this->numero = 112000;
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "other";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
$this->description = "Print via Cups IPP Printer.";
|
||||
$this->description = "Enable Printing System.";
|
||||
$this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||
@ -64,16 +64,15 @@ class modPrintIPP extends DolibarrModules
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("printipp.php@printipp");
|
||||
$this->config_page_url = array("printing.php@printing");
|
||||
|
||||
// Dependances
|
||||
$this->hidden = (! empty($_SERVER["WINDIR"]));
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
$this->phpmin = array(5,1); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(3,7,-2); // Minimum version of Dolibarr required by module
|
||||
$this->phpmin = array(5,1); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(3,7,-2); // Minimum version of Dolibarr required by module
|
||||
$this->conflictwith = array();
|
||||
$this->langfiles = array("printipp");
|
||||
$this->langfiles = array("printing");
|
||||
|
||||
// Constantes
|
||||
$this->const = array();
|
||||
@ -83,7 +82,7 @@ class modPrintIPP extends DolibarrModules
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'printipp';
|
||||
$this->rights_class = 'printing';
|
||||
|
||||
$r=0;
|
||||
// $this->rights[$r][0] Id permission (unique tous modules confondus)
|
||||
@ -94,8 +93,8 @@ class modPrintIPP extends DolibarrModules
|
||||
// $this->rights[$r][5] Niveau 2 pour nommer permission dans code
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 54001;
|
||||
$this->rights[$r][1] = 'Printer';
|
||||
$this->rights[$r][0] = 112001;
|
||||
$this->rights[$r][1] = 'Printing';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 1;
|
||||
$this->rights[$r][4] = 'read';
|
||||
@ -106,16 +105,16 @@ class modPrintIPP extends DolibarrModules
|
||||
|
||||
// This is to declare the Top Menu entry:
|
||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Put 0 if this is a top menu
|
||||
'type'=>'left', // This is a Top menu entry
|
||||
'titre'=>'Printer',
|
||||
'mainmenu'=>'printer',
|
||||
'url'=>'/printipp/index.php',
|
||||
'langs'=>'printipp', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'type'=>'left', // This is a Top menu entry
|
||||
'titre'=>'Printing',
|
||||
'mainmenu'=>'printing',
|
||||
'url'=>'/printing/index.php',
|
||||
'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>300,
|
||||
'enabled'=>'$conf->printipp->enabled && $leftmenu==\'modulesadmintools\'',
|
||||
'perms'=>'$user->rights->printipp->read', // Use 'perms'=>'1' if you want your menu with no permission rules
|
||||
'enabled'=>'$conf->printing->enabled && $leftmenu==\'modulesadmintools\'',
|
||||
'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules
|
||||
'target'=>'',
|
||||
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
|
||||
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
|
||||
|
||||
$r++;
|
||||
|
||||
@ -123,13 +122,13 @@ class modPrintIPP extends DolibarrModules
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
$sql = array();
|
||||
@ -137,15 +136,15 @@ class modPrintIPP extends DolibarrModules
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove($options='')
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove($options='')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
86
htdocs/core/modules/printing/modules_printing.php
Normal file
86
htdocs/core/modules/printing/modules_printing.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/mailings/modules_printing.php
|
||||
* \ingroup printing
|
||||
* \brief File with parent class of printing modules
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Parent class of emailing target selectors modules
|
||||
*/
|
||||
class PrintingDriver
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of printing driver
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @return array List of drivers
|
||||
*/
|
||||
static function listDrivers($db,$maxfilenamelength=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$type='printing';
|
||||
$liste=array();
|
||||
|
||||
$moduledir=DOL_DOCUMENT_ROOT."/core/modules/printing/";
|
||||
$tmpfiles=dol_dir_list($moduledir,'all',0,'\modules.php','','name',SORT_ASC,0);
|
||||
foreach($tmpfiles as $record) {
|
||||
$list[$record['fullname']]=str_replace('.modules.php', '',$record['name']);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return description of Printing Module
|
||||
*
|
||||
* @return string Return translation of key PrintingModuleDescXXX where XXX is module name, or $this->desc if not exists
|
||||
*/
|
||||
function getDesc()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("printing");
|
||||
$transstring="PrintingModuleDesc".$this->name;
|
||||
if ($langs->trans($transstring) != $transstring) return $langs->trans($transstring);
|
||||
else return $this->desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
355
htdocs/core/modules/printing/printgcp.modules.php
Normal file
355
htdocs/core/modules/printing/printgcp.modules.php
Normal file
@ -0,0 +1,355 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/printing/printgcp.modules.php
|
||||
* \ingroup printing
|
||||
* \brief File to provide printing with Google Cloud Print
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
|
||||
|
||||
/**
|
||||
* \class mailing_example
|
||||
* \brief Class to provide printing with Google Cloud Print
|
||||
*/
|
||||
class printing_printgcp extends PrintingDriver
|
||||
{
|
||||
var $name = 'printgcp';
|
||||
var $desc = 'PrintGCPDesc';
|
||||
var $picto = 'printer';
|
||||
var $active = 'PRINTING_PRINTGCP';
|
||||
var $conf = array();
|
||||
var $login = '';
|
||||
var $password = '';
|
||||
var $authtoken = '';
|
||||
var $db;
|
||||
|
||||
const LOGIN_URL = 'https://www.google.com/accounts/ClientLogin';
|
||||
const PRINTERS_SEARCH_URL = 'https://www.google.com/cloudprint/interface/search';
|
||||
const PRINT_URL = 'https://www.google.com/cloudprint/interface/submit';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->login = $conf->global->PRINTGCP_LOGIN;
|
||||
$this->password = $conf->global->PRINTGCP_PASSWORD;
|
||||
$this->authtoken = $conf->global->PRINTGCP_AUTHTOKEN;
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_LOGIN', 'required'=>1, 'example'=>'user@gmail.com', 'type'=>'text');
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_PASSWORD', 'required'=>1, 'example'=>'', 'type'=>'password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return string html list of printers
|
||||
*/
|
||||
function listAvailablePrinters()
|
||||
{
|
||||
global $bc, $conf, $langs;
|
||||
$langs->load('printgcp');
|
||||
$var=true;
|
||||
|
||||
$html = '<tr class="liste_titre">';
|
||||
$html.= '<td>'.$langs->trans('GCP_Name').'</td>';
|
||||
$html.= '<td>'.$langs->trans('GCP_displayName').'</td>';
|
||||
$html.= '<td>'.$langs->trans('GCP_Id').'</td>';
|
||||
$html.= '<td>'.$langs->trans('GCP_OwnerName').'</td>';
|
||||
$html.= '<td>'.$langs->trans('GCP_State').'</td>';
|
||||
$html.= '<td>'.$langs->trans('GCP_connectionStatus').'</td>';
|
||||
$html.= '<td>'.$langs->trans('GCP_Type').'</td>';
|
||||
$html.= '<td align="center">'.$langs->trans("Select").'</td>';
|
||||
$html.= '</tr>'."\n";
|
||||
$list = $this->getlist_available_printers();
|
||||
//$html.= '<td><pre>'.print_r($list,true).'</pre></td>';
|
||||
$var = true;
|
||||
foreach ($list['available'] as $printer_det)
|
||||
{
|
||||
$var=!$var;
|
||||
$html.= "<tr ".$bc[$var].">";
|
||||
$html.= '<td>'.$printer_det['name'].'</td>';
|
||||
$html.= '<td>'.$printer_det['displayName'].'</td>';
|
||||
$html.= '<td>'.$printer_det['id'].'</td>'; // id to identify printer to use
|
||||
$html.= '<td>'.$printer_det['ownerName'].'</td>';
|
||||
$html.= '<td>'.$printer_det['status'].'</td>';
|
||||
$html.= '<td>'.$langs->trans('STATE_'.$printer_det['connectionStatus']).'</td>';
|
||||
$html.= '<td>'.$langs->trans('TYPE_'.$printer_det['type']).'</td>';
|
||||
// Defaut
|
||||
$html.= '<td align="center">';
|
||||
if ($conf->global->PRINTING_GCP_DEFAULT == $printer_det['id'])
|
||||
{
|
||||
$html.= img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
$html.= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&mode=test&varname=PRINTING_GCP_DEFAULT&driver=printgcp&value='.urlencode($printer_det['id']).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
$html.= '</td>';
|
||||
$html.= '</tr>'."\n";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return array list of printers
|
||||
*/
|
||||
function getlist_available_printers()
|
||||
{
|
||||
global $conf,$db;
|
||||
if ($this->authtoken=='') {
|
||||
$this->GoogleLogin();
|
||||
}
|
||||
$ret['available'] = $this->get_printer_detail();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of printers
|
||||
*
|
||||
* @return array list of printers
|
||||
*/
|
||||
function get_printer_detail()
|
||||
{
|
||||
// Check if we have auth token
|
||||
if(empty($this->authtoken)) {
|
||||
// We don't have auth token so throw exception
|
||||
throw new Exception("Please first login to Google by calling loginToGoogle function");
|
||||
}
|
||||
// Prepare auth headers with auth token
|
||||
$authheaders = array("Authorization: GoogleLogin auth=".$this->authtoken,
|
||||
"GData-Version: 3.0",
|
||||
);
|
||||
// Make Http call to get printers added by user to Google Cloud Print
|
||||
$responsedata = $this->makeCurl(self::PRINTERS_SEARCH_URL,array(),$authheaders);
|
||||
$printers = json_decode($responsedata);
|
||||
// Check if we have printers?
|
||||
if(is_null($printers)) {
|
||||
// We dont have printers so return blank array
|
||||
return array();
|
||||
} else {
|
||||
// We have printers so returns printers as array
|
||||
return $this->parsePrinters($printers);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print selected file
|
||||
*
|
||||
* @param string $file file
|
||||
* @param string $module module
|
||||
* @param string $subdir subdir for file
|
||||
* @return string '' if OK, Error message if KO
|
||||
*/
|
||||
function print_file($file, $module, $subdir='')
|
||||
{
|
||||
global $conf, $user, $db;
|
||||
if ($this->authtoken=='') {
|
||||
$this->GoogleLogin();
|
||||
}
|
||||
// si $module=commande_fournisseur alors $conf->fournisseur->commande->dir_output
|
||||
$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->PRINTING_GCP_DEFAULT))
|
||||
{
|
||||
$printer_id=$conf->global->PRINTING_GCP_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'NoDefaultPrinterDefined';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->sendPrintToPrinter($printer_id, $file, $fileprint, 'application/pdf');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends document to the printer
|
||||
*
|
||||
* @param string $printerid Printer id returned by Google Cloud Print
|
||||
* @param string $printjobtitle Job Title
|
||||
* @param string $filepath File Path to be send to Google Cloud Print
|
||||
* @param string $contenttype File content type by example application/pdf, image/png
|
||||
* @return array status array
|
||||
*/
|
||||
public function sendPrintToPrinter($printerid,$printjobtitle,$filepath,$contenttype)
|
||||
{
|
||||
$errors=0;
|
||||
// Check auth token
|
||||
if(empty($this->authtoken)) {
|
||||
$errors++;
|
||||
setEventMessage('Please first login to Google', 'warning');
|
||||
}
|
||||
// Check if printer id
|
||||
if(empty($printerid)) {
|
||||
$errors++;
|
||||
setEventMessage('No provided printer ID', 'warning');
|
||||
}
|
||||
// Open the file which needs to be print
|
||||
$handle = fopen($filepath, "rb");
|
||||
if(!$handle) {
|
||||
$errors++;
|
||||
setEventMessage('Could not read the file.');
|
||||
}
|
||||
// Read file content
|
||||
$contents = fread($handle, filesize($filepath));
|
||||
fclose($handle);
|
||||
// Prepare post fields for sending print
|
||||
$post_fields = array('printerid' => $printerid,
|
||||
'title' => $printjobtitle,
|
||||
'contentTransferEncoding' => 'base64',
|
||||
'content' => base64_encode($contents), // encode file content as base64
|
||||
'contentType' => $contenttype
|
||||
);
|
||||
// Prepare authorization headers
|
||||
$authheaders = array("Authorization: GoogleLogin auth=" . $this->authtoken);
|
||||
// Make http call for sending print Job
|
||||
$response = json_decode($this->makeCurl(self::PRINT_URL,$post_fields,$authheaders));
|
||||
// Has document been successfully sent?
|
||||
if($response->success=="1") {
|
||||
return array('status' =>true,'errorcode' =>'','errormessage'=>"");
|
||||
} else {
|
||||
return array('status' =>false,'errorcode' =>$response->errorCode,'errormessage'=>$response->message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Login into Google Account
|
||||
*
|
||||
* @return string true or false
|
||||
*/
|
||||
function GoogleLogin()
|
||||
{
|
||||
global $db, $conf;
|
||||
// Prepare post fields required for the login
|
||||
$loginpostfields = array("accountType" => "HOSTED_OR_GOOGLE",
|
||||
"Email" => $this->login,
|
||||
"Passwd" => $this->password,
|
||||
"service" => "cloudprint",
|
||||
"source" => "GCP"
|
||||
);
|
||||
// Get the Auth token
|
||||
$loginresponse = $this->makeCurl(self::LOGIN_URL,$loginpostfields);
|
||||
$token = $this->getAuthToken($loginresponse);
|
||||
if(! empty($token)&&!is_null($token)) {
|
||||
$this->authtoken = $token;
|
||||
$result=dolibarr_set_const($db, 'PRINTGCP_AUTHTOKEN', $token, 'chaine', 0, '', $conf->entity);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse json response and return printers array
|
||||
*
|
||||
* @param string $jsonobj Json response object
|
||||
* @return array return array of printers
|
||||
*/
|
||||
private function parsePrinters($jsonobj)
|
||||
{
|
||||
$printers = array();
|
||||
if (isset($jsonobj->printers)) {
|
||||
foreach ($jsonobj->printers as $gcpprinter) {
|
||||
$printers[] = array('id' =>$gcpprinter->id,
|
||||
'name' =>$gcpprinter->name,
|
||||
'defaultDisplayName' =>$gcpprinter->defaultDisplayName,
|
||||
'displayName' =>$gcpprinter->displayName,
|
||||
'ownerId' =>$gcpprinter->ownerId,
|
||||
'ownerName' =>$gcpprinter->ownerName,
|
||||
'connectionStatus' =>$gcpprinter->connectionStatus,
|
||||
'status' =>$gcpprinter->status,
|
||||
'type' =>$gcpprinter->type
|
||||
);
|
||||
}
|
||||
}
|
||||
return $printers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse data to get auth token
|
||||
*
|
||||
* @param string $response response from curl
|
||||
* @return string token
|
||||
*/
|
||||
private function getAuthToken($response)
|
||||
{
|
||||
// Search Auth tag
|
||||
preg_match("/Auth=([a-z0-9_-]+)/i", $response, $matches);
|
||||
$authtoken = @$matches[1];
|
||||
return $authtoken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Curl request
|
||||
*
|
||||
* @param string $url url to hit
|
||||
* @param array $postfields array of post fields
|
||||
* @param array $headers array of http headers
|
||||
* @return array response from curl
|
||||
*/
|
||||
private function makeCurl($url,$postfields=array(),$headers=array())
|
||||
{
|
||||
// Curl Init
|
||||
$curl = curl_init($url);
|
||||
// Curl post request
|
||||
if(! empty($postfields)) {
|
||||
// As is HTTP post curl request so set post fields
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
||||
}
|
||||
// Curl request headers
|
||||
if(! empty($headers)) {
|
||||
// As curl requires header so set headers here
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
// Execute the curl and return response
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
284
htdocs/core/modules/printing/printipp.modules.php
Normal file
284
htdocs/core/modules/printing/printipp.modules.php
Normal file
@ -0,0 +1,284 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/printing/printipp.modules.php
|
||||
* \ingroup mailing
|
||||
* \brief File to provide printing with PrintIPP
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
|
||||
|
||||
/**
|
||||
* \class mailing_example
|
||||
* \brief Class to provide printing with PrintIPP
|
||||
*/
|
||||
class printing_printipp extends PrintingDriver
|
||||
{
|
||||
var $name='printipp';
|
||||
var $desc='PrintIPPDesc';
|
||||
var $picto='printer';
|
||||
var $active='PRINTING_PRINTIPP';
|
||||
var $conf=array();
|
||||
var $host;
|
||||
var $port;
|
||||
var $userid; /* user login */
|
||||
var $user;
|
||||
var $password;
|
||||
var $error;
|
||||
var $db;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db=$db;
|
||||
$this->host=$conf->global->PRINTIPP_HOST;
|
||||
$this->port=$conf->global->PRINTIPP_PORT;
|
||||
$this->user=$conf->global->PRINTIPP_USER;
|
||||
$this->password=$conf->global->PRINTIPP_PASSWORD;
|
||||
$this->conf[] = array('varname'=>'PRINTIPP_HOST', 'required'=>1, 'example'=>'localhost', 'type'=>'text');
|
||||
$this->conf[] = array('varname'=>'PRINTIPP_PORT', 'required'=>1, 'example'=>'631', 'type'=>'text');
|
||||
$this->conf[] = array('varname'=>'PRINTIPP_USER', 'required'=>0, 'example'=>'', 'type'=>'text');
|
||||
$this->conf[] = array('varname'=>'PRINTIPP_PASSWORD', 'required'=>0, 'example'=>'', 'type'=>'password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Print selected file
|
||||
*
|
||||
* @param string $file file
|
||||
* @param string $module module
|
||||
* @param string $subdir subdirectory of document like for expedition subdir is sendings
|
||||
*
|
||||
* @return string '' if OK, Error message if KO
|
||||
*/
|
||||
function print_file($file, $module, $subdir='')
|
||||
{
|
||||
global $conf, $user, $db;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
|
||||
$ipp = new CupsPrintIPP();
|
||||
$ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose
|
||||
$ipp->setHost($this->host);
|
||||
$ipp->setPort($this->port);
|
||||
$ipp->setJobName($file,true);
|
||||
$ipp->setUserName($this->userid);
|
||||
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" AND userid='.$user->id;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($obj)
|
||||
{
|
||||
$ipp->setPrinterURI($obj->printer_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->global->PRINTIPP_URI_DEFAULT))
|
||||
{
|
||||
$ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'NoDefaultPrinterDefined';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set number of copy
|
||||
$ipp->setCopies($obj->copy);
|
||||
$fileprint=$conf->{$module}->dir_output;
|
||||
if ($subdir!='') $fileprint.='/'.$subdir;
|
||||
$fileprint.='/'.$file;
|
||||
$ipp->setData($fileprint);
|
||||
$ipp->printJob();
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return string html list of printers
|
||||
*/
|
||||
function listAvailablePrinters()
|
||||
{
|
||||
global $bc, $conf, $langs;
|
||||
$var=true;
|
||||
|
||||
$html = '<tr class="liste_titre">';
|
||||
$html.= '<td>'.$langs->trans('IPP_Uri').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_Name').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_State').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_State_reason').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_State_reason1').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_BW').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_Color').'</td>';
|
||||
//$html.= '<td>'.$langs->trans('IPP_Device').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_Media').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_Supported').'</td>';
|
||||
$html.= '<td align="center">'.$langs->trans("Select").'</td>';
|
||||
$html.= "</tr>\n";
|
||||
$list = $this->getlist_available_printers();
|
||||
$var = true;
|
||||
foreach ($list as $value)
|
||||
{
|
||||
$var=!$var;
|
||||
$printer_det = $this->get_printer_detail($value);
|
||||
$html.= "<tr ".$bc[$var].">";
|
||||
$html.= '<td>'.$value.'</td>';
|
||||
//$html.= '<td><pre>'.print_r($printer_det,true).'</pre></td>';
|
||||
$html.= '<td>'.$printer_det->printer_name->_value0.'</td>';
|
||||
$html.= '<td>'.$langs->trans('STATE_IPP_'.$printer_det->printer_state->_value0).'</td>';
|
||||
$html.= '<td>'.$langs->trans('STATE_IPP_'.$printer_det->printer_state_reasons->_value0).'</td>';
|
||||
$html.= '<td>'.(! empty($printer_det->printer_state_reasons->_value1)?$langs->trans('STATE_IPP_'.$printer_det->printer_state_reasons->_value1):'').'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_COLOR_'.$printer_det->printer_type->_value2).'</td>';
|
||||
$html.= '<td>'.$langs->trans('IPP_COLOR_'.$printer_det->printer_type->_value3).'</td>';
|
||||
//$html.= '<td>'.$printer_det->device_uri->_value0.'</td>';
|
||||
$html.= '<td>'.$printer_det->media_default->_value0.'</td>';
|
||||
$html.= '<td>'.$langs->trans('MEDIA_IPP_'.$printer_det->media_type_supported->_value1).'</td>';
|
||||
// Defaut
|
||||
$html.= '<td align="center">';
|
||||
if ($conf->global->PRINTIPP_URI_DEFAULT == $value)
|
||||
{
|
||||
$html.= img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
$html.= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&mode=test&varname=PRINTIPP_URI_DEFAULT&driver=printipp&value='.urlencode($value).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
$html.= '</td>';
|
||||
$html.= '</tr>'."\n";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return array list of printers
|
||||
*/
|
||||
function getlist_available_printers()
|
||||
{
|
||||
global $conf,$db;
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
$ipp = new CupsPrintIPP();
|
||||
$ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose
|
||||
$ipp->setHost($this->host);
|
||||
$ipp->setPort($this->port);
|
||||
$ipp->setUserName($this->userid);
|
||||
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
|
||||
$ipp->getPrinters();
|
||||
return $ipp->available_printers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get printer detail
|
||||
*
|
||||
* @param string $uri URI
|
||||
* @return array List of attributes
|
||||
*/
|
||||
function get_printer_detail($uri)
|
||||
{
|
||||
global $conf,$db;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
$ipp = new CupsPrintIPP();
|
||||
$ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose
|
||||
$ipp->setHost($this->host);
|
||||
$ipp->setPort($this->port);
|
||||
$ipp->setUserName($this->userid);
|
||||
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
|
||||
$ipp->setPrinterURI($uri);
|
||||
$ipp->getPrinterAttributes();
|
||||
return $ipp->printer_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* List jobs print
|
||||
*
|
||||
* @param string $module module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function list_jobs($module)
|
||||
{
|
||||
global $conf, $db, $bc;
|
||||
include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
|
||||
$ipp = new CupsPrintIPP();
|
||||
$ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose
|
||||
$ipp->setHost($this->host);
|
||||
$ipp->setPort($this->port);
|
||||
$ipp->setUserName($this->userid);
|
||||
if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password);
|
||||
// select printer uri for module order, propal,...
|
||||
$sql = 'SELECT rowid,printer_uri,printer_name FROM '.MAIN_DB_PREFIX.'printer_ipp WHERE module="'.$module.'"';
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($obj)
|
||||
{
|
||||
$ipp->setPrinterURI($obj->printer_uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
// All printers
|
||||
$ipp->setPrinterURI("ipp://localhost:631/printers/");
|
||||
}
|
||||
}
|
||||
// Getting Jobs
|
||||
$ipp->getJobs(false,0,'completed',false);
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>Id</td>";
|
||||
print "<td>Owner</td>";
|
||||
print "<td>Printer</td>";
|
||||
print "<td>File</td>";
|
||||
print "<td>Status</td>";
|
||||
print "<td>Cancel</td>";
|
||||
print "</tr>\n";
|
||||
$jobs = $ipp->jobs_attributes;
|
||||
$var = True;
|
||||
//print '<pre>'.print_r($jobs,true).'</pre>';
|
||||
foreach ($jobs as $value )
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$value->job_id->_value0.'</td>';
|
||||
print '<td>'.$value->job_originating_user_name->_value0.'</td>';
|
||||
print '<td>'.$value->printer_uri->_value0.'</td>';
|
||||
print '<td>'.$value->job_name->_value0.'</td>';
|
||||
print '<td>'.$value->job_state->_value0.'</td>';
|
||||
print '<td>'.$value->job_uri->_value0.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
}
|
||||
@ -429,6 +429,8 @@ if (GETPOST('removedfile','alpha'))
|
||||
$action ='presend';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
|
||||
|
||||
/* @(#) $Header: /sources/phpprintipp/phpprintipp/php_classes/CupsPrintIPP.php,v 1.1 2008/06/21 00:30:56 harding Exp $
|
||||
*
|
||||
* Class PrintIPP - Send extended IPP requests.
|
||||
@ -22,11 +22,10 @@
|
||||
*
|
||||
* mailto:thomas.harding@laposte.net
|
||||
* Thomas Harding, 56 rue de la bourie rouge, 45 000 ORLEANS -- FRANCE
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
This class is intended to implement Internet Printing Protocol on client side.
|
||||
|
||||
References needed to debug / add functionnalities:
|
||||
@ -39,57 +38,64 @@
|
||||
|
||||
require_once("ExtendedPrintIPP.php");
|
||||
|
||||
class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
|
||||
// {{{ variables declaration
|
||||
|
||||
class CupsPrintIPP extends ExtendedPrintIPP
|
||||
{
|
||||
public $printers_attributes;
|
||||
public $defaults_attributes;
|
||||
|
||||
// }}}
|
||||
|
||||
// {{{ constructor
|
||||
public function __construct() {
|
||||
protected $parsed;
|
||||
protected $output;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
self::_initTags();
|
||||
}
|
||||
// }}}
|
||||
|
||||
//
|
||||
// OPERATIONS
|
||||
//
|
||||
public function cupsGetDefaults($attributes=array("all"))
|
||||
{
|
||||
//The CUPS-Get-Default operation returns the default printer URI and attributes
|
||||
|
||||
// {{{ cupsGetDefaults ($attributes="all")
|
||||
public function cupsGetDefaults($attributes=array("all")) {
|
||||
//The CUPS-Get-Default operation returns the default printer URI and attributes
|
||||
|
||||
$this->jobs = array_merge($this->jobs,array(""));
|
||||
$this->jobs_uri = array_merge($this->jobs_uri,array(""));
|
||||
$this->parsed = array();
|
||||
unset($this->printer_attributes);
|
||||
|
||||
|
||||
if (!isset($this->setup->charset))
|
||||
self::setCharset('us-ascii');
|
||||
|
||||
{
|
||||
self::setCharset();
|
||||
}
|
||||
|
||||
if (!isset($this->setup->language))
|
||||
{
|
||||
self::setLanguage('en');
|
||||
|
||||
}
|
||||
|
||||
self::_setOperationId();
|
||||
|
||||
|
||||
for($i = 0 ; $i < count($attributes) ; $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
{
|
||||
$this->meta->attributes = chr(0x44) // Keyword
|
||||
. self::_giveMeStringLength('requested-attributes')
|
||||
. 'requested-attributes'
|
||||
. self::_giveMeStringLength($attributes[0])
|
||||
. $attributes[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->meta->attributes .= chr(0x44) // Keyword
|
||||
. chr(0x0).chr(0x0) // zero-length name
|
||||
. self::_giveMeStringLength($attributes[$i])
|
||||
. $attributes[$i];
|
||||
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
}
|
||||
}
|
||||
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
. chr(0x40). chr(0x01) // operation: cups vendor extension: get defaults
|
||||
. $this->meta->operation_id // request-id
|
||||
. chr(0x01) // start operation-attributes | operation-attributes-tag
|
||||
@ -97,69 +103,83 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
. $this->meta->language
|
||||
. $this->meta->attributes
|
||||
. chr(0x03); // end operations attribute
|
||||
|
||||
|
||||
$this->output = $this->stringjob;
|
||||
|
||||
|
||||
self::_putDebug("Request: ".$this->output);
|
||||
|
||||
|
||||
$post_values = array( "Content-Type" => "application/ipp",
|
||||
"Data" => $this->output);
|
||||
|
||||
if (self::_sendHttp ($post_values,'/')) {
|
||||
|
||||
|
||||
if (self::_sendHttp ($post_values,'/'))
|
||||
{
|
||||
|
||||
if(self::_parseServerOutput())
|
||||
{
|
||||
self::_parsePrinterAttributes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->attributes = &$this->printer_attributes;
|
||||
|
||||
if (isset($this->printer_attributes->printer_type)) {
|
||||
|
||||
if (isset($this->printer_attributes->printer_type))
|
||||
{
|
||||
$printer_type = $this->printer_attributes->printer_type->_value0;
|
||||
$table = self::_interpretPrinterType($printer_type);
|
||||
|
||||
for($i = 0 ; $i < count($table) ; $i++ ) {
|
||||
|
||||
for($i = 0 ; $i < count($table) ; $i++ )
|
||||
{
|
||||
$index = '_value'.$i;
|
||||
$this->printer_attributes->printer_type->$index = $table[$i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status)) {
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status))
|
||||
{
|
||||
|
||||
$this->status = array_merge($this->status,array($this->serveroutput->status));
|
||||
if ($this->serveroutput->status == "successfull-ok")
|
||||
{
|
||||
self::_errorLog("getting defaults: ".$this->serveroutput->status,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::_errorLog("getting defaults: ".$this->serveroutput->status,1);
|
||||
|
||||
return $this->serveroutput->status;
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
return $this->serveroutput->status;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->status = array_merge($this->status,array("OPERATION FAILED"));
|
||||
self::_errorLog("getting defaults : OPERATION FAILED",1);
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ cupsAcceptJobs ($printer_uri)
|
||||
public function cupsAcceptJobs($printer_uri) {
|
||||
|
||||
|
||||
public function cupsAcceptJobs($printer_uri)
|
||||
{
|
||||
//The CUPS-Get-Default operation returns the default printer URI and attributes
|
||||
|
||||
|
||||
$this->jobs = array_merge($this->jobs,array(""));
|
||||
$this->jobs_uri = array_merge($this->jobs_uri,array(""));
|
||||
$this->parsed = array();
|
||||
unset($this->printer_attributes);
|
||||
|
||||
|
||||
if (!isset($this->setup->charset))
|
||||
self::setCharset('us-ascii');
|
||||
|
||||
{
|
||||
self::setCharset();
|
||||
}
|
||||
|
||||
if (!isset($this->setup->language))
|
||||
{
|
||||
self::setLanguage('en');
|
||||
|
||||
}
|
||||
|
||||
self::_setOperationId();
|
||||
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
. chr(0x40). chr(0x08) // operation: cups vendor extension: Accept-Jobs
|
||||
. $this->meta->operation_id // request-id
|
||||
. chr(0x01) // start operation-attributes | operation-attributes-tag
|
||||
@ -171,65 +191,80 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
. self::_giveMeStringLength($printer_uri)
|
||||
. $printer_uri
|
||||
. chr(0x03); // end operations attribute
|
||||
|
||||
|
||||
$this->output = $this->stringjob;
|
||||
|
||||
|
||||
self::_putDebug("Request: ".$this->output);
|
||||
|
||||
|
||||
$post_values = array( "Content-Type" => "application/ipp",
|
||||
"Data" => $this->output);
|
||||
|
||||
if (self::_sendHttp ($post_values,'/admin/')) {
|
||||
|
||||
|
||||
if (self::_sendHttp ($post_values,'/admin/'))
|
||||
{
|
||||
|
||||
if(self::_parseServerOutput())
|
||||
{
|
||||
self::_parseAttributes();
|
||||
}
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status)) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status))
|
||||
{
|
||||
|
||||
$this->status = array_merge($this->status,array($this->serveroutput->status));
|
||||
if ($this->serveroutput->status == "successfull-ok")
|
||||
{
|
||||
self::_errorLog("getting defaults: ".$this->serveroutput->status,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::_errorLog("getting defaults: ".$this->serveroutput->status,1);
|
||||
|
||||
return $this->serveroutput->status;
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
return $this->serveroutput->status;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->status = array_merge($this->status,array("OPERATION FAILED"));
|
||||
self::_errorLog("getting defaults : OPERATION FAILED",1);
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ cupsRejectJobs ($printer_uri,$printer_state_message=false)
|
||||
public function cupsRejectJobs($printer_uri,$printer_state_message) {
|
||||
|
||||
public function cupsRejectJobs($printer_uri,$printer_state_message)
|
||||
{
|
||||
//The CUPS-Get-Default operation returns the default printer URI and attributes
|
||||
|
||||
|
||||
$this->jobs = array_merge($this->jobs,array(""));
|
||||
$this->jobs_uri = array_merge($this->jobs_uri,array(""));
|
||||
$this->parsed = array();
|
||||
unset($this->attributes);
|
||||
|
||||
|
||||
if (!isset($this->setup->charset))
|
||||
self::setCharset('us-ascii');
|
||||
|
||||
{
|
||||
self::setCharset();
|
||||
}
|
||||
|
||||
if (!isset($this->setup->language))
|
||||
{
|
||||
self::setLanguage('en');
|
||||
|
||||
}
|
||||
|
||||
self::_setOperationId();
|
||||
|
||||
|
||||
$message = "";
|
||||
if ($printer_state_message)
|
||||
{
|
||||
$message = chr(0x04) // start printer-attributes
|
||||
. chr(0x41) // textWithoutLanguage
|
||||
. self::_giveMeStringLength("printer-state-message")
|
||||
. "printer-state-message"
|
||||
. self::_giveMeStringLength($printer_state_message)
|
||||
. $printer_state_message;
|
||||
}
|
||||
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
. chr(0x40). chr(0x09) // operation: cups vendor extension: Reject-Jobs
|
||||
. $this->meta->operation_id // request-id
|
||||
. chr(0x01) // start operation-attributes | operation-attributes-tag
|
||||
@ -242,89 +277,111 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
. $printer_uri
|
||||
. $message
|
||||
. chr(0x03); // end operations attribute
|
||||
|
||||
|
||||
$this->output = $this->stringjob;
|
||||
|
||||
|
||||
self::_putDebug("Request: ".$this->output);
|
||||
|
||||
|
||||
$post_values = array( "Content-Type" => "application/ipp",
|
||||
"Data" => $this->output);
|
||||
|
||||
if (self::_sendHttp ($post_values,'/admin/')) {
|
||||
|
||||
|
||||
if (self::_sendHttp ($post_values,'/admin/'))
|
||||
{
|
||||
|
||||
if(self::_parseServerOutput())
|
||||
{
|
||||
self::_parseAttributes();
|
||||
}
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status)) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status))
|
||||
{
|
||||
|
||||
$this->status = array_merge($this->status,array($this->serveroutput->status));
|
||||
if ($this->serveroutput->status == "successfull-ok")
|
||||
{
|
||||
self::_errorLog("getting defaults: ".$this->serveroutput->status,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::_errorLog("getting defaults: ".$this->serveroutput->status,1);
|
||||
|
||||
return $this->serveroutput->status;
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
return $this->serveroutput->status;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->status = array_merge($this->status,array("OPERATION FAILED"));
|
||||
self::_errorLog("getting defaults : OPERATION FAILED",1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ getPrinters()
|
||||
public function getPrinters($printer_location=false,$printer_info=false,$attributes=array()) {
|
||||
|
||||
|
||||
public function getPrinters($printer_location=false,$printer_info=false,$attributes=array())
|
||||
{
|
||||
if (count($attributes) == 0)
|
||||
true;
|
||||
$attributes=array('printer-uri-supported','printer-location','printer-info','printer-type','color-supported');
|
||||
{
|
||||
true;
|
||||
}
|
||||
$attributes=array('printer-uri-supported', 'printer-location', 'printer-info', 'printer-type', 'color-supported', 'printer-name');
|
||||
$this->jobs = array_merge($this->jobs,array(""));
|
||||
$this->jobs_uri = array_merge($this->jobs_uri,array(""));
|
||||
|
||||
|
||||
unset ($this->printers_attributes);
|
||||
|
||||
|
||||
if (!isset($this->setup->charset))
|
||||
self::setCharset('us-ascii');
|
||||
|
||||
{
|
||||
self::setCharset();
|
||||
}
|
||||
|
||||
if (!isset($this->setup->language))
|
||||
{
|
||||
self::setLanguage('en-us');
|
||||
|
||||
}
|
||||
|
||||
self::_setOperationId();
|
||||
|
||||
|
||||
$this->meta->attributes='';
|
||||
|
||||
|
||||
if ($printer_location)
|
||||
{
|
||||
$this->meta->attributes .= chr(0x41) // textWithoutLanguage
|
||||
. self::_giveMeStringLength('printer-location')
|
||||
. 'printer-location'
|
||||
. self::_giveMeStringLength($printer_location)
|
||||
. $printer_location;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($printer_info)
|
||||
{
|
||||
$this->meta->attributes .= chr(0x41) // textWithoutLanguage
|
||||
. self::_giveMeStringLength('printer-info')
|
||||
. 'printer-info'
|
||||
. self::_giveMeStringLength($printer_info)
|
||||
. $printer_info;
|
||||
|
||||
}
|
||||
|
||||
for($i = 0 ; $i < count($attributes) ; $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
{
|
||||
$this->meta->attributes .= chr(0x44) // Keyword
|
||||
. self::_giveMeStringLength('requested-attributes')
|
||||
. 'requested-attributes'
|
||||
. self::_giveMeStringLength($attributes[0])
|
||||
. $attributes[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->meta->attributes .= chr(0x44) // Keyword
|
||||
. chr(0x0).chr(0x0) // zero-length name
|
||||
. self::_giveMeStringLength($attributes[$i])
|
||||
. $attributes[$i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
$this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1
|
||||
. chr(0x40). chr(0x02) // operation: cups vendor extension: get printers
|
||||
. $this->meta->operation_id // request-id
|
||||
. chr(0x01) // start operation-attributes | operation-attributes-tag
|
||||
@ -332,78 +389,89 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
. $this->meta->language
|
||||
. $this->meta->attributes
|
||||
. chr(0x03); // end operations attribute
|
||||
|
||||
|
||||
$this->output = $this->stringjob;
|
||||
|
||||
|
||||
$post_values = array( "Content-Type" => "application/ipp",
|
||||
"Data" => $this->output);
|
||||
|
||||
if (self::_sendHttp ($post_values,'/')) {
|
||||
|
||||
if(self::_parseServerOutput())
|
||||
$this->_getAvailablePrinters();
|
||||
|
||||
if (self::_sendHttp ($post_values,'/'))
|
||||
{
|
||||
|
||||
if(self::_parseServerOutput())
|
||||
{
|
||||
$this->_getAvailablePrinters();
|
||||
}
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status)) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($this->serveroutput) && isset($this->serveroutput->status))
|
||||
{
|
||||
|
||||
$this->status = array_merge($this->status,array($this->serveroutput->status));
|
||||
if ($this->serveroutput->status == "successfull-ok")
|
||||
{
|
||||
self::_errorLog("getting printers: ".$this->serveroutput->status,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::_errorLog("getting printers: ".$this->serveroutput->status,1);
|
||||
return $this->serveroutput->status;
|
||||
|
||||
} else {
|
||||
}
|
||||
return $this->serveroutput->status;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->status = array_merge($this->status,array("OPERATION FAILED"));
|
||||
self::_errorLog("getting printers : OPERATION FAILED",1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ cupsGetPrinters ()
|
||||
public function cupsGetPrinters () {
|
||||
// alias for getPrinters();
|
||||
|
||||
public function cupsGetPrinters ()
|
||||
{
|
||||
// alias for getPrinters();
|
||||
self::getPrinters();
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ getPrinterAttributes()
|
||||
public function getPrinterAttributes() {
|
||||
// complete informations from parent with Cups-specific stuff
|
||||
|
||||
|
||||
public function getPrinterAttributes()
|
||||
{
|
||||
// complete informations from parent with Cups-specific stuff
|
||||
|
||||
if(!$result = parent::getPrinterAttributes())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(!isset($this->printer_attributes))
|
||||
{
|
||||
return FALSE;
|
||||
|
||||
if (isset ($this->printer_attributes->printer_type)) {
|
||||
}
|
||||
|
||||
if (isset ($this->printer_attributes->printer_type))
|
||||
{
|
||||
$printer_type = $this->printer_attributes->printer_type->_value0;
|
||||
$table = self::_interpretPrinterType($printer_type);
|
||||
|
||||
for($i = 0 ; $i < count($table) ; $i++ ) {
|
||||
|
||||
for($i = 0 ; $i < count($table) ; $i++ )
|
||||
{
|
||||
$index = '_value'.$i;
|
||||
$this->printer_attributes->printer_type->$index = $table[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
//
|
||||
// SETUP
|
||||
//
|
||||
|
||||
// {{{ _initTags ()
|
||||
protected function _initTags () {
|
||||
|
||||
protected function _initTags ()
|
||||
{
|
||||
// override parent with specific cups attributes
|
||||
|
||||
$operation_tags = array ();
|
||||
|
||||
$operation_tags = array ();
|
||||
$this->operation_tags = array_merge ($this->operation_tags, $operation_tags);
|
||||
|
||||
|
||||
$job_tags = array ( "job-billing" => array("tag" => "textWithoutLanguage"),
|
||||
"blackplot" => array("tag" => "boolean"),
|
||||
"brightness" => array("tag" => "integer"),
|
||||
@ -430,25 +498,23 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
"saturation" => array("tag" => "integer"),
|
||||
"scaling" => array("tag" => "integer"),
|
||||
"wrap" => array("tag","boolean"),
|
||||
|
||||
|
||||
);
|
||||
$this->job_tags = array_merge ($this->job_tags, $job_tags);
|
||||
}
|
||||
// }}}
|
||||
|
||||
//
|
||||
// REQUEST BUILDING
|
||||
//
|
||||
|
||||
// {{{ _enumBuild ($tag,$value)
|
||||
protected function _enumBuild ($tag,$value) {
|
||||
|
||||
//
|
||||
// REQUEST BUILDING
|
||||
//
|
||||
protected function _enumBuild ($tag,$value)
|
||||
{
|
||||
$value_built = parent::_enumBuild($tag,$value);
|
||||
|
||||
|
||||
switch ($tag) {
|
||||
case "cpi":
|
||||
switch ($value) {
|
||||
switch ($tag)
|
||||
{
|
||||
case "cpi":
|
||||
switch ($value)
|
||||
{
|
||||
case '10':
|
||||
$value_built = chr(10);
|
||||
break;
|
||||
@ -463,7 +529,8 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
}
|
||||
break;
|
||||
case "lpi":
|
||||
switch ($value) {
|
||||
switch ($value)
|
||||
{
|
||||
case '6':
|
||||
$value_built = chr(6);
|
||||
break;
|
||||
@ -479,60 +546,66 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
$prepend = '';
|
||||
while ((strlen($value_built) + strlen($prepend)) < 4)
|
||||
$prepend .= chr(0);
|
||||
return $prepend.$value_built;
|
||||
return $prepend.$value_built;
|
||||
}
|
||||
// }}}
|
||||
|
||||
//
|
||||
// RESPONSE PARSING
|
||||
//
|
||||
|
||||
// {{{ _getAvailablePrinters ()
|
||||
private function _getAvailablePrinters () {
|
||||
|
||||
//
|
||||
// RESPONSE PARSING
|
||||
//
|
||||
private function _getAvailablePrinters ()
|
||||
{
|
||||
$this->available_printers = array();
|
||||
$this->printer_map = array();
|
||||
$k = 0;
|
||||
$this->printers_attributes = new stdClass();
|
||||
$this->printers_attributes = new \stdClass();
|
||||
|
||||
for ($i = 0 ; (array_key_exists($i,$this->serveroutput->response)) ; $i ++)
|
||||
if (($this->serveroutput->response[$i]['attributes']) == "printer-attributes") {
|
||||
{
|
||||
if (($this->serveroutput->response[$i]['attributes']) == "printer-attributes")
|
||||
{
|
||||
$phpname = "_printer".$k;
|
||||
$this->printers_attributes->$phpname = new stdClass();
|
||||
for ($j = 0 ; array_key_exists($j,$this->serveroutput->response[$i]) ; $j++) {
|
||||
|
||||
$this->printers_attributes->$phpname = new \stdClass();
|
||||
for ($j = 0 ; array_key_exists($j,$this->serveroutput->response[$i]) ; $j++)
|
||||
{
|
||||
|
||||
$value = $this->serveroutput->response[$i][$j]['value'];
|
||||
$name = str_replace("-","_",$this->serveroutput->response[$i][$j]['name']);
|
||||
|
||||
switch ($name) {
|
||||
|
||||
switch ($name)
|
||||
{
|
||||
case "printer_uri_supported":
|
||||
$this->available_printers = array_merge($this->available_printers,array($value));
|
||||
break;
|
||||
case "printer_type":
|
||||
$table = self::_interpretPrinterType($value);
|
||||
$this->printers_attributes->$phpname->$name = new stdClass();
|
||||
|
||||
for($l = 0 ; $l < count($table) ; $l++ ) {
|
||||
$this->printers_attributes->$phpname->$name = new \stdClass();
|
||||
|
||||
for($l = 0 ; $l < count($table) ; $l++ )
|
||||
{
|
||||
$index = '_value'.$l;
|
||||
$this->printers_attributes->$phpname->$name->$index = $table[$l];
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case '':
|
||||
break;
|
||||
case 'printer_name':
|
||||
$this->printer_map[$value] = $k;
|
||||
break;
|
||||
default:
|
||||
$this->printers_attributes->$phpname->$name = $value;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
$k ++;
|
||||
}
|
||||
}
|
||||
$k ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _getEnumVendorExtensions
|
||||
protected function _getEnumVendorExtensions ($value_parsed) {
|
||||
switch ($value_parsed) {
|
||||
|
||||
protected function _getEnumVendorExtensions ($value_parsed)
|
||||
{
|
||||
switch ($value_parsed)
|
||||
{
|
||||
case 0x4002:
|
||||
$value = 'Get-Availables-Printers';
|
||||
break;
|
||||
@ -541,110 +614,152 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($value))
|
||||
return ($value);
|
||||
|
||||
return sprintf('Unknown: 0x%x',$value_parsed);
|
||||
}
|
||||
// }}}
|
||||
if (isset($value))
|
||||
{
|
||||
return ($value);
|
||||
}
|
||||
|
||||
// {{{ _interpretPrinterType($type)
|
||||
private function _interpretPrinterType($value) {
|
||||
return sprintf('Unknown: 0x%x',$value_parsed);
|
||||
}
|
||||
|
||||
|
||||
private function _interpretPrinterType($value)
|
||||
{
|
||||
$value_parsed = 0;
|
||||
for ($i = strlen($value) ; $i > 0 ; $i --)
|
||||
{
|
||||
$value_parsed += pow(256,($i - 1)) * ord($value[strlen($value) - $i]);
|
||||
|
||||
}
|
||||
|
||||
$type[0] = $type[1] = $type[2] = $type[3] = $type[4] = $type[5] = '';
|
||||
$type[6] = $type[7] = $type[8] = $type[9] = $type[10] = '';
|
||||
$type[11] = $type[12] = $type[13] = $type[14] = $type[15] = '';
|
||||
$type[16] = $type[17] = $type[18] = $type[19] = '';
|
||||
|
||||
if ($value_parsed %2 == 1) {
|
||||
|
||||
if ($value_parsed %2 == 1)
|
||||
{
|
||||
$type[0] = 'printer-class';
|
||||
$value_parsed -= 1;
|
||||
}
|
||||
if ($value_parsed %4 == 2 ) {
|
||||
}
|
||||
|
||||
if ($value_parsed %4 == 2 )
|
||||
{
|
||||
$type[1] = 'remote-destination';
|
||||
$value_parsed -= 2;
|
||||
}
|
||||
if ($value_parsed %8 == 4 ) {
|
||||
}
|
||||
|
||||
if ($value_parsed %8 == 4 )
|
||||
{
|
||||
$type[2] = 'print-black';
|
||||
$value_parsed -= 4;
|
||||
}
|
||||
if ($value_parsed %16 == 8 ) {
|
||||
}
|
||||
|
||||
if ($value_parsed %16 == 8 )
|
||||
{
|
||||
$type[3] = 'print-color';
|
||||
$value_parsed -= 8;
|
||||
}
|
||||
if ($value_parsed %32 == 16) {
|
||||
}
|
||||
|
||||
if ($value_parsed %32 == 16)
|
||||
{
|
||||
$type[4] = 'hardware-print-on-both-sides';
|
||||
$value_parsed -= 16;
|
||||
}
|
||||
if ($value_parsed %64 == 32) {
|
||||
}
|
||||
|
||||
if ($value_parsed %64 == 32)
|
||||
{
|
||||
$type[5] = 'hardware-staple-output';
|
||||
$value_parsed -= 32;
|
||||
}
|
||||
if ($value_parsed %128 == 64) {
|
||||
}
|
||||
|
||||
if ($value_parsed %128 == 64)
|
||||
{
|
||||
$type[6] = 'hardware-fast-copies';
|
||||
$value_parsed -= 64;
|
||||
}
|
||||
if ($value_parsed %256 == 128) {
|
||||
}
|
||||
|
||||
if ($value_parsed %256 == 128)
|
||||
{
|
||||
$type[7] = 'hardware-fast-copy-collation';
|
||||
$value_parsed -= 128;
|
||||
}
|
||||
if ($value_parsed %512 == 256) {
|
||||
}
|
||||
|
||||
if ($value_parsed %512 == 256)
|
||||
{
|
||||
$type[8] = 'punch-output';
|
||||
$value_parsed -= 256;
|
||||
}
|
||||
if ($value_parsed %1024 == 512) {
|
||||
}
|
||||
|
||||
if ($value_parsed %1024 == 512)
|
||||
{
|
||||
$type[9] = 'cover-output';
|
||||
$value_parsed -= 512;
|
||||
}
|
||||
if ($value_parsed %2048 == 1024) {
|
||||
}
|
||||
|
||||
if ($value_parsed %2048 == 1024)
|
||||
{
|
||||
$type[10] = 'bind-output';
|
||||
$value_parsed -= 1024;
|
||||
}
|
||||
if ($value_parsed %4096 == 2048) {
|
||||
}
|
||||
|
||||
if ($value_parsed %4096 == 2048)
|
||||
{
|
||||
$type[11] = 'sort-output';
|
||||
$value_parsed -= 2048;
|
||||
}
|
||||
if ($value_parsed %8192 == 4096) {
|
||||
}
|
||||
|
||||
if ($value_parsed %8192 == 4096)
|
||||
{
|
||||
$type[12] = 'handle-media-up-to-US-Legal-A4';
|
||||
$value_parsed -= 4096;
|
||||
}
|
||||
if ($value_parsed %16384 == 8192) {
|
||||
}
|
||||
|
||||
if ($value_parsed %16384 == 8192)
|
||||
{
|
||||
$type[13] = 'handle-media-between-US-Legal-A4-and-ISO_C-A2';
|
||||
$value_parsed -= 8192;
|
||||
}
|
||||
if ($value_parsed %32768 == 16384) {
|
||||
}
|
||||
|
||||
if ($value_parsed %32768 == 16384)
|
||||
{
|
||||
$type[14] = 'handle-media-larger-than-ISO_C-A2';
|
||||
$value_parsed -= 16384;
|
||||
}
|
||||
if ($value_parsed %65536 == 32768) {
|
||||
}
|
||||
|
||||
if ($value_parsed %65536 == 32768)
|
||||
{
|
||||
$type[15] = 'handle-user-defined-media-sizes';
|
||||
$value_parsed -= 32768;
|
||||
}
|
||||
if ($value_parsed %131072 == 65536) {
|
||||
}
|
||||
|
||||
if ($value_parsed %131072 == 65536)
|
||||
{
|
||||
$type[16] = 'implicit-server-generated-class';
|
||||
$value_parsed -= 65536;
|
||||
}
|
||||
if ($value_parsed %262144 == 131072) {
|
||||
}
|
||||
|
||||
if ($value_parsed %262144 == 131072)
|
||||
{
|
||||
$type[17] = 'network-default-printer';
|
||||
$value_parsed -= 131072;
|
||||
}
|
||||
if ($value_parsed %524288 == 262144) {
|
||||
}
|
||||
|
||||
if ($value_parsed %524288 == 262144)
|
||||
{
|
||||
$type[18] = 'fax-device';
|
||||
$value_parsed -= 262144;
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
|
||||
// {{{ _interpretEnum()
|
||||
protected function _interpretEnum($attribute_name,$value) {
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
protected function _interpretEnum($attribute_name,$value)
|
||||
{
|
||||
$value_parsed = self::_interpretInteger($value);
|
||||
|
||||
switch ($attribute_name) {
|
||||
|
||||
switch ($attribute_name)
|
||||
{
|
||||
case 'cpi':
|
||||
case 'lpi':
|
||||
$value = $value_parsed;
|
||||
@ -652,20 +767,8 @@ class CupsPrintIPP extends ExtendedPrintIPP {
|
||||
default:
|
||||
$value = parent::_interpretEnum($attribute_name,$value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
// }}}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: php
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
?>
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,21 @@ create table llx_c_price_expression
|
||||
expression varchar(80) NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
--create table for user conf of printing driver
|
||||
CREATE TABLE llx_printing
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
printer_name text NOT NULL,
|
||||
printer_location text NOT NULL,
|
||||
printer_id varchar(255) NOT NULL,
|
||||
copy integer NOT NULL DEFAULT '1',
|
||||
module varchar(16) NOT NULL,
|
||||
driver varchar(16) NOT NULL,
|
||||
userid integer
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD fk_price_expression integer DEFAULT NULL;
|
||||
|
||||
-- Taiwan VAT Rates
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2013 Florian HENRY <florian.henry@open-concept.pro>
|
||||
-- Copyright (C) 2013 Florian HENRY <florian.henry@open-concept.pro>
|
||||
-- Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
@ -16,15 +17,16 @@
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
CREATE TABLE llx_printer_ipp
|
||||
CREATE TABLE llx_printing
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
datec datetime,
|
||||
printer_name text NOT NULL,
|
||||
printer_location text NOT NULL,
|
||||
printer_uri varchar(255) NOT NULL,
|
||||
printer_id varchar(255) NOT NULL,
|
||||
copy integer NOT NULL DEFAULT '1',
|
||||
module varchar(16) NOT NULL,
|
||||
login varchar(32) NOT NULL
|
||||
driver varchar(16) NOT NULL,
|
||||
userid integer
|
||||
)ENGINE=innodb;
|
||||
@ -685,6 +685,7 @@ XMoreLines=%s line(s) hidden
|
||||
PublicUrl=Public URL
|
||||
AddBox=Add box
|
||||
SelectElementAndClickRefresh=Select an element and click Refresh
|
||||
PrintFile=Print File %s
|
||||
# Week day
|
||||
Monday=Monday
|
||||
Tuesday=Tuesday
|
||||
|
||||
25
htdocs/langs/en_US/printgcp.lang
Normal file
25
htdocs/langs/en_US/printgcp.lang
Normal file
@ -0,0 +1,25 @@
|
||||
# Dolibarr language file - Source file is en_US - printgccp
|
||||
PRINTGCP=Google Cloud Print
|
||||
PrintGCPDesc=This driver allow to send documents directly to a printer with Google Cloud Print.
|
||||
PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print.
|
||||
PrintTestDescprintgcp=List of Printers for Google Cloud Print.
|
||||
PRINTGCP_LOGIN=Google Account Login
|
||||
PRINTGCP_PASSWORD=Google Account Password
|
||||
STATE_ONLINE=Online
|
||||
STATE_UNKNOWN=Unknown
|
||||
STATE_OFFLINE=Offline
|
||||
STATE_DORMANT=Offline for quite a while
|
||||
TYPE_GOOGLE=Google
|
||||
TYPE_HP=HP Printer
|
||||
TYPE_DOCS=DOCS
|
||||
TYPE_DRIVE=Google Drive
|
||||
TYPE_FEDEX=Fedex
|
||||
TYPE_ANDROID_CHROME_SNAPSHOT=Android
|
||||
TYPE_IOS_CHROME_SNAPSHOT=IOS
|
||||
GCP_Name=Name
|
||||
GCP_displayName=Display Name
|
||||
GCP_Id=Printer Id
|
||||
GCP_OwnerName=Owner Name
|
||||
GCP_State=Printer State
|
||||
GCP_connectionStatus=Online State
|
||||
GCP_Type=Printer Type
|
||||
10
htdocs/langs/en_US/printing.lang
Normal file
10
htdocs/langs/en_US/printing.lang
Normal file
@ -0,0 +1,10 @@
|
||||
# Dolibarr language file - Source file is en_US - printing
|
||||
PrintingSetup=Setup of Printing System
|
||||
PrintingDesc=This module adds a Print button to send documents directly to a printer with various module.
|
||||
ModuleDriverSetup=Setup Module Driver
|
||||
PrintingDriverDesc=Configuration variables for printing driver.
|
||||
ListDrivers=List of drivers
|
||||
PrintTestDesc=List of Printers.
|
||||
FileWasSentToPrinter=File %s was sent to printer
|
||||
NoActivePrintingModuleFound=No active module to print document
|
||||
PleaseSelectaDriverfromList=Please select a driver from list.
|
||||
@ -1,6 +1,9 @@
|
||||
# Dolibarr language file - Source file is en_US - printipp
|
||||
PRINTIPP=PrintIPP Driver
|
||||
PrintIPPSetup=Setup of Direct Print module
|
||||
PrintIPPDesc=This module adds a Print button to send documents directly to a printer. It requires a Linux system with CUPS installed.
|
||||
PrintIPPDesc=This driver allow to send documents directly to a printer. It requires a Linux system with CUPS installed.
|
||||
PrintingDriverDescprintipp=Configuration variables for printing driver PrintIPP.
|
||||
PrintTestDescprintipp=List of Printers for driver PrintIPP.
|
||||
PRINTIPP_ENABLED=Show "Direct print" icon in document lists
|
||||
PRINTIPP_HOST=Print server
|
||||
PRINTIPP_PORT=Port
|
||||
@ -12,3 +15,23 @@ NoDefaultPrinterDefined=No default printer defined
|
||||
DefaultPrinter=Default printer
|
||||
Printer=Printer
|
||||
CupsServer=CUPS Server
|
||||
IPP_Uri=Printer Uri
|
||||
IPP_Name=Printer Name
|
||||
IPP_State=Printer State
|
||||
IPP_State_reason=State reason
|
||||
IPP_State_reason1=State reason1
|
||||
IPP_BW=BW
|
||||
IPP_Color=Color
|
||||
IPP_Device=Device
|
||||
IPP_Media=Printer media
|
||||
IPP_Supported=Type of media
|
||||
STATE_IPP_idle=Idle
|
||||
STATE_IPP_stopped=Stopped
|
||||
STATE_IPP_paused=Paused
|
||||
STATE_IPP_toner-low-report=Low Toner
|
||||
STATE_IPP_none=None
|
||||
MEDIA_IPP_stationery=Stationery
|
||||
MEDIA_IPP_thermal=Thermal
|
||||
IPP_COLOR_print-black=BW Printer
|
||||
IPP_COLOR_print-color=Color Printer
|
||||
IPP_COLOR_=No
|
||||
|
||||
277
htdocs/printing/admin/printing.php
Normal file
277
htdocs/printing/admin/printing.php
Normal file
@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/printing/admin/printing.php
|
||||
* \ingroup printing
|
||||
* \brief Page to setup printing module
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/printing/lib/printing.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("printing");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$mode = GETPOST('mode','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$varname = GETPOST('varname', 'alpha');
|
||||
$driver = GETPOST('driver', 'alpha');
|
||||
|
||||
if (! empty($driver)) $langs->load($driver);
|
||||
|
||||
if (!$mode) $mode='config';
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (($mode == 'test' || $mode == 'setup') && empty($driver))
|
||||
{
|
||||
setEventMessage($langs->trans('PleaseSelectaDriverfromList'));
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?mode=config');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'setconst' && $user->admin)
|
||||
{
|
||||
$error=0;
|
||||
$db->begin();
|
||||
foreach ($_POST['setupdriver'] as $setupconst) {
|
||||
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
||||
$result=dolibarr_set_const($db, $setupconst['varname'],$setupconst['value'],'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=dolibarr_set_const($db, $varname, $value,'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("PrintingSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("PrintingSetup"),$linkback,'setup');
|
||||
|
||||
$head=printingadmin_prepare_head();
|
||||
|
||||
if ($mode == 'setup' && $user->admin)
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleDriverSetup"), 0, 'technic');
|
||||
|
||||
print $langs->trans("PrintingDriverDesc".$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th>'.$langs->trans("Value").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
if (! empty($driver)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
$classname = 'printing_'.$driver;
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
$i=0;
|
||||
foreach ($printer->conf as $key) {
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td'.($key['required']?' class=required':'').'>'.$langs->trans($key['varname']).'</td><td>';
|
||||
print '<input size="32" type="'.(empty($key['type'])?'text':$key['type']).'" name="setupdriver['.$i.'][value]" value="'.$conf->global->{$key['varname']}.'">';
|
||||
print '<input type="hidden" name="setupdriver['.$i.'][varname]" value="'.$key['varname'].'">';
|
||||
print ' '.($key['example']!=''?$langs->trans("Example").' : '.$key['example']:'');
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print $langs->trans('PleaseSelectaDriverfromList');
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
if (! empty($driver)) {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></center>';
|
||||
}
|
||||
print '</form>';
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
if ($mode == 'config' && $user->admin)
|
||||
{
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
|
||||
print $langs->trans("PrintingDesc")."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Active").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Setup").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Test").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
$object = new PrintingDriver($db);
|
||||
$result = $object->listDrivers($db, 10);
|
||||
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);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.img_picto('', $printer->picto).$langs->trans($printer->desc).'</td>';
|
||||
print '<td class="center">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff($printer->active);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->{$printer->conf}))
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setvalue&varname='.$printer->active.'&value=1">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setvalue&varname='.$printer->active.'&value=0">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||
}
|
||||
}
|
||||
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?mode=setup&driver='.$printer->name.'">'.img_picto('', 'setup').'</a></td>';
|
||||
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?mode=test&driver='.$printer->name.'">'.img_picto('', 'setup').'</a></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
if ($mode == 'test' && $user->admin)
|
||||
{
|
||||
dol_fiche_head($head, $mode, $langs->trans("PrintingTest"), 0, 'technic');
|
||||
|
||||
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
if (! empty($driver)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
$classname = 'printing_'.$driver;
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
print $printer->listAvailablePrinters();
|
||||
|
||||
} else {
|
||||
print $langs->trans('PleaseSelectaDriverfromList');
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
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 '<th class="center">'.$langs->trans("Delete").'</th>';
|
||||
print "</tr>\n";
|
||||
$sql = 'SELECT p.rowid, 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 '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,20 +17,21 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/printipp/index.php
|
||||
* \ingroup printipp
|
||||
* \brief Printipp
|
||||
* \file htdocs/printing/index.php
|
||||
* \ingroup printing
|
||||
* \brief Printing
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php';
|
||||
|
||||
llxHeader("",$langs->trans("Printer"));
|
||||
llxHeader("",$langs->trans("Printing"));
|
||||
|
||||
print_fiche_titre($langs->trans("Printer"));
|
||||
print_fiche_titre($langs->trans("Printing"));
|
||||
|
||||
$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
|
||||
$printer->list_jobs('commande');
|
||||
// List Jobs from printing modules
|
||||
//$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
|
||||
//$printer->list_jobs('commande');
|
||||
|
||||
llxFooter();
|
||||
|
||||
0
htdocs/printing/lib/index.html
Normal file
0
htdocs/printing/lib/index.html
Normal file
@ -16,44 +16,54 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/printipp/lib/printipp.lib.php
|
||||
* \ingroup printipp
|
||||
* \brief Library for printipp functions
|
||||
* \file htdocs/printing/lib/printing.lib.php
|
||||
* \ingroup printing
|
||||
* \brief Library for printing functions
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define head array for tabs of printipp tools setup pages
|
||||
* Define head array for tabs of printing tools setup pages
|
||||
*
|
||||
* @return Array of head
|
||||
*/
|
||||
function printippadmin_prepare_head()
|
||||
function printingadmin_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/printipp/admin/printipp.php?mode=config";
|
||||
$head[$h][1] = $langs->trans("CupsServer");
|
||||
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=config";
|
||||
$head[$h][1] = $langs->trans("ListDrivers");
|
||||
$head[$h][2] = 'config';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/printipp/admin/printipp.php?mode=test";
|
||||
$head[$h][1] = $langs->trans("Printer");
|
||||
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup";
|
||||
$head[$h][1] = $langs->trans("SetupDriver");
|
||||
$head[$h][2] = 'setup';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test";
|
||||
$head[$h][1] = $langs->trans("TestDriver");
|
||||
$head[$h][2] = 'test';
|
||||
$h++;
|
||||
|
||||
$object=new stdClass();
|
||||
$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
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'printippadmin');
|
||||
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'printipp','remove');
|
||||
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@ -1,246 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/printipp/admin/printipp.php
|
||||
* \ingroup printipp
|
||||
* \brief Page to setup printipp module
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/printipp/lib/printipp.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("printipp");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$mode = GETPOST('mode','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
|
||||
if (!$mode) $mode='config';
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PRINTIPP_HOST",GETPOST('PRINTIPP_HOST','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PRINTIPP_PORT",GETPOST('PRINTIPP_PORT','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PRINTIPP_USER",GETPOST('PRINTIPP_USER','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
$result=dolibarr_set_const($db, "PRINTIPP_PASSWORD",GETPOST('PRINTIPP_PASSWORD','alpha'),'chaine',0,'',$conf->entity);
|
||||
if (! $result > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
else if ($action == 'setprinteruri')
|
||||
{
|
||||
if (dolibarr_set_const($db, "PRINTIPP_URI_DEFAULT",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->PRINTIPP_URI_DEFAULT = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("PrintIPPSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("PrintIPPSetup"),$linkback,'setup');
|
||||
|
||||
$head=printippadmin_prepare_head();
|
||||
|
||||
|
||||
if ($mode == 'config' && $user->admin)
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setvalue">';
|
||||
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
|
||||
print $langs->trans("PrintIPPDesc")."<br><br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$var=true;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
/*
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PRINTIPP_ENABLED").'</td><td colspan="2" align="left">';
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('PRINTIPP_ENABLED');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->PRINTIPP_ENABLED))
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_PRINTIPP_ENABLED">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_PRINTIPP_ENABLED">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||
print $langs->trans("PRINTIPP_HOST").'</td><td>';
|
||||
print '<input size="64" type="text" name="PRINTIPP_HOST" value="'.$conf->global->PRINTIPP_HOST.'">';
|
||||
print ' '.$langs->trans("Example").': localhost';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td class="fieldrequired">';
|
||||
print $langs->trans("PRINTIPP_PORT").'</td><td>';
|
||||
print '<input size="32" type="text" name="PRINTIPP_PORT" value="'.$conf->global->PRINTIPP_PORT.'">';
|
||||
print ' '.$langs->trans("Example").': 631';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PRINTIPP_USER").'</td><td>';
|
||||
print '<input size="32" type="text" name="PRINTIPP_USER" value="'.$conf->global->PRINTIPP_USER.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("PRINTIPP_PASSWORD").'</td><td>';
|
||||
print '<input size="32" type="text" name="PRINTIPP_PASSWORD" value="'.$conf->global->PRINTIPP_PASSWORD.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
//$var=true;
|
||||
//print '<tr class="liste_titre">';
|
||||
//print '<td>'.$langs->trans("OtherParameter").'</td>';
|
||||
//print '<td>'.$langs->trans("Value").'</td>';
|
||||
//print "</tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></center>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
if ($mode == 'test' && $user->admin)
|
||||
{
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
|
||||
|
||||
print $langs->trans("PrintIPPDesc")."<br><br>\n";
|
||||
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
|
||||
$var=true;
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>Uri</td>';
|
||||
print '<td>Name</td>';
|
||||
print '<td>State</td>';
|
||||
print '<td>State_reason</td>';
|
||||
print '<td>State_reason1</td>';
|
||||
print '<td>BW</td>';
|
||||
print '<td>Color</td>';
|
||||
//print '<td>Device</td>';
|
||||
print '<td>Media</td>';
|
||||
print '<td>Supported</td>';
|
||||
print '<td>'.$langs->trans("Select").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$list = $printer->getlist_available_printers();
|
||||
$var = true;
|
||||
foreach ($list as $value)
|
||||
{
|
||||
$var=!$var;
|
||||
$printer_det = $printer->get_printer_detail($value);
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$value.'</td>';
|
||||
//print '<td><pre>'.print_r($printer_det,true).'</pre></td>';
|
||||
print '<td>'.$printer_det->printer_name->_value0.'</td>';
|
||||
print '<td>'.$printer_det->printer_state->_value0.'</td>';
|
||||
print '<td>'.$printer_det->printer_state_reasons->_value0.'</td>';
|
||||
print '<td>'.$printer_det->printer_state_reasons->_value1.'</td>';
|
||||
print '<td>'.$printer_det->printer_type->_value2.'</td>';
|
||||
print '<td>'.$printer_det->printer_type->_value3.'</td>';
|
||||
//print '<td>'.$printer_det->device_uri->_value0.'</td>';
|
||||
print '<td>'.$printer_det->media_default->_value0.'</td>';
|
||||
print '<td>'.$printer_det->media_type_supported->_value1.'</td>';
|
||||
// Defaut
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->PRINTIPP_URI_DEFAULT == "$value")
|
||||
{
|
||||
print img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setprinteruri&mode=test&value='.urlencode($value).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
if (count($list) == 0) print $langs->trans("NoPrinterFound");
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
Loading…
Reference in New Issue
Block a user