Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions admin/history_about.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
* Put some comments here
*/
// Dolibarr environment
$res = @include("../../main.inc.php"); // From htdocs directory
$res = @include "../../main.inc.php"; // From htdocs directory
if (! $res) {
$res = @include("../../../main.inc.php"); // From "custom" directory
$res = @include "../../../main.inc.php"; // From "custom" directory
}

// Libraries
Expand All @@ -37,7 +37,7 @@

// Access control
if (! $user->admin) {
accessforbidden();
accessforbidden();
}

/*
Expand All @@ -48,17 +48,17 @@

// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
. $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans($page_name), $linkback, 'tools');

// Configuration header
$head = historyAdminPrepareHead();
dol_fiche_head(
$head,
'about',
$langs->trans("ModuleName"),
-1,
'history@history'
$head,
'about',
$langs->trans("ModuleName"),
-1,
'history@history'
);

require_once __DIR__ . '/../class/techatm.class.php';
Expand All @@ -73,4 +73,4 @@

llxFooter();

$db->close();
$db->close();
38 changes: 18 additions & 20 deletions class/actions_history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
* Put some comments here
*/


require_once __DIR__.'/../backport/v19/core/class/commonhookactions.class.php';

/**
* Class ActionsHistory
*
* Hook manager for History module
*/
require_once __DIR__.'/../backport/v19/core/class/commonhookactions.class.php';
class ActionsHistory extends \history\RetroCompatCommonHookActions
{
/**
Expand Down Expand Up @@ -54,39 +58,33 @@ public function __construct()
/**
* Overloading the doActions function : replacing the parent's function with the one below
*
* @param array() $parameters Hook metadatas (context, etc...)
* @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string &$action Current action (if set). Generally create or edit or null
* @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string $action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
function doActions($parameters, &$object, &$action, $hookmanager)
public function doActions($parameters, &$object, &$action, $hookmanager)
{

if (!empty($object) && in_array('globalcard', explode(':', $parameters['context'])))
{

if (!empty($object) && in_array('globalcard', explode(':', $parameters['context']))) {
global $history_old_object,$conf;

$history_old_object = clone $object;

if($action == 'addline' && property_exists($object, "class_element_line")) $history_old_object = new $object->class_element_line($this->db);

if(getDolGlobalString('HISTORY_STOCK_FULL_OBJECT_ON_DELETE') && strpos($action,'delete')!==false) {

if(!defined('INC_FROM_DOLIBARR')) define('INC_FROM_DOLIBARR',true);
dol_include_once('/history/config.php');

if($object->id <= 0) {
if ($action == 'addline' && property_exists($object, "class_element_line")) $history_old_object = new $object->class_element_line($this->db);

if(!empty($parameters['id']) && method_exists($object, 'fetch')) $object->fetch($parameters['id']);
if (getDolGlobalString('HISTORY_STOCK_FULL_OBJECT_ON_DELETE') && strpos($action, 'delete')!==false) {
if (!defined('INC_FROM_DOLIBARR')) define('INC_FROM_DOLIBARR', true);
dol_include_once('/history/config.php');

if ($object->id <= 0) {
if (!empty($parameters['id']) && method_exists($object, 'fetch')) $object->fetch($parameters['id']);
}

DeepHistory::makeCopy($object);

}

}
}
return 0;
}
}
Loading