dolibarr  9.0.0
modCategorie.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
3  * Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
27 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
28 
29 
34 {
40  function __construct($db)
41  {
42  global $conf;
43 
44  $this->db = $db;
45  $this->numero = 1780;
46 
47  $this->family = "technic";
48  $this->module_position = '20';
49  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50  $this->name = preg_replace('/^mod/i','',get_class($this));
51  $this->description = "Gestion des categories (produits, clients, fournisseurs...)";
52 
53  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
54  $this->version = 'dolibarr';
55 
56  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
57  $this->picto = 'category';
58 
59  // Data directories to create when module is enabled
60  $this->dirs = array();
61 
62  // Dependencies
63  $this->depends = array();
64 
65  // Config pages
66  $this->config_page_url = array('categorie.php@categories');
67  $this->langfiles = array("products","companies","categories","members");
68 
69  // Constants
70  $this->const = array();
71  $r=0;
72  $this->const[$r][0] = "CATEGORIE_RECURSIV_ADD";
73  $this->const[$r][1] = "yesno";
74  $this->const[$r][2] = "0";
75  $this->const[$r][3] = 'Affect parent categories';
76  $this->const[$r][4] = 0;
77  $r++;
78 
79  // Boxes
80  $this->boxes = array();
81 
82  // Permissions
83  $this->rights = array();
84  $this->rights_class = 'categorie';
85 
86  $r=0;
87 
88  $this->rights[$r][0] = 241; // id de la permission
89  $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
90  $this->rights[$r][2] = 'r'; // type de la permission (deprecated)
91  $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
92  $this->rights[$r][4] = 'lire';
93  $r++;
94 
95  $this->rights[$r][0] = 242; // id de la permission
96  $this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission
97  $this->rights[$r][2] = 'w'; // type de la permission (deprecated)
98  $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
99  $this->rights[$r][4] = 'creer';
100  $r++;
101 
102  $this->rights[$r][0] = 243; // id de la permission
103  $this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission
104  $this->rights[$r][2] = 'd'; // type de la permission (deprecated)
105  $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
106  $this->rights[$r][4] = 'supprimer';
107  $r++;
108 
109 
110  // Menus
111  //-------
112  $this->menu = 1; // This module add menu entries. They are coded into menu manager.
113 
114 
115  // Exports
116  //--------
117  $r=0;
118 
119  $r++;
120  $this->export_code[$r]='category_'.$r;
121  $this->export_label[$r]='CatSupList';
122  $this->export_icon[$r]='category';
123  $this->export_enabled[$r]='$conf->fournisseur->enabled';
124  $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire"));
125  $this->export_fields_array[$r]=array(
126  'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",
127  's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",
128  's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",
129  's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",
130  's.note_public'=>"NotePublic"
131  );
132  $this->export_TypeFields_array[$r]=array(
133  'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",
134  's.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",
135  's.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",
136  's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text"
137  );
138  $this->export_entities_array[$r]=array(
139  's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",
140  's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",
141  's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",
142  's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company"
143  ); // We define here only fields that use another picto
144  $this->export_sql_start[$r]='SELECT DISTINCT ';
145  $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, ';
146  $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, ';
147  $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code';
148  $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
149  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
150  $this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories
151 
152  $r++;
153  $this->export_code[$r]='category_'.$r;
154  $this->export_label[$r]='CatCusList';
155  $this->export_icon[$r]='category';
156  $this->export_enabled[$r]='$conf->societe->enabled';
157  $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire"));
158  $this->export_fields_array[$r]=array(
159  'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",
160  's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",
161  's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",
162  's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",
163  's.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus'
164  );
165  $this->export_TypeFields_array[$r]=array(
166  'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",
167  's.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",
168  'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",
169  's.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code',
170  's.fk_stcomm'=>'List:c_stcomm:libelle:code'
171  );
172  $this->export_entities_array[$r]=array(
173  's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",
174  's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",
175  's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",
176  's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company',
177  's.fk_stcomm'=>'company'
178  ); // We define here only fields that use another picto
179  $this->export_sql_start[$r]='SELECT DISTINCT ';
180  $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, ';
181  $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, ';
182  $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object ';
183  $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
184  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
185  $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories
186 
187  // Add extra fields
188  $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
189  $resql=$this->db->query($sql);
190  if ($resql) // This can fail when class is used on old database (during migration for example)
191  {
192  while ($obj=$this->db->fetch_object($resql))
193  {
194  $fieldname='extra.'.$obj->name;
195  $fieldlabel=ucfirst($obj->label);
196  $typeFilter="Text";
197  switch($obj->type)
198  {
199  case 'int':
200  case 'double':
201  case 'price':
202  $typeFilter="Numeric";
203  break;
204  case 'date':
205  case 'datetime':
206  $typeFilter="Date";
207  break;
208  case 'boolean':
209  $typeFilter="Boolean";
210  break;
211  case 'sellist':
212  $typeFilter="List:".$obj->param;
213  break;
214  case 'select':
215  $typeFilter="Select:".$obj->param;
216  break;
217  }
218  $this->export_fields_array[$r][$fieldname]=$fieldlabel;
219  $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
220  $this->export_entities_array[$r][$fieldname]='company';
221  }
222  }
223  // End add axtra fields
224 
225 
226 
227 
228 
229  $r++;
230  $this->export_code[$r]='category_'.$r;
231  $this->export_label[$r]='CatProdList';
232  $this->export_icon[$r]='category';
233  $this->export_enabled[$r]='$conf->produit->enabled';
234  $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire"));
235  $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref');
236  $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text');
237  $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto
238  $this->export_sql_start[$r]='SELECT DISTINCT ';
239  $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p';
240  $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid';
241  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
242  $this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories
243 
244  $r++;
245  $this->export_code[$r]='category_'.$r;
246  $this->export_label[$r]='CatMemberList';
247  $this->export_icon[$r]='category';
248  $this->export_enabled[$r]='$conf->adherent->enabled';
249  $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
250  $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname');
251  $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text');
252  $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto
253  $this->export_sql_start[$r]='SELECT DISTINCT ';
254  $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
255  $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid';
256  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
257  $this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories
258 
259  $r++;
260  $this->export_code[$r]='category_'.$r;
261  $this->export_label[$r]='CatContactList';
262  $this->export_icon[$r]='category';
263  $this->export_enabled[$r]='$conf->societe->enabled';
264  $this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire"));
265  $this->export_fields_array[$r]=array (
266  'u.rowid' => "CategId",
267  'u.label' => "Label",
268  'u.description' => "Description",
269  'p.rowid' => 'ContactId',
270  'p.civility' => 'UserTitle',
271  'p.lastname' => 'LastName',
272  'p.firstname' => 'Firstname',
273  'p.address' => 'Address',
274  'p.zip' => 'Zip',
275  'p.town' => 'Town',
276  'country.code' => 'CountryCode',
277  'country.label' => 'Country',
278  'p.birthday' => 'DateToBirth',
279  'p.poste' => 'PostOrFunction',
280  'p.phone' => 'Phone',
281  'p.phone_perso' => 'PhonePerso',
282  'p.phone_mobile' => 'PhoneMobile',
283  'p.fax' => 'Fax',
284  'p.email' => 'Email',
285  'p.note_private' => 'NotePrivate',
286  'p.note_public' => 'NotePublic',
287  's.nom'=>"Name",
288  's.client'=>"Customer",
289  's.fournisseur'=>"Supplier",
290  's.status'=>"Status",
291  's.address'=>"Address",
292  's.zip'=>"Zip",
293  's.town'=>"Town",
294  's.phone'=>"Phone",
295  's.fax'=>"Fax",
296  's.url'=>"Url",
297  's.email'=>"Email"
298  );
299  $this->export_TypeFields_array[$r] = array (
300  'u.label' => "Text",
301  'u.description' => "Text",
302  'p.lastname' => 'Text',
303  'p.firstname' => 'Text',
304  's.nom'=>"Text",
305  's.status'=>"Text",
306  's.address'=>"Text",
307  's.zip'=>"Text",
308  's.town'=>"Text",
309  's.phone'=>"Text",
310  's.fax'=>"Text",
311  's.url'=>"Text",
312  's.email'=>"Text"
313  );
314  $this->export_entities_array[$r] = array (
315  'u.rowid' => "category",
316  'u.label' => "category",
317  'u.description' => "category",
318  'p.rowid' => 'contact',
319  'p.civility' => 'contact',
320  'p.lastname' => 'contact',
321  'p.firstname' => 'contact',
322  'p.address' => 'contact',
323  'p.zip' => 'contact',
324  'p.town' => 'contact',
325  'country.code' => 'contact',
326  'country.label' => 'contact',
327  'p.birthday' => 'contact',
328  'p.poste' => 'contact',
329  'p.phone' => 'contact',
330  'p.phone_perso' => 'contact',
331  'p.phone_mobile' => 'contact',
332  'p.fax' => 'contact',
333  'p.email' => 'contact',
334  'p.note_private' => 'contact',
335  'p.note_public' => 'contact',
336  's.nom'=>"company",
337  's.client'=>"company",
338  's.fournisseur'=>"company",
339  's.status'=>"company",
340  's.address'=>"company",
341  's.zip'=>"company",
342  's.town'=>"company",
343  's.phone'=>"company",
344  's.fax'=>"company",
345  's.url'=>"company",
346  's.email'=>"company"
347  ); // We define here only fields that use another picto
348 
349  // Add extra fields
350  $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
351  $resql=$this->db->query($sql);
352  if ($resql) // This can fail when class is used on old database (during migration for example)
353  {
354  while ($obj=$this->db->fetch_object($resql))
355  {
356  $fieldname='extra.'.$obj->name;
357  $fieldlabel=ucfirst($obj->label);
358  $typeFilter="Text";
359  switch($obj->type)
360  {
361  case 'int':
362  case 'double':
363  case 'price':
364  $typeFilter="Numeric";
365  break;
366  case 'date':
367  case 'datetime':
368  $typeFilter="Date";
369  break;
370  case 'boolean':
371  $typeFilter="Boolean";
372  break;
373  case 'sellist':
374  $typeFilter="List:".$obj->param;
375  break;
376  case 'select':
377  $typeFilter="Select:".$obj->param;
378  break;
379  }
380  $this->export_fields_array[$r][$fieldname]=$fieldlabel;
381  $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
382  $this->export_entities_array[$r][$fieldname]='contact';
383  }
384  }
385  // End add axtra fields
386 
387  $this->export_sql_start[$r] = 'SELECT DISTINCT ';
388  $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
389  $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
390  $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
391  $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
392  $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')';
393  $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories
394 
395  // Imports
396  //--------
397 
398  $r=0;
399 
400  $r++;
401  $this->import_code[$r]=$this->rights_class.'_'.$r;
402  $this->import_label[$r]="CatList"; // Translation key
403  $this->import_icon[$r]=$this->picto;
404  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
405  $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie');
406  $this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description");
407 
408  $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]');
409  $typeexample="";
410  if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; }
411  if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; }
412  if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; }
413  if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; }
414  $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category");
415 
416  if (! empty($conf->product->enabled))
417  {
418  //Products
419  $r++;
420  $this->import_code[$r]=$this->rights_class.'_'.$r;
421  $this->import_label[$r]="CatProdLinks"; // Translation key
422  $this->import_icon[$r]=$this->picto;
423  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
424  $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product');
425  $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*"
426  );
427 
428  $this->import_convertvalue_array[$r]=array(
429  'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
430  'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product')
431  );
432  $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456");
433  }
434 
435  if (! empty($conf->societe->enabled))
436  {
437  //Customers
438  $r++;
439  $this->import_code[$r]=$this->rights_class.'_'.$r;
440  $this->import_label[$r]="CatCusLinks"; // Translation key
441  $this->import_icon[$r]=$this->picto;
442  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
443  $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
444  $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*"
445  );
446 
447  $this->import_convertvalue_array[$r]=array(
448  'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
449  'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
450  );
451  $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
452  }
453 
454  if (! empty($conf->fournisseur->enabled))
455  {
456  // Suppliers
457  $r++;
458  $this->import_code[$r]=$this->rights_class.'_'.$r;
459  $this->import_label[$r]="CatSupLinks"; // Translation key
460  $this->import_icon[$r]=$this->picto;
461  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
462  $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
463  $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*"
464  );
465 
466  $this->import_convertvalue_array[$r]=array(
467  'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
468  'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
469  );
470  $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
471  }
472  }
473 
474 
483  function init($options='')
484  {
485  // Permissions
486  $this->remove($options);
487 
488  $sql = array();
489 
490  return $this->_init($sql,$options);
491  }
492 }
Class DolibarrModules.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
</td >< td class="liste_titre" align="right"></td ></tr >< tr class="liste_titre">< input type="checkbox" onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< tr class="oddeven">< td >< input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td >< td >< input type="checkbox" class="check" name="choose'.$i.'"></td >< td class="nowrap"></td >< td >< input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:573
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
init($options='')
Function called when module is enabled.
Class to describe and enable module Categorie.
__construct($db)
Constructor.
_init($array_sql, $options='')
Enables a module.