diff --git a/htdocs/blockedlog/admin/blockedlog_archives.php b/htdocs/blockedlog/admin/blockedlog_archives.php
index bb9488cfff2..f030c26ae8f 100644
--- a/htdocs/blockedlog/admin/blockedlog_archives.php
+++ b/htdocs/blockedlog/admin/blockedlog_archives.php
@@ -115,7 +115,7 @@ $block_static = new BlockedLog($db);
$block_static->loadTrackedEvents();
// Access Control
-if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || !isModEnabled('blockedlog')) {
+if (((!$user->admin && !$user->hasRight('blockedlog', 'read')) || !isModEnabled('blockedlog')) && !userIsTaxAuditor()) {
accessforbidden();
}
@@ -679,7 +679,7 @@ if ($withtab) {
$morehtmlcenter = '';
$registrationnumber = getHashUniqueIdOfRegistration();
-if (!getDolGlobalString("BLOCKEDLOG_FOR_TAX_AUDITOR")) {
+if (!userIsTaxAuditor()) {
$texttop = ''.$langs->trans("RegistrationNumber").': '.dol_trunc($registrationnumber, 10).'';
if (!isRegistrationDataSavedAndPushed()) {
$texttop = '';
@@ -696,7 +696,7 @@ print dol_get_fiche_head($head, 'archives', '', -1);
//print '
';
print '
';
-if (!getDolGlobalString("BLOCKEDLOG_FOR_TAX_AUDITOR")) {
+if (!userIsTaxAuditor()) {
print $langs->trans("ArchivesDesc")."
";
} else {
print $langs->trans("ArchivesAuditorDesc")."
";
@@ -752,10 +752,10 @@ if ($action == 'check' || $action == 'checkconfirmed') {
print $langs->trans("FileHasBeenEncodedWithASecretKeyStartingWith").' : '.$regnumber.'...
';
- if (preg_match('/^'.$regnumber.'/', $secretkey) && !getDolGlobalString("BLOCKEDLOG_FOR_TAX_AUDITOR")) {
+ if (preg_match('/^'.$regnumber.'/', $secretkey) && !userIsTaxAuditor()) {
print 'As this matches the 10 first characters of the full registration number of this instance, we will use the full registration number to control the archive file...';
} else {
- if (!getDolGlobalString("BLOCKEDLOG_FOR_TAX_AUDITOR")) {
+ if (!userIsTaxAuditor()) {
print 'This archive file was not generated by this instance.';
print 'The control of authenticity is possible only if you know the full registration number.';
$inputregistrationnumber = '';
@@ -793,6 +793,13 @@ if ($action == 'check' || $action == 'checkconfirmed') {
$nbLinesModifiedInExportButKo = 0;
$nbLinesModifiedBeforeExport = 0;
+ $amounthtlifetime = array();
+ $amountvatlifetime = array();
+ $amountttclifetime = array();
+ $amounthtlifetime['BILL_VALIDATE'] = $amounthtlifetime['PAYMENT_CUSTOMER'] = null;
+ $amountvatlifetime['BILL_VALIDATE'] = $amountvatlifetime['PAYMENT_CUSTOMER'] = null;
+ $amountttclifetime['BILL_VALIDATE'] = $amountttclifetime['PAYMENT_CUSTOMER'] = null;
+
$handle = fopen($fullpath, "r");
if ($handle) {
$numline = 0;
@@ -931,9 +938,33 @@ if ($action == 'check' || $action == 'checkconfirmed') {
}
}
+ // Test if line is a summary line
if (preg_match('/^SUMMARY /', (string) $line[0])) {
// We are on a line for summary information
$lineanalyzed = 1;
+ if (preg_match('/^SUMMARY TURNOVER BILLED/', (string) $line[0])) {
+ // Do nothing, we recalculate amount from previous lines
+ }
+ if (preg_match('/^SUMMARY TURNOVER PAID/', (string) $line[0])) {
+ // Do nothing, we recalculate amount from previous lines
+ }
+ if (preg_match('/^SUMMARY LIFETIME BILLED/', (string) $line[0])) {
+ // We load data from line
+ $amountstring = (string) $line[0];
+ if (preg_match('/^SUMMARY LIFETIME BILLED[^\d]*\s:\s([\d\.]+)\s[^\d]+\s([\d\.]+)\s[^\d]+\s([\d\.]+)\s[^\d]+/', $amountstring, $reg)) {
+ $amounthtlifetime['BILL_VALIDATE'] = (float) $reg[1];
+ $amountvatlifetime['BILL_VALIDATE'] = (float) $reg[2];
+ $amountttclifetime['BILL_VALIDATE'] = (float) $reg[3];
+ }
+ }
+ if (preg_match('/^SUMMARY LIFETIME PAID/', (string) $line[0])) {
+ $amountstring = (string) $line[0];
+ if (preg_match('/^SUMMARY LIFETIME PAID[^\d]*\s:\s([\d\.]+)/', $amountstring, $reg)) {
+ $amounthtlifetime['PAYMENT_CUSTOMER'] = (float) $reg[1];
+ $amountvatlifetime['PAYMENT_CUSTOMER'] = 0.0;
+ $amountttclifetime['PAYMENT_CUSTOMER'] = (float) $reg[1];
+ }
+ }
}
if (preg_match('/END - ([a-z0-9_]+)=([a-z0-9]+) - ([a-z0-9_]+)=([a-z0-9]+)$/', (string) $line[0], $reg)) {
@@ -991,7 +1022,7 @@ if ($action == 'check' || $action == 'checkconfirmed') {
}
print '
';
- if (!getDolGlobalString("BLOCKEDLOG_FOR_TAX_AUDITOR")) {
+ if (!userIsTaxAuditor()) {
if ($nbLinesModifiedInExportButKo) {
print img_picto('', 'cross', 'class="error valignmiddle pictofixedwidth"');
print ''.$langs->trans("nbLinesModifiedInExportButKo").': ';
@@ -1049,6 +1080,44 @@ if ($action == 'check' || $action == 'checkconfirmed') {
print '
';
}
+ // Now print the value for lifetime amounts.
+ $arraykeys = array('BILL_VALIDATE', 'PAYMENT_CUSTOMER');
+ foreach ($arraykeys as $key) {
+ if (is_null($amounthtlifetime[$key])) { // If not entry found, we discard
+ continue;
+ }
+ $totalhttoshow = $amounthtlifetime[$key];
+ $totalvattoshow = $amountvatlifetime[$key];
+ $totaltoshow = $amountttclifetime[$key];
+
+ print ''.dolPrintHTML($langs->trans("LifetimeAmountShort").' '.$langs->trans('log'.$key)).'';
+ if ($key == 'BILL_VALIDATE') {
+ print ' ('.$langs->trans("Turnover").')';
+ } elseif ($key == 'PAYMENT_CUSTOMER') {
+ print ' ('.$langs->trans("TurnoverCollected").')';
+ }
+ print ': ';
+
+ if ($key == 'PAYMENT_CUSTOMER') {
+ print ''.price($totaltoshow, 0, $langs, 1, -1, -1, getDolCurrency()).'';
+ } else {
+ print $langs->trans("HT").': ';
+ print ''.price($totalhttoshow, 0, $langs, 1, -1, -1, getDolCurrency()).'';
+
+ print ' - ';
+
+ print $langs->trans("VAT").': ';
+ print ''.price($totalvattoshow, 0, $langs, 1, -1, -1, getDolCurrency()).'';
+
+ print ' - ';
+
+ print $langs->trans("TTC").': ';
+ print ''.price($totaltoshow, 0, $langs, 1, -1, -1, getDolCurrency()).'';
+ }
+ print '
';
+ }
+
+
print '
';
$text = $langs->trans("IfIntegrityAuthenticityIsOkYouCanGetdetailByOpeningTheFile");
@@ -1066,7 +1135,7 @@ if ($action == 'check' || $action == 'checkconfirmed') {
if ($action != 'check' && $action != 'checkconfirmed') {
$htmltext = '';
- if (!getDolGlobalString("BLOCKEDLOG_FOR_TAX_AUDITOR")) {
+ if (!userIsTaxAuditor()) {
$htmltext .= $langs->trans("UnalterableLogTool2", $langs->transnoentities("Archives"))."
";
if ($mysoc->country_code == 'FR') {
$htmltext .= '
'.$langs->trans("UnalterableLogTool1FR").'
';
@@ -1145,7 +1214,7 @@ if ($action != 'check' && $action != 'checkconfirmed') {
}
- if (!getDolGlobalString("BLOCKEDLOG_FOR_TAX_AUDITOR")) {
+ if (!userIsTaxAuditor()) {
print '