New: early development of multi-company module
This commit is contained in:
parent
38047abe4d
commit
467ec4a641
@ -49,9 +49,8 @@ $action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action'
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
$comid = isset($_GET["id"])?$_GET["id"]:'';
|
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'commande',$comid,'');
|
$result=restrictedArea($user,'commande',$id,'');
|
||||||
|
|
||||||
// Chargement des permissions
|
// Chargement des permissions
|
||||||
$error = $user->load_entrepots();
|
$error = $user->load_entrepots();
|
||||||
|
|||||||
@ -37,8 +37,6 @@ if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"
|
|||||||
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
|
||||||
if ($conf->stock->enabled) require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
|
if ($conf->stock->enabled) require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
|
||||||
|
|
||||||
if (! $user->rights->expedition->lire) accessforbidden();
|
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load('deliveries');
|
$langs->load('deliveries');
|
||||||
@ -47,16 +45,20 @@ $langs->load('stocks');
|
|||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
$langs->load('propal');
|
$langs->load('propal');
|
||||||
|
|
||||||
// Security check
|
$origin = "expedition";
|
||||||
$id = isset($_GET["id"])?$_GET["id"]:'';
|
$origin_id = isset($_GET["id"])?$_GET["id"]:'';
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
$id = $origin_id;
|
||||||
$result=restrictedArea($user,'expedition',$id,'');
|
|
||||||
|
|
||||||
|
|
||||||
$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal
|
$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal
|
||||||
$origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal
|
$origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal
|
||||||
|
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
$result=restrictedArea($user,$origin,$origin_id,'');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -44,7 +44,7 @@ $langs->load('deliveries');
|
|||||||
// Security check
|
// Security check
|
||||||
$id = isset($_GET["id"])?$_GET["id"]:'';
|
$id = isset($_GET["id"])?$_GET["id"]:'';
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'expedition',$id,'','livraison');
|
$result=restrictedArea($user,'expedition',$id,'livraison','livraison');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -67,8 +67,8 @@ if ($_POST["action"] == 'add')
|
|||||||
$expedition->entrepot_id = $_POST["entrepot_id"];
|
$expedition->entrepot_id = $_POST["entrepot_id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// On boucle sur chaque ligne de commande pour compl<EFBFBD>ter objet livraison
|
// On boucle sur chaque ligne de commande pour completer objet livraison
|
||||||
// avec qt<EFBFBD> <20> livrer
|
// avec qte a livrer
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
$commande->fetch($livraison->commande_id);
|
$commande->fetch($livraison->commande_id);
|
||||||
$commande->fetch_lines();
|
$commande->fetch_lines();
|
||||||
|
|||||||
@ -28,6 +28,7 @@ ALTER TABLE llx_commande ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
|
|||||||
ALTER TABLE llx_commande_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
|
ALTER TABLE llx_commande_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
|
||||||
ALTER TABLE llx_product_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref_fourn;
|
ALTER TABLE llx_product_fournisseur ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref_fourn;
|
||||||
ALTER TABLE llx_facture ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber;
|
ALTER TABLE llx_facture ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER facnumber;
|
||||||
|
ALTER TABLE llx_expedition ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER ref;
|
||||||
|
|
||||||
ALTER TABLE llx_rights_def DROP PRIMARY KEY;
|
ALTER TABLE llx_rights_def DROP PRIMARY KEY;
|
||||||
ALTER TABLE llx_user_param DROP INDEX fk_user;
|
ALTER TABLE llx_user_param DROP INDEX fk_user;
|
||||||
@ -45,6 +46,7 @@ ALTER TABLE llx_commande_fournisseur DROP INDEX uk_commande_fournisseur_ref;
|
|||||||
ALTER TABLE llx_product_fournisseur DROP INDEX fk_product;
|
ALTER TABLE llx_product_fournisseur DROP INDEX fk_product;
|
||||||
ALTER TABLE llx_product_fournisseur DROP INDEX fk_soc;
|
ALTER TABLE llx_product_fournisseur DROP INDEX fk_soc;
|
||||||
ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber;
|
ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber;
|
||||||
|
ALTER TABLE llx_expedition DROP INDEX idx_expedition_uk_ref;
|
||||||
|
|
||||||
ALTER TABLE llx_rights_def ADD PRIMARY KEY (id, entity);
|
ALTER TABLE llx_rights_def ADD PRIMARY KEY (id, entity);
|
||||||
ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity);
|
ALTER TABLE llx_user_param ADD UNIQUE INDEX uk_user_param (fk_user,param,entity);
|
||||||
@ -63,3 +65,4 @@ ALTER TABLE llx_product_fournisseur ADD UNIQUE INDEX uk_product_fournisseur_ref
|
|||||||
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_product (fk_product, entity);
|
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_product (fk_product, entity);
|
||||||
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_soc (fk_soc, entity);
|
ALTER TABLE llx_product_fournisseur ADD INDEX idx_product_fourn_fk_soc (fk_soc, entity);
|
||||||
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, entity);
|
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, entity);
|
||||||
|
ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity);
|
||||||
@ -1,6 +1,6 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
-- Copyright (C) 2008 Regis Houssin <regis@dolibarr.fr>
|
-- Copyright (C) 2008-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
--
|
--
|
||||||
-- 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 +20,8 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref, entity);
|
||||||
|
|
||||||
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_soc (fk_soc);
|
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_soc (fk_soc);
|
||||||
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_author (fk_user_author);
|
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_author (fk_user_author);
|
||||||
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_valid (fk_user_valid);
|
ALTER TABLE llx_expedition ADD INDEX idx_expedition_fk_user_valid (fk_user_valid);
|
||||||
@ -31,5 +33,3 @@ ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_user_author FO
|
|||||||
ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
|
ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
|
||||||
ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_adresse_livraison FOREIGN KEY (fk_adresse_livraison) REFERENCES llx_societe_adresse_livraison (rowid);
|
ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_adresse_livraison FOREIGN KEY (fk_adresse_livraison) REFERENCES llx_societe_adresse_livraison (rowid);
|
||||||
ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_expedition_methode FOREIGN KEY (fk_expedition_methode) REFERENCES llx_expedition_methode (rowid);
|
ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_expedition_methode FOREIGN KEY (fk_expedition_methode) REFERENCES llx_expedition_methode (rowid);
|
||||||
|
|
||||||
ALTER TABLE llx_expedition ADD UNIQUE INDEX idx_expedition_uk_ref (ref);
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
-- Copyright (C) 2008 Regis Houssin <regis@dolibarr.fr>
|
-- Copyright (C) 2008-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
--
|
--
|
||||||
-- 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
|
||||||
@ -24,16 +24,19 @@ create table llx_expedition
|
|||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
ref varchar(30) NOT NULL,
|
ref varchar(30) NOT NULL,
|
||||||
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
fk_soc integer NOT NULL,
|
fk_soc integer NOT NULL,
|
||||||
|
|
||||||
date_creation datetime, -- date de creation
|
date_creation datetime, -- date de creation
|
||||||
fk_user_author integer, -- createur
|
fk_user_author integer, -- createur
|
||||||
date_valid datetime, -- date de validation
|
date_valid datetime, -- date de validation
|
||||||
fk_user_valid integer, -- valideur
|
fk_user_valid integer, -- valideur
|
||||||
date_expedition date, -- date de l'expedition
|
date_expedition date, -- date de lexpedition
|
||||||
fk_adresse_livraison integer DEFAULT NULL, -- adresse de livraison
|
fk_adresse_livraison integer DEFAULT NULL, -- adresse de livraison
|
||||||
fk_expedition_methode integer,
|
fk_expedition_methode integer,
|
||||||
tracking_number varchar(50),
|
tracking_number varchar(50),
|
||||||
fk_statut smallint DEFAULT 0,
|
fk_statut smallint DEFAULT 0,
|
||||||
|
|
||||||
height integer,
|
height integer,
|
||||||
width integer,
|
width integer,
|
||||||
size_units integer,
|
size_units integer,
|
||||||
@ -42,4 +45,5 @@ create table llx_expedition
|
|||||||
weight integer,
|
weight integer,
|
||||||
note text,
|
note text,
|
||||||
model_pdf varchar(50)
|
model_pdf varchar(50)
|
||||||
|
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user