28 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
49 $this->module_position =
'05';
51 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
52 $this->
description =
"Gestion des utilisateurs (requis)";
55 $this->version =
'dolibarr';
57 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
58 $this->picto =
'group';
61 $this->dirs = array(
"/users/temp");
64 $this->config_page_url = array(
"user.php");
67 $this->hidden =
false;
68 $this->depends = array();
69 $this->requiredby = array();
70 $this->conflictwith = array();
71 $this->phpmin = array(5, 4);
72 $this->langfiles = array(
"main",
"users",
"companies",
"members",
"salaries",
"hrm");
73 $this->always_enabled =
true;
76 $this->
const = array();
80 0=>array(
'file'=>
'box_lastlogin.php',
'enabledbydefaulton'=>
'Home'),
81 1=>array(
'file'=>
'box_birthdays.php',
'enabledbydefaulton'=>
'Home')
85 $this->rights = array();
86 $this->rights_class =
'user';
87 $this->rights_admin_allowed = 1;
91 $this->rights[$r][0] = 251;
92 $this->rights[$r][1] =
'Consulter les autres utilisateurs';
93 $this->rights[$r][2] =
'r';
94 $this->rights[$r][3] = 0;
95 $this->rights[$r][4] =
'user';
96 $this->rights[$r][5] =
'lire';
99 $this->rights[$r][0] = 252;
100 $this->rights[$r][1] =
'Consulter les permissions des autres utilisateurs';
101 $this->rights[$r][2] =
'r';
102 $this->rights[$r][3] = 0;
103 $this->rights[$r][4] =
'user_advance';
104 $this->rights[$r][5] =
'readperms';
107 $this->rights[$r][0] = 253;
108 $this->rights[$r][1] =
'Creer/modifier utilisateurs internes et externes';
109 $this->rights[$r][2] =
'w';
110 $this->rights[$r][3] = 0;
111 $this->rights[$r][4] =
'user';
112 $this->rights[$r][5] =
'creer';
115 $this->rights[$r][0] = 254;
116 $this->rights[$r][1] =
'Creer/modifier utilisateurs externes seulement';
117 $this->rights[$r][2] =
'w';
118 $this->rights[$r][3] = 0;
119 $this->rights[$r][4] =
'user_advance';
120 $this->rights[$r][5] =
'write';
123 $this->rights[$r][0] = 255;
124 $this->rights[$r][1] =
'Modifier le mot de passe des autres utilisateurs';
125 $this->rights[$r][2] =
'w';
126 $this->rights[$r][3] = 0;
127 $this->rights[$r][4] =
'user';
128 $this->rights[$r][5] =
'password';
131 $this->rights[$r][0] = 256;
132 $this->rights[$r][1] =
'Supprimer ou desactiver les autres utilisateurs';
133 $this->rights[$r][2] =
'd';
134 $this->rights[$r][3] = 0;
135 $this->rights[$r][4] =
'user';
136 $this->rights[$r][5] =
'supprimer';
139 $this->rights[$r][0] = 341;
140 $this->rights[$r][1] =
'Consulter ses propres permissions';
141 $this->rights[$r][2] =
'r';
142 $this->rights[$r][3] = 0;
143 $this->rights[$r][4] =
'self_advance';
144 $this->rights[$r][5] =
'readperms';
147 $this->rights[$r][0] = 342;
148 $this->rights[$r][1] =
'Creer/modifier ses propres infos utilisateur';
149 $this->rights[$r][2] =
'w';
150 $this->rights[$r][3] = 0;
151 $this->rights[$r][4] =
'self';
152 $this->rights[$r][5] =
'creer';
155 $this->rights[$r][0] = 343;
156 $this->rights[$r][1] =
'Modifier son propre mot de passe';
157 $this->rights[$r][2] =
'w';
158 $this->rights[$r][3] = 0;
159 $this->rights[$r][4] =
'self';
160 $this->rights[$r][5] =
'password';
163 $this->rights[$r][0] = 344;
164 $this->rights[$r][1] =
'Modifier ses propres permissions';
165 $this->rights[$r][2] =
'w';
166 $this->rights[$r][3] = 0;
167 $this->rights[$r][4] =
'self_advance';
168 $this->rights[$r][5] =
'writeperms';
171 $this->rights[$r][0] = 351;
172 $this->rights[$r][1] =
'Consulter les groupes';
173 $this->rights[$r][2] =
'r';
174 $this->rights[$r][3] = 0;
175 $this->rights[$r][4] =
'group_advance';
176 $this->rights[$r][5] =
'read';
179 $this->rights[$r][0] = 352;
180 $this->rights[$r][1] =
'Consulter les permissions des groupes';
181 $this->rights[$r][2] =
'r';
182 $this->rights[$r][3] = 0;
183 $this->rights[$r][4] =
'group_advance';
184 $this->rights[$r][5] =
'readperms';
187 $this->rights[$r][0] = 353;
188 $this->rights[$r][1] =
'Creer/modifier les groupes et leurs permissions';
189 $this->rights[$r][2] =
'w';
190 $this->rights[$r][3] = 0;
191 $this->rights[$r][4] =
'group_advance';
192 $this->rights[$r][5] =
'write';
195 $this->rights[$r][0] = 354;
196 $this->rights[$r][1] =
'Supprimer ou desactiver les groupes';
197 $this->rights[$r][2] =
'd';
198 $this->rights[$r][3] = 0;
199 $this->rights[$r][4] =
'group_advance';
200 $this->rights[$r][5] =
'delete';
203 $this->rights[$r][0] = 358;
204 $this->rights[$r][1] =
'Exporter les utilisateurs';
205 $this->rights[$r][2] =
'r';
206 $this->rights[$r][3] = 0;
207 $this->rights[$r][4] =
'user';
208 $this->rights[$r][5] =
'export';
219 $this->export_code[$r] = $this->rights_class.
'_'.$r;
220 $this->export_label[$r] =
'List of users and attributes';
221 $this->export_permission[$r] = array(array(
"user",
"user",
"export"));
222 $this->export_fields_array[$r] = array(
223 'u.rowid'=>
"Id",
'u.login'=>
"Login",
'u.lastname'=>
"Lastname",
'u.firstname'=>
"Firstname",
'u.employee'=>
"Employee",
'u.job'=>
"PostOrFunction",
'u.gender'=>
"Gender",
224 'u.accountancy_code'=>
"UserAccountancyCode",
225 'u.address'=>
"Address",
'u.zip'=>
"Zip",
'u.town'=>
"Town",
226 'u.office_phone'=>
'Phone',
'u.user_mobile'=>
"Mobile",
'u.office_fax'=>
'Fax',
227 'u.email'=>
"Email",
'u.note'=>
"Note",
'u.signature'=>
'Signature',
228 'u.fk_user'=>
'HierarchicalResponsible',
'u.thm'=>
'THM',
'u.tjm'=>
'TJM',
'u.weeklyhours'=>
'WeeklyHours',
229 'u.dateemployment'=>
'DateEmployment',
'u.salary'=>
'Salary',
'u.color'=>
'Color',
'u.api_key'=>
'ApiKey',
230 'u.birth'=>
'DateOfBirth',
231 'u.datec'=>
"DateCreation",
'u.tms'=>
"DateLastModification",
232 'u.admin'=>
"Administrator",
'u.statut'=>
'Status',
'u.datelastlogin'=>
'LastConnexion',
'u.datepreviouslogin'=>
'PreviousConnexion',
233 'u.fk_socpeople'=>
"IdContact",
'u.fk_soc'=>
"IdCompany",
'u.fk_member'=>
"MemberId"
235 $this->export_TypeFields_array[$r] = array(
236 'u.rowid'=>
'Numeric',
'u.login'=>
"Text",
'u.lastname'=>
"Text",
'u.firstname'=>
"Text",
'u.employee'=>
'Boolean',
'u.job'=>
'Text',
237 'u.accountancy_code'=>
'Text',
238 'u.address'=>
"Text",
'u.zip'=>
"Text",
'u.town'=>
"Text",
239 'u.office_phone'=>
'Text',
'u.user_mobile'=>
'Text',
'u.office_fax'=>
'Text',
240 'u.email'=>
'Text',
'u.datec'=>
"Date",
'u.tms'=>
"Date",
'u.admin'=>
"Boolean",
'u.statut'=>
'Status',
'u.note'=>
"Text",
'u.datelastlogin'=>
'Date',
241 'u.fk_user'=>
"List:user:login",
243 'u.datepreviouslogin'=>
'Date',
'u.fk_soc'=>
"List:societe:nom:rowid",
'u.fk_member'=>
"List:adherent:firstname"
245 $this->export_entities_array[$r] = array(
246 'u.rowid'=>
"user",
'u.login'=>
"user",
'u.lastname'=>
"user",
'u.firstname'=>
"user",
'u.employee'=>
'user',
'u.job'=>
'user',
'u.gender'=>
'user',
247 'u.accountancy_code'=>
'user',
248 'u.address'=>
"user",
'u.zip'=>
"user",
'u.town'=>
"user",
249 'u.office_phone'=>
'user',
'u.user_mobile'=>
'user',
'u.office_fax'=>
'user',
250 'u.email'=>
'user',
'u.note'=>
"user",
'u.signature'=>
'user',
251 'u.fk_user'=>
'user',
'u.thm'=>
'user',
'u.tjm'=>
'user',
'u.weeklyhours'=>
'user',
252 'u.dateemployment'=>
'user',
'u.salary'=>
'user',
'u.color'=>
'user',
'u.api_key'=>
'user',
254 'u.datec'=>
"user",
'u.tms'=>
"user",
255 'u.admin'=>
"user",
'u.statut'=>
'user',
'u.datelastlogin'=>
'user',
'u.datepreviouslogin'=>
'user',
256 'u.fk_socpeople'=>
"contact",
'u.fk_soc'=>
"company",
'u.fk_member'=>
"member"
258 $keyforselect =
'user'; $keyforelement =
'user'; $keyforaliasextra =
'extra';
259 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
260 if (empty($conf->adherent->enabled))
262 unset($this->export_fields_array[$r][
'u.fk_member']);
263 unset($this->export_entities_array[$r][
'u.fk_member']);
265 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
266 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'user as u';
267 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user_extrafields as extra ON u.rowid = extra.fk_object';
268 $this->export_sql_end[$r] .=
' WHERE u.entity IN ('.getEntity(
'user').
')';
275 $this->import_code[$r] = $this->rights_class.
'_'.$r;
276 $this->import_label[$r] =
'ImportDataset_user_1';
277 $this->import_icon[$r] =
'user';
278 $this->import_entities_array[$r] = array();
279 $this->import_tables_array[$r] = array(
'u'=>MAIN_DB_PREFIX.
'user',
'extra'=>MAIN_DB_PREFIX.
'user_extrafields');
280 $this->import_fields_array[$r] = array(
281 'u.login'=>
"Login*",
'u.lastname'=>
"Name*",
'u.firstname'=>
"Firstname",
'u.employee'=>
"Employee*",
'u.job'=>
"PostOrFunction",
'u.gender'=>
"Gender",
282 'u.accountancy_code'=>
"UserAccountancyCode",
283 'u.pass_crypted'=>
"Password",
'u.admin'=>
"Administrator",
'u.fk_soc'=>
"Company*",
'u.address'=>
"Address",
'u.zip'=>
"Zip",
'u.town'=>
"Town",
284 'u.fk_state'=>
"StateId",
'u.fk_country'=>
"CountryCode",
285 'u.office_phone'=>
"Phone",
'u.user_mobile'=>
"Mobile",
'u.office_fax'=>
"Fax",
286 'u.email'=>
"Email",
'u.note'=>
"Note",
'u.signature'=>
'Signature',
287 'u.fk_user'=>
'HierarchicalResponsible',
'u.thm'=>
'THM',
'u.tjm'=>
'TJM',
'u.weeklyhours'=>
'WeeklyHours',
288 'u.dateemployment'=>
'DateEmployment',
'u.salary'=>
'Salary',
'u.color'=>
'Color',
'u.api_key'=>
'ApiKey',
289 'u.birth'=>
'DateOfBirth',
290 'u.datec'=>
"DateCreation",
294 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.
")";
298 while ($obj = $this->
db->fetch_object(
$resql))
300 $fieldname =
'extra.'.$obj->name;
301 $fieldlabel = ucfirst($obj->label);
302 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
306 $this->import_fieldshidden_array[$r] = array(
'u.fk_user_creat'=>
'user->id',
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'user');
307 $this->import_convertvalue_array[$r] = array(
308 'u.fk_state'=>array(
'rule'=>
'fetchidfromcodeid',
'classfile'=>
'/core/class/cstate.class.php',
'class'=>
'Cstate',
'method'=>
'fetch',
'dict'=>
'DictionaryState'),
309 'u.fk_country'=>array(
'rule'=>
'fetchidfromcodeid',
'classfile'=>
'/core/class/ccountry.class.php',
'class'=>
'Ccountry',
'method'=>
'fetch',
'dict'=>
'DictionaryCountry'),
310 'u.salary'=>array(
'rule'=>
'numeric')
313 $this->import_regex_array[$r] = array(
314 'u.employee'=>
'^[0|1]',
315 'u.datec'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
316 'u.dateemployment'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
317 'u.birth'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
319 $this->import_examplevalues_array[$r] = array(
320 'u.lastname'=>
"Doe",
'u.firstname'=>
'John',
'u.login'=>
'jdoe',
'u.employee'=>
'0 or 1',
'u.job'=>
'CTO',
'u.gender'=>
'0 or 1',
321 'u.pass_crypted'=>
'Encrypted password',
322 'u.fk_soc'=>
'0 (internal user) or company name (external user)',
'u.datec'=>
dol_print_date(
dol_now(),
'%Y-%m-%d'),
'u.address'=>
"61 jump street",
323 'u.zip'=>
"123456",
'u.town'=>
"Big town",
'u.fk_country'=>
'US, FR, DE...',
'u.office_phone'=>
"0101010101",
'u.office_fax'=>
"0101010102",
324 'u.email'=>
"test@mycompany.com",
'u.salary'=>
"10000",
'u.note'=>
"This is an example of note for record",
'u.datec'=>
"2015-01-01 or 2015-01-01 12:30:00",
325 'u.statut'=>
"0 (closed) or 1 (active)",
327 $this->import_updatekeys_array[$r] = array(
'u.lastname'=>
'Lastname',
'u.firstname'=>
'Firstname',
'u.login'=>
'Login');
339 public function init($options =
'')
344 $this->
remove($options);
348 return $this->
_init($sql, $options);
init($options= '')
Function called when module is enabled.
</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.
dol_now($mode= 'auto')
Return date for now.
Class to describe and enable module User.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
__construct($db)
Constructor.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
_init($array_sql, $options= '')
Enables a module.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->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)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.