28 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
29 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
49 $this->family =
"technic";
50 $this->module_position =
'20';
52 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
53 $this->
description =
"Gestion des categories (produits, clients, fournisseurs...)";
56 $this->version =
'dolibarr';
58 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
59 $this->picto =
'category';
62 $this->dirs = array();
65 $this->depends = array();
68 $this->config_page_url = array(
'categorie.php@categories');
69 $this->langfiles = array(
"products",
"companies",
"categories",
"members",
"stocks",
"website");
72 $this->
const = array();
74 $this->
const[$r][0] =
"CATEGORIE_RECURSIV_ADD";
75 $this->
const[$r][1] =
"yesno";
76 $this->
const[$r][2] =
"0";
77 $this->
const[$r][3] =
'Affect parent categories';
78 $this->
const[$r][4] = 0;
82 $this->boxes = array();
85 $this->rights = array();
86 $this->rights_class =
'categorie';
90 $this->rights[$r][0] = 241;
91 $this->rights[$r][1] =
'Lire les categories';
92 $this->rights[$r][2] =
'r';
93 $this->rights[$r][3] = 0;
94 $this->rights[$r][4] =
'lire';
97 $this->rights[$r][0] = 242;
98 $this->rights[$r][1] =
'Creer/modifier les categories';
99 $this->rights[$r][2] =
'w';
100 $this->rights[$r][3] = 0;
101 $this->rights[$r][4] =
'creer';
104 $this->rights[$r][0] = 243;
105 $this->rights[$r][1] =
'Supprimer les categories';
106 $this->rights[$r][2] =
'd';
107 $this->rights[$r][3] = 0;
108 $this->rights[$r][4] =
'supprimer';
123 $this->export_code[$r] = $this->rights_class.
'_list';
124 $this->export_label[$r] =
'CatListAll';
125 $this->export_icon[$r] = $this->picto;
126 $this->export_enabled[$r] =
'true';
127 $this->export_permission[$r] = array(array(
"categorie",
"lire"));
131 $typeexample .= ($typeexample ?
" / " :
"").
"0=Product-Service";
134 $typeexample .= ($typeexample ?
"/" :
"").
"1=Supplier";
137 $typeexample .= ($typeexample ?
" / " :
"").
"2=Customer-Prospect";
140 $typeexample .= ($typeexample ?
" / " :
"").
"3=Member";
143 $typeexample .= ($typeexample ?
" / " :
"").
"4=Contact";
145 if (!empty($conf->bank->enabled)) {
146 $typeexample .= ($typeexample ?
" / " :
"").
"5=Bank account";
149 $typeexample .= ($typeexample ?
" / " :
"").
"6=Project";
151 if (!empty($conf->user->enabled)) {
152 $typeexample .= ($typeexample ?
" / " :
"").
"7=User";
154 if (!empty($conf->bank->enabled)) {
155 $typeexample .= ($typeexample ?
" / " :
"").
"8=Bank line";
158 $typeexample .= ($typeexample ?
" / " :
"").
"9=Warehouse";
161 $typeexample .= ($typeexample ?
" / " :
"").
"10=Agenda event";
164 $typeexample .= ($typeexample ?
" / " :
"").
"11=Website page";
168 $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");
169 $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');
170 $this->export_entities_array[$r] = array();
171 $this->export_help_array[$r] = array(
'cat.type'=>$typeexample);
173 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
174 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
175 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
176 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
180 $this->export_code[$r] = $this->rights_class.
'_0_'.Categorie::$MAP_ID_TO_CODE[0];
181 $this->export_label[$r] =
'CatProdList';
182 $this->export_icon[$r] = $this->picto;
183 $this->export_enabled[$r] =
'isModEnabled("product") || isModEnabled("service")';
184 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"produit",
"export"));
185 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategoryID",
'pcat.label'=>
"ParentCategoryLabel",
'p.rowid'=>
'ProductId',
'p.ref'=>
'Ref',
'p.label'=>
'Label');
186 $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');
187 $this->export_entities_array[$r] = array(
'p.rowid'=>
'product',
'p.ref'=>
'product',
'p.label'=>
'product');
189 $keyforselect =
'product';
190 $keyforelement =
'product';
191 $keyforaliasextra =
'extra';
192 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
194 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
195 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
196 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
197 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_categorie = cat.rowid';
198 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'product as p ON p.rowid = cp.fk_product';
199 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON extra.fk_object = p.rowid';
200 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
201 $this->export_sql_end[$r] .=
' AND cat.type = 0';
205 $this->export_code[$r] = $this->rights_class.
'_1_'.Categorie::$MAP_ID_TO_CODE[1];
206 $this->export_label[$r] =
'CatSupList';
207 $this->export_icon[$r] = $this->picto;
208 $this->export_enabled[$r] =
'isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")';
209 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"fournisseur",
"lire"));
210 $this->export_fields_array[$r] = array(
211 'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategoryID",
'pcat.label'=>
"ParentCategoryLabel",
212 's.rowid'=>
'IdThirdParty',
's.nom'=>
'Name',
's.prefix_comm'=>
"Prefix",
's.fournisseur'=>
"Supplier",
's.datec'=>
"DateCreation",
's.tms'=>
"DateLastModification",
's.code_fournisseur'=>
"SupplierCode",
213 's.address'=>
"Address",
's.zip'=>
"Zip",
's.town'=>
"Town",
'c.label'=>
"Country",
'c.code'=>
"CountryCode",
214 's.phone'=>
"Phone",
's.fax'=>
"Fax",
's.url'=>
"Url",
's.email'=>
"Email",
215 's.siret'=>
"ProfId1",
's.siren'=>
"ProfId2",
's.ape'=>
"ProfId3",
's.idprof4'=>
"ProfId4",
's.tva_intra'=>
"VATIntraShort",
's.capital'=>
"Capital",
's.note_public'=>
"NotePublic",
216 't.libelle'=>
'ThirdPartyType'
218 $this->export_TypeFields_array[$r] = array(
219 'cat.rowid'=>
'Numeric',
'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'Numeric',
'pcat.label'=>
'Text',
220 '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",
221 's.address'=>
"Text",
's.zip'=>
"Text",
's.town'=>
"Text",
'c.label'=>
"List:c_country:label:label",
'c.code'=>
"Text",
222 's.phone'=>
"Text",
's.fax'=>
"Text",
's.url'=>
"Text",
's.email'=>
"Text",
223 's.siret'=>
"Text",
's.siren'=>
"Text",
's.ape'=>
"Text",
's.idprof4'=>
"Text",
's.tva_intra'=>
"Text",
's.capital'=>
"Numeric",
's.note_public'=>
"Text",
224 't.libelle'=>
'List:c_typent:libelle:code'
226 $this->export_entities_array[$r] = array(
227 's.rowid'=>
'company',
's.nom'=>
'company',
's.prefix_comm'=>
"company",
's.fournisseur'=>
"company",
's.datec'=>
"company",
's.tms'=>
"company",
's.code_fournisseur'=>
"company",
228 's.address'=>
"company",
's.zip'=>
"company",
's.town'=>
"company",
'c.label'=>
"company",
'c.code'=>
"company",
229 's.phone'=>
"company",
's.fax'=>
"company",
's.url'=>
"company",
's.email'=>
"company",
230 's.siret'=>
"company",
's.siren'=>
"company",
's.ape'=>
"company",
's.idprof4'=>
"company",
's.tva_intra'=>
"company",
's.capital'=>
"company",
's.note_public'=>
"company",
231 't.libelle'=>
'company'
234 $keyforselect =
'societe';
235 $keyforelement =
'company';
236 $keyforaliasextra =
'extra';
237 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
239 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
240 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
241 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
242 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid';
243 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = cf.fk_soc';
244 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_extrafields as extra ON s.rowid = extra.fk_object';
245 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON s.fk_pays = c.rowid';
246 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as t ON s.fk_typent = t.id';
247 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
248 $this->export_sql_end[$r] .=
' AND cat.type = 1';
252 $this->export_code[$r] = $this->rights_class.
'_2_'.Categorie::$MAP_ID_TO_CODE[2];
253 $this->export_label[$r] =
'CatCusList';
254 $this->export_icon[$r] = $this->picto;
255 $this->export_enabled[$r] =
'isModEnabled("societe")';
256 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"societe",
"export"));
257 $this->export_fields_array[$r] = array(
258 'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategoryID",
'pcat.label'=>
"ParentCategoryLabel",
259 's.rowid'=>
'IdThirdParty',
's.nom'=>
'Name',
's.prefix_comm'=>
"Prefix",
's.client'=>
"Customer",
's.datec'=>
"DateCreation",
's.tms'=>
"DateLastModification",
's.code_client'=>
"CustomerCode",
260 's.address'=>
"Address",
's.zip'=>
"Zip",
's.town'=>
"Town",
'c.label'=>
"Country",
'c.code'=>
"CountryCode",
261 's.phone'=>
"Phone",
's.fax'=>
"Fax",
's.url'=>
"Url",
's.email'=>
"Email",
262 's.siret'=>
"ProfId1",
's.siren'=>
"ProfId2",
's.ape'=>
"ProfId3",
's.idprof4'=>
"ProfId4",
's.tva_intra'=>
"VATIntraShort",
's.capital'=>
"Capital",
's.note_public'=>
"NotePublic",
263 't.libelle'=>
'ThirdPartyType',
'pl.code'=>
'ProspectLevel',
'st.code'=>
'ProspectStatus'
265 $this->export_TypeFields_array[$r] = array(
266 'cat.rowid'=>
'Numeric',
'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'Numeric',
'pcat.label'=>
'Text',
267 '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",
268 's.address'=>
"Text",
's.zip'=>
"Text",
's.town'=>
"Text",
'c.label'=>
"List:c_country:label:label",
'c.code'=>
"Text",
269 's.phone'=>
"Text",
's.fax'=>
"Text",
's.url'=>
"Text",
's.email'=>
"Text",
270 's.siret'=>
"Text",
's.siren'=>
"Text",
's.ape'=>
"Text",
's.idprof4'=>
"Text",
's.tva_intra'=>
"Text",
's.capital'=>
"Numeric",
's.note_public'=>
"Text",
271 't.libelle'=>
'List:c_typent:libelle:code',
'pl.code'=>
'List:c_prospectlevel:label:code',
'st.code'=>
'List:c_stcomm:libelle:code'
273 $this->export_entities_array[$r] = array(
274 's.rowid'=>
'company',
's.nom'=>
'company',
's.prefix_comm'=>
"company",
's.client'=>
"company",
's.datec'=>
"company",
's.tms'=>
"company",
's.code_client'=>
"company",
275 's.address'=>
"company",
's.zip'=>
"company",
's.town'=>
"company",
'c.label'=>
"company",
'c.code'=>
"company",
276 's.phone'=>
"company",
's.fax'=>
"company",
's.url'=>
"company",
's.email'=>
"company",
277 's.siret'=>
"company",
's.siren'=>
"company",
's.ape'=>
"company",
's.idprof4'=>
"company",
's.tva_intra'=>
"company",
's.capital'=>
"company",
's.note_public'=>
"company",
278 't.libelle'=>
'company',
'pl.code'=>
'company',
'st.code'=>
'company'
281 $keyforselect =
'societe';
282 $keyforelement =
'company';
283 $keyforaliasextra =
'extra';
284 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
286 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
287 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
288 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
289 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_societe as cs ON cs.fk_categorie = cat.rowid';
290 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = cs.fk_soc';
291 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_extrafields as extra ON s.rowid = extra.fk_object';
292 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON s.fk_pays = c.rowid';
293 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as t ON s.fk_typent = t.id';
294 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_prospectlevel as pl ON s.fk_prospectlevel = pl.code';
295 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_stcomm as st ON s.fk_stcomm = st.id';
296 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
297 $this->export_sql_end[$r] .=
' AND cat.type = 2';
301 $this->export_code[$r] = $this->rights_class.
'_3_'.Categorie::$MAP_ID_TO_CODE[3];
302 $this->export_label[$r] =
'CatMemberList';
303 $this->export_icon[$r] = $this->picto;
304 $this->export_enabled[$r] =
'isModEnabled("adherent")';
305 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"adherent",
"export"));
306 $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');
307 $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');
308 $this->export_entities_array[$r] = array(
'p.rowid'=>
'member',
'p.lastname'=>
'member',
'p.firstname'=>
'member');
310 $keyforselect =
'adherent';
311 $keyforelement =
'member';
312 $keyforaliasextra =
'extra';
313 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
315 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
316 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
317 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
318 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_member as cm ON cm.fk_categorie = cat.rowid';
319 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'adherent as p ON p.rowid = cm.fk_member';
320 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'adherent_extrafields as extra ON cat.rowid = extra.fk_object ';
321 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
322 $this->export_sql_end[$r] .=
' AND cat.type = 3';
326 $this->export_code[$r] = $this->rights_class.
'_4_'.Categorie::$MAP_ID_TO_CODE[4];
327 $this->export_label[$r] =
'CatContactList';
328 $this->export_icon[$r] = $this->picto;
329 $this->export_enabled[$r] =
'isModEnabled("societe")';
330 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"societe",
"contact",
"export"));
331 $this->export_fields_array[$r] = array(
332 'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategoryID",
'pcat.label'=>
"ParentCategoryLabel",
333 'p.rowid' =>
'ContactId',
'civ.label' =>
'UserTitle',
'p.lastname' =>
'LastName',
'p.firstname' =>
'Firstname',
334 'p.address' =>
'Address',
'p.zip' =>
'Zip',
'p.town' =>
'Town',
'c.code' =>
'CountryCode',
'c.label' =>
'Country',
335 'p.birthday' =>
'DateOfBirth',
'p.poste' =>
'PostOrFunction',
336 'p.phone' =>
'Phone',
'p.phone_perso' =>
'PhonePerso',
'p.phone_mobile' =>
'PhoneMobile',
'p.fax' =>
'Fax',
'p.email' =>
'Email',
337 'p.note_private' =>
'NotePrivate',
'p.note_public' =>
'NotePublic',
'p.statut' =>
'Status',
338 's.nom'=>
"Name",
's.client'=>
"Customer",
's.fournisseur'=>
"Supplier",
's.status'=>
"Status",
339 's.address'=>
"Address",
's.zip'=>
"Zip",
's.town'=>
"Town",
340 's.phone'=>
"Phone",
's.fax'=>
"Fax",
's.url'=>
"Url",
's.email'=>
"Email"
342 $this->export_TypeFields_array[$r] = array(
343 'cat.rowid'=>
'Numeric',
'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'Numeric',
'pcat.label'=>
'Text',
344 'civ.label' =>
'List:c_civility:label:label',
'p.rowid'=>
'Numeric',
'p.lastname' =>
'Text',
'p.firstname' =>
'Text',
345 'p.address' =>
'Text',
'p.zip' =>
'Text',
'p.town' =>
'Text',
'c.code' =>
'Text',
'c.label' =>
'List:c_country:label:label',
346 'p.birthday' =>
'Date',
'p.poste' =>
'Text',
347 'p.phone' =>
'Text',
'p.phone_perso' =>
'Text',
'p.phone_mobile' =>
'Text',
'p.fax' =>
'Text',
'p.email' =>
'Text',
348 'p.note_private' =>
'Text',
'p.note_public' =>
'Text',
'p.statut' =>
'Boolean',
349 's.nom'=>
"Text",
's.client'=>
"Boolean",
's.fournisseur'=>
"Boolean",
's.status'=>
"Boolean",
350 's.address'=>
"Text",
's.zip'=>
"Text",
's.town'=>
"Text",
351 's.phone'=>
"Text",
's.fax'=>
"Text",
's.url'=>
"Text",
's.email'=>
"Text"
353 $this->export_entities_array[$r] = array(
354 'p.rowid' =>
'contact',
'civ.label' =>
'contact',
'p.lastname' =>
'contact',
'p.firstname' =>
'contact',
355 'p.address' =>
'contact',
'p.zip' =>
'contact',
'p.town' =>
'contact',
'c.code' =>
'contact',
'c.label' =>
'contact',
356 'p.birthday' =>
'contact',
'p.poste' =>
'contact',
357 'p.phone' =>
'contact',
'p.phone_perso' =>
'contact',
'p.phone_mobile' =>
'contact',
'p.fax' =>
'contact',
'p.email' =>
'contact',
358 'p.note_private' =>
'contact',
'p.note_public' =>
'contact',
'p.statut' =>
'contact',
359 's.nom'=>
"company",
's.client'=>
"company",
's.fournisseur'=>
"company",
's.status'=>
"company",
360 's.address'=>
"company",
's.zip'=>
"company",
's.town'=>
"company",
361 's.phone'=>
"company",
's.fax'=>
"company",
's.url'=>
"company",
's.email'=>
"company"
364 $keyforselect =
'socpeople';
365 $keyforelement =
'contact';
366 $keyforaliasextra =
'extra';
367 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
369 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
370 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
371 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
372 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_contact as cc ON cc.fk_categorie = cat.rowid';
373 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'socpeople as p ON p.rowid = cc.fk_socpeople';
374 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
375 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_civility as civ ON civ.code = p.civility';
376 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON c.rowid = p.fk_pays';
377 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = p.fk_soc';
378 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
379 $this->export_sql_end[$r] .=
' AND cat.type = 4';
385 $this->export_code[$r] = $this->rights_class.
'_6_'.Categorie::$MAP_ID_TO_CODE[6];
386 $this->export_label[$r] =
'CatProjectsList';
387 $this->export_icon[$r] = $this->picto;
388 $this->export_enabled[$r] =
"isModEnabled('project')";
389 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"projet",
"export"));
390 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
'pcat.label'=>
"ParentCategoryLabel",
'p.rowid'=>
'ProjectId',
'p.ref'=>
'Ref',
's.rowid'=>
"IdThirdParty",
's.nom'=>
"Name");
391 $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");
392 $this->export_entities_array[$r] = array(
'p.rowid'=>
'project',
'p.ref'=>
'project',
's.rowid'=>
"company",
's.nom'=>
"company");
394 $keyforselect =
'projet';
395 $keyforelement =
'project';
396 $keyforaliasextra =
'extra';
397 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
399 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
400 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
401 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
402 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_project as cp ON cp.fk_categorie = cat.rowid';
403 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'projet as p ON p.rowid = cp.fk_project';
404 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'projet_extrafields as extra ON extra.fk_object = p.rowid';
405 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = p.fk_soc';
406 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
407 $this->export_sql_end[$r] .=
' AND cat.type = 6';
411 $this->export_code[$r] = $this->rights_class.
'_7_'.Categorie::$MAP_ID_TO_CODE[7];
412 $this->export_label[$r] =
'CatUsersList';
413 $this->export_icon[$r] = $this->picto;
414 $this->export_enabled[$r] =
'!empty($conf->user->enabled)';
415 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"user",
"export"));
416 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
'pcat.label'=>
"ParentCategoryLabel",
'p.rowid'=>
'UserID',
'p.login'=>
'Login',
'p.lastname'=>
'Lastname',
'p.firstname'=>
'Firstname');
417 $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');
418 $this->export_entities_array[$r] = array(
'p.rowid'=>
'user',
'p.login'=>
'user',
'p.lastname'=>
'user',
'p.firstname'=>
'user');
420 $keyforselect =
'user';
421 $keyforelement =
'user';
422 $keyforaliasextra =
'extra';
423 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
425 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
426 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
427 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
428 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_user as cu ON cu.fk_categorie = cat.rowid';
429 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'user as p ON p.rowid = cu.fk_user';
430 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extra ON extra.fk_object = p.rowid';
431 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
432 $this->export_sql_end[$r] .=
' AND cat.type = 7';
449 $this->import_code[$r] = $this->rights_class.
'_list';
450 $this->import_label[$r] =
"CatList";
451 $this->import_icon[$r] = $this->picto;
452 $this->import_entities_array[$r] = array();
453 $this->import_tables_array[$r] = array(
'ca'=>MAIN_DB_PREFIX.
'categorie');
454 $this->import_fields_array[$r] = array(
455 'ca.label'=>
"Label*",
'ca.type'=>
"Type*",
'ca.description'=>
"Description",
456 'ca.fk_parent' =>
'ParentCategory'
458 $this->import_regex_array[$r] = array(
'ca.type'=>
'^(0|1|2|3|4|5|6|7|8|9|10|11)$');
459 $this->import_convertvalue_array[$r] = array(
460 'ca.fk_parent' => array(
461 'rule' =>
'fetchidfromcodeandlabel',
462 'classfile' =>
'/categories/class/categorie.class.php',
463 'class' =>
'Categorie',
465 'element' =>
'category',
466 'codefromfield' =>
'ca.type'
470 $this->import_examplevalues_array[$r] = array(
471 'ca.label'=>
"My Category Label",
'ca.type'=>$typeexample,
'ca.description'=>
"My Category description",
472 'ca.fk_parent' =>
'rowid or label'
474 $this->import_updatekeys_array[$r] = array(
'ca.label'=>
'Label');
479 $this->import_code[$r] = $this->rights_class.
'_0_'.Categorie::$MAP_ID_TO_CODE[0];
480 $this->import_label[$r] =
"CatProdLinks";
481 $this->import_icon[$r] = $this->picto;
482 $this->import_entities_array[$r] = array();
483 $this->import_tables_array[$r] = array(
'cp'=>MAIN_DB_PREFIX.
'categorie_product');
484 $this->import_fields_array[$r] = array(
'cp.fk_categorie'=>
"Category*",
'cp.fk_product'=>
"Product*");
485 $this->import_regex_array[$r] = array(
'cp.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=0');
487 $this->import_convertvalue_array[$r] = array(
488 'cp.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
489 'cp.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
491 $this->import_examplevalues_array[$r] = array(
'cp.fk_categorie'=>
"rowid or label",
'cp.fk_product'=>
"rowid or ref");
492 $this->import_updatekeys_array[$r] = array(
'cp.fk_categorie' =>
'Category',
'cp.fk_product' =>
'ProductRef');
498 $this->import_code[$r] = $this->rights_class.
'_1_'.Categorie::$MAP_ID_TO_CODE[1];
499 $this->import_label[$r] =
"CatSupLinks";
500 $this->import_icon[$r] = $this->picto;
501 $this->import_entities_array[$r] = array();
502 $this->import_tables_array[$r] = array(
'cs'=>MAIN_DB_PREFIX.
'categorie_fournisseur');
503 $this->import_fields_array[$r] = array(
'cs.fk_categorie'=>
"Category*",
'cs.fk_soc'=>
"Supplier*");
504 $this->import_regex_array[$r] = array(
505 'cs.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=1',
506 'cs.fk_soc'=>
'rowid@'.MAIN_DB_PREFIX.
'societe:fournisseur>0'
509 $this->import_convertvalue_array[$r] = array(
510 'cs.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
511 'cs.fk_soc'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/societe/class/societe.class.php',
'class'=>
'Societe',
'method'=>
'fetch',
'element'=>
'ThirdParty')
513 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie'=>
"rowid or label",
'cs.fk_soc'=>
"rowid or name");
519 $this->import_code[$r] = $this->rights_class.
'_2_'.Categorie::$MAP_ID_TO_CODE[2];
520 $this->import_label[$r] =
"CatCusLinks";
521 $this->import_icon[$r] = $this->picto;
522 $this->import_entities_array[$r] = array();
523 $this->import_tables_array[$r] = array(
'cs'=>MAIN_DB_PREFIX.
'categorie_societe');
524 $this->import_fields_array[$r] = array(
'cs.fk_categorie'=>
"Category*",
'cs.fk_soc'=>
"Customer*");
525 $this->import_regex_array[$r] = array(
526 'cs.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=2',
527 'cs.fk_soc'=>
'rowid@'.MAIN_DB_PREFIX.
'societe:client>0'
530 $this->import_convertvalue_array[$r] = array(
531 'cs.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
532 'cs.fk_soc'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/societe/class/societe.class.php',
'class'=>
'Societe',
'method'=>
'fetch',
'element'=>
'ThirdParty')
534 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie'=>
"rowid or label",
'cs.fk_soc'=>
"rowid or name");
540 $this->import_code[$r] = $this->rights_class.
'_3_'.Categorie::$MAP_ID_TO_CODE[3];
541 $this->import_label[$r] =
"CatMembersLinks";
542 $this->import_icon[$r] = $this->picto;
543 $this->import_entities_array[$r] = array();
544 $this->import_tables_array[$r] = array(
'cm'=>MAIN_DB_PREFIX.
'categorie_contact');
545 $this->import_fields_array[$r] = array(
'cm.fk_categorie'=>
"Category*",
'cm.fk_member'=>
"Member*");
546 $this->import_regex_array[$r] = array(
'cm.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=3');
548 $this->import_convertvalue_array[$r] = array(
549 'cs.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
550 'cs.fk_member'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/adherents/class/adherent.class.php',
'class'=>
'Adherent',
'method'=>
'fetch',
'element'=>
'Member')
552 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie'=>
"rowid or label",
'cs.fk_member'=>
"rowid or ref");
558 $this->import_code[$r] = $this->rights_class.
'_4_'.Categorie::$MAP_ID_TO_CODE[4];
559 $this->import_label[$r] =
"CatContactsLinks";
560 $this->import_icon[$r] = $this->picto;
561 $this->import_entities_array[$r] = array();
562 $this->import_tables_array[$r] = array(
'cc'=>MAIN_DB_PREFIX.
'categorie_contact');
563 $this->import_fields_array[$r] = array(
'cc.fk_categorie'=>
"Category*",
'cc.fk_socpeople'=>
"IdContact*");
564 $this->import_regex_array[$r] = array(
565 'cc.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=4'
569 $this->import_convertvalue_array[$r] = array(
570 'cc.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
573 $this->import_examplevalues_array[$r] = array(
'cc.fk_categorie'=>
"rowid or label",
'cc.fk_socpeople'=>
"rowid");
581 $this->import_code[$r] = $this->rights_class.
'_6_'.Categorie::$MAP_ID_TO_CODE[6];
582 $this->import_label[$r] =
"CatProjectsLinks";
583 $this->import_icon[$r] = $this->picto;
584 $this->import_entities_array[$r] = array();
585 $this->import_tables_array[$r] = array(
'cp'=>MAIN_DB_PREFIX.
'categorie_project');
586 $this->import_fields_array[$r] = array(
'cp.fk_categorie'=>
"Category*",
'cp.fk_project'=>
"Project*");
587 $this->import_regex_array[$r] = array(
'cp.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=6');
589 $this->import_convertvalue_array[$r] = array(
590 'cs.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
591 'cs.fk_project'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/projet/class/project.class.php',
'class'=>
'Project',
'method'=>
'fetch',
'element'=>
'Project')
593 $this->import_examplevalues_array[$r] = array(
'cp.fk_categorie'=>
"rowid or label",
'cp.fk_project'=>
"rowid or ref");
597 if (!empty($conf->user->enabled)) {
599 $this->import_code[$r] = $this->rights_class.
'_7_'.Categorie::$MAP_ID_TO_CODE[7];
600 $this->import_label[$r] =
"CatUsersLinks";
601 $this->import_icon[$r] = $this->picto;
602 $this->import_entities_array[$r] = array();
603 $this->import_tables_array[$r] = array(
'cu'=>MAIN_DB_PREFIX.
'categorie_user');
604 $this->import_fields_array[$r] = array(
'cu.fk_categorie'=>
"Category*",
'cu.fk_user'=>
"User*");
605 $this->import_regex_array[$r] = array(
'cu.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=7');
607 $this->import_convertvalue_array[$r] = array(
608 'cu.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
609 'cu.fk_user'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/user/class/user.class.php',
'class'=>
'User',
'method'=>
'fetch',
'element'=>
'User')
611 $this->import_examplevalues_array[$r] = array(
'cu.fk_categorie'=>
"rowid or label",
'cu.fk_user'=>
"rowid or login");
632 public function init($options =
'')
635 $this->
remove($options);
639 return $this->
_init($sql, $options);
_init($array_sql, $options='')
Enables a module.
Class to describe and enable module Categorie.
init($options='')
Function called when module is enabled.
__construct($db)
Constructor.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
isModEnabled($module)
Is Dolibarr module enabled.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.