Merge pull request #19510 from frederic34/contractdirectprint

add direct print for contracts
This commit is contained in:
Laurent Destailleur 2021-11-30 11:20:51 +01:00 committed by GitHub
commit ecdae02062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>';
}