diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php
index 4b44bd35149..20fe5b86355 100644
--- a/htdocs/accountancy/admin/subaccount.php
+++ b/htdocs/accountancy/admin/subaccount.php
@@ -105,7 +105,7 @@ $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title);
// Customer
-$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '0' as type, sa.entity";
+$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta <> ''";
@@ -148,7 +148,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
// Supplier
$sql .= " UNION ";
-$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '1' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
+$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta_fournisseur <> ''";
//print $sql;
@@ -190,7 +190,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
// User
$sql .= " UNION ";
-$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '2' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
+$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.accountancy_code <> ''";
//print $sql;
@@ -287,7 +287,7 @@ if ($resql)
print '
';
if (!empty($arrayfields['subaccount']['checked'])) print ' | ';
if (!empty($arrayfields['label']['checked'])) print ' | ';
- if (!empty($arrayfields['type']['checked'])) print ''.$form->selectarray('search_type', array('0'=>$langs->trans('Customer'), '1'=>$langs->trans('Supplier'), '2'=>$langs->trans('Employee')), $search_type, 1).' | ';
+ if (!empty($arrayfields['type']['checked'])) print ''.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).' | ';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) print ' | '; }
print '';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@@ -335,17 +335,17 @@ if ($resql)
print ' | ';
$s = '';
// Customer
- if ($obj->type == 0)
+ if ($obj->type == 1)
{
$s .= ''.$langs->trans("Customer").'';
}
// Supplier
- elseif ($obj->type == 1)
+ elseif ($obj->type == 2)
{
$s .= ''.$langs->trans("Supplier").'';
}
// User
- elseif ($obj->type == 2)
+ elseif ($obj->type == 3)
{
$s .= ''.$langs->trans("Employee").'';
}
@@ -378,17 +378,17 @@ if ($resql)
print ' | ';
$e = '';
// Customer
- if ($obj->type == 0)
+ if ($obj->type == 1)
{
$e .= ''.img_edit().'';
}
// Supplier
- elseif ($obj->type == 1)
+ elseif ($obj->type == 2)
{
$e .= ''.img_edit().'';
}
// User
- elseif ($obj->type == 2)
+ elseif ($obj->type == 3)
{
$e .= ''.img_edit().'';
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index f932e739ad1..c41c61be536 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -79,9 +79,10 @@ class FormFile
* @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be)
* @param int $usewithoutform 0=Default, 1=Disable |