1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* Copyright (C) 2005 Matthieu Valleton <[email protected]> |
4
|
|
|
* Copyright (C) 2005-2014 Laurent Destailleur <[email protected]> |
5
|
|
|
* Copyright (C) 2012-2016 Juanjo Menent <[email protected]> |
6
|
|
|
* Copyright (C) 2020 Stéphane Lesage <[email protected]> |
7
|
|
|
* Copyright (C) 2024 MDW <[email protected]> |
8
|
|
|
* Copyright (C) 2024 Rafael San José <[email protected]> |
9
|
|
|
* |
10
|
|
|
* This program is free software; you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU General Public License as published by |
12
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
13
|
|
|
* (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* This program is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
* GNU General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU General Public License |
21
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
namespace Dolibarr\Modules; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* \defgroup category Module categories |
28
|
|
|
* \brief Module to manage categories |
29
|
|
|
* \file htdocs/core/modules/modCategorie.class.php |
30
|
|
|
* \ingroup category |
31
|
|
|
* \brief Description and activation file for the module Category |
32
|
|
|
*/ |
33
|
|
|
|
34
|
|
|
namespace Dolibarr\Modules; |
35
|
|
|
|
36
|
|
|
use Categorie; |
37
|
|
|
use Dolibarr\Core\Base\DolibarrModules; |
38
|
|
|
use DoliDB; |
39
|
|
|
|
40
|
|
|
include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Class to describe and enable module Categorie |
45
|
|
|
*/ |
46
|
|
|
class Category extends DolibarrModules |
47
|
|
|
{ |
48
|
|
|
/** |
49
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions |
50
|
|
|
* |
51
|
|
|
* @param DoliDB $db Database handler |
52
|
|
|
*/ |
53
|
|
|
public function __construct($db) |
54
|
|
|
{ |
55
|
|
|
global $conf; |
56
|
|
|
|
57
|
|
|
$this->db = $db; |
|
|
|
|
58
|
|
|
$this->numero = 1780; |
59
|
|
|
|
60
|
|
|
$this->family = "technic"; |
61
|
|
|
$this->module_position = '25'; |
62
|
|
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
63
|
|
|
$this->name = preg_replace('/^mod/i', '', get_class($this)); |
64
|
|
|
$this->description = "Gestion des categories (produits, clients, fournisseurs...)"; |
65
|
|
|
|
66
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
67
|
|
|
$this->version = 'dolibarr'; |
68
|
|
|
|
69
|
|
|
$this->const_name = 'MAIN_MODULE_' . static::getNameOf($this->name); // strtoupper($this->name); |
70
|
|
|
$this->picto = 'category'; |
71
|
|
|
|
72
|
|
|
// Data directories to create when module is enabled |
73
|
|
|
$this->dirs = array(); |
74
|
|
|
|
75
|
|
|
// Dependencies |
76
|
|
|
$this->depends = array(); |
77
|
|
|
|
78
|
|
|
// Config pages |
79
|
|
|
$this->config_page_url = array('categorie.php@categories'); |
80
|
|
|
$this->langfiles = array("products", "companies", "categories", "members", "stocks", "website"); |
81
|
|
|
|
82
|
|
|
// Constants |
83
|
|
|
$this->const = array(); |
84
|
|
|
$r = 0; |
85
|
|
|
$this->const[$r][0] = "CATEGORIE_RECURSIV_ADD"; |
86
|
|
|
$this->const[$r][1] = "yesno"; |
87
|
|
|
$this->const[$r][2] = "0"; |
88
|
|
|
$this->const[$r][3] = 'Affect parent categories'; |
89
|
|
|
$this->const[$r][4] = 0; |
90
|
|
|
$r++; |
91
|
|
|
|
92
|
|
|
// Boxes |
93
|
|
|
$this->boxes = array(); |
94
|
|
|
|
95
|
|
|
// Permissions |
96
|
|
|
$this->rights = array(); |
97
|
|
|
$this->rights_class = 'categorie'; |
98
|
|
|
|
99
|
|
|
$r = 0; |
100
|
|
|
|
101
|
|
|
$this->rights[$r][0] = 241; // id de la permission |
102
|
|
|
$this->rights[$r][1] = 'Lire les categories'; // libelle de la permission |
103
|
|
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecated) |
104
|
|
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par default |
105
|
|
|
$this->rights[$r][4] = 'lire'; |
106
|
|
|
$r++; |
107
|
|
|
|
108
|
|
|
$this->rights[$r][0] = 242; // id de la permission |
109
|
|
|
$this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission |
110
|
|
|
$this->rights[$r][2] = 'w'; // type de la permission (deprecated) |
111
|
|
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par default |
112
|
|
|
$this->rights[$r][4] = 'creer'; |
113
|
|
|
$r++; |
114
|
|
|
|
115
|
|
|
$this->rights[$r][0] = 243; // id de la permission |
116
|
|
|
$this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission |
117
|
|
|
$this->rights[$r][2] = 'd'; // type de la permission (deprecated) |
118
|
|
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par default |
119
|
|
|
$this->rights[$r][4] = 'supprimer'; |
120
|
|
|
$r++; |
121
|
|
|
|
122
|
|
|
|
123
|
|
|
// Menus |
124
|
|
|
//------- |
125
|
|
|
$this->menu = 1; // This module add menu entries. They are coded into menu manager. |
126
|
|
|
|
127
|
|
|
|
128
|
|
|
// Exports |
129
|
|
|
//-------- |
130
|
|
|
$r = 0; |
131
|
|
|
|
132
|
|
|
// All Categories List |
133
|
|
|
$r++; |
134
|
|
|
$this->export_code[$r] = $this->rights_class . '_list'; |
135
|
|
|
$this->export_label[$r] = 'CatListAll'; |
136
|
|
|
$this->export_icon[$r] = $this->picto; |
137
|
|
|
$this->export_enabled[$r] = 'true'; |
138
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire")); |
139
|
|
|
|
140
|
|
|
$typeexample = ""; |
141
|
|
|
if (isModEnabled("product") || isModEnabled("service")) { |
142
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "0=Product-Service"; |
143
|
|
|
} |
144
|
|
|
if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { |
145
|
|
|
$typeexample .= ($typeexample ? "/" : "") . "1=Supplier"; |
146
|
|
|
} |
147
|
|
|
if (isModEnabled("societe")) { |
148
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "2=Customer-Prospect"; |
149
|
|
|
} |
150
|
|
|
if (isModEnabled('member')) { |
151
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "3=Member"; |
152
|
|
|
} |
153
|
|
|
if (isModEnabled("societe")) { |
154
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "4=Contact"; |
155
|
|
|
} |
156
|
|
|
if (isModEnabled('bank')) { |
157
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "5=Bank account"; |
158
|
|
|
} |
159
|
|
|
if (isModEnabled('project')) { |
160
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "6=Project"; |
161
|
|
|
} |
162
|
|
|
if (isModEnabled('user')) { |
163
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "7=User"; |
164
|
|
|
} |
165
|
|
|
if (isModEnabled('bank')) { |
166
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "8=Bank line"; |
167
|
|
|
} |
168
|
|
|
if (isModEnabled('stock')) { |
169
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "9=Warehouse"; |
170
|
|
|
} |
171
|
|
|
if (isModEnabled('agenda')) { |
172
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "10=Agenda event"; |
173
|
|
|
} |
174
|
|
|
if (isModEnabled('website')) { |
175
|
|
|
$typeexample .= ($typeexample ? " / " : "") . "11=Website page"; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
// Definition of vars |
179
|
|
|
$this->export_fields_array[$r] = array('cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.type' => "Type", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategoryID", 'pcat.label' => "ParentCategoryLabel", 'cat.color' => "Color", 'cat.date_creation' => "DateCreation", 'cat.tms' => "DateLastModification"); |
180
|
|
|
$this->export_TypeFields_array[$r] = array('cat.rowid' => 'Numeric', 'cat.label' => "Text", 'cat.type' => "Numeric", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text'); |
181
|
|
|
$this->export_entities_array[$r] = array(); // We define here only fields that use another picto |
182
|
|
|
$this->export_help_array[$r] = array('cat.type' => $typeexample); |
183
|
|
|
|
184
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
185
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
186
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
187
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
188
|
|
|
|
189
|
|
|
// 0 Products |
190
|
|
|
$r++; |
191
|
|
|
$this->export_code[$r] = $this->rights_class . '_0_' . Categorie::$MAP_ID_TO_CODE[0]; |
192
|
|
|
$this->export_label[$r] = 'CatProdList'; |
193
|
|
|
$this->export_icon[$r] = $this->picto; |
194
|
|
|
$this->export_enabled[$r] = 'isModEnabled("product") || isModEnabled("service")'; |
195
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export")); |
196
|
|
|
$this->export_fields_array[$r] = array('cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategoryID", 'pcat.label' => "ParentCategoryLabel", 'cat.color' => "Color", 'cat.date_creation' => "DateCreation", 'cat.tms' => "DateLastModification", 'p.rowid' => 'ProductId', 'p.ref' => 'Ref', 'p.label' => 'Label'); |
197
|
|
|
$this->export_TypeFields_array[$r] = array('cat.rowid' => 'Numeric', 'cat.label' => "Text", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text', 'p.rowid' => 'Numeric', 'p.ref' => 'Text', 'p.label' => 'Text'); |
198
|
|
|
$this->export_entities_array[$r] = array('p.rowid' => 'product', 'p.ref' => 'product', 'p.label' => 'product'); // We define here only fields that use another picto |
199
|
|
|
|
200
|
|
|
$keyforselect = 'product'; |
201
|
|
|
$keyforelement = 'product'; |
202
|
|
|
$keyforaliasextra = 'extra'; |
203
|
|
|
include DOL_DOCUMENT_ROOT . '/core/extrafieldsinexport.inc.php'; |
204
|
|
|
|
205
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
206
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
207
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
208
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'categorie_product as cp ON cp.fk_categorie = cat.rowid'; |
209
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'product as p ON p.rowid = cp.fk_product'; |
210
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_extrafields as extra ON extra.fk_object = p.rowid'; |
211
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
212
|
|
|
$this->export_sql_end[$r] .= ' AND cat.type = 0'; |
213
|
|
|
|
214
|
|
|
// 1 Suppliers |
215
|
|
|
$r++; |
216
|
|
|
$this->export_code[$r] = $this->rights_class . '_1_' . Categorie::$MAP_ID_TO_CODE[1]; |
217
|
|
|
$this->export_label[$r] = 'CatSupList'; |
218
|
|
|
$this->export_icon[$r] = $this->picto; |
219
|
|
|
$this->export_enabled[$r] = 'isModEnabled("supplier_order") || isModEnabled("supplier_invoice")'; |
220
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); |
221
|
|
|
$this->export_fields_array[$r] = array( |
222
|
|
|
'cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategoryID", 'pcat.label' => "ParentCategoryLabel", |
223
|
|
|
'cat.color' => "Color", 'cat.date_creation' => "DateCreation", 'cat.tms' => "DateLastModification", |
224
|
|
|
's.rowid' => 'IdThirdParty', 's.nom' => 'Name', 's.prefix_comm' => "Prefix", 's.fournisseur' => "Supplier", 's.datec' => "DateCreation", 's.tms' => "DateLastModification", 's.code_fournisseur' => "SupplierCode", |
225
|
|
|
's.address' => "Address", 's.zip' => "Zip", 's.town' => "Town", 'c.label' => "Country", 'c.code' => "CountryCode", |
226
|
|
|
's.phone' => "Phone", 's.fax' => "Fax", 's.url' => "Url", 's.email' => "Email", |
227
|
|
|
's.siret' => "ProfId1", 's.siren' => "ProfId2", 's.ape' => "ProfId3", 's.idprof4' => "ProfId4", 's.tva_intra' => "VATIntraShort", 's.capital' => "Capital", 's.note_public' => "NotePublic", |
228
|
|
|
't.libelle' => 'ThirdPartyType' |
229
|
|
|
); |
230
|
|
|
$this->export_TypeFields_array[$r] = array( |
231
|
|
|
'cat.rowid' => 'Numeric', 'cat.label' => "Text", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text', |
232
|
|
|
's.rowid' => 'List:societe:nom', 's.nom' => 'Text', 's.prefix_comm' => "Text", 's.fournisseur' => "Text", 's.datec' => "Date", 's.tms' => "Date", 's.code_fournisseur' => "Text", |
233
|
|
|
's.address' => "Text", 's.zip' => "Text", 's.town' => "Text", 'c.label' => "List:c_country:label:label", 'c.code' => "Text", |
234
|
|
|
's.phone' => "Text", 's.fax' => "Text", 's.url' => "Text", 's.email' => "Text", |
235
|
|
|
's.siret' => "Text", 's.siren' => "Text", 's.ape' => "Text", 's.idprof4' => "Text", 's.tva_intra' => "Text", 's.capital' => "Numeric", 's.note_public' => "Text", |
236
|
|
|
't.libelle' => 'List:c_typent:libelle:code' |
237
|
|
|
); |
238
|
|
|
$this->export_entities_array[$r] = array( |
239
|
|
|
's.rowid' => 'company', 's.nom' => 'company', 's.prefix_comm' => "company", 's.fournisseur' => "company", 's.datec' => "company", 's.tms' => "company", 's.code_fournisseur' => "company", |
240
|
|
|
's.address' => "company", 's.zip' => "company", 's.town' => "company", 'c.label' => "company", 'c.code' => "company", |
241
|
|
|
's.phone' => "company", 's.fax' => "company", 's.url' => "company", 's.email' => "company", |
242
|
|
|
's.siret' => "company", 's.siren' => "company", 's.ape' => "company", 's.idprof4' => "company", 's.tva_intra' => "company", 's.capital' => "company", 's.note_public' => "company", |
243
|
|
|
't.libelle' => 'company' |
244
|
|
|
); // We define here only fields that use another picto |
245
|
|
|
|
246
|
|
|
$keyforselect = 'societe'; |
247
|
|
|
$keyforelement = 'company'; |
248
|
|
|
$keyforaliasextra = 'extra'; |
249
|
|
|
include DOL_DOCUMENT_ROOT . '/core/extrafieldsinexport.inc.php'; |
250
|
|
|
|
251
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
252
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
253
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
254
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid'; |
255
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = cf.fk_soc'; |
256
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe_extrafields as extra ON s.rowid = extra.fk_object'; |
257
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as c ON s.fk_pays = c.rowid'; |
258
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_typent as t ON s.fk_typent = t.id'; |
259
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
260
|
|
|
$this->export_sql_end[$r] .= ' AND cat.type = 1'; |
261
|
|
|
|
262
|
|
|
// 2 Customers/Prospects |
263
|
|
|
$r++; |
264
|
|
|
$this->export_code[$r] = $this->rights_class . '_2_' . Categorie::$MAP_ID_TO_CODE[2]; |
265
|
|
|
$this->export_label[$r] = 'CatCusList'; |
266
|
|
|
$this->export_icon[$r] = $this->picto; |
267
|
|
|
$this->export_enabled[$r] = 'isModEnabled("societe")'; |
268
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "export")); |
269
|
|
|
$this->export_fields_array[$r] = array( |
270
|
|
|
'cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategoryID", 'pcat.label' => "ParentCategoryLabel", |
271
|
|
|
'cat.color' => "Color", 'cat.date_creation' => "DateCreation", 'cat.tms' => "DateLastModification", |
272
|
|
|
's.rowid' => 'IdThirdParty', 's.nom' => 'Name', 's.prefix_comm' => "Prefix", 's.client' => "Customer", 's.datec' => "DateCreation", 's.tms' => "DateLastModification", 's.code_client' => "CustomerCode", |
273
|
|
|
's.address' => "Address", 's.zip' => "Zip", 's.town' => "Town", 'c.label' => "Country", 'c.code' => "CountryCode", |
274
|
|
|
's.phone' => "Phone", 's.fax' => "Fax", 's.url' => "Url", 's.email' => "Email", |
275
|
|
|
's.siret' => "ProfId1", 's.siren' => "ProfId2", 's.ape' => "ProfId3", 's.idprof4' => "ProfId4", 's.tva_intra' => "VATIntraShort", 's.capital' => "Capital", 's.note_public' => "NotePublic", |
276
|
|
|
't.libelle' => 'ThirdPartyType', 'pl.code' => 'ProspectLevel', 'st.code' => 'ProspectStatus' |
277
|
|
|
); |
278
|
|
|
$this->export_TypeFields_array[$r] = array( |
279
|
|
|
'cat.rowid' => 'Numeric', 'cat.label' => "Text", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text', |
280
|
|
|
's.rowid' => 'List:societe:nom', 's.nom' => 'Text', 's.prefix_comm' => "Text", 's.client' => "Text", 's.datec' => "Date", 's.tms' => "Date", 's.code_client' => "Text", |
281
|
|
|
's.address' => "Text", 's.zip' => "Text", 's.town' => "Text", 'c.label' => "List:c_country:label:label", 'c.code' => "Text", |
282
|
|
|
's.phone' => "Text", 's.fax' => "Text", 's.url' => "Text", 's.email' => "Text", |
283
|
|
|
's.siret' => "Text", 's.siren' => "Text", 's.ape' => "Text", 's.idprof4' => "Text", 's.tva_intra' => "Text", 's.capital' => "Numeric", 's.note_public' => "Text", |
284
|
|
|
't.libelle' => 'List:c_typent:libelle:code', 'pl.code' => 'List:c_prospectlevel:label:code', 'st.code' => 'List:c_stcomm:libelle:code' |
285
|
|
|
); |
286
|
|
|
$this->export_entities_array[$r] = array( |
287
|
|
|
's.rowid' => 'company', 's.nom' => 'company', 's.prefix_comm' => "company", 's.client' => "company", 's.datec' => "company", 's.tms' => "company", 's.code_client' => "company", |
288
|
|
|
's.address' => "company", 's.zip' => "company", 's.town' => "company", 'c.label' => "company", 'c.code' => "company", |
289
|
|
|
's.phone' => "company", 's.fax' => "company", 's.url' => "company", 's.email' => "company", |
290
|
|
|
's.siret' => "company", 's.siren' => "company", 's.ape' => "company", 's.idprof4' => "company", 's.tva_intra' => "company", 's.capital' => "company", 's.note_public' => "company", |
291
|
|
|
't.libelle' => 'company', 'pl.code' => 'company', 'st.code' => 'company' |
292
|
|
|
); // We define here only fields that use another picto |
293
|
|
|
|
294
|
|
|
$keyforselect = 'societe'; |
295
|
|
|
$keyforelement = 'company'; |
296
|
|
|
$keyforaliasextra = 'extra'; |
297
|
|
|
include DOL_DOCUMENT_ROOT . '/core/extrafieldsinexport.inc.php'; |
298
|
|
|
|
299
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
300
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
301
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
302
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'categorie_societe as cs ON cs.fk_categorie = cat.rowid'; |
303
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = cs.fk_soc'; |
304
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe_extrafields as extra ON s.rowid = extra.fk_object'; |
305
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as c ON s.fk_pays = c.rowid'; |
306
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_typent as t ON s.fk_typent = t.id'; |
307
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_prospectlevel as pl ON s.fk_prospectlevel = pl.code'; |
308
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_stcomm as st ON s.fk_stcomm = st.id'; |
309
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
310
|
|
|
$this->export_sql_end[$r] .= ' AND cat.type = 2'; |
311
|
|
|
|
312
|
|
|
// 3 Members |
313
|
|
|
$r++; |
314
|
|
|
$this->export_code[$r] = $this->rights_class . '_3_' . Categorie::$MAP_ID_TO_CODE[3]; |
315
|
|
|
$this->export_label[$r] = 'CatMemberList'; |
316
|
|
|
$this->export_icon[$r] = $this->picto; |
317
|
|
|
$this->export_enabled[$r] = 'isModEnabled("member")'; |
318
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "export")); |
319
|
|
|
$this->export_fields_array[$r] = array('cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategoryID", 'pcat.label' => "ParentCategoryLabel", 'p.rowid' => 'MemberId', 'p.lastname' => 'LastName', 'p.firstname' => 'Firstname'); |
320
|
|
|
$this->export_TypeFields_array[$r] = array('cat.rowid' => "Numeric", 'cat.label' => "Text", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text', 'p.lastname' => 'Text', 'p.firstname' => 'Text'); |
321
|
|
|
$this->export_entities_array[$r] = array('p.rowid' => 'member', 'p.lastname' => 'member', 'p.firstname' => 'member'); // We define here only fields that use another picto |
322
|
|
|
|
323
|
|
|
$keyforselect = 'adherent'; |
324
|
|
|
$keyforelement = 'member'; |
325
|
|
|
$keyforaliasextra = 'extra'; |
326
|
|
|
include DOL_DOCUMENT_ROOT . '/core/extrafieldsinexport.inc.php'; |
327
|
|
|
|
328
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
329
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
330
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
331
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'categorie_member as cm ON cm.fk_categorie = cat.rowid'; |
332
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'adherent as p ON p.rowid = cm.fk_member'; |
333
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'adherent_extrafields as extra ON cat.rowid = extra.fk_object '; |
334
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
335
|
|
|
$this->export_sql_end[$r] .= ' AND cat.type = 3'; |
336
|
|
|
|
337
|
|
|
// 4 Contacts |
338
|
|
|
$r++; |
339
|
|
|
$this->export_code[$r] = $this->rights_class . '_4_' . Categorie::$MAP_ID_TO_CODE[4]; |
340
|
|
|
$this->export_label[$r] = 'CatContactList'; |
341
|
|
|
$this->export_icon[$r] = $this->picto; |
342
|
|
|
$this->export_enabled[$r] = 'isModEnabled("societe")'; |
343
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "contact", "export")); |
344
|
|
|
$this->export_fields_array[$r] = array( |
345
|
|
|
'cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategoryID", 'pcat.label' => "ParentCategoryLabel", |
346
|
|
|
'cat.color' => "Color", 'cat.date_creation' => "DateCreation", 'cat.tms' => "DateLastModification", |
347
|
|
|
'p.rowid' => 'ContactId', 'civ.label' => 'UserTitle', 'p.lastname' => 'LastName', 'p.firstname' => 'Firstname', |
348
|
|
|
'p.address' => 'Address', 'p.zip' => 'Zip', 'p.town' => 'Town', 'c.code' => 'CountryCode', 'c.label' => 'Country', |
349
|
|
|
'p.birthday' => 'DateOfBirth', 'p.poste' => 'PostOrFunction', |
350
|
|
|
'p.phone' => 'Phone', 'p.phone_perso' => 'PhonePerso', 'p.phone_mobile' => 'PhoneMobile', 'p.fax' => 'Fax', 'p.email' => 'Email', |
351
|
|
|
'p.note_private' => 'NotePrivate', 'p.note_public' => 'NotePublic', 'p.statut' => 'Status', |
352
|
|
|
's.nom' => "Name", 's.client' => "Customer", 's.fournisseur' => "Supplier", 's.status' => "Status", |
353
|
|
|
's.address' => "Address", 's.zip' => "Zip", 's.town' => "Town", |
354
|
|
|
's.phone' => "Phone", 's.fax' => "Fax", 's.url' => "Url", 's.email' => "Email" |
355
|
|
|
); |
356
|
|
|
$this->export_TypeFields_array[$r] = array( |
357
|
|
|
'cat.rowid' => 'Numeric', 'cat.label' => "Text", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text', |
358
|
|
|
'civ.label' => 'List:c_civility:label:label', 'p.rowid' => 'Numeric', 'p.lastname' => 'Text', 'p.firstname' => 'Text', |
359
|
|
|
'p.address' => 'Text', 'p.zip' => 'Text', 'p.town' => 'Text', 'c.code' => 'Text', 'c.label' => 'List:c_country:label:label', |
360
|
|
|
'p.birthday' => 'Date', 'p.poste' => 'Text', |
361
|
|
|
'p.phone' => 'Text', 'p.phone_perso' => 'Text', 'p.phone_mobile' => 'Text', 'p.fax' => 'Text', 'p.email' => 'Text', |
362
|
|
|
'p.note_private' => 'Text', 'p.note_public' => 'Text', 'p.statut' => 'Boolean', |
363
|
|
|
's.nom' => "Text", 's.client' => "Boolean", 's.fournisseur' => "Boolean", 's.status' => "Boolean", |
364
|
|
|
's.address' => "Text", 's.zip' => "Text", 's.town' => "Text", |
365
|
|
|
's.phone' => "Text", 's.fax' => "Text", 's.url' => "Text", 's.email' => "Text" |
366
|
|
|
); |
367
|
|
|
$this->export_entities_array[$r] = array( |
368
|
|
|
'p.rowid' => 'contact', 'civ.label' => 'contact', 'p.lastname' => 'contact', 'p.firstname' => 'contact', |
369
|
|
|
'p.address' => 'contact', 'p.zip' => 'contact', 'p.town' => 'contact', 'c.code' => 'contact', 'c.label' => 'contact', |
370
|
|
|
'p.birthday' => 'contact', 'p.poste' => 'contact', |
371
|
|
|
'p.phone' => 'contact', 'p.phone_perso' => 'contact', 'p.phone_mobile' => 'contact', 'p.fax' => 'contact', 'p.email' => 'contact', |
372
|
|
|
'p.note_private' => 'contact', 'p.note_public' => 'contact', 'p.statut' => 'contact', |
373
|
|
|
's.nom' => "company", 's.client' => "company", 's.fournisseur' => "company", 's.status' => "company", |
374
|
|
|
's.address' => "company", 's.zip' => "company", 's.town' => "company", |
375
|
|
|
's.phone' => "company", 's.fax' => "company", 's.url' => "company", 's.email' => "company" |
376
|
|
|
); // We define here only fields that use another picto |
377
|
|
|
|
378
|
|
|
$keyforselect = 'socpeople'; |
379
|
|
|
$keyforelement = 'contact'; |
380
|
|
|
$keyforaliasextra = 'extra'; |
381
|
|
|
include DOL_DOCUMENT_ROOT . '/core/extrafieldsinexport.inc.php'; |
382
|
|
|
|
383
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
384
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
385
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
386
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'categorie_contact as cc ON cc.fk_categorie = cat.rowid'; |
387
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'socpeople as p ON p.rowid = cc.fk_socpeople'; |
388
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; |
389
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_civility as civ ON civ.code = p.civility'; |
390
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as c ON c.rowid = p.fk_pays'; |
391
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; |
392
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
393
|
|
|
$this->export_sql_end[$r] .= ' AND cat.type = 4'; |
394
|
|
|
|
395
|
|
|
// 5 Bank accounts, TODO ? |
396
|
|
|
|
397
|
|
|
// 6 Projects |
398
|
|
|
$r++; |
399
|
|
|
$this->export_code[$r] = $this->rights_class . '_6_' . Categorie::$MAP_ID_TO_CODE[6]; |
400
|
|
|
$this->export_label[$r] = 'CatProjectsList'; |
401
|
|
|
$this->export_icon[$r] = $this->picto; |
402
|
|
|
$this->export_enabled[$r] = "isModEnabled('project')"; |
403
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export")); |
404
|
|
|
$this->export_fields_array[$r] = array('cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategory", 'pcat.label' => "ParentCategoryLabel", 'cat.color' => "Color", 'cat.date_creation' => "DateCreation", 'cat.tms' => "DateLastModification", 'p.rowid' => 'ProjectId', 'p.ref' => 'Ref', 's.rowid' => "IdThirdParty", 's.nom' => "Name"); |
405
|
|
|
$this->export_TypeFields_array[$r] = array('cat.rowid' => 'Numeric', 'cat.label' => "Text", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text', 'p.rowid' => 'Numeric', 'p.ref' => 'Text', 's.rowid' => "Numeric", 's.nom' => "Text"); |
406
|
|
|
$this->export_entities_array[$r] = array('p.rowid' => 'project', 'p.ref' => 'project', 's.rowid' => "company", 's.nom' => "company"); // We define here only fields that use another picto |
407
|
|
|
|
408
|
|
|
$keyforselect = 'projet'; |
409
|
|
|
$keyforelement = 'project'; |
410
|
|
|
$keyforaliasextra = 'extra'; |
411
|
|
|
include DOL_DOCUMENT_ROOT . '/core/extrafieldsinexport.inc.php'; |
412
|
|
|
|
413
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
414
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
415
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
416
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'categorie_project as cp ON cp.fk_categorie = cat.rowid'; |
417
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'projet as p ON p.rowid = cp.fk_project'; |
418
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'projet_extrafields as extra ON extra.fk_object = p.rowid'; |
419
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; |
420
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
421
|
|
|
$this->export_sql_end[$r] .= ' AND cat.type = 6'; |
422
|
|
|
|
423
|
|
|
// 7 Users |
424
|
|
|
$r++; |
425
|
|
|
$this->export_code[$r] = $this->rights_class . '_7_' . Categorie::$MAP_ID_TO_CODE[7]; |
426
|
|
|
$this->export_label[$r] = 'CatUsersList'; |
427
|
|
|
$this->export_icon[$r] = $this->picto; |
428
|
|
|
$this->export_enabled[$r] = 'isModEnabled("user")'; |
429
|
|
|
$this->export_permission[$r] = array(array("categorie", "lire"), array("user", "export")); |
430
|
|
|
$this->export_fields_array[$r] = array('cat.rowid' => "CategId", 'cat.label' => "Label", 'cat.description' => "Description", 'cat.fk_parent' => "ParentCategory", 'pcat.label' => "ParentCategoryLabel", 'cat.color' => "Color", 'cat.date_creation' => "DateCreation", 'cat.tms' => "DateLastModification", 'p.rowid' => 'UserID', 'p.login' => 'Login', 'p.lastname' => 'Lastname', 'p.firstname' => 'Firstname'); |
431
|
|
|
$this->export_TypeFields_array[$r] = array('cat.rowid' => "Numeric", 'cat.label' => "Text", 'cat.description' => "Text", 'cat.fk_parent' => 'Numeric', 'pcat.label' => 'Text', 'p.rowid' => 'Numeric', 'p.login' => 'Text', 'p.lastname' => 'Text', 'p.firstname' => 'Text'); |
432
|
|
|
$this->export_entities_array[$r] = array('p.rowid' => 'user', 'p.login' => 'user', 'p.lastname' => 'user', 'p.firstname' => 'user'); // We define here only fields that use another picto |
433
|
|
|
|
434
|
|
|
$keyforselect = 'user'; |
435
|
|
|
$keyforelement = 'user'; |
436
|
|
|
$keyforaliasextra = 'extra'; |
437
|
|
|
include DOL_DOCUMENT_ROOT . '/core/extrafieldsinexport.inc.php'; |
438
|
|
|
|
439
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
440
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as cat'; |
441
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie as pcat ON pcat.rowid = cat.fk_parent'; |
442
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'categorie_user as cu ON cu.fk_categorie = cat.rowid'; |
443
|
|
|
$this->export_sql_end[$r] .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'user as p ON p.rowid = cu.fk_user'; |
444
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user_extrafields as extra ON extra.fk_object = p.rowid'; |
445
|
|
|
$this->export_sql_end[$r] .= ' WHERE cat.entity IN (' . getEntity('category') . ')'; |
446
|
|
|
$this->export_sql_end[$r] .= ' AND cat.type = 7'; |
447
|
|
|
|
448
|
|
|
// 8 Bank Lines, TODO ? |
449
|
|
|
|
450
|
|
|
// 9 Warehouses, TODO ? |
451
|
|
|
|
452
|
|
|
// 10 Agenda Events, TODO ? |
453
|
|
|
|
454
|
|
|
// 11 Website Pages, TODO ? |
455
|
|
|
|
456
|
|
|
// Imports |
457
|
|
|
//-------- |
458
|
|
|
|
459
|
|
|
$r = 0; |
460
|
|
|
|
461
|
|
|
// Categories |
462
|
|
|
$r++; |
463
|
|
|
$this->import_code[$r] = $this->rights_class . '_list'; |
464
|
|
|
$this->import_label[$r] = "CatList"; // Translation key |
465
|
|
|
$this->import_icon[$r] = $this->picto; |
466
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
467
|
|
|
$this->import_tables_array[$r] = array('ca' => MAIN_DB_PREFIX . 'categorie'); |
468
|
|
|
$this->import_fields_array[$r] = array( |
469
|
|
|
'ca.label' => "Label*", 'ca.type' => "Type*", 'ca.description' => "Description", |
470
|
|
|
'ca.fk_parent' => 'ParentCategory' |
471
|
|
|
); |
472
|
|
|
$this->import_regex_array[$r] = array('ca.type' => '^(0|1|2|3|4|5|6|7|8|9|10|11)$'); |
473
|
|
|
$this->import_convertvalue_array[$r] = array( |
474
|
|
|
'ca.fk_parent' => array( |
475
|
|
|
'rule' => 'fetchidfromcodeandlabel', |
476
|
|
|
'classfile' => '/categories/class/categorie.class.php', |
477
|
|
|
'class' => 'Categorie', |
478
|
|
|
'method' => 'fetch', |
479
|
|
|
'element' => 'category', |
480
|
|
|
'codefromfield' => 'ca.type' |
481
|
|
|
) |
482
|
|
|
); |
483
|
|
|
|
484
|
|
|
$this->import_examplevalues_array[$r] = array( |
485
|
|
|
'ca.label' => "My Category Label", 'ca.type' => $typeexample, 'ca.description' => "My Category description", // $typeexample built above in exports |
486
|
|
|
'ca.fk_parent' => 'rowid or label' |
487
|
|
|
); |
488
|
|
|
$this->import_updatekeys_array[$r] = array('ca.label' => 'Label', 'ca.type' => 'Type'); |
489
|
|
|
|
490
|
|
|
// 0 Products |
491
|
|
|
if (isModEnabled("product")) { |
492
|
|
|
$r++; |
493
|
|
|
$this->import_code[$r] = $this->rights_class . '_0_' . Categorie::$MAP_ID_TO_CODE[0]; |
494
|
|
|
$this->import_label[$r] = "CatProdLinks"; // Translation key |
495
|
|
|
$this->import_icon[$r] = $this->picto; |
496
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
497
|
|
|
$this->import_tables_array[$r] = array('cp' => MAIN_DB_PREFIX . 'categorie_product'); |
498
|
|
|
$this->import_fields_array[$r] = array('cp.fk_categorie' => "Category*", 'cp.fk_product' => "Product*"); |
499
|
|
|
$this->import_regex_array[$r] = array('cp.fk_categorie' => 'rowid@' . MAIN_DB_PREFIX . 'categorie:type=0'); |
500
|
|
|
|
501
|
|
|
$this->import_convertvalue_array[$r] = array( |
502
|
|
|
'cp.fk_categorie' => array('rule' => 'fetchidfromref', 'classfile' => '/categories/class/categorie.class.php', 'class' => 'Categorie', 'method' => 'fetch', 'element' => 'category'), |
503
|
|
|
'cp.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') |
504
|
|
|
); |
505
|
|
|
$this->import_examplevalues_array[$r] = array('cp.fk_categorie' => "rowid or label", 'cp.fk_product' => "rowid or ref"); |
506
|
|
|
$this->import_updatekeys_array[$r] = array('cp.fk_categorie' => 'Category', 'cp.fk_product' => 'ProductRef'); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
// 1 Suppliers |
510
|
|
|
if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { |
511
|
|
|
$r++; |
512
|
|
|
$this->import_code[$r] = $this->rights_class . '_1_' . Categorie::$MAP_ID_TO_CODE[1]; |
513
|
|
|
$this->import_label[$r] = "CatSupLinks"; // Translation key |
514
|
|
|
$this->import_icon[$r] = $this->picto; |
515
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
516
|
|
|
$this->import_tables_array[$r] = array('cs' => MAIN_DB_PREFIX . 'categorie_fournisseur'); |
517
|
|
|
$this->import_fields_array[$r] = array('cs.fk_categorie' => "Category*", 'cs.fk_soc' => "Supplier*"); |
518
|
|
|
$this->import_regex_array[$r] = array( |
519
|
|
|
'cs.fk_categorie' => 'rowid@' . MAIN_DB_PREFIX . 'categorie:type=1', |
520
|
|
|
'cs.fk_soc' => 'rowid@' . MAIN_DB_PREFIX . 'societe:fournisseur>0' |
521
|
|
|
); |
522
|
|
|
|
523
|
|
|
$this->import_convertvalue_array[$r] = array( |
524
|
|
|
'cs.fk_categorie' => array('rule' => 'fetchidfromref', 'classfile' => '/categories/class/categorie.class.php', 'class' => 'Categorie', 'method' => 'fetch', 'element' => 'category'), |
525
|
|
|
'cs.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty') |
526
|
|
|
); |
527
|
|
|
$this->import_examplevalues_array[$r] = array('cs.fk_categorie' => "rowid or label", 'cs.fk_soc' => "rowid or name"); |
528
|
|
|
} |
529
|
|
|
|
530
|
|
|
// 2 Customers |
531
|
|
|
if (isModEnabled("societe")) { |
532
|
|
|
$r++; |
533
|
|
|
$this->import_code[$r] = $this->rights_class . '_2_' . Categorie::$MAP_ID_TO_CODE[2]; |
534
|
|
|
$this->import_label[$r] = "CatCusLinks"; // Translation key |
535
|
|
|
$this->import_icon[$r] = $this->picto; |
536
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
537
|
|
|
$this->import_tables_array[$r] = array('cs' => MAIN_DB_PREFIX . 'categorie_societe'); |
538
|
|
|
$this->import_fields_array[$r] = array('cs.fk_categorie' => "Category*", 'cs.fk_soc' => "Customer*"); |
539
|
|
|
$this->import_regex_array[$r] = array( |
540
|
|
|
'cs.fk_categorie' => 'rowid@' . MAIN_DB_PREFIX . 'categorie:type=2', |
541
|
|
|
'cs.fk_soc' => 'rowid@' . MAIN_DB_PREFIX . 'societe:client>0' |
542
|
|
|
); |
543
|
|
|
|
544
|
|
|
$this->import_convertvalue_array[$r] = array( |
545
|
|
|
'cs.fk_categorie' => array('rule' => 'fetchidfromref', 'classfile' => '/categories/class/categorie.class.php', 'class' => 'Categorie', 'method' => 'fetch', 'element' => 'category'), |
546
|
|
|
'cs.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty') |
547
|
|
|
); |
548
|
|
|
$this->import_examplevalues_array[$r] = array('cs.fk_categorie' => "rowid or label", 'cs.fk_soc' => "rowid or name"); |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
// 3 Members |
552
|
|
|
if (isModEnabled('member')) { |
553
|
|
|
$r++; |
554
|
|
|
$this->import_code[$r] = $this->rights_class . '_3_' . Categorie::$MAP_ID_TO_CODE[3]; |
555
|
|
|
$this->import_label[$r] = "CatMembersLinks"; // Translation key |
556
|
|
|
$this->import_icon[$r] = $this->picto; |
557
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
558
|
|
|
$this->import_tables_array[$r] = array('cm' => MAIN_DB_PREFIX . 'categorie_contact'); |
559
|
|
|
$this->import_fields_array[$r] = array('cm.fk_categorie' => "Category*", 'cm.fk_member' => "Member*"); |
560
|
|
|
$this->import_regex_array[$r] = array('cm.fk_categorie' => 'rowid@' . MAIN_DB_PREFIX . 'categorie:type=3'); |
561
|
|
|
|
562
|
|
|
$this->import_convertvalue_array[$r] = array( |
563
|
|
|
'cs.fk_categorie' => array('rule' => 'fetchidfromref', 'classfile' => '/categories/class/categorie.class.php', 'class' => 'Categorie', 'method' => 'fetch', 'element' => 'category'), |
564
|
|
|
'cs.fk_member' => array('rule' => 'fetchidfromref', 'classfile' => '/adherents/class/adherent.class.php', 'class' => 'Adherent', 'method' => 'fetch', 'element' => 'Member') |
565
|
|
|
); |
566
|
|
|
$this->import_examplevalues_array[$r] = array('cs.fk_categorie' => "rowid or label", 'cs.fk_member' => "rowid or ref"); |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
// 4 Contacts/Addresses |
570
|
|
|
if (isModEnabled("societe")) { |
571
|
|
|
$r++; |
572
|
|
|
$this->import_code[$r] = $this->rights_class . '_4_' . Categorie::$MAP_ID_TO_CODE[4]; |
573
|
|
|
$this->import_label[$r] = "CatContactsLinks"; // Translation key |
574
|
|
|
$this->import_icon[$r] = $this->picto; |
575
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
576
|
|
|
$this->import_tables_array[$r] = array('cc' => MAIN_DB_PREFIX . 'categorie_contact'); |
577
|
|
|
$this->import_fields_array[$r] = array('cc.fk_categorie' => "Category*", 'cc.fk_socpeople' => "IdContact*"); |
578
|
|
|
$this->import_regex_array[$r] = array( |
579
|
|
|
'cc.fk_categorie' => 'rowid@' . MAIN_DB_PREFIX . 'categorie:type=4' |
580
|
|
|
//'cc.fk_socpeople'=>'rowid@'.MAIN_DB_PREFIX.'socpeople' |
581
|
|
|
); |
582
|
|
|
|
583
|
|
|
$this->import_convertvalue_array[$r] = array( |
584
|
|
|
'cc.fk_categorie' => array('rule' => 'fetchidfromref', 'classfile' => '/categories/class/categorie.class.php', 'class' => 'Categorie', 'method' => 'fetch', 'element' => 'category'), |
585
|
|
|
//'cc.fk_socpeople'=>array('rule'=>'fetchidfromref','classfile'=>'/contact/class/contact.class.php','class'=>'Contact','method'=>'fetch','element'=>'Contact') |
586
|
|
|
); |
587
|
|
|
$this->import_examplevalues_array[$r] = array('cc.fk_categorie' => "rowid or label", 'cc.fk_socpeople' => "rowid"); |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
// 5 Bank accounts, TODO ? |
591
|
|
|
|
592
|
|
|
// 6 Projects |
593
|
|
|
if (isModEnabled('project')) { |
594
|
|
|
$r++; |
595
|
|
|
$this->import_code[$r] = $this->rights_class . '_6_' . Categorie::$MAP_ID_TO_CODE[6]; |
596
|
|
|
$this->import_label[$r] = "CatProjectsLinks"; // Translation key |
597
|
|
|
$this->import_icon[$r] = $this->picto; |
598
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
599
|
|
|
$this->import_tables_array[$r] = array('cp' => MAIN_DB_PREFIX . 'categorie_project'); |
600
|
|
|
$this->import_fields_array[$r] = array('cp.fk_categorie' => "Category*", 'cp.fk_project' => "Project*"); |
601
|
|
|
$this->import_regex_array[$r] = array('cp.fk_categorie' => 'rowid@' . MAIN_DB_PREFIX . 'categorie:type=6'); |
602
|
|
|
|
603
|
|
|
$this->import_convertvalue_array[$r] = array( |
604
|
|
|
'cs.fk_categorie' => array('rule' => 'fetchidfromref', 'classfile' => '/categories/class/categorie.class.php', 'class' => 'Categorie', 'method' => 'fetch', 'element' => 'category'), |
605
|
|
|
'cs.fk_project' => array('rule' => 'fetchidfromref', 'classfile' => '/projet/class/project.class.php', 'class' => 'Project', 'method' => 'fetch', 'element' => 'Project') |
606
|
|
|
); |
607
|
|
|
$this->import_examplevalues_array[$r] = array('cp.fk_categorie' => "rowid or label", 'cp.fk_project' => "rowid or ref"); |
608
|
|
|
} |
609
|
|
|
|
610
|
|
|
// 7 Users |
611
|
|
|
if (isModEnabled('user')) { |
612
|
|
|
$r++; |
613
|
|
|
$this->import_code[$r] = $this->rights_class . '_7_' . Categorie::$MAP_ID_TO_CODE[7]; |
614
|
|
|
$this->import_label[$r] = "CatUsersLinks"; // Translation key |
615
|
|
|
$this->import_icon[$r] = $this->picto; |
616
|
|
|
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
617
|
|
|
$this->import_tables_array[$r] = array('cu' => MAIN_DB_PREFIX . 'categorie_user'); |
618
|
|
|
$this->import_fields_array[$r] = array('cu.fk_categorie' => "Category*", 'cu.fk_user' => "User*"); |
619
|
|
|
$this->import_regex_array[$r] = array('cu.fk_categorie' => 'rowid@' . MAIN_DB_PREFIX . 'categorie:type=7'); |
620
|
|
|
|
621
|
|
|
$this->import_convertvalue_array[$r] = array( |
622
|
|
|
'cu.fk_categorie' => array('rule' => 'fetchidfromref', 'classfile' => '/categories/class/categorie.class.php', 'class' => 'Categorie', 'method' => 'fetch', 'element' => 'category'), |
623
|
|
|
'cu.fk_user' => array('rule' => 'fetchidfromref', 'classfile' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'User') |
624
|
|
|
); |
625
|
|
|
$this->import_examplevalues_array[$r] = array('cu.fk_categorie' => "rowid or label", 'cu.fk_user' => "rowid or login"); |
626
|
|
|
} |
627
|
|
|
|
628
|
|
|
// 8 Bank Lines, TODO ? |
629
|
|
|
|
630
|
|
|
// 9 Warehouses, TODO ? |
631
|
|
|
|
632
|
|
|
// 10 Agenda Events, TODO ? |
633
|
|
|
|
634
|
|
|
// 11 Website Pages, TODO ? |
635
|
|
|
} |
636
|
|
|
|
637
|
|
|
|
638
|
|
|
/** |
639
|
|
|
* Function called when module is enabled. |
640
|
|
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
641
|
|
|
* It also creates data directories |
642
|
|
|
* |
643
|
|
|
* @param string $options Options when enabling module ('', 'noboxes') |
644
|
|
|
* @return int 1 if OK, 0 if KO |
645
|
|
|
*/ |
646
|
|
|
public function init($options = '') |
647
|
|
|
{ |
648
|
|
|
// Permissions |
649
|
|
|
$this->remove($options); |
650
|
|
|
|
651
|
|
|
$sql = array(); |
652
|
|
|
|
653
|
|
|
return $this->_init($sql, $options); |
654
|
|
|
} |
655
|
|
|
} |
656
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..