diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 52b7761adbe..38ea4c57355 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1103,11 +1103,13 @@ else if ($action == 'remove_file')
}
// Print file
-else if ($action == 'print_file' AND $user->rights->printipp->use)
+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='';
}
/*
@@ -2363,7 +2365,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$genallowed=$user->rights->commande->creer;
$delallowed=$user->rights->commande->supprimer;
$printer = false;
- if ($user->rights->printipp->use AND $conf->printipp->enabled) $printer = true;
+ if ($user->rights->printipp->read AND $conf->printipp->enabled) $printer = true;
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$printer);
/*
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 3a28ddb22a5..108d3441c16 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1674,7 +1674,7 @@ else if ($action == 'remove_file')
}
// Print file
-else if ($action == 'print_file' AND $user->rights->printipp->use)
+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);
@@ -3430,7 +3430,7 @@ else if ($id > 0 || ! empty($ref))
$genallowed=$user->rights->facture->creer;
$delallowed=$user->rights->facture->supprimer;
$printer = false;
- if ($user->rights->printipp->use AND $conf->printipp->enabled) $printer = true;
+ if ($user->rights->printipp->read AND $conf->printipp->enabled) $printer = true;
print '
';
print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang,$printer);
diff --git a/htdocs/core/modules/modPrintIPP.class.php b/htdocs/core/modules/modPrintIPP.class.php
index 53cadf53699..47ae72e3493 100644
--- a/htdocs/core/modules/modPrintIPP.class.php
+++ b/htdocs/core/modules/modPrintIPP.class.php
@@ -95,7 +95,7 @@ class modPrintIPP extends DolibarrModules
$this->rights[$r][1] = 'Printer';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
- $this->rights[$r][4] = 'use';
+ $this->rights[$r][4] = 'read';
// Main menu entries
$this->menus = array(); // List of menus to add
@@ -110,7 +110,7 @@ class modPrintIPP extends DolibarrModules
'langs'=>'printipp', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100,
'enabled'=>'$conf->printipp->enabled',
- 'perms'=>'$user->rights->printipp->use', // Use 'perms'=>'1' if you want your menu with no permission rules
+ 'perms'=>'$user->rights->printipp->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
diff --git a/htdocs/printipp/admin/printipp.php b/htdocs/printipp/admin/printipp.php
index d82196fd3b4..6ea4e1dd2f9 100644
--- a/htdocs/printipp/admin/printipp.php
+++ b/htdocs/printipp/admin/printipp.php
@@ -44,6 +44,12 @@ if (!$mode) $mode='config';
if ($action == 'setvalue' && $user->admin)
{
$db->begin();
+ if (GETPOST('PRINTIPP_ENABLED','alpha') == '1') $result=dolibarr_set_const($db, "PRINTIPP_ENABLED",1,'yesno',0,'',$conf->entity);
+ else
+ {
+ $result=dolibarr_del_const($db, "PRINTIPP_ENABLED",$conf->entity);
+ }
+ 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);
@@ -101,6 +107,27 @@ if ($mode=='config'&& $user->admin)
print '