NEW log download or preview event on a validate bill

This commit is contained in:
alexis Algoud 2017-06-13 15:55:22 +02:00
parent 4c424bb760
commit ef0907d89e
5 changed files with 56 additions and 3 deletions

View File

@ -0,0 +1,19 @@
<?php
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$id = GETPOST('id','int');
$element = GETPOST('element','alpha');
$action = GETPOST('action','alpha');
if($element === 'facture') {
dol_include_once('/compta/facture/class/facture.class.php');
$facture = new Facture($db);
if($facture->fetch($id)>0) {
$facture->call_trigger($action, $user);
}
}

View File

@ -4248,6 +4248,37 @@ else if ($id > 0 || ! empty($ref))
$delallowed = $user->rights->facture->supprimer;
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
if(!empty($conf->blockedlog->enabled) && $object->statut>0) {
?>
<script type="text/javascript">
$(document).ready(function() {
$('a.documentpreview').click(function() {
$.post("<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>"
, {
id:<?php echo $object->id; ?>
, element:"<?php echo $object->element ?>"
, action:"PREVIEW_BILL"
}
);
});
$('a.documentdownload').click(function() {
$.post("<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>"
, {
id:<?php echo $object->id; ?>
, element:"<?php echo $object->element ?>"
, action:"DOWNLOAD_BILL"
}
);
});
});
</script>
<?php
}
$somethingshown = $formfile->numoffiles;
// Show links to link elements

View File

@ -712,7 +712,7 @@ class FormFile
$out.= '<td class="tdoverflowmax300">';
$tmp = $this->showPreview($file,$modulepart,$relativepath,0,$param);
$out.= ($tmp?$tmp.' ':'');
$out.= '<a href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"';
$out.= '<a class="documentdownload" href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"';
$mime=dol_mimetype($relativepath,'',0);
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
$out.= ' target="_blank">';

View File

@ -51,7 +51,8 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
return 0;
}
if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED' || $action === 'BILL_SENTBYMAIL') {
if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
|| $action === 'BILL_SENTBYMAIL' || $action === 'DOWNLOAD_BILL' || $action === 'PREVIEW_BILL') {
$amounts= (double) $object->total_ttc;
}
else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') {

View File

@ -18,4 +18,6 @@ logBILL_VALIDATE=Customer bill set valid from draft
logBILL_SENTBYMAIL=Customer bill send by mail
BlockedlogInfoDialog=Log Details
Fingerprint=Fingerprint
DownloadLogCSV=Download fingerprints CSV
DownloadLogCSV=Download fingerprints CSV
logPREVIEW_BILL=Preview of a validated customer bill in order to print or download
logDOWNLOAD_BILL=Download of a validated customer bill in order to print or send