New: early development of multi-company module
This commit is contained in:
parent
c75e812a76
commit
fd7d9b5d5a
@ -38,7 +38,7 @@ $typeconst=array('yesno','texte','chaine');
|
|||||||
|
|
||||||
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
||||||
{
|
{
|
||||||
if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],1,isset($_POST["constnote"])?$_POST["constnote"]:''));
|
if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],1,isset($_POST["constnote"])?$_POST["constnote"]:'',$_POST["entity"]));
|
||||||
{
|
{
|
||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
@ -93,10 +93,17 @@ print '</form>';
|
|||||||
|
|
||||||
# Affiche lignes des constantes
|
# Affiche lignes des constantes
|
||||||
if ($all==1){
|
if ($all==1){
|
||||||
$sql = "SELECT rowid, name, value, note FROM llx_const ORDER BY name ASC";
|
$sql = "SELECT rowid, name, value, note, entity ";
|
||||||
|
$sql.= "FROM llx_const ";
|
||||||
|
$sql.= "WHERE entity = 0 OR entity = ".$conf->entity." ";
|
||||||
|
$sql.= "ORDER BY name ASC";
|
||||||
}else{
|
}else{
|
||||||
$sql = "SELECT rowid, name, value, note FROM llx_const WHERE visible = 1 ORDER BY name ASC";
|
$sql = "SELECT rowid, name, value, note, entity ";
|
||||||
|
$sql.= "FROM llx_const ";
|
||||||
|
$sql.= "WHERE visible = 1 AND (entity = 0 OR entity = ".$conf->entity.") ";
|
||||||
|
$sql.= "ORDER BY name ASC";
|
||||||
}
|
}
|
||||||
|
dol_syslog("Const::listConstant sql=".$sql,LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -113,6 +120,7 @@ if ($result)
|
|||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
print '<input type="hidden" name="constname" value="'.$obj->name.'">';
|
print '<input type="hidden" name="constname" value="'.$obj->name.'">';
|
||||||
|
print '<input type="hidden" name="entity" value="'.$obj->entity.'">';
|
||||||
|
|
||||||
print "<tr $bc[$var] class=value><td>$obj->name</td>\n";
|
print "<tr $bc[$var] class=value><td>$obj->name</td>\n";
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class Conf
|
|||||||
* - En $this->global->key=value
|
* - En $this->global->key=value
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT name, value, entity FROM ".MAIN_DB_PREFIX."const ";
|
$sql = "SELECT name, value, entity FROM ".MAIN_DB_PREFIX."const ";
|
||||||
$sql.= " WHERE entity = ".$this->entity;
|
$sql.= " WHERE entity = 0 OR entity = ".$this->entity;
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,4 +36,13 @@ create table llx_const
|
|||||||
tms timestamp,
|
tms timestamp,
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
UNIQUE INDEX(name)
|
UNIQUE INDEX(name)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- List of codes for the field entity
|
||||||
|
--
|
||||||
|
-- 0 : common constant
|
||||||
|
-- 1 : first company constant
|
||||||
|
-- 2 : second company constant
|
||||||
|
-- 3 : etc...
|
||||||
|
--
|
||||||
Loading…
Reference in New Issue
Block a user