diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php
index 355f5ae44fd..2eddf30ab90 100644
--- a/htdocs/admin/ihm.php
+++ b/htdocs/admin/ihm.php
@@ -309,8 +309,8 @@ if ($action == 'edit') // Edit
// Firstname/Name
print '
| '.$langs->trans("FirstnameNamePosition").' | ';
- $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"),1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
- print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION',$array,(isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
+ $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
+ print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
print ' | ';
print ' | ';
print '
';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 1785e3ae810..6fe2dffd3d3 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1572,9 +1572,12 @@ class Form
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0";
if (! empty($morefilter)) $sql.=" ".$morefilter;
- if(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)){
+ if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
+ {
$sql.= " ORDER BY u.firstname ASC";
- }else{
+ }
+ else
+ {
$sql.= " ORDER BY u.lastname ASC";
}
@@ -1621,9 +1624,11 @@ class Form
$out.= '>';
}
- $fullNameMode = 0; //Lastname + firstname
- if(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)){
- $fullNameMode = 1; //firstname + lastname
+ // $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0)
+ $fullNameMode = 0;
+ if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION))
+ {
+ $fullNameMode = 1; //Firstname+lastname
}
$out.= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql
index f67839073f0..81df41d55e0 100644
--- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql
+++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql
@@ -29,7 +29,11 @@
-- Missing in 8.0 ?
+ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accounting_account_fk_pcg_version;
ALTER TABLE llx_accounting_account MODIFY COLUMN fk_pcg_version varchar(32) NOT NULL;
+ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32) NOT NULL;
+ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version);
+
ALTER TABLE llx_accounting_account MODIFY COLUMN account_number varchar(32) NOT NULL;
-- For 9.0
diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php
index a2f4f64aba5..7f3455ce37a 100644
--- a/test/phpunit/AdherentTest.php
+++ b/test/phpunit/AdherentTest.php
@@ -317,7 +317,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
- $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 1; // Force setup for firstname then lastname
+ $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname
$template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'.
'__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__';