Fix: possibility to add more parameters (eg: entity=0)
This commit is contained in:
parent
2ef70d4f52
commit
1b236c5c56
@ -160,7 +160,7 @@ class Conf
|
||||
$modulename = strtolower($reg[1]);
|
||||
$partname = strtolower($reg[2]);
|
||||
$varname = $partname.'_modules';
|
||||
$this->$varname = array();
|
||||
if (! is_array($this->$varname)) { $this->$varname = array(); }
|
||||
$arrValue = unserialize($value);
|
||||
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
|
||||
else $value = ($value == 1 ? '/'.$modulename.'/core/'.$partname.'/' : $value);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -43,9 +43,9 @@ class HookManager
|
||||
*
|
||||
* @param DoliDB $DB Handler acces base de donnees
|
||||
*/
|
||||
function HookManager($DB)
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1261,13 +1261,28 @@ abstract class DolibarrModules
|
||||
global $conf;
|
||||
|
||||
$err=0;
|
||||
$entity=$conf->entity;
|
||||
|
||||
if (is_array($this->module_parts) && ! empty($this->module_parts))
|
||||
{
|
||||
foreach($this->module_parts as $key => $value)
|
||||
{
|
||||
$newvalue = $value;
|
||||
|
||||
// Serialize array parameters
|
||||
if (is_array($value)) $value = serialize($value);
|
||||
if (is_array($value))
|
||||
{
|
||||
// Can defined other parameters
|
||||
if (is_array($value['data']) && ! empty($value['data']))
|
||||
{
|
||||
$newvalue = serialize($value['data']);
|
||||
if (isset($value['entity'])) $entity = $value['entity'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$newvalue = serialize($value);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
|
||||
$sql.= "name";
|
||||
@ -1278,12 +1293,12 @@ abstract class DolibarrModules
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= $this->db->encrypt($this->const_name."_".strtoupper($key),1);
|
||||
$sql.= $this->db->encrypt($this->const_name."_".strtoupper($key), 1);
|
||||
$sql.= ", 'chaine'";
|
||||
$sql.= ", ".$this->db->encrypt($value,1);
|
||||
$sql.= ", ".$this->db->encrypt($newvalue, 1);
|
||||
$sql.= ", null";
|
||||
$sql.= ", '0'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert_".$key." sql=".$sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user