WIP LNE
This commit is contained in:
parent
22e090eee5
commit
1d75cdc96e
8 changed files with 186 additions and 90 deletions
|
|
@ -383,7 +383,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
|
|||
*/
|
||||
|
||||
if ($checksignature) {
|
||||
$statusofrecord = 'Valid';
|
||||
$statusofrecord = $langs->transnoentitiesnoconv('StatusValid');
|
||||
if ($loweridinerror > 0) {
|
||||
$statusofrecordnote = 'ValidButFoundAPreviousKO';
|
||||
} else {
|
||||
|
|
@ -485,7 +485,7 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
|
|||
|
||||
$statusofrecord = '';
|
||||
|
||||
fwrite($fh, 'SUMMARY TURNOVER BILLED - '.$langs->transnoentitiesnoconv("Bills").' : '.$totalhtamountalllines['BILL_VALIDATE'].' '.$langs->trans("HT").' - '.$totalvatamountalllines['BILL_VALIDATE'].' '.$langs->trans("VAT").' - '.$totalamountalllines['BILL_VALIDATE'].' '.$langs->trans("HT").';'
|
||||
fwrite($fh, 'SUMMARY PERIOD BILLED - '.$langs->transnoentitiesnoconv("Bills").' : '.$totalhtamountalllines['BILL_VALIDATE'].' '.$langs->trans("HT").' - '.$totalvatamountalllines['BILL_VALIDATE'].' '.$langs->trans("VAT").' - '.$totalamountalllines['BILL_VALIDATE'].' '.$langs->trans("HT").';'
|
||||
.csvClean('').';'
|
||||
.csvClean($block_static->date_creation).';'
|
||||
.csvClean($block_static->action).';'
|
||||
|
|
@ -521,9 +521,10 @@ if ($action == 'export' && $user->hasRight('blockedlog', 'read')) { // read is
|
|||
$block_static->object_version = '';
|
||||
$block_static->object_format = '';
|
||||
$block_static->signature = '';
|
||||
|
||||
$statusofrecord = '';
|
||||
|
||||
fwrite($fh, 'SUMMARY TURNOVER PAID - '.$langs->transnoentitiesnoconv("Payments").' : '.$totalamountalllines['PAYMENT_CUSTOMER'].';'
|
||||
fwrite($fh, 'SUMMARY PERIOD PAID - '.$langs->transnoentitiesnoconv("Payments").' : '.$totalamountalllines['PAYMENT_CUSTOMER'].';'
|
||||
.csvClean('').';'
|
||||
.csvClean($block_static->date_creation).';'
|
||||
.csvClean($block_static->action).';'
|
||||
|
|
@ -998,10 +999,10 @@ if ($action == 'check' || $action == 'checkconfirmed') {
|
|||
// We are on a line for summary information
|
||||
$lineanalyzed = 1;
|
||||
/*
|
||||
if (preg_match('/^SUMMARY TURNOVER BILLED/', (string) $line[0])) {
|
||||
if (preg_match('/^SUMMARY PERIOD BILLED/', (string) $line[0])) {
|
||||
// Do nothing, we recalculate amount from previous lines
|
||||
}
|
||||
if (preg_match('/^SUMMARY TURNOVER PAID/', (string) $line[0])) {
|
||||
if (preg_match('/^SUMMARY PERIOD PAID/', (string) $line[0])) {
|
||||
// Do nothing, we recalculate amount from previous lines
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ print '<td class="liste_titre"><input type="text" class="maxwidth50" name="searc
|
|||
|
||||
// Status
|
||||
print '<td class="liste_titre center minwidth75imp parentonrightofpage">';
|
||||
$array = array("1" => "OnlyNonValid");
|
||||
$array = array("1" => $langs->trans("OnlyNonValid").' (KO)');
|
||||
print $form->selectarray('search_showonlyerrors', $array, $search_showonlyerrors, 1, 0, 0, '', 1, 0, 0, 'ASC', 'search_status width100 onrightofpage', 1);
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -487,36 +487,34 @@ print '</tr>';
|
|||
$checkresult = array();
|
||||
$checkdetail = array();
|
||||
$checkerror = array();
|
||||
$loweridinerror = 0;
|
||||
$loweridinerror = 0; // The lower rowid we found an anomaly (for debug or analysis purposes only)
|
||||
|
||||
if (getDolGlobalString('BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR')) {
|
||||
// This is version that is faster but require more memory and report errors that are outside the filter range
|
||||
// This is the algorithm that optimize the memory (note: it will not report errors that are outside the filter range, but we don't need them)
|
||||
if (is_array($blocks)) {
|
||||
foreach ($blocks as &$block) {
|
||||
// Enable this log to get information used to recalculate the signature
|
||||
//var_dump($block->id.' '.$block->signature, $block->object_data);
|
||||
|
||||
// TODO Make a full scan of table in reverse order of id of $block, so we can use the parameter $previoushash into checkSignature to save requests
|
||||
// to find the $loweridinerror.
|
||||
} else {
|
||||
// This is version that optimize the memory (note: it will not report errors that are outside the filter range, but we don't need them)
|
||||
if (is_array($blocks)) {
|
||||
foreach ($blocks as &$block) {
|
||||
// Enable this log to get information used to recalculate the signature
|
||||
//var_dump($block->id.' '.$block->signature, $block->object_data);
|
||||
$tmpcheckresult = $block->checkSignature('', 1); // Note: this make a sql request at each call, we can't avoid this as the sorting order and filter is various
|
||||
|
||||
$tmpcheckresult = $block->checkSignature('', 1); // Note: this make a sql request at each call, we can't avoid this as the sorting order and filter is various
|
||||
$checksignature = $tmpcheckresult['checkresult'];
|
||||
|
||||
$checksignature = $tmpcheckresult['checkresult'];
|
||||
$checkresult[$block->id] = $checksignature; // false if error
|
||||
$checkdetail[$block->id] = $tmpcheckresult;
|
||||
|
||||
$checkresult[$block->id] = $checksignature; // false if error
|
||||
$checkdetail[$block->id] = $tmpcheckresult;
|
||||
if (!empty($tmpcheckresult['error'])) {
|
||||
$checkerror[$block->id] = $tmpcheckresult['error'];
|
||||
}
|
||||
if (!empty($tmpcheckresult['error'])) {
|
||||
$checkerror[$block->id] = $tmpcheckresult['error'];
|
||||
}
|
||||
if (!empty($block->note)) {
|
||||
$checkresult[$block->id] = false;
|
||||
//$checkerror[$block->id] = $block->note;
|
||||
}
|
||||
|
||||
if (!$checksignature) {
|
||||
if (empty($loweridinerror)) {
|
||||
$loweridinerror = $block->id;
|
||||
} else {
|
||||
$loweridinerror = min($loweridinerror, $block->id);
|
||||
}
|
||||
if (!$checksignature) {
|
||||
if (empty($loweridinerror)) {
|
||||
$loweridinerror = $block->id;
|
||||
} else {
|
||||
$loweridinerror = min($loweridinerror, $block->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -539,7 +537,7 @@ if (is_array($blocks)) {
|
|||
}
|
||||
|
||||
// Check that there was no deletion on the end of chain.
|
||||
$lockfile = $conf->blockedlog->dir_output.'/blockedlog-'.dol_sanitizeFileName($mysoc->idprof1).'.head';
|
||||
$lockfile = $block_static->getEndOfChainFlagFile();
|
||||
|
||||
if (!file_exists($lockfile)) {
|
||||
$error++;
|
||||
|
|
@ -571,7 +569,7 @@ if (is_array($blocks)) {
|
|||
$headstring = dolDecrypt($line, $remoteobfuscationkey);
|
||||
|
||||
$reg = array();
|
||||
if (preg_match('/^BLOCKEDLOGHEAD (\d+) ([^\s]+) ([a-zA-Z0-9]+)/', $headstring, $reg)) { // Failed to decypt the head
|
||||
if (preg_match('/^BLOCKEDLOGHEAD (\d+) ([^\s]+) ([a-zA-Z0-9\-]+)/', $headstring, $reg)) { // Failed to decypt the head
|
||||
// Get last line
|
||||
$sql = "SELECT rowid, date_creation, signature FROM ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity);
|
||||
|
|
@ -706,7 +704,7 @@ if (is_array($blocks)) {
|
|||
print '<td class="center">';
|
||||
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error
|
||||
if ($checkresult[$block->id]) {
|
||||
print '<span class="badge badge-status4 badge-status" title="'.dolPrintHTMLForAttribute($langs->trans('OkCheckFingerprintValidityButChainIsKo')).'">OK</span>';
|
||||
print '<span class="badge badge-status4 badge-status" title="'.dolPrintHTMLForAttribute($langs->trans('OkCheckFingerprintValidityButChainIsKo')).'">'.$langs->trans("StatusValid").'</span>';
|
||||
} elseif ($block->action == 'MODULE_RESET') {
|
||||
// Old action code on old version.
|
||||
print '<span class="badge badge-status8 badge-status" title="'.dolPrintHTMLForAttribute('Module has been disabled').'">OK</span>';
|
||||
|
|
@ -715,13 +713,20 @@ if (is_array($blocks)) {
|
|||
if (!empty($checkerror[$block->id])) {
|
||||
print dolPrintHTMLForAttribute($checkerror[$block->id])."\n";
|
||||
}
|
||||
print dolPrintHTMLForAttribute($langs->trans('KoCheckFingerprintValidity')).'">KO</span>';
|
||||
$alt = $langs->trans('KoCheckFingerprintValidity');
|
||||
if ($block->note) {
|
||||
$notetoshow = $block->note;
|
||||
$notetoshow = str_replace('EndOfChainDeletionDetected', $langs->trans("EndOfChainDeletionDetected"), $notetoshow);
|
||||
$alt .= "\n".' '.$langs->trans("AddtionalInformation").': '.$notetoshow;
|
||||
}
|
||||
|
||||
print dolPrintHTMLForAttribute($alt).'">KO</span>';
|
||||
}
|
||||
} else {
|
||||
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidity').'">OK</span>';
|
||||
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidity').'">'.$langs->trans("StatusValid").'</span>';
|
||||
}
|
||||
|
||||
// Note
|
||||
// Add debug information
|
||||
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error
|
||||
if ($checkresult[$block->id]) {
|
||||
if (getDolGlobalString("BLOCKEDLOG_DEBUG")) {
|
||||
|
|
@ -754,13 +759,21 @@ if (is_array($blocks)) {
|
|||
}
|
||||
}
|
||||
|
||||
// Show total line
|
||||
// Show total lines
|
||||
if ($nbshown == 0) {
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
} else {
|
||||
ksort($totalamount);
|
||||
|
||||
$showturnover = 0;
|
||||
foreach ($totalamount as $key => $totalamountperref) {
|
||||
if ($key == 'BILL_VALIDATE' || $key == 'PAYMENT_CUSTOMER') {
|
||||
$showturnover++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($totalamount as $key => $totalamountperref) {
|
||||
if ($showturnover) {
|
||||
// Total
|
||||
print '<tr class="liste_total totalblockedlog">';
|
||||
|
||||
|
|
@ -778,6 +791,7 @@ if (is_array($blocks)) {
|
|||
} elseif ($key == 'PAYMENT_CUSTOMER') {
|
||||
print ' <span class="opacitylow">('.$langs->trans("TurnoverCollected").')</span>';
|
||||
}
|
||||
print '<br><span class="opacitylow">'.$langs->trans("ForPeriodAndFilters").'</span>';
|
||||
print '</td>';
|
||||
|
||||
// Action
|
||||
|
|
@ -931,7 +945,10 @@ if (is_array($blocks)) {
|
|||
|
||||
print '</tr>';
|
||||
}
|
||||
if (empty($search_code) || in_array('PAYMENT_CUSTOMER_CREATE', $search_code) || in_array('PAYMENT_CUSTOMER_DELETE', $search_code)) {
|
||||
if (empty($search_code)
|
||||
|| in_array('PAYMENT_CUSTOMER', $search_code) // Filter for both PAYMENT_CUSTOMER_CREATE and PAYMENT_CUSTOMER_DELETE
|
||||
|| in_array('PAYMENT_CUSTOMER_CREATE', $search_code)
|
||||
|| in_array('PAYMENT_CUSTOMER_DELETE', $search_code)) {
|
||||
// Total
|
||||
print '<tr class="liste_total totalblockedlog">';
|
||||
|
||||
|
|
|
|||
|
|
@ -179,6 +179,11 @@ class BlockedLog
|
|||
*/
|
||||
public $debuginfo;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $note;
|
||||
|
||||
/**
|
||||
* Array of tracked event codes. They are event codes that triggers a record in the unalterable log (and you can filter in list of events).
|
||||
* @var array<string,string|mixed>
|
||||
|
|
@ -1140,7 +1145,8 @@ class BlockedLog
|
|||
}
|
||||
|
||||
$sql = "SELECT b.rowid, b.date_creation, b.action, b.module_source, b.pos_source, b.amounts_taxexcl, b.amounts, b.element, b.fk_object, b.entity,";
|
||||
$sql .= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.type_code, b.linktoref, b.linktype, b.object_data, b.object_version, b.object_format, b.signature";
|
||||
$sql .= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.type_code, b.linktoref, b.linktype, b.object_data, b.object_version, b.object_format, b.signature,";
|
||||
$sql .= " b.note";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog as b";
|
||||
if ($id) {
|
||||
$sql .= " WHERE b.rowid = ".((int) $id);
|
||||
|
|
@ -1193,6 +1199,9 @@ class BlockedLog
|
|||
$this->signature = $obj->signature;
|
||||
$this->certified = ($obj->certified == 1);
|
||||
|
||||
$this->note = $obj->note;
|
||||
//$this->debuginfo = $obj->debuginfo; // We don't need this, sot we don't load it to save memory.
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
|
|
@ -1336,9 +1345,10 @@ class BlockedLog
|
|||
$previousid = $tmparray['previousid'];
|
||||
$previousdatecreation = $tmparray['previousdatecreation'];
|
||||
|
||||
// The string of line to sign
|
||||
$concatenateddata = $this->buildKeyForSignature(); // All the information for the hash (meta data + data saved)
|
||||
|
||||
// The new hash
|
||||
// The new hash, including previous hash
|
||||
$this->signature = $this->buildFinalSignatureHash($previoushash.$concatenateddata); // Build the hmac signature
|
||||
|
||||
// For debug info (we can clean this field later)
|
||||
|
|
@ -1425,63 +1435,108 @@ class BlockedLog
|
|||
|
||||
// Check and store the signature of this new line in the head file.
|
||||
try {
|
||||
$lockfile = $conf->blockedlog->dir_output.'/blockedlog-'.dol_sanitizeFileName($mysoc->idprof1).'.head';
|
||||
$finalsignature = $this->signature;
|
||||
$finalnote = '';
|
||||
|
||||
$lockhandle = fopen($lockfile, "c+");
|
||||
if (flock($lockhandle, LOCK_EX)) { // acquire an exclusive lock
|
||||
$line = trim(fgets($lockhandle, 4096)); // Read first line
|
||||
$lockfile = $this->getEndOfChainFlagFile();
|
||||
|
||||
if (preg_match('/^dolcrypt/', $line)) { // Old method (does not happen after migration)
|
||||
$headstring = dolDecrypt($line);
|
||||
} elseif (preg_match('/^dolobfuscation/', $line)) {
|
||||
$remoteobfuscationkey = $this->getObfuscationKey();
|
||||
if (empty($remoteobfuscationkey)) {
|
||||
throw new Exception("Failed to get the remote obfuscation key. We can't record the head file so we abort the transaction.");
|
||||
}
|
||||
$headstring = dolDecrypt($line, $remoteobfuscationkey);
|
||||
// If the .end file does not exists (has been removed), we track the record as error.
|
||||
if (!file_exists($lockfile)) {
|
||||
//throw new Exception("The head file ".$lockfile." was not found or is not writable.");
|
||||
|
||||
$this->note = 'EndOfChainDeletionDetected [after '.dol_print_date($previousdatecreation, 'dayhourrfc', 'gmt').']';
|
||||
|
||||
// The string of line to sign
|
||||
$concatenateddata = $this->buildKeyForSignature(); // All the information for the hash (meta data + data saved)
|
||||
|
||||
// The new hash, including previous hash
|
||||
$finalsignature = $this->buildFinalSignatureHash($previoushash.$concatenateddata); // Build the hmac signature
|
||||
$finalnote = $this->note;
|
||||
|
||||
$line = '';
|
||||
} elseif (is_writable($lockfile)) {
|
||||
$line = file_get_contents($lockfile);
|
||||
} else {
|
||||
// Go to the catch()
|
||||
throw new Exception("Cannot write into the blockedlog .end file ".$lockfile.' to update it. Is the file writable by the running user and not open by another process? Transaction aborted.');
|
||||
}
|
||||
|
||||
// Check and update the .end flag file.
|
||||
$headstring = '';
|
||||
$remoteobfuscationkey = '';
|
||||
if (preg_match('/^dolcrypt/', $line)) { // Old method (does not happen after migration)
|
||||
$headstring = dolDecrypt($line);
|
||||
} elseif (preg_match('/^dolobfuscation/', $line)) {
|
||||
$remoteobfuscationkey = $this->getObfuscationKey();
|
||||
if (empty($remoteobfuscationkey)) {
|
||||
throw new Exception("Failed to get the remote obfuscation key. We can't read the end of chain flag file so we abort the transaction.");
|
||||
}
|
||||
$headstring = dolDecrypt($line, $remoteobfuscationkey);
|
||||
}
|
||||
|
||||
$reg = array();
|
||||
if (preg_match('/^BLOCKEDLOGHEAD (\d+) ([^\s]+) ([a-zA-Z0-9\-]+)/', $headstring, $reg)) {
|
||||
// We succeed in decypting the head
|
||||
$previousidheadflag = $reg[1];
|
||||
$previousdatecreationheadflag = $reg[2];
|
||||
$previoushashheadflag = $reg[3];
|
||||
|
||||
// Check the signature of the previous line
|
||||
if ($previousid < $previousidheadflag || $previoushash != $previoushashheadflag) {
|
||||
// We detect that old record were removed. We force a non valid signature on the new record.
|
||||
$this->note = 'EndOfChainDeletionDetected ['.dol_print_date($previousdatecreation, 'dayhourrfc', 'gmt').' - '.dol_print_date($previousdatecreationheadflag, 'dayhourrfc', 'gmt').']';
|
||||
|
||||
// The string of line to sign
|
||||
$concatenateddata = $this->buildKeyForSignature(); // All the information for the hash (meta data + data saved)
|
||||
|
||||
// The new hash, including previous hash
|
||||
$finalsignature = $this->buildFinalSignatureHash($previoushash.$concatenateddata); // Build the hmac signature
|
||||
$finalnote = $this->note;
|
||||
}
|
||||
} elseif ($headstring != '') {
|
||||
// Failed to decrypt the head
|
||||
throw new Exception("Failed to decode the content of the head file ".$lockfile." with the obfuscation key, so we can't record the head file so we abort the transaction.");
|
||||
}
|
||||
|
||||
// If a different signature has been forced to generate an error.
|
||||
if ($finalsignature != $this->signature) {
|
||||
// For debug info (we can clean this field later)
|
||||
if (getDolGlobalString('BLOCKEDLOG_ADD_DEBUG_INFO')) {
|
||||
$this->debuginfo = 'previoushash='.$previoushash.' concatenateddatafirstpart='.$this->buildFirstPartOfKeyForSignature().' => signature='.$this->signature; // Not used
|
||||
}
|
||||
|
||||
$finalsignature = $this->signature;
|
||||
|
||||
$reg = array();
|
||||
if (preg_match('/^BLOCKEDLOGHEAD (\d+) ([^\s]+) ([a-zA-Z0-9]+)/', $headstring, $reg)) {
|
||||
// We succeed in decypting the head
|
||||
$previousidheadflag = $reg[1];
|
||||
$previousdatecreationheadflag = $reg[2];
|
||||
$previoushashheadflag = $reg[3];
|
||||
|
||||
// Check the signature of the previous line
|
||||
if ($previousid < $previousidheadflag || $previoushash != $previoushashheadflag) {
|
||||
// We detect that old record were removed. We force a non valid signature on the new record.
|
||||
$finalsignature = 'EndOfChainDeletionDetected ['.dol_print_date($previousdatecreation, 'dayhourrfc', 'gmt').' - '.dol_print_date($previousdatecreationheadflag, 'dayhourrfc', 'gmt').']';
|
||||
// We update the record we have just inserted to set the new "error" signature
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."blockedlog SET signature = '".$this->db->escape($finalsignature)."' WHERE rowid = ".((int) $this->id);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
throw new Exception("End of chain deletion detected but we failed to update the signature of the record ".$this->id." to set the new signature ".$finalsignature." to track this.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Failed to decrypt the head
|
||||
throw new Exception("Failed to decode the content of the head file ".$lockfile." with the obfuscation key, so we can't record the head file so we abort the transaction.");
|
||||
// We update the record we have just inserted to record the new "anomaly" we have detected. Anomaly is also incrusted into the signature.
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."blockedlog";
|
||||
$sql .= " SET signature = '".$this->db->escape($finalsignature)."',";
|
||||
$sql .= " note = '".$this->db->escape($finalnote)."',";
|
||||
$sql .= " debuginfo = '".$this->db->escape($this->debuginfo)."'";
|
||||
$sql .=" WHERE rowid = ".((int) $this->id);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
throw new Exception("End of chain deletion detected but we failed to update the signature of the record ".$this->id." to set the note and new signature ".$finalsignature." to track this.");
|
||||
}
|
||||
}
|
||||
|
||||
// Lock acquired, we can now write the new head
|
||||
$stringtowrite = 'BLOCKEDLOGHEAD '.$this->id." ".dol_print_date($this->date_creation, 'dayhourrfc', 'gmt')." ".(string) $finalsignature;
|
||||
$stringtowriteencoded = dolEncrypt($stringtowrite, $remoteobfuscationkey, '', '', 'dolobfuscationv1-'.$mysoc->idprof1);
|
||||
// Lock acquired, we can now write the new .end file
|
||||
$stringtowrite = 'BLOCKEDLOGHEAD '.$this->id." ".dol_print_date($this->date_creation, 'dayhourrfc', 'gmt')." ".(string) $finalsignature;
|
||||
$remoteobfuscationkey = $this->getObfuscationKey();
|
||||
if (empty($remoteobfuscationkey)) {
|
||||
throw new Exception("Failed to get the remote obfuscation key. We can't record the end of chain flag file so we abort the transaction.");
|
||||
}
|
||||
|
||||
rewind($lockhandle);
|
||||
//ftruncate($lockhandle, 0);
|
||||
$stringtowriteencoded = dolEncrypt($stringtowrite, $remoteobfuscationkey, '', '', 'dolobfuscationv1-'.$mysoc->idprof1);
|
||||
|
||||
// Update or create the .end file.
|
||||
$lockhandle = fopen($lockfile, 'w+');
|
||||
if ($lockhandle) {
|
||||
if (fwrite($lockhandle, $stringtowriteencoded."\n") === false) {
|
||||
throw new Exception("Cannot write to the blockedlog head file ".$lockfile);
|
||||
throw new Exception("Cannot write to the blockedlog .end file ".$lockfile);
|
||||
}
|
||||
|
||||
fclose($lockhandle); // Remove the lock
|
||||
dolChmod($lockfile);
|
||||
} else {
|
||||
// Go to the catch()
|
||||
throw new Exception("Cannot lock the blockedlog HEAD file ".$lockfile.' to update it. Is the file writable by running user and not open by another process? Transaction aborted.');
|
||||
throw new Exception("Cannot open for writing the blockedlog .end file ".$lockfile);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
|
|
@ -1526,6 +1581,18 @@ class BlockedLog
|
|||
// The commit or rollback will release the lock so app can insert other record now
|
||||
}
|
||||
|
||||
/**
|
||||
* Return path of end of chain flag file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEndOfChainflagFile()
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
|
||||
return $conf->blockedlog->dir_output.'/blockedlog-'.dol_sanitizeFileName($mysoc->idprof1).'.end';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if calculated signature still correct compared to the value in the chain
|
||||
*
|
||||
|
|
@ -1611,6 +1678,9 @@ class BlockedLog
|
|||
}
|
||||
$s .= '|'.(string) $this->linktoref;
|
||||
$s .= '|'.(string) $this->linktype;
|
||||
if ($this->note) {
|
||||
$s .= '|'.(string) $this->note;
|
||||
}
|
||||
return $s;
|
||||
} else {
|
||||
throw new Exception('Error bad value "'.$this->object_format.'" for object_format');
|
||||
|
|
|
|||
|
|
@ -1029,10 +1029,12 @@ if (empty($action) || $action == "view" || $action == "close") {
|
|||
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $id).'&action=confirm_delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>';
|
||||
} else {
|
||||
if ($permissiontoreopen) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $id).'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dolPrintHTMLForAttribute($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('ReOpen').'</a></div>';
|
||||
if (!isALNERunningVersion()) {
|
||||
if ($permissiontoreopen) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.((int) $id).'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dolPrintHTMLForAttribute($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ ALTER TABLE llx_adherent_type ADD COLUMN amountformuladescription text;
|
|||
ALTER TABLE llx_blockedlog ADD COLUMN pos_source varchar(32) DEFAULT '';
|
||||
ALTER TABLE llx_blockedlog ADD COLUMN signature_backward varchar(100) DEFAULT '';
|
||||
ALTER TABLE llx_blockedlog ADD COLUMN type_code varchar(8) DEFAULT '';
|
||||
ALTER TABLE llx_blockedlog ADD COLUMN note varchar(128) DEFAULT NULL;
|
||||
|
||||
ALTER TABLE llx_website_page ADD COLUMN keep_history integer DEFAULT 5;
|
||||
ALTER TABLE llx_website_page ADD COLUMN metarobots varchar(128) after keywords;
|
||||
|
|
|
|||
|
|
@ -46,5 +46,6 @@ CREATE TABLE llx_blockedlog
|
|||
certified integer, -- not used, reserved for future use
|
||||
actionrefisunique varchar(16) DEFAULT NULL, -- not used, reserved for future use
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
debuginfo mediumtext
|
||||
debuginfo mediumtext, -- debug information
|
||||
note varchar(128) NULL -- note information
|
||||
) ENGINE=innodb;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ ArchiveLogs=Archives of immutable logs
|
|||
ShowAllFingerPrintsMightBeTooLong=Show all archived unlaterable logs (might be long)
|
||||
ShowAllFingerPrintsErrorsMightBeTooLong=Show all non-valid immutable logs (might be long)
|
||||
DownloadBlockChain=Download blockchain
|
||||
KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, OR has erased the previous archived record (check that the line with previous # exists) OR has modified the checksum of the previous record.
|
||||
KoCheckFingerprintValidity=Archived log entry is not valid. It means someone (a hacker?) has modified some data of this record after it was recorded, OR has erased the previous record (check that the line with previous # exists) OR has modified the checksum of the previous record.
|
||||
OkCheckFingerprintValidity=Archived log record is valid. The data on this line was not modified and the entry follows the previous one.
|
||||
OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to previous one but the chain was corrupted previously.
|
||||
AddedByAuthority=Stored into remote authority
|
||||
|
|
@ -133,6 +133,9 @@ IncludesAllHelp=Includes all record, even the one recorded with an old version b
|
|||
OnlyFromV2=Only record from v24
|
||||
OnlyFromV2Help=After the v24 version, the amount excluding tax for fast calculation of cumulative total was recorded in the unalterable Log, so it is reported, but date range may be lower than the one of the "Includes all" option.
|
||||
NeedAThirdPartyStatement=You need a third-party statement to be compliant with law
|
||||
ForPeriodAndFilters=For the period and filters
|
||||
AddtionalInformation=Additional technical information
|
||||
StatusValid=Valid
|
||||
## logTypes
|
||||
logBILL_DELETE=Customer invoice logically deleted
|
||||
logBILL_PAYED=Customer invoice paid
|
||||
|
|
@ -180,3 +183,4 @@ WarningNoProtectionOnEndOfChain=Note that this chain is not protected against de
|
|||
FailedToGetRemoteObfuscationKeyReTryLater=Failed to get the remote obfuscation key. May be the server %s can't be reachable. Thanks to retry later.
|
||||
FailedToDecodeTheHeadFlagEndOfChainIsNotReliable=Failed to decode the flag that protect the end of chain. Some record at end of chain may have been removed after the last one.
|
||||
CantValidateEndOfChain=Validation of integrity of end of chain is not possible.
|
||||
EndOfChainDeletionDetected=Deletion of record at the end of chain (before this record) has been detected
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ SentOrderToKitchen=Send order to kitchen
|
|||
LifetimeAmountShort=Lifetime amount
|
||||
LifetimeAmount=Lifetime amount (%s)
|
||||
LifetimeStatDate=Lifetime amount start date
|
||||
AllTerminals=All terminals
|
||||
AllTerminals=All POS terminals
|
||||
AllPaymentModes=All payment modes
|
||||
NoFreeZoneProduct=Disallow the use of non predefined products
|
||||
NoFreeZoneProductDesc=You can activate the feature to force the use of predefined product only in any sales. Adding a custom non predefined product will become not possible.
|
||||
|
|
|
|||
Loading…
Reference in a new issue