dolibarr  7.0.0-beta
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->special = 0;
58  $this->picto = 'category';
59 
60  // Data directories to create when module is enabled
61  $this->dirs = array();
62 
63  // Dependencies
64  $this->depends = array();
65 
66  // Config pages
67  $this->config_page_url = array('categorie.php@categories');
68  $this->langfiles = array("products","companies","categories","members");
69 
70  // Constants
71  $this->const = array();
72  $r=0;
73  $this->const[$r][0] = "CATEGORIE_RECURSIV_ADD";
74  $this->const[$r][1] = "yesno";
75  $this->const[$r][2] = "0";
76  $this->const[$r][3] = 'Affect parent categories';
77  $this->const[$r][4] = 0;
78  $r++;
79 
80  // Boxes
81  $this->boxes = array();
82 
83  // Permissions
84  $this->rights = array();
85  $this->rights_class = 'categorie';
86 
87  $r=0;
88 
89  $this->rights[$r][0] = 241; // id de la permission
90  $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
91  $this->rights[$r][2] = 'r'; // type de la permission (deprecated)
92  $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
93  $this->rights[$r][4] = 'lire';
94  $r++;
95 
96  $this->rights[$r][0] = 242; // id de la permission
97  $this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission
98  $this->rights[$r][2] = 'w'; // type de la permission (deprecated)
99  $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
100  $this->rights[$r][4] = 'creer';
101  $r++;
102 
103  $this->rights[$r][0] = 243; // id de la permission
104  $this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission
105  $this->rights[$r][2] = 'd'; // type de la permission (deprecated)
106  $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
107  $this->rights[$r][4] = 'supprimer';
108  $r++;
109 
110 
111  // Menus
112  //-------
113  $this->menu = 1; // This module add menu entries. They are coded into menu manager.
114 
115 
116  // Exports
117  //--------
118  $r=0;
119 
120  $r++;
121  $this->export_code[$r]='category_'.$r;
122  $this->export_label[$r]='CatSupList';
123  $this->export_icon[$r]='category';
124  $this->export_enabled[$r]='$conf->fournisseur->enabled';
125  $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire"));
126  $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_public'=>"NotePublic");
127  $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'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",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text");
128  $this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",'s.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company"); // We define here only fields that use another picto
129  $this->export_sql_start[$r]='SELECT DISTINCT ';
130  $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_fournisseur as cf, '.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';
131  $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
132  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
133  $this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories
134 
135  $r++;
136  $this->export_code[$r]='category_'.$r;
137  $this->export_label[$r]='CatCusList';
138  $this->export_icon[$r]='category';
139  $this->export_enabled[$r]='$conf->societe->enabled';
140  $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire"));
141  $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus');
142  $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'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",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code');
143  $this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",'s.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company'); // 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, '.MAIN_DB_PREFIX.'categorie_societe as cf, '.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 ';
146  $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
147  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
148  $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories
149 
150  // Add extra fields
151  $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
152  $resql=$this->db->query($sql);
153  if ($resql) // This can fail when class is used on old database (during migration for example)
154  {
155  while ($obj=$this->db->fetch_object($resql))
156  {
157  $fieldname='extra.'.$obj->name;
158  $fieldlabel=ucfirst($obj->label);
159  $typeFilter="Text";
160  switch($obj->type)
161  {
162  case 'int':
163  case 'double':
164  case 'price':
165  $typeFilter="Numeric";
166  break;
167  case 'date':
168  case 'datetime':
169  $typeFilter="Date";
170  break;
171  case 'boolean':
172  $typeFilter="Boolean";
173  break;
174  case 'sellist':
175  $typeFilter="List:".$obj->param;
176  break;
177  case 'select':
178  $typeFilter="Select:".$obj->param;
179  break;
180  }
181  $this->export_fields_array[$r][$fieldname]=$fieldlabel;
182  $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
183  $this->export_entities_array[$r][$fieldname]='company';
184  }
185  }
186  // End add axtra fields
187 
188 
189 
190 
191 
192  $r++;
193  $this->export_code[$r]='category_'.$r;
194  $this->export_label[$r]='CatProdList';
195  $this->export_icon[$r]='category';
196  $this->export_enabled[$r]='$conf->produit->enabled';
197  $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire"));
198  $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref');
199  $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text');
200  $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto
201  $this->export_sql_start[$r]='SELECT DISTINCT ';
202  $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';
203  $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid';
204  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
205  $this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories
206 
207  $r++;
208  $this->export_code[$r]='category_'.$r;
209  $this->export_label[$r]='CatMemberList';
210  $this->export_icon[$r]='category';
211  $this->export_enabled[$r]='$conf->adherent->enabled';
212  $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
213  $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname');
214  $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text');
215  $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto
216  $this->export_sql_start[$r]='SELECT DISTINCT ';
217  $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';
218  $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid';
219  $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
220  $this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories
221 
222  $r++;
223  $this->export_code[$r]='category_'.$r;
224  $this->export_label[$r]='CatContactList';
225  $this->export_icon[$r]='category';
226  $this->export_enabled[$r]='$conf->societe->enabled';
227  $this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire"));
228  $this->export_fields_array[$r]=array (
229  'u.rowid' => "CategId",
230  'u.label' => "Label",
231  'u.description' => "Description",
232  'p.rowid' => 'ContactId',
233  'p.civility' => 'UserTitle',
234  'p.lastname' => 'LastName',
235  'p.firstname' => 'Firstname',
236  'p.address' => 'Address',
237  'p.zip' => 'Zip',
238  'p.town' => 'Town',
239  'country.code' => 'CountryCode',
240  'country.label' => 'Country',
241  'p.birthday' => 'DateToBirth',
242  'p.poste' => 'PostOrFunction',
243  'p.phone' => 'Phone',
244  'p.phone_perso' => 'PhonePerso',
245  'p.phone_mobile' => 'PhoneMobile',
246  'p.fax' => 'Fax',
247  'p.email' => 'Email',
248  'p.note_private' => 'NotePrivate',
249  'p.note_public' => 'NotePublic',
250  's.nom'=>"Name",
251  's.client'=>"Customer",
252  's.fournisseur'=>"Supplier",
253  's.status'=>"Status",
254  's.address'=>"Address",
255  's.zip'=>"Zip",
256  's.town'=>"Town",
257  's.phone'=>"Phone",
258  's.fax'=>"Fax",
259  's.url'=>"Url",
260  's.email'=>"Email"
261  );
262  $this->export_TypeFields_array[$r] = array (
263  'u.label' => "Text",
264  'u.description' => "Text",
265  'p.lastname' => 'Text',
266  'p.firstname' => 'Text',
267  's.nom'=>"Text",
268  's.status'=>"Text",
269  's.address'=>"Text",
270  's.zip'=>"Text",
271  's.town'=>"Text",
272  's.phone'=>"Text",
273  's.fax'=>"Text",
274  's.url'=>"Text",
275  's.email'=>"Text"
276  );
277  $this->export_entities_array[$r] = array (
278  'u.rowid' => "category",
279  'u.label' => "category",
280  'u.description' => "category",
281  'p.rowid' => 'contact',
282  'p.civility' => 'contact',
283  'p.lastname' => 'contact',
284  'p.firstname' => 'contact',
285  'p.address' => 'contact',
286  'p.zip' => 'contact',
287  'p.town' => 'contact',
288  'country.code' => 'contact',
289  'country.label' => 'contact',
290  'p.birthday' => 'contact',
291  'p.poste' => 'contact',
292  'p.phone' => 'contact',
293  'p.phone_perso' => 'contact',
294  'p.phone_mobile' => 'contact',
295  'p.fax' => 'contact',
296  'p.email' => 'contact',
297  'p.note_private' => 'contact',
298  'p.note_public' => 'contact',
299  's.nom'=>"company",
300  's.client'=>"company",
301  's.fournisseur'=>"company",
302  's.status'=>"company",
303  's.address'=>"company",
304  's.zip'=>"company",
305  's.town'=>"company",
306  's.phone'=>"company",
307  's.fax'=>"company",
308  's.url'=>"company",
309  's.email'=>"company"
310  ); // We define here only fields that use another picto
311 
312  // Add extra fields
313  $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
314  $resql=$this->db->query($sql);
315  if ($resql) // This can fail when class is used on old database (during migration for example)
316  {
317  while ($obj=$this->db->fetch_object($resql))
318  {
319  $fieldname='extra.'.$obj->name;
320  $fieldlabel=ucfirst($obj->label);
321  $typeFilter="Text";
322  switch($obj->type)
323  {
324  case 'int':
325  case 'double':
326  case 'price':
327  $typeFilter="Numeric";
328  break;
329  case 'date':
330  case 'datetime':
331  $typeFilter="Date";
332  break;
333  case 'boolean':
334  $typeFilter="Boolean";
335  break;
336  case 'sellist':
337  $typeFilter="List:".$obj->param;
338  break;
339  case 'select':
340  $typeFilter="Select:".$obj->param;
341  break;
342  }
343  $this->export_fields_array[$r][$fieldname]=$fieldlabel;
344  $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
345  $this->export_entities_array[$r][$fieldname]='contact';
346  }
347  }
348  // End add axtra fields
349 
350  $this->export_sql_start[$r] = 'SELECT DISTINCT ';
351  $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';
352  $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
353  $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
354  $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
355  $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')';
356  $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories
357 
358  // Imports
359  //--------
360 
361  $r=0;
362 
363  $r++;
364  $this->import_code[$r]=$this->rights_class.'_'.$r;
365  $this->import_label[$r]="CatList"; // Translation key
366  $this->import_icon[$r]=$this->picto;
367  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
368  $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie');
369  $this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description");
370 
371  $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]');
372  $typeexample="";
373  if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; }
374  if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; }
375  if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; }
376  if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; }
377  $this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category");
378 
379  if (! empty($conf->product->enabled))
380  {
381  //Products
382  $r++;
383  $this->import_code[$r]=$this->rights_class.'_'.$r;
384  $this->import_label[$r]="CatProdLinks"; // Translation key
385  $this->import_icon[$r]=$this->picto;
386  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
387  $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product');
388  $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*"
389  );
390 
391  $this->import_convertvalue_array[$r]=array(
392  'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
393  'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product')
394  );
395  $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456");
396  }
397 
398  if (! empty($conf->societe->enabled))
399  {
400  //Customers
401  $r++;
402  $this->import_code[$r]=$this->rights_class.'_'.$r;
403  $this->import_label[$r]="CatCusLinks"; // Translation key
404  $this->import_icon[$r]=$this->picto;
405  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
406  $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
407  $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*"
408  );
409 
410  $this->import_convertvalue_array[$r]=array(
411  'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
412  'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
413  );
414  $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
415  }
416 
417  if (! empty($conf->fournisseur->enabled))
418  {
419  // Suppliers
420  $r++;
421  $this->import_code[$r]=$this->rights_class.'_'.$r;
422  $this->import_label[$r]="CatSupLinks"; // Translation key
423  $this->import_icon[$r]=$this->picto;
424  $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
425  $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
426  $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*"
427  );
428 
429  $this->import_convertvalue_array[$r]=array(
430  'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
431  'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
432  );
433  $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
434  }
435  }
436 
437 
446  function init($options='')
447  {
448  // Permissions
449  $this->remove($options);
450 
451  $sql = array();
452 
453  return $this->_init($sql,$options);
454  }
455 }
Class DolibarrModules.
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="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< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:554
init($options='')
Function called when module is enabled.
Class to describe and enable module Categorie.
__construct($db)
Constructor.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
_init($array_sql, $options='')
Enables a module.
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:1013