forked from Wavyzz/dolibarr
New: add dictionnary sharing (multicompany)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||||
|
|||||||
@@ -110,10 +110,13 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
|
|||||||
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
|
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
|
||||||
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
|
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
|
||||||
* 'email_template', 'event',
|
* 'email_template', 'event',
|
||||||
* @param int $shared 1=Return id of current entity + shared entities (default), 0=Return id of current entity only
|
* @param int $shared 0=Return id of current entity only,
|
||||||
|
* 1=Return id of current entity + shared entities (default),
|
||||||
|
* 2=Return id of current entity OR $forceentity value (eg. dictionnary share)
|
||||||
|
* @param int $forceentity Entity id
|
||||||
* @return mixed Entity id(s) to use
|
* @return mixed Entity id(s) to use
|
||||||
*/
|
*/
|
||||||
function getEntity($element=false, $shared=1)
|
function getEntity($element=false, $shared=1, $forceentity=null)
|
||||||
{
|
{
|
||||||
global $conf, $mc;
|
global $conf, $mc;
|
||||||
|
|
||||||
@@ -124,14 +127,23 @@ function getEntity($element=false, $shared=1)
|
|||||||
|
|
||||||
if (is_object($mc))
|
if (is_object($mc))
|
||||||
{
|
{
|
||||||
return $mc->getEntity($element, $shared);
|
return $mc->getEntity($element, $shared, $forceentity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
|
if ($shared == 2)
|
||||||
|
{
|
||||||
|
$out.= $forceentity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$addzero = array('user', 'usergroup', 'email_template', 'default_values');
|
$addzero = array('user', 'usergroup', 'email_template', 'default_values');
|
||||||
if (in_array($element, $addzero)) $out.= '0,';
|
if (in_array($element, $addzero)) $out.= '0,';
|
||||||
$out.= $conf->entity;
|
$out.= $conf->entity;
|
||||||
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -381,3 +381,11 @@ create table llx_loan_schedule
|
|||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
ALTER TABLE llx_tva ADD COLUMN datec date AFTER tms;
|
ALTER TABLE llx_tva ADD COLUMN datec date AFTER tms;
|
||||||
|
|
||||||
|
ALTER TABLE llx_c_paiement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER id;
|
||||||
|
ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement;
|
||||||
|
ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(entity, code);
|
||||||
|
|
||||||
|
ALTER TABLE llx_c_payment_term ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
|
||||||
|
ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(entity, code);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
-- ========================================================================
|
-- ========================================================================
|
||||||
-- Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
-- Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- 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
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,4 +17,4 @@
|
|||||||
--
|
--
|
||||||
-- ========================================================================
|
-- ========================================================================
|
||||||
|
|
||||||
ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(code);
|
ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(entity, code);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
-- Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
-- Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
-- Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
-- Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
|
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- 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
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
create table llx_c_paiement
|
create table llx_c_paiement
|
||||||
(
|
(
|
||||||
id integer PRIMARY KEY,
|
id integer PRIMARY KEY,
|
||||||
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
code varchar(6) NOT NULL,
|
code varchar(6) NOT NULL,
|
||||||
libelle varchar(62),
|
libelle varchar(62),
|
||||||
type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other
|
type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other
|
||||||
@@ -28,6 +30,3 @@ create table llx_c_paiement
|
|||||||
accountancy_code varchar(32) NULL,
|
accountancy_code varchar(32) NULL,
|
||||||
module varchar(32) NULL
|
module varchar(32) NULL
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
20
htdocs/install/mysql/tables/llx_c_payment_term.key.sql
Normal file
20
htdocs/install/mysql/tables/llx_c_payment_term.key.sql
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
-- ========================================================================
|
||||||
|
-- Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||||
|
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
--
|
||||||
|
-- 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/>.
|
||||||
|
--
|
||||||
|
-- ========================================================================
|
||||||
|
|
||||||
|
ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(entity, code);
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- 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
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
create table llx_c_payment_term
|
create table llx_c_payment_term
|
||||||
(
|
(
|
||||||
rowid integer PRIMARY KEY,
|
rowid integer PRIMARY KEY,
|
||||||
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
code varchar(16),
|
code varchar(16),
|
||||||
sortorder smallint,
|
sortorder smallint,
|
||||||
active tinyint DEFAULT 1,
|
active tinyint DEFAULT 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user