diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 89a78b5d6da..a0f535c2b7b 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -249,7 +249,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print '
'; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 3c251cf6c3b..a7692655a0a 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -296,7 +296,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print '
'; -$head = invoice_admin_prepare_head(null); +$head = invoice_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice'); /* diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 90ceed434c2..81b7e74a479 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -73,7 +73,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print "
\n"; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 8f1dfb80538..515714a51e4 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -74,7 +74,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print "
\n"; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index aef978ec6ad..01f32740036 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -263,7 +263,7 @@ $form=new Form($db); $linkback='
'.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(null); +$head = propal_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Proposals"), 0, 'propal'); @@ -602,7 +602,7 @@ if ($conf->banque->enabled) { $var=!$var; print ''; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL'); diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 5745c5f82ba..2f48eb2be79 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -198,7 +198,7 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index ac2ab824233..2d4be98f34a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -199,7 +199,7 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index ba584bdae8c..79dc0637b46 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -75,7 +75,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
\n"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 4a2671942fa..96e20b92f17 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -73,7 +73,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
\n"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index d41dd27b362..2a1a2286db5 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -69,7 +69,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(null); +$head = propal_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), 0, 'propal'); diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index e83f31e993f..40dbad4ef94 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -74,7 +74,7 @@ llxHeader('',$langs->trans("PropalSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(null); +$head = propal_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), 0, 'propal'); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 6e105acea6d..0ac5d78aead 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -553,6 +553,8 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST( } } +include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php'; + /* * Send mail diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e31de409403..1291d6cce26 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1115,15 +1115,6 @@ else if ($action == 'remove_file') { } } -// Print file -else if ($action == 'print_file' and $user->rights->printipp->read) { - 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); - $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); - setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file'))); - $action = ''; -} - else if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); @@ -1151,6 +1142,9 @@ else if ($action == 'update_extras') { $action = 'edit_extras'; } +include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php'; + + /* * Send mail */ diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9d003ae0aa7..4f8eb73a8db 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1615,14 +1615,7 @@ else if ($action == 'remove_file') { } } -// Print file -else if ($action == 'print_file' and $user->rights->printipp->read) { - 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); - $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); - setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file'))); - $action = ''; -} +include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) { diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index 4f5d2ba1bcf..6d60180593a 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -70,7 +70,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print '
'; -$head = invoice_admin_prepare_head(null); +$head = invoice_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice'); diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index 9c1240a28c9..fd4284a01dd 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -71,7 +71,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print '
'; -$head = invoice_admin_prepare_head(null); +$head = invoice_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("Invoices"), 0, 'invoice'); diff --git a/htdocs/core/actions_printipp.inc.php b/htdocs/core/actions_printipp.inc.php new file mode 100644 index 00000000000..3c18faa813b --- /dev/null +++ b/htdocs/core/actions_printipp.inc.php @@ -0,0 +1,45 @@ + + * + * 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 . + * 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 = ''; +} diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 33888b057b7..c400dc151d3 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -253,7 +253,7 @@ class DolGraph /** * Set legend * - * @param string $legend Legend + * @param array $legend Legend. Example: array('seriename1','seriname2',...) * @return void */ function SetLegend($legend) diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 942ee3da3c3..71ee2a1be37 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -83,19 +83,22 @@ class dolprintIPP * @param string $file file * @param string $module module * - * @return void + * @return string '' if OK, Error message if KO */ - function print_file($file,$module) + function print_file($file, $module) { global $conf,$db; + include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; + $ipp = new CupsPrintIPP(); - $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose + $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_uri,copy FROM '.MAIN_DB_PREFIX.'printer_ipp WHERE module="'.$module.'"'; $result = $this->db->query($sql); @@ -108,13 +111,23 @@ class dolprintIPP } else { - $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); + 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); $ipp->setData(DOL_DATA_ROOT.'/'.$module.'/'.$file); $ipp->printJob(); + + return ''; } /** diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 42e0c4c9523..824bd4f3ae9 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -270,7 +270,13 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false; + + $printer=0; + if (in_array($modulepart,array('facture','propal','proposal','order','commande'))) // This feature is implemented only for such elements + { + $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false; + } + $hookmanager->initHooks(array('formfile')); $forname='builddoc'; $out=''; diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index bc0422a5fb4..243b862ff88 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -52,7 +52,6 @@ if (empty($font_loc)) die('DOL_DEFAULT_TTF_BOLD must de defined with full path t if (defined('PHP-BARCODE_PATH_COMMAND')) $genbarcode_loc=constant('PHP-BARCODE_PATH_COMMAND'); else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; -//dol_syslog("genbarcode_loc=".$genbarcode_loc." - env_windows=".$_SERVER['WINDIR']); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 964dcfbb0c6..4dd9a51d0b7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -217,10 +217,9 @@ function societe_prepare_head2($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object Thirdparty * @return array head array with tabs */ -function societe_admin_prepare_head($object) +function societe_admin_prepare_head() { global $langs, $conf, $user; @@ -236,7 +235,7 @@ function societe_admin_prepare_head($object) // 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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin'); $head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsThirdParties"); @@ -248,7 +247,7 @@ function societe_admin_prepare_head($object) $head[$h][2] = 'attributes_contacts'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove'); return $head; } diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index c1e37f3c485..e4e7b04b057 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -160,10 +160,9 @@ function ordersupplier_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object order * @return array head array with tabs */ -function supplierorder_admin_prepare_head($object) +function supplierorder_admin_prepare_head() { global $langs, $conf, $user; @@ -180,7 +179,7 @@ function supplierorder_admin_prepare_head($object) $head[$h][2] = 'invoice'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin'); $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders"); @@ -192,7 +191,7 @@ function supplierorder_admin_prepare_head($object) $head[$h][2] = 'supplierinvoice'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'supplierorder_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'supplierorder_admin','remove'); return $head; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 84bf351e7b9..3ad081b1158 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4612,26 +4612,26 @@ function picto_from_langcode($codelang) * Complete or removed entries into a head array (used to build tabs) with value added by external modules. * Such values are declared into $conf->modules_parts['tab']. * - * @param Conf $conf Object conf - * @param Translate $langs Object langs - * @param Object $object Object object - * @param array $head Object head - * @param int $h New position to fill - * @param string $type Value for object where objectvalue can be - * 'thirdparty' to add a tab in third party view - * 'intervention' to add a tab in intervention view - * 'supplier_order' to add a tab in supplier order view - * 'supplier_invoice' to add a tab in supplier invoice view - * 'invoice' to add a tab in customer invoice view - * 'order' to add a tab in customer order view - * 'product' to add a tab in product view - * 'propal' to add a tab in propal view - * 'user' to add a tab in user view - * 'group' to add a tab in group view - * 'member' to add a tab in fundation member view - * 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member) - * 'ecm' to add a tab for another ecm view - * @param string $mode 'add' to complete head, 'remove' to remove entries + * @param Conf $conf Object conf + * @param Translate $langs Object langs + * @param Object|null $object Object object + * @param array $head Object head + * @param int $h New position to fill + * @param string $type Value for object where objectvalue can be + * 'thirdparty' to add a tab in third party view + * 'intervention' to add a tab in intervention view + * 'supplier_order' to add a tab in supplier order view + * 'supplier_invoice' to add a tab in supplier invoice view + * 'invoice' to add a tab in customer invoice view + * 'order' to add a tab in customer order view + * 'product' to add a tab in product view + * 'propal' to add a tab in propal view + * 'user' to add a tab in user view + * 'group' to add a tab in group view + * 'member' to add a tab in fundation member view + * 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member) + * 'ecm' to add a tab for another ecm view + * @param string $mode 'add' to complete head, 'remove' to remove entries * @return void */ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add') diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index b26326ae5e7..ac9da88bdc2 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -106,10 +106,9 @@ function facture_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object Invoice * @return array head array with tabs */ -function invoice_admin_prepare_head($object) +function invoice_admin_prepare_head() { global $langs, $conf, $user; @@ -125,7 +124,7 @@ function invoice_admin_prepare_head($object) // 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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin'); $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices"); @@ -137,7 +136,7 @@ function invoice_admin_prepare_head($object) $head[$h][2] = 'attributeslines'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'invoice_admin','remove'); return $head; } diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index caee12ed135..d5a362663b7 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -117,7 +117,7 @@ function show_ldap_test_button($butlabel,$testlabel,$key,$dn,$objectclass) /** * Show a LDAP array into an HTML output array. * - * @param string $result Array to show. This array is already encoded into charset_output + * @param array $result Array to show. This array is already encoded into charset_output * @param int $level Level * @param int $count Count * @param string $var Var diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index ba3e8344f47..abdf1b648a5 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -116,10 +116,9 @@ function commande_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object order - * @return array head array with tabs + * @return array head array with tabs */ -function order_admin_prepare_head($object) +function order_admin_prepare_head() { global $langs, $conf, $user; @@ -131,7 +130,7 @@ function order_admin_prepare_head($object) $head[$h][2] = 'general'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin'); $head[$h][0] = DOL_URL_ROOT.'/admin/order_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); @@ -143,7 +142,7 @@ function order_admin_prepare_head($object) $head[$h][2] = 'attributeslines'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'order_admin','remove'); return $head; } diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 33ded69b802..741dd98de6d 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -147,10 +147,9 @@ function product_prepare_head($object, $user) /** * Return array head with list of tabs to view object informations. * -* @param Object $object Product * @return array head array with tabs */ -function product_admin_prepare_head($object=null) +function product_admin_prepare_head() { global $langs, $conf, $user; @@ -166,14 +165,14 @@ function product_admin_prepare_head($object=null) // 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,'product_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin'); $head[$h][0] = DOL_URL_ROOT.'/product/admin/product_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'product_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'product_admin','remove'); return $head; } diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 8a96b86c967..fd227d512b7 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -110,10 +110,9 @@ function propal_prepare_head($object) /** * Return array head with list of tabs to view object informations. * - * @param Object $object Propal * @return array head array with tabs */ -function propal_admin_prepare_head($object) +function propal_admin_prepare_head() { global $langs, $conf, $user; @@ -129,7 +128,7 @@ function propal_admin_prepare_head($object) // 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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin'); + complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin'); $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); @@ -141,7 +140,7 @@ function propal_admin_prepare_head($object) $head[$h][2] = 'attributeslines'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin','remove'); return $head; } diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 5ae50b7629a..0abec31b6fd 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -242,9 +242,9 @@ function entity_prepare_head($object, $aEntities) /** * Show list of themes. Show all thumbs of themes * - * @param User $fuser User concerned or null for global theme - * @param int $edit 1 to add edit form - * @param boolean $foruserprofile Show for user profile view + * @param User|null $fuser User concerned or null for global theme + * @param int $edit 1 to add edit form + * @param boolean $foruserprofile Show for user profile view * @return void */ function show_theme($fuser,$edit=0,$foruserprofile=false) diff --git a/htdocs/core/modules/modPrintIPP.class.php b/htdocs/core/modules/modPrintIPP.class.php index d9e2166b4e6..3cdcd6cdfa6 100644 --- a/htdocs/core/modules/modPrintIPP.class.php +++ b/htdocs/core/modules/modPrintIPP.class.php @@ -51,7 +51,7 @@ class modPrintIPP extends DolibarrModules // 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->version = 'experimental'; // 'development' or 'experimental' or 'dolibarr' or version + $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) $this->special = 1; @@ -67,10 +67,11 @@ class modPrintIPP extends DolibarrModules $this->config_page_url = array("printipp.php@printipp"); // 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,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"); diff --git a/htdocs/langs/en_US/printipp.lang b/htdocs/langs/en_US/printipp.lang index cc719fddded..835e6827f12 100644 --- a/htdocs/langs/en_US/printipp.lang +++ b/htdocs/langs/en_US/printipp.lang @@ -7,3 +7,8 @@ PRINTIPP_PORT=Port PRINTIPP_USER=Login PRINTIPP_PASSWORD=Password NoPrinterFound=No printers found (check your CUPS setup) +FileWasSentToPrinter=File %s was sent to printer +NoDefaultPrinterDefined=No default printer defined +DefaultPrinter=Default printer +Printer=Printer +CupsServer=CUPS Server diff --git a/htdocs/printipp/admin/printipp.php b/htdocs/printipp/admin/printipp.php index 6aaf44f8bdd..28ad55453eb 100644 --- a/htdocs/printipp/admin/printipp.php +++ b/htdocs/printipp/admin/printipp.php @@ -35,6 +35,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha'); +$value = GETPOST('value','alpha'); if (!$mode) $mode='config'; @@ -68,6 +69,17 @@ if ($action == 'setvalue' && $user->admin) } } +// 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 @@ -82,11 +94,6 @@ print_fiche_titre($langs->trans("PrintIPPSetup"),$linkback,'setup'); $head=printippadmin_prepare_head(); -dol_fiche_head($head, $mode, $langs->trans("ModuleSetup")); - -print $langs->trans("PrintIPPDesc")."
\n"; - -print '
'; if ($mode == 'config' && $user->admin) { @@ -94,8 +101,11 @@ if ($mode == 'config' && $user->admin) print ''; print ''; + dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic'); - print ''; + print $langs->trans("PrintIPPDesc")."

\n"; + + print '
'; $var=true; print ''; @@ -103,8 +113,9 @@ if ($mode == 'config' && $user->admin) print ''; print "\n"; + /* $var=!$var; - print ''; - + */ + $var=!$var; print ''; $var=!$var; - print ''; $var=!$var; - print ''; @@ -156,16 +168,22 @@ if ($mode == 'config' && $user->admin) //print ''; //print "\n"; - print ''; - print '
'.$langs->trans("Value").'
'; + print '
'; print $langs->trans("PRINTIPP_ENABLED").''; if (! empty($conf->use_javascript_ajax)) @@ -123,7 +134,8 @@ if ($mode == 'config' && $user->admin) } } print '
'; print $langs->trans("PRINTIPP_HOST").''; @@ -139,13 +151,13 @@ if ($mode == 'config' && $user->admin) print '
'; + print '
'; print $langs->trans("PRINTIPP_USER").''; print ''; print '
'; + print '
'; print $langs->trans("PRINTIPP_PASSWORD").''; print ''; print '
'.$langs->trans("Value").'

'; + dol_fiche_end(); + + print '
'; + print ''; } if ($mode == 'test' && $user->admin) { - print ''; + dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic'); + + print $langs->trans("PrintIPPDesc")."

\n"; + + print '
'; $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 '
'; @@ -180,6 +198,7 @@ if ($mode == 'test' && $user->admin) //print ''; print ''; print ''; + print ''; print "\n"; $list = $printer->getlist_available_printers(); @@ -200,14 +219,26 @@ if ($mode == 'test' && $user->admin) //print ''; print ''; print ''; + // Defaut + print "'; print "\n"; } print '
DeviceMediaSupported'.$langs->trans("Select").'
'.$printer_det->device_uri->_value0.''.$printer_det->media_default->_value0.''.$printer_det->media_type_supported->_value1.'"; + if ($conf->global->PRINTIPP_URI_DEFAULT == "$value") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print ''.img_picto($langs->trans("Disabled"),'off').''; + } + print '
'; if (count($list) == 0) print $langs->trans("NoPrinterFound"); + + dol_fiche_end(); } -dol_fiche_end(); llxFooter(); diff --git a/htdocs/printipp/lib/printipp.lib.php b/htdocs/printipp/lib/printipp.lib.php index c87080032f5..64c14609df5 100644 --- a/htdocs/printipp/lib/printipp.lib.php +++ b/htdocs/printipp/lib/printipp.lib.php @@ -36,12 +36,12 @@ function printippadmin_prepare_head() $head = array(); $head[$h][0] = DOL_URL_ROOT."/printipp/admin/printipp.php?mode=config"; - $head[$h][1] = $langs->trans("Config"); + $head[$h][1] = $langs->trans("CupsServer"); $head[$h][2] = 'config'; $h++; $head[$h][0] = DOL_URL_ROOT."/printipp/admin/printipp.php?mode=test"; - $head[$h][1] = $langs->trans("Test"); + $head[$h][1] = $langs->trans("Printer"); $head[$h][2] = 'test'; $h++; diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 9bb756ac7ee..a0b72c80aea 100644 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -68,7 +68,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup'); -$head = societe_admin_prepare_head(null); +$head = societe_admin_prepare_head(); dol_fiche_head($head, 'attributes_contacts', $langs->trans("ThirdParties"), 0, 'company');