50 $this->family =
"technic";
51 $this->module_position =
'25';
53 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
54 $this->
description =
"Gestion des categories (produits, clients, fournisseurs...)";
57 $this->version =
'dolibarr';
59 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
60 $this->picto =
'category';
63 $this->dirs = array();
66 $this->depends = array();
69 $this->config_page_url = array(
'categorie.php@categories');
70 $this->langfiles = array(
"products",
"companies",
"categories",
"members",
"stocks",
"website");
73 $this->
const = array();
75 $this->
const[$r][0] =
"CATEGORIE_RECURSIV_ADD";
76 $this->
const[$r][1] =
"yesno";
77 $this->
const[$r][2] =
"0";
78 $this->
const[$r][3] =
'Affect parent categories';
79 $this->
const[$r][4] = 0;
83 $this->boxes = array();
86 $this->rights = array();
87 $this->rights_class =
'categorie';
91 $this->rights[$r][0] = 241;
92 $this->rights[$r][1] =
'Lire les categories';
93 $this->rights[$r][2] =
'r';
94 $this->rights[$r][3] = 0;
95 $this->rights[$r][4] =
'lire';
98 $this->rights[$r][0] = 242;
99 $this->rights[$r][1] =
'Creer/modifier les categories';
100 $this->rights[$r][2] =
'w';
101 $this->rights[$r][3] = 0;
102 $this->rights[$r][4] =
'creer';
105 $this->rights[$r][0] = 243;
106 $this->rights[$r][1] =
'Supprimer les categories';
107 $this->rights[$r][2] =
'd';
108 $this->rights[$r][3] = 0;
109 $this->rights[$r][4] =
'supprimer';
124 $this->export_code[$r] = $this->rights_class.
'_list';
125 $this->export_label[$r] =
'CatListAll';
126 $this->export_icon[$r] = $this->picto;
127 $this->export_enabled[$r] =
'true';
128 $this->export_permission[$r] = array(array(
"categorie",
"lire"));
131 if (isModEnabled(
"product") || isModEnabled(
"service")) {
132 $typeexample .= ($typeexample ?
" / " :
"").
"0=Product-Service";
134 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
135 $typeexample .= ($typeexample ?
"/" :
"").
"1=Supplier";
137 if (isModEnabled(
"societe")) {
138 $typeexample .= ($typeexample ?
" / " :
"").
"2=Customer-Prospect";
140 if (isModEnabled(
'member')) {
141 $typeexample .= ($typeexample ?
" / " :
"").
"3=Member";
143 if (isModEnabled(
"societe")) {
144 $typeexample .= ($typeexample ?
" / " :
"").
"4=Contact";
146 if (isModEnabled(
'bank')) {
147 $typeexample .= ($typeexample ?
" / " :
"").
"5=Bank account";
149 if (isModEnabled(
'project')) {
150 $typeexample .= ($typeexample ?
" / " :
"").
"6=Project";
152 if (isModEnabled(
'user')) {
153 $typeexample .= ($typeexample ?
" / " :
"").
"7=User";
155 if (isModEnabled(
'bank')) {
156 $typeexample .= ($typeexample ?
" / " :
"").
"8=Bank line";
158 if (isModEnabled(
'stock')) {
159 $typeexample .= ($typeexample ?
" / " :
"").
"9=Warehouse";
161 if (isModEnabled(
'agenda')) {
162 $typeexample .= ($typeexample ?
" / " :
"").
"10=Agenda event";
164 if (isModEnabled(
'website')) {
165 $typeexample .= ($typeexample ?
" / " :
"").
"11=Website page";
169 $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");
170 $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');
171 $this->export_entities_array[$r] = array();
172 $this->export_help_array[$r] = array(
'cat.type' => $typeexample);
174 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
175 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
176 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
177 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
181 $this->export_code[$r] = $this->rights_class.
'_0_'.Categorie::$MAP_ID_TO_CODE[0];
182 $this->export_label[$r] =
'CatProdList';
183 $this->export_icon[$r] = $this->picto;
184 $this->export_enabled[$r] =
'isModEnabled("product") || isModEnabled("service")';
185 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"produit",
"export"));
186 $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');
187 $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');
188 $this->export_entities_array[$r] = array(
'p.rowid' =>
'product',
'p.ref' =>
'product',
'p.label' =>
'product');
190 $keyforselect =
'product';
191 $keyforelement =
'product';
192 $keyforaliasextra =
'extra';
193 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
195 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
196 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
197 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
198 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_categorie = cat.rowid';
199 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'product as p ON p.rowid = cp.fk_product';
200 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON extra.fk_object = p.rowid';
201 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
202 $this->export_sql_end[$r] .=
' AND cat.type = 0';
206 $this->export_code[$r] = $this->rights_class.
'_1_'.Categorie::$MAP_ID_TO_CODE[1];
207 $this->export_label[$r] =
'CatSupList';
208 $this->export_icon[$r] = $this->picto;
209 $this->export_enabled[$r] =
'isModEnabled("supplier_order") || isModEnabled("supplier_invoice")';
210 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"fournisseur",
"lire"));
211 $this->export_fields_array[$r] = array(
212 'cat.rowid' =>
"CategId",
'cat.label' =>
"Label",
'cat.description' =>
"Description",
'cat.fk_parent' =>
"ParentCategoryID",
'pcat.label' =>
"ParentCategoryLabel",
213 'cat.color' =>
"Color",
'cat.date_creation' =>
"DateCreation",
'cat.tms' =>
"DateLastModification",
214 's.rowid' =>
'IdThirdParty',
's.nom' =>
'Name',
's.prefix_comm' =>
"Prefix",
's.fournisseur' =>
"Supplier",
's.datec' =>
"DateCreation",
's.tms' =>
"DateLastModification",
's.code_fournisseur' =>
"SupplierCode",
215 's.address' =>
"Address",
's.zip' =>
"Zip",
's.town' =>
"Town",
'c.label' =>
"Country",
'c.code' =>
"CountryCode",
216 's.phone' =>
"Phone",
's.fax' =>
"Fax",
's.url' =>
"Url",
's.email' =>
"Email",
217 's.siret' =>
"ProfId1",
's.siren' =>
"ProfId2",
's.ape' =>
"ProfId3",
's.idprof4' =>
"ProfId4",
's.tva_intra' =>
"VATIntraShort",
's.capital' =>
"Capital",
's.note_public' =>
"NotePublic",
218 't.libelle' =>
'ThirdPartyType'
220 $this->export_TypeFields_array[$r] = array(
221 'cat.rowid' =>
'Numeric',
'cat.label' =>
"Text",
'cat.description' =>
"Text",
'cat.fk_parent' =>
'Numeric',
'pcat.label' =>
'Text',
222 '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",
223 's.address' =>
"Text",
's.zip' =>
"Text",
's.town' =>
"Text",
'c.label' =>
"List:c_country:label:label",
'c.code' =>
"Text",
224 's.phone' =>
"Text",
's.fax' =>
"Text",
's.url' =>
"Text",
's.email' =>
"Text",
225 's.siret' =>
"Text",
's.siren' =>
"Text",
's.ape' =>
"Text",
's.idprof4' =>
"Text",
's.tva_intra' =>
"Text",
's.capital' =>
"Numeric",
's.note_public' =>
"Text",
226 't.libelle' =>
'List:c_typent:libelle:code'
228 $this->export_entities_array[$r] = array(
229 's.rowid' =>
'company',
's.nom' =>
'company',
's.prefix_comm' =>
"company",
's.fournisseur' =>
"company",
's.datec' =>
"company",
's.tms' =>
"company",
's.code_fournisseur' =>
"company",
230 's.address' =>
"company",
's.zip' =>
"company",
's.town' =>
"company",
'c.label' =>
"company",
'c.code' =>
"company",
231 's.phone' =>
"company",
's.fax' =>
"company",
's.url' =>
"company",
's.email' =>
"company",
232 's.siret' =>
"company",
's.siren' =>
"company",
's.ape' =>
"company",
's.idprof4' =>
"company",
's.tva_intra' =>
"company",
's.capital' =>
"company",
's.note_public' =>
"company",
233 't.libelle' =>
'company'
236 $keyforselect =
'societe';
237 $keyforelement =
'company';
238 $keyforaliasextra =
'extra';
239 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
241 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
242 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
243 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
244 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid';
245 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = cf.fk_soc';
246 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_extrafields as extra ON s.rowid = extra.fk_object';
247 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON s.fk_pays = c.rowid';
248 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as t ON s.fk_typent = t.id';
249 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
250 $this->export_sql_end[$r] .=
' AND cat.type = 1';
254 $this->export_code[$r] = $this->rights_class.
'_2_'.Categorie::$MAP_ID_TO_CODE[2];
255 $this->export_label[$r] =
'CatCusList';
256 $this->export_icon[$r] = $this->picto;
257 $this->export_enabled[$r] =
'isModEnabled("societe")';
258 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"societe",
"export"));
259 $this->export_fields_array[$r] = array(
260 'cat.rowid' =>
"CategId",
'cat.label' =>
"Label",
'cat.description' =>
"Description",
'cat.fk_parent' =>
"ParentCategoryID",
'pcat.label' =>
"ParentCategoryLabel",
261 'cat.color' =>
"Color",
'cat.date_creation' =>
"DateCreation",
'cat.tms' =>
"DateLastModification",
262 's.rowid' =>
'IdThirdParty',
's.nom' =>
'Name',
's.prefix_comm' =>
"Prefix",
's.client' =>
"Customer",
's.datec' =>
"DateCreation",
's.tms' =>
"DateLastModification",
's.code_client' =>
"CustomerCode",
263 's.address' =>
"Address",
's.zip' =>
"Zip",
's.town' =>
"Town",
'c.label' =>
"Country",
'c.code' =>
"CountryCode",
264 's.phone' =>
"Phone",
's.fax' =>
"Fax",
's.url' =>
"Url",
's.email' =>
"Email",
265 's.siret' =>
"ProfId1",
's.siren' =>
"ProfId2",
's.ape' =>
"ProfId3",
's.idprof4' =>
"ProfId4",
's.tva_intra' =>
"VATIntraShort",
's.capital' =>
"Capital",
's.note_public' =>
"NotePublic",
266 't.libelle' =>
'ThirdPartyType',
'pl.code' =>
'ProspectLevel',
'st.code' =>
'ProspectStatus'
268 $this->export_TypeFields_array[$r] = array(
269 'cat.rowid' =>
'Numeric',
'cat.label' =>
"Text",
'cat.description' =>
"Text",
'cat.fk_parent' =>
'Numeric',
'pcat.label' =>
'Text',
270 '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",
271 's.address' =>
"Text",
's.zip' =>
"Text",
's.town' =>
"Text",
'c.label' =>
"List:c_country:label:label",
'c.code' =>
"Text",
272 's.phone' =>
"Text",
's.fax' =>
"Text",
's.url' =>
"Text",
's.email' =>
"Text",
273 's.siret' =>
"Text",
's.siren' =>
"Text",
's.ape' =>
"Text",
's.idprof4' =>
"Text",
's.tva_intra' =>
"Text",
's.capital' =>
"Numeric",
's.note_public' =>
"Text",
274 't.libelle' =>
'List:c_typent:libelle:code',
'pl.code' =>
'List:c_prospectlevel:label:code',
'st.code' =>
'List:c_stcomm:libelle:code'
276 $this->export_entities_array[$r] = array(
277 's.rowid' =>
'company',
's.nom' =>
'company',
's.prefix_comm' =>
"company",
's.client' =>
"company",
's.datec' =>
"company",
's.tms' =>
"company",
's.code_client' =>
"company",
278 's.address' =>
"company",
's.zip' =>
"company",
's.town' =>
"company",
'c.label' =>
"company",
'c.code' =>
"company",
279 's.phone' =>
"company",
's.fax' =>
"company",
's.url' =>
"company",
's.email' =>
"company",
280 's.siret' =>
"company",
's.siren' =>
"company",
's.ape' =>
"company",
's.idprof4' =>
"company",
's.tva_intra' =>
"company",
's.capital' =>
"company",
's.note_public' =>
"company",
281 't.libelle' =>
'company',
'pl.code' =>
'company',
'st.code' =>
'company'
284 $keyforselect =
'societe';
285 $keyforelement =
'company';
286 $keyforaliasextra =
'extra';
287 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
289 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
290 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
291 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
292 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_societe as cs ON cs.fk_categorie = cat.rowid';
293 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = cs.fk_soc';
294 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_extrafields as extra ON s.rowid = extra.fk_object';
295 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON s.fk_pays = c.rowid';
296 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as t ON s.fk_typent = t.id';
297 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_prospectlevel as pl ON s.fk_prospectlevel = pl.code';
298 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_stcomm as st ON s.fk_stcomm = st.id';
299 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
300 $this->export_sql_end[$r] .=
' AND cat.type = 2';
304 $this->export_code[$r] = $this->rights_class.
'_3_'.Categorie::$MAP_ID_TO_CODE[3];
305 $this->export_label[$r] =
'CatMemberList';
306 $this->export_icon[$r] = $this->picto;
307 $this->export_enabled[$r] =
'isModEnabled("member")';
308 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"adherent",
"export"));
309 $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');
310 $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');
311 $this->export_entities_array[$r] = array(
'p.rowid' =>
'member',
'p.lastname' =>
'member',
'p.firstname' =>
'member');
313 $keyforselect =
'adherent';
314 $keyforelement =
'member';
315 $keyforaliasextra =
'extra';
316 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
318 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
319 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
320 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
321 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_member as cm ON cm.fk_categorie = cat.rowid';
322 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'adherent as p ON p.rowid = cm.fk_member';
323 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'adherent_extrafields as extra ON cat.rowid = extra.fk_object ';
324 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
325 $this->export_sql_end[$r] .=
' AND cat.type = 3';
329 $this->export_code[$r] = $this->rights_class.
'_4_'.Categorie::$MAP_ID_TO_CODE[4];
330 $this->export_label[$r] =
'CatContactList';
331 $this->export_icon[$r] = $this->picto;
332 $this->export_enabled[$r] =
'isModEnabled("societe")';
333 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"societe",
"contact",
"export"));
334 $this->export_fields_array[$r] = array(
335 'cat.rowid' =>
"CategId",
'cat.label' =>
"Label",
'cat.description' =>
"Description",
'cat.fk_parent' =>
"ParentCategoryID",
'pcat.label' =>
"ParentCategoryLabel",
336 'cat.color' =>
"Color",
'cat.date_creation' =>
"DateCreation",
'cat.tms' =>
"DateLastModification",
337 'p.rowid' =>
'ContactId',
'civ.label' =>
'UserTitle',
'p.lastname' =>
'LastName',
'p.firstname' =>
'Firstname',
338 'p.address' =>
'Address',
'p.zip' =>
'Zip',
'p.town' =>
'Town',
'c.code' =>
'CountryCode',
'c.label' =>
'Country',
339 'p.birthday' =>
'DateOfBirth',
'p.poste' =>
'PostOrFunction',
340 'p.phone' =>
'Phone',
'p.phone_perso' =>
'PhonePerso',
'p.phone_mobile' =>
'PhoneMobile',
'p.fax' =>
'Fax',
'p.email' =>
'Email',
341 'p.note_private' =>
'NotePrivate',
'p.note_public' =>
'NotePublic',
'p.statut' =>
'Status',
342 's.nom' =>
"Name",
's.client' =>
"Customer",
's.fournisseur' =>
"Supplier",
's.status' =>
"Status",
343 's.address' =>
"Address",
's.zip' =>
"Zip",
's.town' =>
"Town",
344 's.phone' =>
"Phone",
's.fax' =>
"Fax",
's.url' =>
"Url",
's.email' =>
"Email"
346 $this->export_TypeFields_array[$r] = array(
347 'cat.rowid' =>
'Numeric',
'cat.label' =>
"Text",
'cat.description' =>
"Text",
'cat.fk_parent' =>
'Numeric',
'pcat.label' =>
'Text',
348 'civ.label' =>
'List:c_civility:label:label',
'p.rowid' =>
'Numeric',
'p.lastname' =>
'Text',
'p.firstname' =>
'Text',
349 'p.address' =>
'Text',
'p.zip' =>
'Text',
'p.town' =>
'Text',
'c.code' =>
'Text',
'c.label' =>
'List:c_country:label:label',
350 'p.birthday' =>
'Date',
'p.poste' =>
'Text',
351 'p.phone' =>
'Text',
'p.phone_perso' =>
'Text',
'p.phone_mobile' =>
'Text',
'p.fax' =>
'Text',
'p.email' =>
'Text',
352 'p.note_private' =>
'Text',
'p.note_public' =>
'Text',
'p.statut' =>
'Boolean',
353 's.nom' =>
"Text",
's.client' =>
"Boolean",
's.fournisseur' =>
"Boolean",
's.status' =>
"Boolean",
354 's.address' =>
"Text",
's.zip' =>
"Text",
's.town' =>
"Text",
355 's.phone' =>
"Text",
's.fax' =>
"Text",
's.url' =>
"Text",
's.email' =>
"Text"
357 $this->export_entities_array[$r] = array(
358 'p.rowid' =>
'contact',
'civ.label' =>
'contact',
'p.lastname' =>
'contact',
'p.firstname' =>
'contact',
359 'p.address' =>
'contact',
'p.zip' =>
'contact',
'p.town' =>
'contact',
'c.code' =>
'contact',
'c.label' =>
'contact',
360 'p.birthday' =>
'contact',
'p.poste' =>
'contact',
361 'p.phone' =>
'contact',
'p.phone_perso' =>
'contact',
'p.phone_mobile' =>
'contact',
'p.fax' =>
'contact',
'p.email' =>
'contact',
362 'p.note_private' =>
'contact',
'p.note_public' =>
'contact',
'p.statut' =>
'contact',
363 's.nom' =>
"company",
's.client' =>
"company",
's.fournisseur' =>
"company",
's.status' =>
"company",
364 's.address' =>
"company",
's.zip' =>
"company",
's.town' =>
"company",
365 's.phone' =>
"company",
's.fax' =>
"company",
's.url' =>
"company",
's.email' =>
"company"
368 $keyforselect =
'socpeople';
369 $keyforelement =
'contact';
370 $keyforaliasextra =
'extra';
371 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
373 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
374 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
375 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
376 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_contact as cc ON cc.fk_categorie = cat.rowid';
377 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'socpeople as p ON p.rowid = cc.fk_socpeople';
378 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
379 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_civility as civ ON civ.code = p.civility';
380 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON c.rowid = p.fk_pays';
381 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = p.fk_soc';
382 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
383 $this->export_sql_end[$r] .=
' AND cat.type = 4';
389 $this->export_code[$r] = $this->rights_class.
'_6_'.Categorie::$MAP_ID_TO_CODE[6];
390 $this->export_label[$r] =
'CatProjectsList';
391 $this->export_icon[$r] = $this->picto;
392 $this->export_enabled[$r] =
"isModEnabled('project')";
393 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"projet",
"export"));
394 $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");
395 $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");
396 $this->export_entities_array[$r] = array(
'p.rowid' =>
'project',
'p.ref' =>
'project',
's.rowid' =>
"company",
's.nom' =>
"company");
398 $keyforselect =
'projet';
399 $keyforelement =
'project';
400 $keyforaliasextra =
'extra';
401 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
403 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
404 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
405 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
406 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_project as cp ON cp.fk_categorie = cat.rowid';
407 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'projet as p ON p.rowid = cp.fk_project';
408 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'projet_extrafields as extra ON extra.fk_object = p.rowid';
409 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = p.fk_soc';
410 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
411 $this->export_sql_end[$r] .=
' AND cat.type = 6';
415 $this->export_code[$r] = $this->rights_class.
'_7_'.Categorie::$MAP_ID_TO_CODE[7];
416 $this->export_label[$r] =
'CatUsersList';
417 $this->export_icon[$r] = $this->picto;
418 $this->export_enabled[$r] =
'isModEnabled("user")';
419 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"user",
"export"));
420 $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');
421 $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');
422 $this->export_entities_array[$r] = array(
'p.rowid' =>
'user',
'p.login' =>
'user',
'p.lastname' =>
'user',
'p.firstname' =>
'user');
424 $keyforselect =
'user';
425 $keyforelement =
'user';
426 $keyforaliasextra =
'extra';
427 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
429 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
430 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
431 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
432 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_user as cu ON cu.fk_categorie = cat.rowid';
433 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'user as p ON p.rowid = cu.fk_user';
434 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extra ON extra.fk_object = p.rowid';
435 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
436 $this->export_sql_end[$r] .=
' AND cat.type = 7';
453 $this->import_code[$r] = $this->rights_class.
'_list';
454 $this->import_label[$r] =
"CatList";
455 $this->import_icon[$r] = $this->picto;
456 $this->import_entities_array[$r] = array();
457 $this->import_tables_array[$r] = array(
'ca' => MAIN_DB_PREFIX.
'categorie');
458 $this->import_fields_array[$r] = array(
459 'ca.label' =>
"Label*",
'ca.type' =>
"Type*",
'ca.description' =>
"Description",
460 'ca.fk_parent' =>
'ParentCategory'
462 $this->import_regex_array[$r] = array(
'ca.type' =>
'^(0|1|2|3|4|5|6|7|8|9|10|11)$');
463 $this->import_convertvalue_array[$r] = array(
464 'ca.fk_parent' => array(
465 'rule' =>
'fetchidfromcodeandlabel',
466 'classfile' =>
'/categories/class/categorie.class.php',
467 'class' =>
'Categorie',
469 'element' =>
'category',
470 'codefromfield' =>
'ca.type'
474 $this->import_examplevalues_array[$r] = array(
475 'ca.label' =>
"My Category Label",
'ca.type' => $typeexample,
'ca.description' =>
"My Category description",
476 'ca.fk_parent' =>
'rowid or label'
478 $this->import_updatekeys_array[$r] = array(
'ca.label' =>
'Label',
'ca.type' =>
'Type');
481 if (isModEnabled(
"product")) {
483 $this->import_code[$r] = $this->rights_class.
'_0_'.Categorie::$MAP_ID_TO_CODE[0];
484 $this->import_label[$r] =
"CatProdLinks";
485 $this->import_icon[$r] = $this->picto;
486 $this->import_entities_array[$r] = array();
487 $this->import_tables_array[$r] = array(
'cp' => MAIN_DB_PREFIX.
'categorie_product');
488 $this->import_fields_array[$r] = array(
'cp.fk_categorie' =>
"Category*",
'cp.fk_product' =>
"Product*");
489 $this->import_regex_array[$r] = array(
'cp.fk_categorie' =>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=0');
491 $this->import_convertvalue_array[$r] = array(
492 'cp.fk_categorie' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/categories/class/categorie.class.php',
'class' =>
'Categorie',
'method' =>
'fetch',
'element' =>
'category'),
493 'cp.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
495 $this->import_examplevalues_array[$r] = array(
'cp.fk_categorie' =>
"rowid or label",
'cp.fk_product' =>
"rowid or ref");
496 $this->import_updatekeys_array[$r] = array(
'cp.fk_categorie' =>
'Category',
'cp.fk_product' =>
'ProductRef');
500 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
502 $this->import_code[$r] = $this->rights_class.
'_1_'.Categorie::$MAP_ID_TO_CODE[1];
503 $this->import_label[$r] =
"CatSupLinks";
504 $this->import_icon[$r] = $this->picto;
505 $this->import_entities_array[$r] = array();
506 $this->import_tables_array[$r] = array(
'cs' => MAIN_DB_PREFIX.
'categorie_fournisseur');
507 $this->import_fields_array[$r] = array(
'cs.fk_categorie' =>
"Category*",
'cs.fk_soc' =>
"Supplier*");
508 $this->import_regex_array[$r] = array(
509 'cs.fk_categorie' =>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=1',
510 'cs.fk_soc' =>
'rowid@'.MAIN_DB_PREFIX.
'societe:fournisseur>0'
513 $this->import_convertvalue_array[$r] = array(
514 'cs.fk_categorie' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/categories/class/categorie.class.php',
'class' =>
'Categorie',
'method' =>
'fetch',
'element' =>
'category'),
515 'cs.fk_soc' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/societe/class/societe.class.php',
'class' =>
'Societe',
'method' =>
'fetch',
'element' =>
'ThirdParty')
517 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie' =>
"rowid or label",
'cs.fk_soc' =>
"rowid or name");
521 if (isModEnabled(
"societe")) {
523 $this->import_code[$r] = $this->rights_class.
'_2_'.Categorie::$MAP_ID_TO_CODE[2];
524 $this->import_label[$r] =
"CatCusLinks";
525 $this->import_icon[$r] = $this->picto;
526 $this->import_entities_array[$r] = array();
527 $this->import_tables_array[$r] = array(
'cs' => MAIN_DB_PREFIX.
'categorie_societe');
528 $this->import_fields_array[$r] = array(
'cs.fk_categorie' =>
"Category*",
'cs.fk_soc' =>
"Customer*");
529 $this->import_regex_array[$r] = array(
530 'cs.fk_categorie' =>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=2',
531 'cs.fk_soc' =>
'rowid@'.MAIN_DB_PREFIX.
'societe:client>0'
534 $this->import_convertvalue_array[$r] = array(
535 'cs.fk_categorie' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/categories/class/categorie.class.php',
'class' =>
'Categorie',
'method' =>
'fetch',
'element' =>
'category'),
536 'cs.fk_soc' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/societe/class/societe.class.php',
'class' =>
'Societe',
'method' =>
'fetch',
'element' =>
'ThirdParty')
538 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie' =>
"rowid or label",
'cs.fk_soc' =>
"rowid or name");
542 if (isModEnabled(
'member')) {
544 $this->import_code[$r] = $this->rights_class.
'_3_'.Categorie::$MAP_ID_TO_CODE[3];
545 $this->import_label[$r] =
"CatMembersLinks";
546 $this->import_icon[$r] = $this->picto;
547 $this->import_entities_array[$r] = array();
548 $this->import_tables_array[$r] = array(
'cm' => MAIN_DB_PREFIX.
'categorie_contact');
549 $this->import_fields_array[$r] = array(
'cm.fk_categorie' =>
"Category*",
'cm.fk_member' =>
"Member*");
550 $this->import_regex_array[$r] = array(
'cm.fk_categorie' =>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=3');
552 $this->import_convertvalue_array[$r] = array(
553 'cs.fk_categorie' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/categories/class/categorie.class.php',
'class' =>
'Categorie',
'method' =>
'fetch',
'element' =>
'category'),
554 'cs.fk_member' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/adherents/class/adherent.class.php',
'class' =>
'Adherent',
'method' =>
'fetch',
'element' =>
'Member')
556 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie' =>
"rowid or label",
'cs.fk_member' =>
"rowid or ref");
560 if (isModEnabled(
"societe")) {
562 $this->import_code[$r] = $this->rights_class.
'_4_'.Categorie::$MAP_ID_TO_CODE[4];
563 $this->import_label[$r] =
"CatContactsLinks";
564 $this->import_icon[$r] = $this->picto;
565 $this->import_entities_array[$r] = array();
566 $this->import_tables_array[$r] = array(
'cc' => MAIN_DB_PREFIX.
'categorie_contact');
567 $this->import_fields_array[$r] = array(
'cc.fk_categorie' =>
"Category*",
'cc.fk_socpeople' =>
"IdContact*");
568 $this->import_regex_array[$r] = array(
569 'cc.fk_categorie' =>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=4'
573 $this->import_convertvalue_array[$r] = array(
574 'cc.fk_categorie' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/categories/class/categorie.class.php',
'class' =>
'Categorie',
'method' =>
'fetch',
'element' =>
'category'),
577 $this->import_examplevalues_array[$r] = array(
'cc.fk_categorie' =>
"rowid or label",
'cc.fk_socpeople' =>
"rowid");
583 if (isModEnabled(
'project')) {
585 $this->import_code[$r] = $this->rights_class.
'_6_'.Categorie::$MAP_ID_TO_CODE[6];
586 $this->import_label[$r] =
"CatProjectsLinks";
587 $this->import_icon[$r] = $this->picto;
588 $this->import_entities_array[$r] = array();
589 $this->import_tables_array[$r] = array(
'cp' => MAIN_DB_PREFIX.
'categorie_project');
590 $this->import_fields_array[$r] = array(
'cp.fk_categorie' =>
"Category*",
'cp.fk_project' =>
"Project*");
591 $this->import_regex_array[$r] = array(
'cp.fk_categorie' =>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=6');
593 $this->import_convertvalue_array[$r] = array(
594 'cs.fk_categorie' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/categories/class/categorie.class.php',
'class' =>
'Categorie',
'method' =>
'fetch',
'element' =>
'category'),
595 'cs.fk_project' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/projet/class/project.class.php',
'class' =>
'Project',
'method' =>
'fetch',
'element' =>
'Project')
597 $this->import_examplevalues_array[$r] = array(
'cp.fk_categorie' =>
"rowid or label",
'cp.fk_project' =>
"rowid or ref");
601 if (isModEnabled(
'user')) {
603 $this->import_code[$r] = $this->rights_class.
'_7_'.Categorie::$MAP_ID_TO_CODE[7];
604 $this->import_label[$r] =
"CatUsersLinks";
605 $this->import_icon[$r] = $this->picto;
606 $this->import_entities_array[$r] = array();
607 $this->import_tables_array[$r] = array(
'cu' => MAIN_DB_PREFIX.
'categorie_user');
608 $this->import_fields_array[$r] = array(
'cu.fk_categorie' =>
"Category*",
'cu.fk_user' =>
"User*");
609 $this->import_regex_array[$r] = array(
'cu.fk_categorie' =>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=7');
611 $this->import_convertvalue_array[$r] = array(
612 'cu.fk_categorie' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/categories/class/categorie.class.php',
'class' =>
'Categorie',
'method' =>
'fetch',
'element' =>
'category'),
613 'cu.fk_user' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/user/class/user.class.php',
'class' =>
'User',
'method' =>
'fetch',
'element' =>
'User')
615 $this->import_examplevalues_array[$r] = array(
'cu.fk_categorie' =>
"rowid or label",
'cu.fk_user' =>
"rowid or login");