diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index f4e9b0d7356..55d4d45d28e 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -68,7 +68,7 @@ class modUser extends DolibarrModules // Dependancies $this->depends = array(); $this->requiredby = array(); - $this->langfiles = array("main","users","companies","members"); + $this->langfiles = array("main","users","companies","members",'salaries'); // Constants $this->const = array(); @@ -230,6 +230,43 @@ class modUser extends DolibarrModules $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; $this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user',1).')'; + + // Imports + //-------- + $r=0; + + // Import list of users attributes + $r++; + $this->import_code[$r]=$this->rights_class.'_'.$r; + $this->import_label[$r]='ImportDataset_user_1'; + $this->import_icon[$r]='user'; + $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r]=array('u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"Job",'u.gender'=>"Gender",'u.login'=>"Login*",'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature','u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM','u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation"); + // Add extra fields + $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity = ".$conf->entity; + $resql=$this->db->query($sql); + if ($resql) // This can fail when class is used on old database (during migration for example) + { + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='extra.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); + } + } + // End add extra fields + $this->import_fieldshidden_array[$r]=array('u.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_convertvalue_array[$r]=array( + 'u.fk_state'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'), + 'u.fk_country'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'), + 'u.salary'=>array('rule'=>'numeric') + ); + //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); + $this->import_regex_array[$r]=array('u.employee'=>'^[0|1]','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])?$'); + $this->import_examplevalues_array[$r]=array('u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",'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",'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",'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"); + $this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login'); + } diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index a23d14a979d..1245041d98a 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -77,18 +77,27 @@ $(document).ready(function () { + + +
+'; +echo dol_escape_htmltag($title); +if ($disablenofollow) echo ''; +?> +
+ + +
- -
-
"> @@ -146,10 +155,10 @@ if (! empty($hookmanager->resArray['options'])) {
-
+
+
-
@@ -209,19 +218,9 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file ?> -
+ - - - - -
-'; -echo dol_escape_htmltag($title); -if ($disablenofollow) echo ''; -?> -
+ diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 8a403d675d7..bdc38b08873 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -52,18 +52,25 @@ $(document).ready(function () { + +
+'; +echo dol_escape_htmltag($title); +if ($disablenofollow) echo ''; +?> +
+ +
- -
-
@@ -114,13 +121,11 @@ if (! empty($hookmanager->resArray['options'])) {
-
+
+
- - -
@@ -143,15 +148,6 @@ if (! empty($hookmanager->resArray['options'])) {
- -
-'; -echo dol_escape_htmltag($title); -if ($disablenofollow) echo ''; -?> -
- diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 3916770de8a..82ecad62417 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -340,7 +340,7 @@ if ($step == 1 || ! $datatoimport) $head = import_prepare_head($param, 1); - dol_fiche_head($head, 'step1', $langs->trans("NewImport")); + dol_fiche_head($head, 'step1', $langs->trans("NewImport"), -1); print $langs->trans("SelectImportDataSet").'
'; @@ -403,8 +403,10 @@ if ($step == 2 && $datatoimport) $head = import_prepare_head($param,2); - dol_fiche_head($head, 'step2', $langs->trans("NewImport")); + dol_fiche_head($head, 'step2', $langs->trans("NewImport"), -1); + print '
'; + print '
'; print ''; @@ -426,6 +428,8 @@ if ($step == 2 && $datatoimport) print '
'; + print '

'; + dol_fiche_end(); @@ -478,7 +482,7 @@ if ($step == 3 && $datatoimport) $head = import_prepare_head($param, 3); - dol_fiche_head($head, 'step3', $langs->trans("NewImport")); + dol_fiche_head($head, 'step3', $langs->trans("NewImport"), -1); /* * Confirm delete file @@ -489,6 +493,9 @@ if ($step == 3 && $datatoimport) } + print '
'; + print '
'; + print ''; // Module @@ -508,10 +515,14 @@ if ($step == 3 && $datatoimport) print ''; print '
'; + print '
'; print '
'; - print ''.$langs->trans("InformationOnSourceFile").'
'; + print ''.$langs->trans("InformationOnSourceFile").''; + + print '
'; + print '
'; print ''; //print ''; @@ -525,6 +536,7 @@ if ($step == 3 && $datatoimport) print ''; print '
'.$langs->trans("InformationOnSourceFile").'
'; + print '
'; dol_fiche_end(); @@ -735,7 +747,10 @@ if ($step == 4 && $datatoimport) $head = import_prepare_head($param,4); - dol_fiche_head($head, 'step4', $langs->trans("NewImport")); + dol_fiche_head($head, 'step4', $langs->trans("NewImport"), -1); + + print '
'; + print '
'; print ''; @@ -756,10 +771,13 @@ if ($step == 4 && $datatoimport) print ''; print '
'; - + print '
'; + print '
'; - print ''.$langs->trans("InformationOnSourceFile").'
'; + print ''.$langs->trans("InformationOnSourceFile").''; + print '
'; + print '
'; print ''; //print ''; @@ -801,6 +819,7 @@ if ($step == 4 && $datatoimport) print ''; print '
'.$langs->trans("InformationOnSourceFile").'
'; + print '
'; dol_fiche_end(); @@ -1204,8 +1223,10 @@ if ($step == 5 && $datatoimport) print ''; // step 5 print ''; // step 5 - dol_fiche_head($head, 'step5', $langs->trans("NewImport")); + dol_fiche_head($head, 'step5', $langs->trans("NewImport"), -1); + print '
'; + print '
'; print ''; @@ -1226,10 +1247,13 @@ if ($step == 5 && $datatoimport) print ''; print '
'; - + print '
'; + print '
'; - print ''.$langs->trans("InformationOnSourceFile").'
'; + print ''.$langs->trans("InformationOnSourceFile").''; + print '
'; + print '
'; print ''; //print ''; @@ -1276,7 +1300,6 @@ if ($step == 5 && $datatoimport) { print ''; print ''; - print '   '.$langs->trans("Modify").''; } else { @@ -1288,20 +1311,27 @@ if ($step == 5 && $datatoimport) { print ''; print ''; - print '   '.$langs->trans("Modify").''; } else { print ''; print $form->textwithpicto("", $langs->trans("KeepEmptyToGoToEndOfFile")); } + if ($action == 'launchsimu') print '   '.$langs->trans("Modify").''; print ''; print ''; print '
'.$langs->trans("InformationOnSourceFile").'
'; print $langs->trans("KeysToUseForUpdates"); print ''; if($action=='launchsimu') { - print $form->multiselectarray('updatekeysbis', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '', 'disabled'); + if (count($updatekeys)) + { + print $form->multiselectarray('updatekeysbis', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '', 'disabled'); + } + else + { + print ''.$langs->trans("NoUpdateAttempt").'   -'; + } foreach($updatekeys as $val) { print ''; } @@ -1323,15 +1353,19 @@ if ($step == 5 && $datatoimport) print '
'; - + print '
'; + print '
'; - print ''.$langs->trans("InformationOnTargetTables").'
'; + print ''.$langs->trans("InformationOnTargetTables").''; + print '
'; + print '
'; + print ''; //print ''; // Tables imported - print ''; print '
'.$langs->trans("InformationOnTargetTables").'
'; + print '
'; print $langs->trans("TablesTarget"); print ''; $listtables=array(); @@ -1391,7 +1425,8 @@ if ($step == 5 && $datatoimport) print '
'; - + print '
'; + dol_fiche_end(); diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 91a0c36aaeb..e73c0df2add 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -59,8 +59,9 @@ ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_creat integer; ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_modif integer; ALTER TABLE llx_product_price_by_qty DROP COLUMN date_price; ALTER TABLE llx_product_price_by_qty ADD COLUMN tms timestamp; -ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key integer; +ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key varchar(14); +ALTER TABLE llx_user ADD COLUMN import_key varchar(14); CREATE TABLE llx_product_attribute diff --git a/htdocs/install/mysql/tables/llx_product_price_by_qty.sql b/htdocs/install/mysql/tables/llx_product_price_by_qty.sql index 8543f1720b2..2b91647b80a 100644 --- a/htdocs/install/mysql/tables/llx_product_price_by_qty.sql +++ b/htdocs/install/mysql/tables/llx_product_price_by_qty.sql @@ -31,5 +31,5 @@ create table llx_product_price_by_qty fk_user_creat integer, fk_user_modif integer, tms timestamp, - import_key integer + import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index e711c1e9ad9..d033ba5eca4 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -83,5 +83,7 @@ create table llx_user salary double(24,8), -- denormalized value coming from llx_user_employment salaryextra double(24,8), -- denormalized value coming from llx_user_employment dateemployment date, -- denormalized value coming from llx_user_employment - weeklyhours double(16,8) -- denormalized value coming from llx_user_employment + weeklyhours double(16,8), -- denormalized value coming from llx_user_employment + + import_key varchar(14) -- import key )ENGINE=innodb; diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 139b3e463b8..a2e208673bd 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -117,7 +117,9 @@ ImportFromToLine=Import line numbers (from - to) SetThisValueTo2ToExcludeFirstLine=For example, set this value to 3 to exclude the 2 first lines KeepEmptyToGoToEndOfFile=Keep this field empty to go up to the end of file SelectPrimaryColumnsForUpdateAttempt=Select column(s) to use as primary key for update attempt -UpdateNotYetSupportedForThisImport=Update is not supported for this type of import (only insert) +UpdateNotYetSupportedForThisImport=Update is not supported for this type of import (only insert) +NoUpdateAttempt=No update attempt was performed, only insert +ImportDataset_user_1=Users (employees or not) and properties ## filters SelectFilterFields=If you want to filter on some values, just input values here. FilteredFields=Filtered fields diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9fe43395c5e..971a4d2ed40 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1526,6 +1526,7 @@ foreach($mainmenuusedarray as $val) } .login_vertical_align { padding: 10px; + padding-bottom: 80px; } form#login { padding-bottom: 30px; @@ -1535,7 +1536,7 @@ form#login { .login_table_title { max-width: 530px; color: #aaa !important; - padding-top: 30px; + padding-bottom: 20px; /* text-shadow: 1px 1px 1px #FFF; */ } .login_table label { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 852b729bba9..27c4713742a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1562,6 +1562,7 @@ foreach($mainmenuusedarray as $val) } .login_vertical_align { padding: 10px; + padding-bottom: 80px; } form#login { padding-bottom: 30px; @@ -1571,7 +1572,7 @@ form#login { .login_table_title { max-width: 530px; color: #aaa !important; - padding-top: 30px; + padding-bottom: 20px; /* text-shadow: 1px 1px 1px #FFF; */ } .login_table label {