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"));
130 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"0=Product-Service"; }
131 if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $typeexample .= ($typeexample ?
"/" :
"").
"1=Supplier"; }
132 if (!empty($conf->societe->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"2=Customer-Prospect"; }
133 if (!empty($conf->adherent->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"3=Member"; }
134 if (!empty($conf->societe->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"4=Contact"; }
135 if (!empty($conf->bank->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"5=Bank account"; }
136 if (!empty($conf->projet->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"6=Project"; }
137 if (!empty($conf->user->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"7=User"; }
138 if (!empty($conf->bank->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"8=Bank line"; }
139 if (!empty($conf->stock->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"9=Warehouse"; }
140 if (!empty($conf->agenda->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"10=Agenda event"; }
141 if (!empty($conf->website->enabled)) { $typeexample .= ($typeexample ?
" / " :
"").
"11=Website page"; }
143 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.type'=>
"Type",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
'pcat.label'=>
"ParentCategoryLabel" );
144 $this->export_TypeFields_array[$r] = array(
'cat.label'=>
"Text",
'cat.type'=>
"Numeric",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
'pcat.label'=>
'Text' );
145 $this->export_entities_array[$r] = array();
146 $this->export_help_array[$r] = array(
'cat.type'=>$typeexample);
148 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
149 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
150 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as pcat ON pcat.rowid = cat.fk_parent';
151 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
155 $this->export_code[$r] = $this->rights_class.
'_0_'.Categorie::$MAP_ID_TO_CODE[0];
156 $this->export_label[$r] =
'CatProdList';
157 $this->export_icon[$r] = $this->picto;
158 $this->export_enabled[$r] =
'!empty($conf->product->enabled) || !empty($conf->service->abled)';
159 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"produit",
"export"));
160 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
'p.rowid'=>
'ProductId',
'p.ref'=>
'Ref',
'p.label'=>
'Label');
161 $this->export_TypeFields_array[$r] = array(
'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
'p.ref'=>
'Text',
'p.label'=>
'Text');
162 $this->export_entities_array[$r] = array(
'p.rowid'=>
'product',
'p.ref'=>
'product',
'p.label'=>
'product');
164 $keyforselect =
'product'; $keyforelement =
'product'; $keyforaliasextra =
'extra';
165 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
167 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
168 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
169 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_categorie = cat.rowid';
170 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'product as p ON p.rowid = cp.fk_product';
171 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON extra.fk_object = p.rowid';
172 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
173 $this->export_sql_end[$r] .=
' AND cat.type = 0';
177 $this->export_code[$r] = $this->rights_class.
'_1_'.Categorie::$MAP_ID_TO_CODE[1];
178 $this->export_label[$r] =
'CatSupList';
179 $this->export_icon[$r] = $this->picto;
180 $this->export_enabled[$r] =
'!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)';
181 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"fournisseur",
"lire"));
182 $this->export_fields_array[$r] = array(
183 'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
184 's.rowid'=>
'IdThirdParty',
's.nom'=>
'Name',
's.prefix_comm'=>
"Prefix",
's.fournisseur'=>
"Supplier",
's.datec'=>
"DateCreation",
's.tms'=>
"DateLastModification",
's.code_fournisseur'=>
"SupplierCode",
185 's.address'=>
"Address",
's.zip'=>
"Zip",
's.town'=>
"Town",
'c.label'=>
"Country",
'c.code'=>
"CountryCode",
186 's.phone'=>
"Phone",
's.fax'=>
"Fax",
's.url'=>
"Url",
's.email'=>
"Email",
187 's.siret'=>
"ProfId1",
's.siren'=>
"ProfId2",
's.ape'=>
"ProfId3",
's.idprof4'=>
"ProfId4",
's.tva_intra'=>
"VATIntraShort",
's.capital'=>
"Capital",
's.note_public'=>
"NotePublic",
188 't.libelle'=>
'ThirdPartyType'
190 $this->export_TypeFields_array[$r] = array(
191 'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
192 '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",
193 's.address'=>
"Text",
's.zip'=>
"Text",
's.town'=>
"Text",
'c.label'=>
"List:c_country:label:label",
'c.code'=>
"Text",
194 's.phone'=>
"Text",
's.fax'=>
"Text",
's.url'=>
"Text",
's.email'=>
"Text",
195 's.siret'=>
"Text",
's.siren'=>
"Text",
's.ape'=>
"Text",
's.idprof4'=>
"Text",
's.tva_intra'=>
"Text",
's.capital'=>
"Numeric",
's.note_public'=>
"Text",
196 't.libelle'=>
'List:c_typent:libelle:code'
198 $this->export_entities_array[$r] = array(
199 's.rowid'=>
'company',
's.nom'=>
'company',
's.prefix_comm'=>
"company",
's.fournisseur'=>
"company",
's.datec'=>
"company",
's.tms'=>
"company",
's.code_fournisseur'=>
"company",
200 's.address'=>
"company",
's.zip'=>
"company",
's.town'=>
"company",
'c.label'=>
"company",
'c.code'=>
"company",
201 's.phone'=>
"company",
's.fax'=>
"company",
's.url'=>
"company",
's.email'=>
"company",
202 's.siret'=>
"company",
's.siren'=>
"company",
's.ape'=>
"company",
's.idprof4'=>
"company",
's.tva_intra'=>
"company",
's.capital'=>
"company",
's.note_public'=>
"company",
203 't.libelle'=>
'company'
206 $keyforselect =
'societe'; $keyforelement =
'company'; $keyforaliasextra =
'extra';
207 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
209 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
210 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
211 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid';
212 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = cf.fk_soc';
213 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_extrafields as extra ON s.rowid = extra.fk_object';
214 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON s.fk_pays = c.rowid';
215 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as t ON s.fk_typent = t.id';
216 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
217 $this->export_sql_end[$r] .=
' AND cat.type = 1';
221 $this->export_code[$r] = $this->rights_class.
'_2_'.Categorie::$MAP_ID_TO_CODE[2];
222 $this->export_label[$r] =
'CatCusList';
223 $this->export_icon[$r] = $this->picto;
224 $this->export_enabled[$r] =
'!empty($conf->societe->enabled)';
225 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"societe",
"export"));
226 $this->export_fields_array[$r] = array(
227 'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
228 's.rowid'=>
'IdThirdParty',
's.nom'=>
'Name',
's.prefix_comm'=>
"Prefix",
's.client'=>
"Customer",
's.datec'=>
"DateCreation",
's.tms'=>
"DateLastModification",
's.code_client'=>
"CustomerCode",
229 's.address'=>
"Address",
's.zip'=>
"Zip",
's.town'=>
"Town",
'c.label'=>
"Country",
'c.code'=>
"CountryCode",
230 's.phone'=>
"Phone",
's.fax'=>
"Fax",
's.url'=>
"Url",
's.email'=>
"Email",
231 's.siret'=>
"ProfId1",
's.siren'=>
"ProfId2",
's.ape'=>
"ProfId3",
's.idprof4'=>
"ProfId4",
's.tva_intra'=>
"VATIntraShort",
's.capital'=>
"Capital",
's.note_public'=>
"NotePublic",
232 't.libelle'=>
'ThirdPartyType',
'pl.code'=>
'ProspectLevel',
'st.code'=>
'ProspectStatus'
234 $this->export_TypeFields_array[$r] = array(
235 'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
236 '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",
237 's.address'=>
"Text",
's.zip'=>
"Text",
's.town'=>
"Text",
'c.label'=>
"List:c_country:label:label",
'c.code'=>
"Text",
238 's.phone'=>
"Text",
's.fax'=>
"Text",
's.url'=>
"Text",
's.email'=>
"Text",
239 's.siret'=>
"Text",
's.siren'=>
"Text",
's.ape'=>
"Text",
's.idprof4'=>
"Text",
's.tva_intra'=>
"Text",
's.capital'=>
"Numeric",
's.note_public'=>
"Text",
240 't.libelle'=>
'List:c_typent:libelle:code',
'pl.code'=>
'List:c_prospectlevel:label:code',
'st.code'=>
'List:c_stcomm:libelle:code'
242 $this->export_entities_array[$r] = array(
243 's.rowid'=>
'company',
's.nom'=>
'company',
's.prefix_comm'=>
"company",
's.client'=>
"company",
's.datec'=>
"company",
's.tms'=>
"company",
's.code_client'=>
"company",
244 's.address'=>
"company",
's.zip'=>
"company",
's.town'=>
"company",
'c.label'=>
"company",
'c.code'=>
"company",
245 's.phone'=>
"company",
's.fax'=>
"company",
's.url'=>
"company",
's.email'=>
"company",
246 's.siret'=>
"company",
's.siren'=>
"company",
's.ape'=>
"company",
's.idprof4'=>
"company",
's.tva_intra'=>
"company",
's.capital'=>
"company",
's.note_public'=>
"company",
247 't.libelle'=>
'company',
'pl.code'=>
'company',
'st.code'=>
'company'
250 $keyforselect =
'societe'; $keyforelement =
'company'; $keyforaliasextra =
'extra';
251 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
253 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
254 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
255 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_societe as cs ON cs.fk_categorie = cat.rowid';
256 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = cs.fk_soc';
257 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe_extrafields as extra ON s.rowid = extra.fk_object';
258 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON s.fk_pays = c.rowid';
259 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as t ON s.fk_typent = t.id';
260 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_prospectlevel as pl ON s.fk_prospectlevel = pl.code';
261 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_stcomm as st ON s.fk_stcomm = st.id';
262 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
263 $this->export_sql_end[$r] .=
' AND cat.type = 2';
267 $this->export_code[$r] = $this->rights_class.
'_3_'.Categorie::$MAP_ID_TO_CODE[3];
268 $this->export_label[$r] =
'CatMemberList';
269 $this->export_icon[$r] = $this->picto;
270 $this->export_enabled[$r] =
'!empty($conf->adherent->enabled)';
271 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"adherent",
"export"));
272 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
'p.rowid'=>
'MemberId',
'p.lastname'=>
'LastName',
'p.firstname'=>
'Firstname');
273 $this->export_TypeFields_array[$r] = array(
'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
'p.lastname'=>
'Text',
'p.firstname'=>
'Text');
274 $this->export_entities_array[$r] = array(
'p.rowid'=>
'member',
'p.lastname'=>
'member',
'p.firstname'=>
'member');
276 $keyforselect =
'adherent'; $keyforelement =
'member'; $keyforaliasextra =
'extra';
277 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
279 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
280 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
281 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_member as cm ON cm.fk_categorie = cat.rowid';
282 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'adherent as p ON p.rowid = cm.fk_member';
283 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'adherent_extrafields as extra ON cat.rowid = extra.fk_object ';
284 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
285 $this->export_sql_end[$r] .=
' AND cat.type = 3';
289 $this->export_code[$r] = $this->rights_class.
'_4_'.Categorie::$MAP_ID_TO_CODE[4];
290 $this->export_label[$r] =
'CatContactList';
291 $this->export_icon[$r] = $this->picto;
292 $this->export_enabled[$r] =
'!empty($conf->societe->enabled)';
293 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"societe",
"contact",
"export"));
294 $this->export_fields_array[$r] = array(
295 'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
296 'p.rowid' =>
'ContactId',
'civ.label' =>
'UserTitle',
'p.lastname' =>
'LastName',
'p.firstname' =>
'Firstname',
297 'p.address' =>
'Address',
'p.zip' =>
'Zip',
'p.town' =>
'Town',
'c.code' =>
'CountryCode',
'c.label' =>
'Country',
298 'p.birthday' =>
'DateOfBirth',
'p.poste' =>
'PostOrFunction',
299 'p.phone' =>
'Phone',
'p.phone_perso' =>
'PhonePerso',
'p.phone_mobile' =>
'PhoneMobile',
'p.fax' =>
'Fax',
'p.email' =>
'Email',
300 'p.note_private' =>
'NotePrivate',
'p.note_public' =>
'NotePublic',
'p.statut' =>
'Status',
301 's.nom'=>
"Name",
's.client'=>
"Customer",
's.fournisseur'=>
"Supplier",
's.status'=>
"Status",
302 's.address'=>
"Address",
's.zip'=>
"Zip",
's.town'=>
"Town",
303 's.phone'=>
"Phone",
's.fax'=>
"Fax",
's.url'=>
"Url",
's.email'=>
"Email"
305 $this->export_TypeFields_array[$r] = array(
306 'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
307 'civ.label' =>
'List:c_civility:label:label',
'p.lastname' =>
'Text',
'p.firstname' =>
'Text',
308 'p.address' =>
'Text',
'p.zip' =>
'Text',
'p.town' =>
'Text',
'c.code' =>
'Text',
'c.label' =>
'List:c_country:label:label',
309 'p.birthday' =>
'Date',
'p.poste' =>
'Text',
310 'p.phone' =>
'Text',
'p.phone_perso' =>
'Text',
'p.phone_mobile' =>
'Text',
'p.fax' =>
'Text',
'p.email' =>
'Text',
311 'p.note_private' =>
'Text',
'p.note_public' =>
'Text',
'p.statut' =>
'Boolean',
312 's.nom'=>
"Text",
's.client'=>
"Boolean",
's.fournisseur'=>
"Boolean",
's.status'=>
"Boolean",
313 's.address'=>
"Text",
's.zip'=>
"Text",
's.town'=>
"Text",
314 's.phone'=>
"Text",
's.fax'=>
"Text",
's.url'=>
"Text",
's.email'=>
"Text"
316 $this->export_entities_array[$r] = array(
317 'p.rowid' =>
'contact',
'civ.label' =>
'contact',
'p.lastname' =>
'contact',
'p.firstname' =>
'contact',
318 'p.address' =>
'contact',
'p.zip' =>
'contact',
'p.town' =>
'contact',
'c.code' =>
'contact',
'c.label' =>
'contact',
319 'p.birthday' =>
'contact',
'p.poste' =>
'contact',
320 'p.phone' =>
'contact',
'p.phone_perso' =>
'contact',
'p.phone_mobile' =>
'contact',
'p.fax' =>
'contact',
'p.email' =>
'contact',
321 'p.note_private' =>
'contact',
'p.note_public' =>
'contact',
'p.statut' =>
'contact',
322 's.nom'=>
"company",
's.client'=>
"company",
's.fournisseur'=>
"company",
's.status'=>
"company",
323 's.address'=>
"company",
's.zip'=>
"company",
's.town'=>
"company",
324 's.phone'=>
"company",
's.fax'=>
"company",
's.url'=>
"company",
's.email'=>
"company"
327 $keyforselect =
'socpeople'; $keyforelement =
'contact'; $keyforaliasextra =
'extra';
328 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
330 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
331 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
332 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_contact as cc ON cc.fk_categorie = cat.rowid';
333 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'socpeople as p ON p.rowid = cc.fk_socpeople';
334 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
335 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_civility as civ ON civ.code = p.civility';
336 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON c.rowid = p.fk_pays';
337 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = p.fk_soc';
338 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
339 $this->export_sql_end[$r] .=
' AND cat.type = 4';
345 $this->export_code[$r] = $this->rights_class.
'_6_'.Categorie::$MAP_ID_TO_CODE[6];
346 $this->export_label[$r] =
'CatProjectsList';
347 $this->export_icon[$r] = $this->picto;
348 $this->export_enabled[$r] =
'!empty($conf->projet->enabled)';
349 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"projet",
"export"));
350 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
'p.rowid'=>
'ProjectId',
'p.ref'=>
'Ref',
's.rowid'=>
"IdThirdParty",
's.nom'=>
"Name");
351 $this->export_TypeFields_array[$r] = array(
'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
'p.ref'=>
'Text',
's.rowid'=>
"List:societe:nom:rowid",
's.nom'=>
"Text");
352 $this->export_entities_array[$r] = array(
'p.rowid'=>
'project',
'p.ref'=>
'project',
's.rowid'=>
"company",
's.nom'=>
"company");
354 $keyforselect =
'projet'; $keyforelement =
'project'; $keyforaliasextra =
'extra';
355 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
357 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
358 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
359 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_project as cp ON cp.fk_categorie = cat.rowid';
360 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'projet as p ON p.rowid = cp.fk_project';
361 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'projet_extrafields as extra ON extra.fk_object = p.rowid';
362 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON s.rowid = p.fk_soc';
363 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
364 $this->export_sql_end[$r] .=
' AND cat.type = 6';
368 $this->export_code[$r] = $this->rights_class.
'_7_'.Categorie::$MAP_ID_TO_CODE[7];
369 $this->export_label[$r] =
'CatUsersList';
370 $this->export_icon[$r] = $this->picto;
371 $this->export_enabled[$r] =
'!empty($conf->user->enabled)';
372 $this->export_permission[$r] = array(array(
"categorie",
"lire"), array(
"user",
"export"));
373 $this->export_fields_array[$r] = array(
'cat.rowid'=>
"CategId",
'cat.label'=>
"Label",
'cat.description'=>
"Description",
'cat.fk_parent'=>
"ParentCategory",
'p.rowid'=>
'TechnicalID',
'p.login'=>
'Login',
'p.lastname'=>
'Lastname',
'p.firstname'=>
'Firstname');
374 $this->export_TypeFields_array[$r] = array(
'cat.label'=>
"Text",
'cat.description'=>
"Text",
'cat.fk_parent'=>
'List:categorie:label:rowid',
'p.login'=>
'Text',
'p.lastname'=>
'Text',
'p.firstname'=>
'Text');
375 $this->export_entities_array[$r] = array(
'p.rowid'=>
'user',
'p.login'=>
'user',
'p.lastname'=>
'user',
'p.firstname'=>
'user');
377 $keyforselect =
'user'; $keyforelement =
'user'; $keyforaliasextra =
'extra';
378 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
380 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
381 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'categorie as cat';
382 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'categorie_user as cu ON cu.fk_categorie = cat.rowid';
383 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'user as p ON p.rowid = cu.fk_user';
384 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extra ON extra.fk_object = p.rowid';
385 $this->export_sql_end[$r] .=
' WHERE cat.entity IN ('.getEntity(
'category').
')';
386 $this->export_sql_end[$r] .=
' AND cat.type = 7';
403 $this->import_code[$r] = $this->rights_class.
'_list';
404 $this->import_label[$r] =
"CatList";
405 $this->import_icon[$r] = $this->picto;
406 $this->import_entities_array[$r] = array();
407 $this->import_tables_array[$r] = array(
'ca'=>MAIN_DB_PREFIX.
'categorie');
408 $this->import_fields_array[$r] = array(
409 'ca.label'=>
"Label*",
'ca.type'=>
"Type*",
'ca.description'=>
"Description",
410 'ca.fk_parent' =>
'ParentCategory'
412 $this->import_regex_array[$r] = array(
'ca.type'=>
'^(0|1|2|3|4|5|6|7|8|9|10|11)$');
413 $this->import_convertvalue_array[$r] = array(
414 'ca.fk_parent' => array(
415 'rule' =>
'fetchidfromcodeandlabel',
416 'classfile' =>
'/categories/class/categorie.class.php',
417 'class' =>
'Categorie',
419 'element' =>
'category',
420 'codefromfield' =>
'ca.type'
424 $this->import_examplevalues_array[$r] = array(
425 'ca.label'=>
"My Category Label",
'ca.type'=>$typeexample,
'ca.description'=>
"My Category description",
426 'ca.fk_parent' =>
'rowid or label'
428 $this->import_updatekeys_array[$r] = array(
'ca.label'=>
'Label');
431 if (!empty($conf->product->enabled))
434 $this->import_code[$r] = $this->rights_class.
'_0_'.Categorie::$MAP_ID_TO_CODE[0];
435 $this->import_label[$r] =
"CatProdLinks";
436 $this->import_icon[$r] = $this->picto;
437 $this->import_entities_array[$r] = array();
438 $this->import_tables_array[$r] = array(
'cp'=>MAIN_DB_PREFIX.
'categorie_product');
439 $this->import_fields_array[$r] = array(
'cp.fk_categorie'=>
"Category*",
'cp.fk_product'=>
"Product*");
440 $this->import_regex_array[$r] = array(
'cp.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=0');
442 $this->import_convertvalue_array[$r] = array(
443 'cp.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
444 'cp.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
446 $this->import_examplevalues_array[$r] = array(
'cp.fk_categorie'=>
"rowid or label",
'cp.fk_product'=>
"rowid or ref");
450 if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
453 $this->import_code[$r] = $this->rights_class.
'_1_'.Categorie::$MAP_ID_TO_CODE[1];
454 $this->import_label[$r] =
"CatSupLinks";
455 $this->import_icon[$r] = $this->picto;
456 $this->import_entities_array[$r] = array();
457 $this->import_tables_array[$r] = array(
'cs'=>MAIN_DB_PREFIX.
'categorie_fournisseur');
458 $this->import_fields_array[$r] = array(
'cs.fk_categorie'=>
"Category*",
'cs.fk_soc'=>
"Supplier*");
459 $this->import_regex_array[$r] = array(
460 'cs.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=1',
461 'cs.fk_soc'=>
'rowid@'.MAIN_DB_PREFIX.
'societe:fournisseur>0'
464 $this->import_convertvalue_array[$r] = array(
465 'cs.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
466 'cs.fk_soc'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/societe/class/societe.class.php',
'class'=>
'Societe',
'method'=>
'fetch',
'element'=>
'ThirdParty')
468 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie'=>
"rowid or label",
'cs.fk_soc'=>
"rowid or ref");
472 if (!empty($conf->societe->enabled))
475 $this->import_code[$r] = $this->rights_class.
'_2_'.Categorie::$MAP_ID_TO_CODE[2];
476 $this->import_label[$r] =
"CatCusLinks";
477 $this->import_icon[$r] = $this->picto;
478 $this->import_entities_array[$r] = array();
479 $this->import_tables_array[$r] = array(
'cs'=>MAIN_DB_PREFIX.
'categorie_societe');
480 $this->import_fields_array[$r] = array(
'cs.fk_categorie'=>
"Category*",
'cs.fk_soc'=>
"Customer*");
481 $this->import_regex_array[$r] = array(
482 'cs.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=2',
483 'cs.fk_soc'=>
'rowid@'.MAIN_DB_PREFIX.
'societe:client>0'
486 $this->import_convertvalue_array[$r] = array(
487 'cs.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
488 'cs.fk_soc'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/societe/class/societe.class.php',
'class'=>
'Societe',
'method'=>
'fetch',
'element'=>
'ThirdParty')
490 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie'=>
"rowid or label",
'cs.fk_soc'=>
"rowid or ref");
494 if (!empty($conf->adherent->enabled))
497 $this->import_code[$r] = $this->rights_class.
'_3_'.Categorie::$MAP_ID_TO_CODE[3];
498 $this->import_label[$r] =
"CatMembersLinks";
499 $this->import_icon[$r] = $this->picto;
500 $this->import_entities_array[$r] = array();
501 $this->import_tables_array[$r] = array(
'cm'=>MAIN_DB_PREFIX.
'categorie_contact');
502 $this->import_fields_array[$r] = array(
'cm.fk_categorie'=>
"Category*",
'cm.fk_member'=>
"Member*");
503 $this->import_regex_array[$r] = array(
'cm.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=3');
505 $this->import_convertvalue_array[$r] = array(
506 'cs.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
507 'cs.fk_member'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/adherents/class/adherent.class.php',
'class'=>
'Adherent',
'method'=>
'fetch',
'element'=>
'Member')
509 $this->import_examplevalues_array[$r] = array(
'cs.fk_categorie'=>
"rowid or label",
'cs.fk_member'=>
"rowid or ref");
513 if (!empty($conf->societe->enabled))
516 $this->import_code[$r] = $this->rights_class.
'_4_'.Categorie::$MAP_ID_TO_CODE[4];
517 $this->import_label[$r] =
"CatContactsLinks";
518 $this->import_icon[$r] = $this->picto;
519 $this->import_entities_array[$r] = array();
520 $this->import_tables_array[$r] = array(
'cc'=>MAIN_DB_PREFIX.
'categorie_contact');
521 $this->import_fields_array[$r] = array(
'cc.fk_categorie'=>
"Category*",
'cc.fk_socpeople'=>
"IdContact*");
522 $this->import_regex_array[$r] = array(
523 'cc.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=4'
527 $this->import_convertvalue_array[$r] = array(
528 'cc.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
531 $this->import_examplevalues_array[$r] = array(
'cc.fk_categorie'=>
"rowid or label",
'cc.fk_socpeople'=>
"rowid");
537 if (!empty($conf->projet->enabled))
540 $this->import_code[$r] = $this->rights_class.
'_6_'.Categorie::$MAP_ID_TO_CODE[6];
541 $this->import_label[$r] =
"CatProjectsLinks";
542 $this->import_icon[$r] = $this->picto;
543 $this->import_entities_array[$r] = array();
544 $this->import_tables_array[$r] = array(
'cp'=>MAIN_DB_PREFIX.
'categorie_project');
545 $this->import_fields_array[$r] = array(
'cp.fk_categorie'=>
"Category*",
'cp.fk_project'=>
"Project*");
546 $this->import_regex_array[$r] = array(
'cp.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=6');
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_project'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/projet/class/project.class.php',
'class'=>
'Project',
'method'=>
'fetch',
'element'=>
'Project')
552 $this->import_examplevalues_array[$r] = array(
'cp.fk_categorie'=>
"rowid or label",
'cp.fk_project'=>
"rowid or ref");
556 if (!empty($conf->user->enabled))
559 $this->import_code[$r] = $this->rights_class.
'_7_'.Categorie::$MAP_ID_TO_CODE[7];
560 $this->import_label[$r] =
"CatUsersLinks";
561 $this->import_icon[$r] = $this->picto;
562 $this->import_entities_array[$r] = array();
563 $this->import_tables_array[$r] = array(
'cu'=>MAIN_DB_PREFIX.
'categorie_user');
564 $this->import_fields_array[$r] = array(
'cu.fk_categorie'=>
"Category*",
'cu.fk_user'=>
"User*");
565 $this->import_regex_array[$r] = array(
'cu.fk_categorie'=>
'rowid@'.MAIN_DB_PREFIX.
'categorie:type=7');
567 $this->import_convertvalue_array[$r] = array(
568 'cu.fk_categorie'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/categories/class/categorie.class.php',
'class'=>
'Categorie',
'method'=>
'fetch',
'element'=>
'category'),
569 'cu.fk_user'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/user/class/user.class.php',
'class'=>
'User',
'method'=>
'fetch',
'element'=>
'User')
571 $this->import_examplevalues_array[$r] = array(
'cu.fk_categorie'=>
"rowid or label",
'cu.fk_user'=>
"rowid or login");
592 public function init($options =
'')
595 $this->
remove($options);
599 return $this->
_init($sql, $options);
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
Class to describe and enable module Categorie.
__construct($db)
Constructor.
_init($array_sql, $options= '')
Enables a module.
init($options= '')
Function called when module is enabled.