Selaa lähdekoodia

Work on blockedlog

Laurent Destailleur 7 vuotta sitten
vanhempi
commit
dc692f333d

+ 23 - 0
htdocs/blockedlog/README-fr.md

@@ -0,0 +1,23 @@
+LOG INALTERABLE
+===============
+
+## Fonctionnalité
+ 
+Ce module tace, en temps réel, certains évènements métiers dans une log non reversible (que vous ne pouvez pas modifier une fois enregistré) de type blockchain. 
+Ce module est requis pour la compatibilité avec les exigences légales de certains pays (comme la France avec la loi Fincance 2016 - Norme NF535).
+
+
+**Les évènements tracés de manière inaltérables sont:**
+
+- Création de facture
+- Enregistrement des paiements
+- Impression et téléchargement de facture faites via le logiciel
+
+Remarque: Le type des événements tracés est probablement plus large que la plupart des exigences légales mais permet d'être prêt pour d'éventuel élargissement 
+de ces exigences.
+Vous pouvez aussi lire et recherche au sein de la log dédiée.
+
+Tous les enregistrements de la logs inaltérable sont liés avec le précédent dnas une Blockchain, et leur contenu fait parti de la signature inclue dans le lien,
+aussi, une fois le module activé et le premier enregistrement réalisé, il ne sera plus possible d'effacer ni modifié un enregistrement dans la log 
+inaltérable sans corrompre la chaine. Dès lors qu'un enregistrement est invalide, tous les suivants seront également considérés invalides.
+

+ 22 - 0
htdocs/blockedlog/README.md

@@ -0,0 +1,22 @@
+BLOCKED LOG
+===========
+
+## Feature
+ 
+This module tracks, in real time, some events into a non reversible log (that you can't modify once recorded) into a block chain. 
+This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535).
+
+
+**The tracked events are:**
+
+- Invoices creation
+- Payments record
+- Invoice printing
+
+You can also read and search into this dedicated log.
+
+All record in the log are linked with the previous one in a blockchain, and content of the record is part of the
+signature included into the link, so, once the module is activated, it is no more possible to erase or modify a record without corrupting all the chain.
+
+
+

+ 41 - 45
htdocs/blockedlog/admin/fingerprints.php

@@ -128,20 +128,20 @@ print ' | <a href="?action=downloadcsv">'.$langs->trans('DownloadLogCSV').'</a>'
 print ' </div>';
 
 
+print '<div class="div-table-responsive">';		// You can use div-table-responsive-no-min if you dont need reserved height for your table
 print '<table class="noborder" width="100%">';
-print '<tr class="liste_titre">';
-
-print '<td class="minwidth50">'.$langs->trans('#').'</td>';
-print '<td class="center">'.$langs->trans('Date').'</td>';
-print '<td>'.$langs->trans('Author').'</td>';
-print '<td>'.$langs->trans('Action').'</td>';
-print '<td>'.$langs->trans('Ref').'</td>';
-print '<td>'.$langs->trans('Element').'</td>';
-print '<td>'.$langs->trans('Amount').'</td>';
-print '<td class="center">'.$langs->trans('DataOfArchivedEvent').'</td>';
-print '<td>'.$langs->trans('Fingerprint').'</td>';
-print '<td><span id="blockchainstatus"></span></td>';
 
+print '<tr class="liste_titre">';
+print getTitleFieldOfList($langs->trans('#'), 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'minwidth50 ')."\n";
+print getTitleFieldOfList($langs->trans('Date'), 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList($langs->trans('Element'), 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'')."\n";
+print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder,'')."\n";
 print '</tr>';
 
 foreach($blocks as &$block) {
@@ -159,7 +159,7 @@ foreach($blocks as &$block) {
 	   	print '<td>'.$block->ref_object.'</td>';
 	   	print '<td>'.$object_link.'</td>';
 	   	print '<td align="right">'.price($block->amounts).'</td>';
-	   	print '<td align="center"><a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
+	   	print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
 
 	   	print '<td>';
 	   	print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature);
@@ -179,53 +179,49 @@ foreach($blocks as &$block) {
 }
 
 print '</table>';
+print '</div>';
 
+print '<script type="text/javascript">
 
+jQuery(document).ready(function () {
+	jQuery("#dialogforpopup").dialog(
+	{ closeOnEscape: true, classes: { "ui-dialog": "highlight" },
+	maxHeight: window.innerHeight-60, height: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? 400 : 700).',
+	modal: true,
+	autoOpen: false }).css("z-index: 5000");
 
-?>
-<script type="text/javascript">
-$('a[rel=show-info]').click(function() {
+	$("a[rel=show-info]").click(function() {
 
-	$pop = $('<div id="pop-info"><table width="100%" class="border"><thead><th width="25%"><?php echo $langs->trans('Field') ?></th><th><?php echo $langs->trans('Value') ?></th></thead><tbody></tbody></table></div>');
+	    console.log("We click on tooltip");
 
-	$pop.dialog({
-		title:"<?php echo $langs->transnoentities('BlockedlogInfoDialog'); ?>"
-		,modal:true
-		,width:'80%'
-	});
-
-	var fk_block = $(this).attr("blockid");
+		jQuery("#dialogforpopup").html(\'<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%">'.$langs->trans('Field').'</th><th>'.$langs->trans('Value').'</th></thead><tbody></tbody></table></div>\');
 
-	$.ajax({
-		url:"../ajax/block-info.php?id="+fk_block
-		,dataType:'json'
-	}).done(function(data) {
+		var fk_block = $(this).attr("data-blockid");
 
-		drawData(data,'');
+		$.ajax({
+			url:"../ajax/block-info.php?id="+fk_block
+			,dataType:"json"
+		}).done(function(data) {
+			drawData(data,"");
+		});
 
+		jQuery("#dialogforpopup").dialog("open");
 	});
 
-});
-
-function drawData(data, prefix) {
 
-	for(x in data) {
+	function drawData(data, prefix) {
+		for(x in data) {
+			value = data[x];
 
-		value = data[x];
-
-		$('#pop-info table tbody').append('<tr><td>'+prefix+x+'</td><td>'+value+'</td></tr>');
-
-		if( (typeof value === "object") && (value !== null) ) {
-			drawData(value, prefix+x+' &gt;&gt; ');
+			$("#pop-info table tbody").append("<tr><td>"+prefix+x+"</td><td class=\"wordwrap\">"+value+"</td></tr>");
+			if( (typeof value === "object") && (value !== null) ) {
+				drawData(value, prefix+x+" &gt;&gt; ");
+			}
 		}
-
 	}
 
-}
-
-</script>
-
-<?php
+})
+</script>'."\n";
 
 
 if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {

+ 1 - 1
htdocs/langs/en_US/blockedlog.lang

@@ -1,6 +1,6 @@
 BlockedLog=Non Reversible Logs
 Field=Field
-BlockedLogDesc=This module store event for invoice and payments into a block chain
+BlockedLogDesc=This module tracks some events into a non reversible log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535).
 Fingerprints=Archived events and fingerprints
 FingerprintsDesc=Archived business events and fingerprints
 CompanyInitialKey=Company initial key

+ 1 - 1
htdocs/modulebuilder/template/myobject_list.php

@@ -408,7 +408,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
 $parameters=array('arrayfields'=>$arrayfields);
 $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object);    // Note that $action and $object may have been modified by hook
 print $hookmanager->resPrint;
-print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
+print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
 print '</tr>'."\n";