Standardize and debug code of module BlockedLog
This commit is contained in:
parent
26e80045a6
commit
1c8daf9700
@ -17,7 +17,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/blockedlog/admin/blockedlog.php
|
||||
* \ingroup system
|
||||
* \ingroup blockedlog
|
||||
* \brief Page setup for blockedlog module
|
||||
*/
|
||||
|
||||
@ -37,6 +37,7 @@ $action = GETPOST('action','alpha');
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
@ -77,7 +78,7 @@ $form=new Form($db);
|
||||
llxHeader('',$langs->trans("BlockedLogSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ModuleSetup").' BlockedLog',$linkback);
|
||||
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'),$linkback);
|
||||
|
||||
$head=blockedlogadmin_prepare_head();
|
||||
|
||||
@ -95,13 +96,11 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="titlefield">';
|
||||
print $langs->trans("EntityKey").'</td><td align="center">';
|
||||
|
||||
print $langs->trans("CompanyInitialKey").'</td><td>';
|
||||
print $block_static->getSignature();
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
||||
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
||||
// Example with a yes / no select
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/blockedlog/admin/blockedlog.php
|
||||
* \ingroup system
|
||||
* \file htdocs/blockedlog/admin/fingerprints.php
|
||||
* \ingroup blockedlog
|
||||
* \brief Page setup for blockedlog module
|
||||
*/
|
||||
|
||||
@ -110,7 +110,7 @@ $form=new Form($db);
|
||||
llxHeader('',$langs->trans("BlockedLogSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ModuleSetup").' BlockedLog',$linkback);
|
||||
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'),$linkback);
|
||||
|
||||
$head=blockedlogadmin_prepare_head();
|
||||
|
||||
@ -131,12 +131,14 @@ print ' </div>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td>'.$langs->trans('Date').'</td>';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
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>'.$langs->trans('Author').'</td>';
|
||||
print '<td class="center">'.$langs->trans('DataOfArchivedEvent').'</td>';
|
||||
print '<td>'.$langs->trans('Fingerprint').'</td>';
|
||||
print '<td><span id="blockchainstatus"></span></td>';
|
||||
|
||||
@ -150,20 +152,27 @@ foreach($blocks as &$block) {
|
||||
if(!$showonlyerrors || $block->error>0) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$block->id.'</td>';
|
||||
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
|
||||
print '<td>'.$block->ref_object.'</td>';
|
||||
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
||||
print '<td>'.$object_link.'<a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
||||
print '<td align="right">'.price($block->amounts).'</td>';
|
||||
print '<td>'.$block->getUser().'</td>';
|
||||
print '<td>'.$block->signature.'</td>';
|
||||
print '<td>';
|
||||
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
||||
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>';
|
||||
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature);
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
print $block->error == 0 ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'tick') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
|
||||
|
||||
print $block->error == 0 ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'on') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'off');
|
||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
||||
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
@ -171,6 +180,8 @@ foreach($blocks as &$block) {
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('a[rel=show-info]').click(function() {
|
||||
|
||||
@ -1,45 +1,77 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require '../../master.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
|
||||
|
||||
$user=new User($db);
|
||||
$user->fetch(1); //TODO conf user authority
|
||||
|
||||
$auth = new BlockedLogAuthority($db);
|
||||
|
||||
$signature = GETPOST('s');
|
||||
$newblock = GETPOST('b');
|
||||
$hash = GETPOST('h');
|
||||
|
||||
if($auth->fetch(0, $signature)<=0) {
|
||||
$auth->signature = $signature;
|
||||
$auth->create($user);
|
||||
}
|
||||
/**
|
||||
* \file htdocs/blockedlog/ajax/authority.php
|
||||
* \ingroup blockedlog
|
||||
* \brief authority
|
||||
*/
|
||||
|
||||
|
||||
if(!empty($hash)) {
|
||||
// This script is called with a POST method.
|
||||
// Directory to scan (full path) is inside POST['dir'].
|
||||
|
||||
echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk';
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
}
|
||||
elseif(!empty($newblock)){
|
||||
if($auth->checkBlock($newblock)) {
|
||||
$auth->addBlock($newblock);
|
||||
$auth->update($user);
|
||||
$res=require '../../master.inc.php';
|
||||
|
||||
echo 'blockadded';
|
||||
}
|
||||
else{
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
|
||||
|
||||
echo 'blockalreadyadded';
|
||||
$user=new User($db);
|
||||
$user->fetch(1); //TODO conf user authority
|
||||
|
||||
}
|
||||
$auth = new BlockedLogAuthority($db);
|
||||
|
||||
$signature = GETPOST('s');
|
||||
$newblock = GETPOST('b');
|
||||
$hash = GETPOST('h');
|
||||
|
||||
if($auth->fetch(0, $signature)<=0) {
|
||||
$auth->signature = $signature;
|
||||
$auth->create($user);
|
||||
}
|
||||
|
||||
|
||||
if(!empty($hash)) {
|
||||
|
||||
echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk';
|
||||
|
||||
}
|
||||
elseif(!empty($newblock)){
|
||||
if($auth->checkBlock($newblock)) {
|
||||
$auth->addBlock($newblock);
|
||||
$auth->update($user);
|
||||
|
||||
echo 'blockadded';
|
||||
}
|
||||
else{
|
||||
echo 'idontunderstandwhatihavetodo';
|
||||
|
||||
echo 'blockalreadyadded';
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo 'idontunderstandwhatihavetodo';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,19 +1,49 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
/**
|
||||
* \file htdocs/blockedlog/ajax/block-add.php
|
||||
* \ingroup blockedlog
|
||||
* \brief Block-add
|
||||
*/
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$element = GETPOST('element','alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
if($element === 'facture') {
|
||||
dol_include_once('/compta/facture/class/facture.class.php');
|
||||
// This script is called with a POST method.
|
||||
// Directory to scan (full path) is inside POST['dir'].
|
||||
|
||||
$facture = new Facture($db);
|
||||
if($facture->fetch($id)>0) {
|
||||
$facture->call_trigger($action, $user);
|
||||
}
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
$res=require '../../main.inc.php';
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$element = GETPOST('element','alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
if ($element === 'facture') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$facture = new Facture($db);
|
||||
if($facture->fetch($id)>0) {
|
||||
$facture->call_trigger($action, $user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,47 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
/**
|
||||
* \file htdocs/blockedlog/ajax/block-info.php
|
||||
* \ingroup blockedlog
|
||||
* \brief block-info
|
||||
*/
|
||||
|
||||
$id = GETPOST('id');
|
||||
|
||||
$block = new BlockedLog($db);
|
||||
if($block->fetch($id)>0) {
|
||||
echo json_encode($block->object_data);
|
||||
}
|
||||
else {
|
||||
echo json_encode(false);
|
||||
}
|
||||
// This script is called with a POST method.
|
||||
// Directory to scan (full path) is inside POST['dir'].
|
||||
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
|
||||
$id = GETPOST('id');
|
||||
|
||||
$block = new BlockedLog($db);
|
||||
if($block->fetch($id)>0) {
|
||||
echo json_encode($block->object_data);
|
||||
}
|
||||
else {
|
||||
echo json_encode(false);
|
||||
}
|
||||
|
||||
@ -1,30 +1,63 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
/**
|
||||
* \file htdocs/blockedlog/ajax/block-info.php
|
||||
* \ingroup blockedlog
|
||||
* \brief block-info
|
||||
*/
|
||||
|
||||
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) exit('BLOCKEDLOG_AUTHORITY_URL not set');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
|
||||
// This script is called with a POST method.
|
||||
// Directory to scan (full path) is inside POST['dir'].
|
||||
|
||||
$auth=new BlockedLogAuthority($db);
|
||||
$auth->syncSignatureWithAuthority();
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
$block_static = new BlockedLog($db);
|
||||
|
||||
$blocks = $block_static->getLog('just_certified', 0, 0, 1) ;
|
||||
require '../../main.inc.php';
|
||||
|
||||
$auth->signature = $block_static->getSignature();
|
||||
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) exit('BLOCKEDLOG_AUTHORITY_URL not set');
|
||||
|
||||
foreach($blocks as &$b) {
|
||||
$auth->blockchain.=$b->signature;
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';
|
||||
|
||||
}
|
||||
$auth=new BlockedLogAuthority($db);
|
||||
$auth->syncSignatureWithAuthority();
|
||||
|
||||
$hash = $auth->getBlockchainHash();
|
||||
$block_static = new BlockedLog($db);
|
||||
|
||||
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$auth->signature.'&h='.$hash;
|
||||
$blocks = $block_static->getLog('just_certified', 0, 0, 1) ;
|
||||
|
||||
$res = file_get_contents($url);
|
||||
//echo $url;
|
||||
echo $res;
|
||||
$auth->signature = $block_static->getSignature();
|
||||
|
||||
foreach($blocks as &$b) {
|
||||
$auth->blockchain.=$b->signature;
|
||||
|
||||
}
|
||||
|
||||
$hash = $auth->getBlockchainHash();
|
||||
|
||||
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$auth->signature.'&h='.$hash;
|
||||
|
||||
$res = file_get_contents($url);
|
||||
//echo $url;
|
||||
echo $res;
|
||||
@ -523,14 +523,14 @@ class BlockedLog
|
||||
}
|
||||
|
||||
/**
|
||||
* return and set the entity signature included into line signature
|
||||
* Return and set the entity signature included into line signature
|
||||
*
|
||||
* @return string current entity signature
|
||||
*/
|
||||
public function getSignature() {
|
||||
global $db,$conf,$mysoc;
|
||||
|
||||
if(empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint
|
||||
if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
@ -538,7 +538,7 @@ class BlockedLog
|
||||
|
||||
dolibarr_set_const($db, 'BLOCKEDLOG_ENTITY_FINGERPRINT', $fingerprint, 'chaine',0,'Numeric Unique Fingerprint', $conf->entity);
|
||||
|
||||
$conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT= $fingerprint;
|
||||
$conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT=$fingerprint;
|
||||
}
|
||||
|
||||
return $conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT;
|
||||
|
||||
@ -34,7 +34,7 @@ function blockedlogadmin_prepare_head()
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/blockedlog/admin/blockedlog.php";
|
||||
$head[$h][1] = $langs->trans("BlockedLog");
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$head[$h][2] = 'blockedlog';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -4247,37 +4247,6 @@ 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
|
||||
|
||||
@ -43,15 +43,15 @@ class modBlockedLog extends DolibarrModules
|
||||
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "technic";
|
||||
$this->family = "base";
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
$this->description = "Enable a log on some business events into a reserved log. This module may be mandatory for some countries.";
|
||||
$this->description = "Enable a log on some business events into a non reversible log. This module may be mandatory for some countries.";
|
||||
$this->version = 'development'; // 'development', 'experimental' or 'dolibarr' or version
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
|
||||
$this->special = 1;
|
||||
$this->special = 2;
|
||||
// Name of image file used for this module.
|
||||
$this->picto='technic';
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
}
|
||||
|
||||
if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
|
||||
|| $action === 'BILL_SENTBYMAIL' || $action === 'DOWNLOAD_BILL' || $action === 'PREVIEW_BILL') {
|
||||
|| $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW') {
|
||||
$amounts= (double) $object->total_ttc;
|
||||
}
|
||||
else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') {
|
||||
|
||||
@ -467,7 +467,7 @@ Module30Desc=Invoice and credit note management for customers. Invoice managemen
|
||||
Module40Name=Suppliers
|
||||
Module40Desc=Supplier management and buying (orders and invoices)
|
||||
Module42Name=Logs
|
||||
Module42Desc=Logging facilities (file, syslog, ...)
|
||||
Module42Desc=Logging facilities (file, syslog, ...). Such logs are for technical/debug purposes. For legal purpose, see instead module 'Non Reversible Logs'.
|
||||
Module49Name=Editors
|
||||
Module49Desc=Editor management
|
||||
Module50Name=Products
|
||||
@ -565,6 +565,8 @@ Module2900Name=GeoIPMaxmind
|
||||
Module2900Desc=GeoIP Maxmind conversions capabilities
|
||||
Module3100Name=Skype
|
||||
Module3100Desc=Add a Skype button into users / third parties / contacts / members cards
|
||||
Module3200Name=Non Reversible Logs
|
||||
Module3200Desc=Activate log of some business events into a non reversible log. Events are archived in real-time. The log is a table that can be then exported. This module may be mandatory for some countries.
|
||||
Module4000Name=HRM
|
||||
Module4000Desc=Human resources management (mangement of department, employee contracts and feelings)
|
||||
Module5000Name=Multi-company
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
BlockedLog=Non Reversible Logs
|
||||
Field=Field
|
||||
BlockedLogDesc=This module store event for invoice and payments as block chain
|
||||
FingerprintsDesc=All fingerprints stored
|
||||
EntityKey=Entity Key
|
||||
ShowAllFingerPrintsMightBeTooLong=Show all fingerprints (might be long)
|
||||
ShowAllFingerPrintsErrorsMightBeTooLong=Show all fingerprints with error (might be long)
|
||||
BlockedLogDesc=This module store event for invoice and payments into a block chain
|
||||
Fingerprints=Archived events and fingerprints
|
||||
FingerprintsDesc=Archived business events and fingerprints
|
||||
CompanyInitialKey=Company initial key
|
||||
ShowAllFingerPrintsMightBeTooLong=Show all archived logs (might be long)
|
||||
ShowAllFingerPrintsErrorsMightBeTooLong=Show all archive logs with error (might be long)
|
||||
DownloadBlockChain=Download fingerprints
|
||||
KoCheckFingerprintValidity=Fingerprint is not valid
|
||||
OkCheckFingerprintValidity=Fingerprint is valid
|
||||
KoCheckFingerprintValidity=Archived log is not valid. It means someone (a hacker ?) has modified some datas of this archived log after it was recorded, or has erased the previous archived record (check that line with previous # exists).
|
||||
OkCheckFingerprintValidity=Archived log is valid. It means all data on this line were not modified and record follow the previous one.
|
||||
AddedByAuthority=Stored into remote authority
|
||||
NotAddedByAuthorityYet=Not yet stored into remote authority
|
||||
ShowDetails=Show stored details
|
||||
@ -18,6 +20,7 @@ logBILL_VALIDATE=Customer bill set valid from draft
|
||||
logBILL_SENTBYMAIL=Customer bill send by mail
|
||||
BlockedlogInfoDialog=Log Details
|
||||
Fingerprint=Fingerprint
|
||||
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
|
||||
DownloadLogCSV=Download archive logs (CSV)
|
||||
logDOC_PREVIEW=Preview of a validated document in order to print or download
|
||||
logDOC_DOWNLOAD=Download of a validated document in order to print or send
|
||||
DataOfArchivedEvent=Full datas of archived event
|
||||
@ -1891,7 +1891,7 @@ if (! function_exists("llxFooter"))
|
||||
*/
|
||||
function llxFooter($comment='',$zone='private')
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
global $conf, $langs, $user, $object;
|
||||
global $delayedhtmlcontent;
|
||||
|
||||
// Global html output events ($mesgs, $errors, $warnings)
|
||||
@ -2026,6 +2026,40 @@ if (! function_exists("llxFooter"))
|
||||
</script>';
|
||||
}
|
||||
|
||||
// Wrapper to add log when clicking on download or preview
|
||||
if (! empty($conf->blockedlog->enabled) && is_object($object) && $object->id > 0 && $object->statut > 0)
|
||||
{
|
||||
if (in_array($object->element, array('facture'))) // Restrict for the moment to element 'facture'
|
||||
{
|
||||
print "\n<!-- JS CODE TO ENABLE log when making a download or a preview of a document -->\n";
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(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:'DOC_PREVIEW'
|
||||
}
|
||||
);
|
||||
});
|
||||
$('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:'DOC_DOWNLOAD'
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// A div for the address popup
|
||||
print "\n<!-- A div to allow dialog popup -->\n";
|
||||
print '<div id="dialogforpopup" style="display: none;"></div>'."\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user