add direct print for contracts

This commit is contained in:
Frédéric FRANCE 2021-11-28 20:55:17 +01:00
parent 2d92130c1e
commit 5473dbd3f0
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 5 additions and 2 deletions

View File

@ -916,6 +916,8 @@ if (empty($reshook)) {
}
}
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to build doc
$upload_dir = $conf->contrat->multidir_output[$object->entity];

View File

@ -442,7 +442,8 @@ class FormFile
}
$printer = 0;
if (in_array($modulepart, array('facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) { // The direct print feature is implemented only for such elements
// The direct print feature is implemented only for such elements
if (in_array($modulepart, array('contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) {
$printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled)) ?true:false;
}
@ -944,7 +945,7 @@ class FormFile
$out .= '">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
if ($printer) {
$out .= '<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource, '?') ? '&' : '?').'action=print_file&token='.newToken().'printer='.urlencode($modulepart).'&file='.urlencode($relativepath);
$out .= '<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource, '?') ? '&' : '?').'action=print_file&token='.newToken().'&printer='.urlencode($modulepart).'&file='.urlencode($relativepath);
$out .= ($param ? '&'.$param : '');
$out .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>';
}