浏览代码

Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/accountancy/customer/index.php
	htdocs/accountancy/expensereport/index.php
	htdocs/compta/facture/class/facture-rec.class.php
	htdocs/fichinter/class/fichinter.class.php
	htdocs/societe/class/societe.class.php
	htdocs/societe/list.php
Laurent Destailleur 7 年之前
父节点
当前提交
a4665e17d4

+ 33 - 7
htdocs/accountancy/customer/index.php

@@ -207,8 +207,8 @@ for($i = 1; $i <= 12; $i ++) {
 }
 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
 
-$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
-$sql .= "  " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
+$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
+$sql .= "  " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
 for($i = 1; $i <= 12; $i ++) {
 	$sql .= "  SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
 }
@@ -234,8 +234,20 @@ if ($resql) {
 
 	while ( $row = $db->fetch_row($resql)) {
 
-		print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
-		print '<td align="left">' . $row[1] . '</td>';
+		print '<tr class="oddeven"><td>';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("Unknown");
+		}
+		else print length_accountg($row[0]);
+		print '</td>';
+		print '<td align="left">';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
+		}
+		else print $row[1];
+		print '</td>';
 		for($i = 2; $i <= 12; $i ++) {
 			print '<td align="right">' . price($row[$i]) . '</td>';
 		}
@@ -264,8 +276,8 @@ for($i = 1; $i <= 12; $i ++) {
 }
 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
 
-$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
-$sql .= "  " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
+$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
+$sql .= "  " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
 for($i = 1; $i <= 12; $i ++) {
 	$sql .= "  SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
 }
@@ -291,7 +303,20 @@ if ($resql) {
 
 	while ( $row = $db->fetch_row($resql)) {
 
-		print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
+		print '<tr class="oddeven"><td>';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("Unknown");
+		}
+		else print length_accountg($row[0]);
+		print '</td>';
+		print '<td align="left">';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
+		}
+		else print $row[1];
+		print '</td>';
 		print '<td align="left">' . $row[1] . '</td>';
 		for($i = 2; $i <= 12; $i ++) {
 			print '<td align="right">' . price($row[$i]) . '</td>';
@@ -360,6 +385,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
 	print "</table>\n";
 	print '</div>';
 
+
 	if (! empty($conf->margin->enabled)) {
 		print "<br>\n";
 		print '<div class="div-table-responsive-no-min">';

+ 34 - 10
htdocs/accountancy/expensereport/index.php

@@ -184,8 +184,8 @@ for($i = 1; $i <= 12; $i ++) {
 }
 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
 
-$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
-$sql .= "  " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
+$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
+$sql .= "  " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
 for($i = 1; $i <= 12; $i ++) {
     $sql .= "  SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
 }
@@ -207,9 +207,21 @@ if ($resql) {
 
     while ( $row = $db->fetch_row($resql)) {
 
-        print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
-        print '<td align="left">' . $row[1] . '</td>';
-        for($i = 2; $i <= 12; $i ++) {
+		print '<tr class="oddeven"><td>';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("Unknown");
+		}
+		else print length_accountg($row[0]);
+		print '</td>';
+		print '<td align="left">';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
+		}
+		else print $row[1];
+		print '</td>';
+    	for($i = 2; $i <= 12; $i ++) {
             print '<td align="right">' . price($row[$i]) . '</td>';
         }
         print '<td align="right">' . price($row[13]) . '</td>';
@@ -238,8 +250,8 @@ for($i = 1; $i <= 12; $i ++) {
 }
 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
 
-$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
-$sql .= "  " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
+$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
+$sql .= "  " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
 for($i = 1; $i <= 12; $i ++) {
     $sql .= "  SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
 }
@@ -261,9 +273,21 @@ if ($resql) {
 
     while ( $row = $db->fetch_row($resql)) {
 
-        print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
-        print '<td align="left">' . $row[1] . '</td>';
-        for($i = 2; $i <= 12; $i ++) {
+		print '<tr class="oddeven"><td>';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("Unknown");
+		}
+		else print length_accountg($row[0]);
+		print '</td>';
+		print '<td align="left">';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
+		}
+		else print $row[1];
+		print '</td>';
+    	for($i = 2; $i <= 12; $i ++) {
             print '<td align="right">' . price($row[$i]) . '</td>';
         }
         print '<td align="right">' . price($row[13]) . '</td>';

+ 69 - 16
htdocs/accountancy/journal/bankjournal.php

@@ -102,12 +102,15 @@ $idpays = $mysoc->country_id;
 
 $sql  = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
 $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
-$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
-$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop";
+$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop_company,";
+$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop_user,";
+$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
 $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
 $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
+$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
+$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
 $sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
@@ -145,6 +148,7 @@ $result = $db->query($sql);
 if ($result) {
 
 	$num = $db->num_rows($result);
+	//print $sql;
 
 	// Variables
 	$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined');	// NotDefined is a reserved word
@@ -170,13 +174,31 @@ if ($result) {
 	{
 		$obj = $db->fetch_object($result);
 
-		// Set accountancy code (for bank and thirdparty)
+		$lineisapurchase = -1;
+		$lineisasale = -1;
+		// Old method to detect if it's a sale or purchase
+		if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
+		if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
+		// Try a more reliable method to detect if record is a supplier payment or a customer payment
+		if ($lineisapurchase < 0)
+		{
+			if ($obj->typeop_payment_supplier == 'payment_supplier') $lineisapurchase = 1;
+		}
+		if ($lineisasale < 0)
+		{
+			if ($obj->typeop_payment == 'payment') $lineisasale = 1;
+		}
+		//var_dump($obj->type_payment); var_dump($obj->type_payment_supplier);
+		//var_dump($lineisapurchase); //var_dump($lineisasale);
+
+		// Set accountancy code for bank
 		$compta_bank = $obj->account_number;
 
+		// Set accountancy code for thirdparty
 		$compta_soc = 'NotDefined';
-		if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)')
+		if ($lineisapurchase > 0)
 			$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
-		if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)')
+		if ($lineisasale > 0)
 			$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
 
 		$tabcompany[$obj->rowid] = array (
@@ -185,6 +207,7 @@ if ($result) {
 				'code_compta' => $compta_soc,
 		);
 
+		// Set accountancy code for user
 		$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
 
 		$tabuser[$obj->rowid] = array (
@@ -200,6 +223,7 @@ if ($result) {
 		$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type;		// CHQ, VIR, LIQ, CB, ...
 		$tabpay[$obj->rowid]["ref"] = $obj->label;					// By default. Not unique. May be changed later
 		$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
+		$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
 		$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
 		if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
 			$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
@@ -212,7 +236,7 @@ if ($result) {
 		//var_dump($tabpay);
 
 		// By default
-		$tabpay[$obj->rowid]['type'] = 'unknown';	// Can be SOLD, miscellaneous entry, payment of patient, or old record with no links in bank_url.
+		$tabpay[$obj->rowid]['type'] = 'unknown';	// Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
 		$tabtype[$obj->rowid] = 'unknown';
 
 		// get_url may return -1 which is not traversable
@@ -602,6 +626,8 @@ if (! $error && $action == 'writebookkeeping') {
 	}
 }
 
+
+
 // Export
 if ($action == 'exportcsv') {		// ISO and not UTF8 !
 	$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
@@ -735,6 +761,22 @@ if (empty($action) || $action == 'view') {
 
 	journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
 
+
+	// Test that setup is complete
+	$sql='SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
+	$resql=$db->query($sql);
+	if ($resql)
+	{
+		$obj=$db->fetch_object($resql);
+		if ($obj->nb > 0)
+		{
+			print img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
+			print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
+		}
+	}
+	else dol_print_error($db);
+
+
 	// Button to write into Ledger
 	if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
 		|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
@@ -796,8 +838,10 @@ if (empty($action) || $action == 'view') {
 		// Bank
 		foreach ( $tabbq[$key] as $k => $mt )
 		{
+			//var_dump($tabpay[$key]);
+			print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
 			print '<tr class="oddeven">';
-			print "<td><!-- Bank bank.rowid=".$key."--></td>";
+			print "<td></td>";
 			print "<td>" . $date . "</td>";
 			print "<td>" . $ref . "</td>";
 			// Ledger account
@@ -818,11 +862,14 @@ if (empty($action) || $action == 'view') {
 			}
 			else print $accounttoshow;*/
 			print "</td>";
-			if ($val['soclib'] == '') {
-				print "<td>" . $langs->trans("Bank") . " - " . $reflabel . "</td>";
-			} else {
-				print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
+			print "<td>";
+			//var_dump($tabpay[$key]);
+			print $langs->trans("Bank");
+			print ' '.$val['bank_account_ref'];
+			if (! empty($val['soclib'])) {
+				print  " - " . $val['soclib'];
 			}
+			print "</td>";
 			print "<td>" . $val["type_payment"] . "</td>";
 			print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
 			print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
@@ -833,14 +880,15 @@ if (empty($action) || $action == 'view') {
 		if (is_array($tabtp[$key])) {
 			foreach ( $tabtp[$key] as $k => $mt ) {
 				if ($k != 'type') {
+					print '<!-- Thirdparty bank.rowid='.$key.' -->';
 					print '<tr class="oddeven">';
-					print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
+					print "<td></td>";
 					print "<td>" . $date . "</td>";
 					print "<td>" . $ref . "</td>";
 					// Ledger account
 					print "<td>";
 					$account_ledger = $k;
-
+					// Try to force general ledger account depending on type
 					if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
 					if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
 					if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
@@ -877,7 +925,11 @@ if (empty($action) || $action == 'view') {
 						{
 							if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
 							{
-								print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
+								/*var_dump($tabpay[$key]);
+								var_dump($tabtype[$key]);
+								var_dump($tabbq[$key]);*/
+								//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
+								print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown").'</span>';
 							}
 							else print $accounttoshowsubledger;
 						}
@@ -892,8 +944,9 @@ if (empty($action) || $action == 'view') {
 			}
 		} else {
 			foreach ( $tabbq[$key] as $k => $mt ) {
+				print '<!-- Wait bank.rowid='.$key.' -->';
 				print '<tr class="oddeven">';
-				print "<td><!-- Wait bank.rowid=".$key." --></td>";
+				print "<td></td>";
 				print "<td>" . $date . "</td>";
 				print "<td>" . $ref . "</td>";
 				// Ledger account
@@ -936,7 +989,7 @@ $db->close();
  * Return source for doc_ref of a bank transaction
  *
  * @param 	string 	$val			Array of val
- * @param 	string	$typerecord		Type of record
+ * @param 	string	$typerecord		Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
  * @return string|unknown
  */
 function getSourceDocRef($val, $typerecord)

+ 33 - 9
htdocs/accountancy/supplier/index.php

@@ -183,8 +183,8 @@ for($i = 1; $i <= 12; $i ++) {
 }
 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
 
-$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
-$sql .= "  " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
+$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
+$sql .= "  " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
 for($i = 1; $i <= 12; $i ++) {
 	$sql .= "  SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
 }
@@ -206,8 +206,20 @@ if ($resql) {
 
 	while ( $row = $db->fetch_row($resql)) {
 
-		print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
-		print '<td align="left">' . $row[1] . '</td>';
+		print '<tr class="oddeven"><td>';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("Unknown");
+		}
+		else print length_accountg($row[0]);
+		print '</td>';
+		print '<td align="left">';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
+		}
+		else print $row[1];
+		print '</td>';
 		for($i = 2; $i <= 12; $i ++) {
 			print '<td align="right">' . price($row[$i]) . '</td>';
 		}
@@ -237,8 +249,8 @@ for($i = 1; $i <= 12; $i ++) {
 }
 print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
 
-$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
-$sql .= "  " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
+$sql = "SELECT  ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
+$sql .= "  " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
 for($i = 1; $i <= 12; $i ++) {
     $sql .= "  SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
 }
@@ -260,9 +272,21 @@ if ($resql) {
 
     while ( $row = $db->fetch_row($resql)) {
 
-        print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
-        print '<td align="left">' . $row[1] . '</td>';
-        for($i = 2; $i <= 12; $i ++) {
+		print '<tr class="oddeven"><td>';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("Unknown");
+		}
+		else print length_accountg($row[0]);
+		print '</td>';
+		print '<td align="left">';
+		if ($row[0] == 'tobind')
+		{
+			print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
+		}
+		else print $row[1];
+		print '</td>';
+    	for($i = 2; $i <= 12; $i ++) {
             print '<td align="right">' . price($row[$i]) . '</td>';
         }
         print '<td align="right">' . price($row[13]) . '</td>';

+ 1 - 1
htdocs/admin/dict.php

@@ -1142,7 +1142,7 @@ if ($id)
         }
 
         if ($id == 4) print '<td></td>';
-        print '<td colspan="3" align="right">';
+        print '<td colspan="3" align="center">';
         if ($action != 'edit')
         {
         	print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';

+ 3 - 3
htdocs/admin/index.php

@@ -70,13 +70,13 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
 
 print $langs->trans("SetupDescription1").' ';
 print $langs->trans("AreaForAdminOnly").' ';
-print $langs->trans("SetupDescription2", $langs->trans("MenuCompanySetup"), $langs->trans("Modules"))."<br><br>";
+print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>";
 
 print '<br>';
 
 // Show info setup company
 if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
-print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->trans("Setup"), $langs->trans("MenuCompanySetup"));
+print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
 if (! empty($setupcompanynotcomplete))
 {
 	$langs->load("errors");
@@ -88,7 +88,7 @@ print '<br>';
 print '<br>';
 
 // Show info setup module
-print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->trans("Setup"), $langs->trans("Modules"));
+print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
 if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING))	// If only user module enabled
 {
 	$langs->load("errors");

+ 22 - 9
htdocs/categories/class/categorie.class.php

@@ -1548,17 +1548,30 @@ class Categorie extends CommonObject
 			dol_mkdir($dir);
 		}
 
-		if (file_exists($dir))
-		{
-			$originImage = $dir . $file['name'];
+		if (file_exists($dir)) {
+			if (is_array($file['name']) && count($file['name']) > 0) {
+				for($i = 0; $i <= count($file['name']); $i ++) {
 
-			// Cree fichier en taille origine
-			dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
+					$originImage = $dir . $file['name'][$i];
 
-			if (file_exists($originImage))
-			{
-			    // Create thumbs
-				$this->addThumbs($originImage);
+					// Cree fichier en taille origine
+					dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0);
+
+					if (file_exists($originImage)) {
+						// Create thumbs
+						$this->addThumbs($originImage);
+					}
+				}
+			} else {
+				$originImage = $dir . $file['name'];
+
+				// Cree fichier en taille origine
+				dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
+
+				if (file_exists($originImage)) {
+					// Create thumbs
+					$this->addThumbs($originImage);
+				}
 			}
 		}
 	}

+ 8 - 0
htdocs/compta/facture/card.php

@@ -3207,6 +3207,14 @@ else if ($id > 0 || ! empty($ref))
 		$facthatreplace->fetch($objectidnext);
 		print ' (' . $langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)) . ')';
 	}
+
+	if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
+		$discount = new DiscountAbsolute($db);
+		$result = $discount->fetch(0, $object->id);
+		if ($result > 0){
+		    print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(), $discount->getNomUrl(1, 'discount')).'<br>';
+		}
+	}
 	print '</td></tr>';
 
 	// Relative and absolute discounts

+ 32 - 27
htdocs/compta/facture/class/facture-rec.class.php

@@ -1355,7 +1355,6 @@ class FactureRec extends CommonInvoice
  */
 class FactureLigneRec extends CommonInvoiceLine
 {
-
 	public $element='facturedetrec';
 	public $table_element='facturedet_rec';
 
@@ -1364,36 +1363,40 @@ class FactureLigneRec extends CommonInvoiceLine
      *
      *	@return		int		<0 if KO, >0 if OK
      */
-    function delete()
+    function delete(User $user, $notrigger = false)
     {
-        global $conf,$langs,$user;
+    	$error=0;
 
-        $error=0;
+	    $this->db->begin();
 
-        $this->db->begin();
+	    if (! $error) {
+	        if (! $notrigger) {
+	            // Call triggers
+	            $result=$this->call_trigger('LINEBILLREC_DELETE', $user);
+	            if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
+	            // End call triggers
+	        }
+	    }
 
-        $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".($this->rowid > 0 ? $this->rowid : $this->id);
-        dol_syslog(get_class($this)."::delete", LOG_DEBUG);
-        if ($this->db->query($sql) )
-        {
-        	// Call trigger
-        	$result=$this->call_trigger('LINEBILLREC_DELETE',$user);
-        	if ($result < 0)
-        	{
-        		$this->db->rollback();
-        		return -1;
-        	}
-        	// End call triggers
-
-            $this->db->commit();
-            return 1;
-        }
-        else
-        {
-            $this->error=$this->db->error()." sql=".$sql;
-            $this->db->rollback();
-            return -1;
-        }
+	    if (! $error)
+	    {
+    		$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
+
+    		$res = $this->db->query($sql);
+    		if($res===false) {
+    		    $error++;
+    		    $this->errors[] = $this->db->lasterror();
+    		}
+	    }
+
+    	// Commit or rollback
+		if ($error) {
+		    $this->db->rollback();
+		    return -1;
+		} else {
+		    $this->db->commit();
+		    return 1;
+		}
     }
 
 
@@ -1551,4 +1554,6 @@ class FactureLigneRec extends CommonInvoiceLine
 
     }
 
+=======
+>>>>>>> branch '6.0' of git@github.com:Dolibarr/dolibarr.git
 }

+ 0 - 2
htdocs/compta/facture/class/facture.class.php

@@ -439,7 +439,6 @@ class Facture extends CommonInvoice
 		$sql.= ", ".(double) $this->multicurrency_tx;
 		$sql.=")";
 
-		dol_syslog(get_class($this)."::create", LOG_DEBUG);
 		$resql=$this->db->query($sql);
 		if ($resql)
 		{
@@ -449,7 +448,6 @@ class Facture extends CommonInvoice
 			$this->ref='(PROV'.$this->id.')';
 			$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
 
-			dol_syslog(get_class($this)."::create", LOG_DEBUG);
 			$resql=$this->db->query($sql);
 			if (! $resql) $error++;
 

+ 1 - 1
htdocs/contact/list.php

@@ -665,7 +665,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
    }
 }
 // Hook fields
-$parameters=array('arrayfields'=>$arrayfields);
+$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
 $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters);    // Note that $action and $object may have been modified by hook
 print $hookmanager->resPrint;
 if (! empty($arrayfields['p.datec']['checked']))      print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

+ 10 - 5
htdocs/core/class/conf.class.php

@@ -83,11 +83,12 @@ class Conf
 		$this->file				= new stdClass();
 		$this->db				= new stdClass();
 		$this->global			= new stdClass();
-		$this->mycompany		= new stdClass();
-		$this->admin			= new stdClass();
+		$this->mycompany			= new stdClass();
+		$this->admin				= new stdClass();
 		$this->user				= new stdClass();
 		$this->syslog			= new stdClass();
 		$this->browser			= new stdClass();
+		$this->medias			= new stdClass();
 		$this->multicompany		= new stdClass();
 
 		//! Charset for HTML output and for storing data in memory
@@ -96,7 +97,7 @@ class Conf
 		// First level object
 		// TODO Remove this part.
 		$this->expedition_bon	= new stdClass();
-		$this->livraison_bon	= new stdClass();
+		$this->livraison_bon		= new stdClass();
 		$this->fournisseur		= new stdClass();
 		$this->product			= new stdClass();
 		$this->service			= new stdClass();
@@ -106,12 +107,12 @@ class Conf
 		$this->propal			= new stdClass();
 		$this->facture			= new stdClass();
 		$this->contrat			= new stdClass();
-		$this->usergroup		= new stdClass();
+		$this->usergroup			= new stdClass();
 		$this->adherent			= new stdClass();
 		$this->bank				= new stdClass();
 		$this->notification		= new stdClass();
 		$this->mailing			= new stdClass();
-		$this->expensereport    = new stdClass();
+		$this->expensereport		= new stdClass();
 	}
 
 
@@ -322,6 +323,10 @@ class Conf
 		$this->propal->dir_output=$rootfordata."/propale";
 		$this->propal->dir_temp=$rootfordata."/propale/temp";
 
+		// For medias storage
+		$this->medias->multidir_output	= array($this->entity => $rootfordata."/medias");
+		$this->medias->multidir_temp		= array($this->entity => $rootfordata."/medias/temp");
+
 		// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
 
 		// Sous module bons d'expedition

+ 5 - 5
htdocs/core/class/discount.class.php

@@ -64,7 +64,7 @@ class DiscountAbsolute
      *  @param      int		$fk_facture_source	fk_facture_source
      *	@return		int							<0 if KO, =0 if not found, >0 if OK
      */
-    function fetch($rowid,$fk_facture_source=0)
+    function fetch($rowid, $fk_facture_source=0)
     {
     	global $conf;
 
@@ -386,7 +386,7 @@ class DiscountAbsolute
     function getSumDepositsUsed($invoice, $multicurrency=0)
     {
         dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG);
-        
+
         if ($invoice->element == 'facture' || $invoice->element == 'invoice')
         {
             $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
@@ -407,7 +407,7 @@ class DiscountAbsolute
             dol_print_error($this->error);
             return -1;
         }
-        
+
         $resql=$this->db->query($sql);
         if ($resql)
         {
@@ -432,7 +432,7 @@ class DiscountAbsolute
     function getSumCreditNotesUsed($invoice, $multicurrency=0)
     {
         dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG);
-        
+
         if ($invoice->element == 'facture' || $invoice->element == 'invoice')
         {
             $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
@@ -453,7 +453,7 @@ class DiscountAbsolute
             dol_print_error($this->error);
             return -1;
         }
-            
+
         $resql=$this->db->query($sql);
         if ($resql)
         {

+ 1 - 1
htdocs/core/lib/files.lib.php

@@ -1964,7 +1964,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
 	if ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
 	{
 	    $accessallowed=1;
-	    $original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
+	    $original_file=$conf->medias->multidir_output[$entity].'/'.$original_file;
 	}
 	// Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
 	elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root))

+ 4 - 4
htdocs/core/modules/syslog/mod_syslog_syslog.php

@@ -49,7 +49,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
 	public function isActive()
 	{
 	    global $conf;
-	    
+
 		// This function does not exists on some ISP (Ex: Free in France)
 		if (!function_exists('openlog')) return 0;
 
@@ -81,15 +81,15 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
 	 */
 	public function checkConfiguration()
 	{
-		global $langs;
+		global $conf, $langs;
 
 		$errors = array();
 
-	    $facility = SYSLOG_FACILITY;
+	    $facility = constant($conf->global->SYSLOG_FACILITY);
 	    if ($facility)
 		{
 			// Only LOG_USER supported on Windows
-			if (! empty($_SERVER["WINDIR"])) $facility='LOG_USER';
+			if (! empty($_SERVER["WINDIR"])) $facility=constant('LOG_USER');
 
 			dol_syslog("admin/syslog: facility ".$facility);
 		}

+ 8 - 7
htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php

@@ -313,7 +313,7 @@ class doc_generic_user_odt extends ModelePDFUser
 				{
 					$socobject=$object->client;
 				}
-				
+
 				// Open and load template
 				require_once ODTPHP_PATH.'odf.php';
 				try {
@@ -332,7 +332,7 @@ class doc_generic_user_odt extends ModelePDFUser
 					$this->error=$e->getMessage();
 					return -1;
 				}
-				
+
 				// Make substitutions into odt
 				$array_user=$this->get_substitutionarray_user($object,$outputlangs);
 				$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
@@ -366,7 +366,7 @@ class doc_generic_user_odt extends ModelePDFUser
 					{
 					}
 				}
-				
+
 				// Replace labels translated
 				$tmparray=$outputlangs->get_translations_for_substitutions();
 				foreach($tmparray as $key=>$value)
@@ -422,12 +422,13 @@ class doc_generic_user_odt extends ModelePDFUser
 		return -1;
 	}
 
-	function get_substitutionarray_object($object,$outputlangs) {
+	function get_substitutionarray_object($object,$outputlangs,$array_key='object') {
+		$array_other=array();
 		foreach($object as $key => $value) {
-			if(!is_array($value) && !is_object($value)) {
-	    	$array_other['object_'.$key] = $value;
+			if (!is_array($value) && !is_object($value)) {
+				$array_other[$array_key.'_'.$key] = $value;
 			}
-	     }
+		}
 		return $array_other;
 	}
 

+ 16 - 16
htdocs/core/tpl/contacts.tpl.php

@@ -35,13 +35,13 @@ elseif ($module == 'project')		{ $permission=$user->rights->projet->creer; }
 elseif ($module == 'action')		{ $permission=$user->rights->agenda->myactions->create; }
 elseif ($module == 'shipping')		{ $permission=$user->rights->expedition->creer; }
 elseif ($module == 'project_task')	{ $permission=$user->rights->projet->creer; }
-elseif (! isset($permission) && isset($user->rights->$module->creer))			
-{ 
-	$permission=$user->rights->$module->creer; 
+elseif (! isset($permission) && isset($user->rights->$module->creer))
+{
+	$permission=$user->rights->$module->creer;
 }
 elseif (! isset($permission)  && isset($user->rights->$module->write))
 {
-	$permission=$user->rights->$module->write; 
+	$permission=$user->rights->$module->write;
 }
 
 $formcompany= new FormCompany($db);
@@ -55,8 +55,8 @@ $userstatic=new User($db);
 <div class="div-table-responsive">
 <div class="tagtable centpercent noborder allwidth">
 
-<?php 
-if ($permission) { 
+<?php
+if ($permission) {
 ?>
 	<form class="tagtr liste_titre">
 		<div class="tagtd liste_titre"><?php echo $langs->trans("Nature"); ?></div>
@@ -72,7 +72,7 @@ if ($permission) {
 	$var=true;
 	if (empty($hideaddcontactforuser))
 	{
-		
+
 	?>
 	<form class="tagtr impair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
 	<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
@@ -87,10 +87,10 @@ if ($permission) {
 		<?php
 		$tmpobject=$object;
 		if ($object->element == 'shipping' && is_object($objectsrc)) $tmpobject=$objectsrc;
-		echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal'); 
+		echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal');
 		?></div>
 		<div class="tagtd">&nbsp;</div>
-		<div class="tagtd right"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div>
+		<div class="tagtd center"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div>
 	</form>
 
 	<?php
@@ -98,7 +98,7 @@ if ($permission) {
 
 	if (empty($hideaddcontactforthirdparty))
 	{
-		
+
 	?>
 
 	<form class="tagtr pair" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
@@ -110,9 +110,9 @@ if ($permission) {
 		<div class="tagtd nowrap noborderbottom"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></div>
 		<div class="tagtd nowrap maxwidthonsmartphone noborderbottom">
 			<?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?>
-			<?php 
-			// add company icon before select list 
-			if ($selectedCompany) 
+			<?php
+			// add company icon before select list
+			if ($selectedCompany)
 			{
 			    echo img_object('', 'company', 'class="hideonsmartphone"');
 			}
@@ -129,14 +129,14 @@ if ($permission) {
 			$formcompany->selectTypeContact($tmpobject, '', 'type','external'); ?>
 		</div>
 		<div class="tagtd noborderbottom">&nbsp;</div>
-		<div class="tagtd right noborderbottom">
+		<div class="tagtd center noborderbottom">
 			<input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled'; ?>>
 		</div>
 	</form>
 
-<?php 
+<?php
 	}
-} 
+}
 ?>
 
 	<form class="tagtr liste_titre liste_titre_add formnoborder">

+ 5 - 4
htdocs/fichinter/class/fichinter.class.php

@@ -578,7 +578,8 @@ class Fichinter extends CommonObject
 
 		return price2num($amount, 'MT');
 	}
-	
+
+
 	/**
 	 *  Create a document onto disk according to template module.
 	 *
@@ -597,12 +598,12 @@ class Fichinter extends CommonObject
 
 		if (! dol_strlen($modele)) {
 
-			$modele = 'azur';
+			$modele = 'soleil';
 
 			if ($this->modelpdf) {
 				$modele = $this->modelpdf;
-			} elseif (! empty($conf->global->PROPALE_ADDON_PDF)) {
-				$modele = $conf->global->PROPALE_ADDON_PDF;
+			} elseif (! empty($conf->global->FICHEINTER_ADDON_PDF)) {
+				$modele = $conf->global->FICHEINTER_ADDON_PDF;
 			}
 		}
 

+ 249 - 237
htdocs/install/upgrade2.php

@@ -375,39 +375,40 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
         }
     }
 
-    // Code executed only if migrate is LAST ONE. Must always be done.
-    if (versioncompare($versiontoarray,$versionranarray) >= 0 || versioncompare($versiontoarray,$versionranarray) <= -3)
-    {
-        // Reload modules (this must be always done and only into last targeted version, because code to reload module may need table structure of last version)
-        $listofmodule=array(
-            'MAIN_MODULE_AGENDA'=>'newboxdefonly',
-            'MAIN_MODULE_BARCODE'=>'newboxdefonly',
-            'MAIN_MODULE_CRON'=>'newboxdefonly',
-            'MAIN_MODULE_COMMANDE'=>'newboxdefonly',
-            'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly',
-            'MAIN_MODULE_DON'=>'newboxdefonly',
-            'MAIN_MODULE_ECM'=>'newboxdefonly',
-            'MAIN_MODULE_FACTURE'=>'newboxdefonly',
-            'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly',
-            'MAIN_MODULE_HOLIDAY'=>'newboxdefonly',
-            'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly',
-            'MAIN_MODULE_PAYBOX'=>'newboxdefonly',
-            'MAIN_MODULE_PRODUIT'=>'newboxdefonly',
-            'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
-            'MAIN_MODULE_SERVICE'=>'newboxdefonly',
-            'MAIN_MODULE_USER'=>'newboxdefonly',
-            'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly',
-            'MAIN_MODULE_BARCODE'=>'newboxdefonly',
-            'MAIN_MODULE_CRON'=>'newboxdefonly',
-            'MAIN_MODULE_PRINTING'=>'newboxdefonly',
-
-            'MAIN_MODULE_USER'=>'newboxdefonly',        //This one must be always done and only into last targeted version)
-        );
-        migrate_reload_modules($db,$langs,$conf,$listofmodule);
-
-        // Reload menus (this must be always and only into last targeted version)
-        migrate_reload_menu($db,$langs,$conf,$versionto);
-    }
+	// Code executed only if migrate is LAST ONE. Must always be done.
+	if (versioncompare($versiontoarray,$versionranarray) >= 0 || versioncompare($versiontoarray,$versionranarray) <= -3)
+	{
+		// Reload modules (this must be always done and only into last targeted version, because code to reload module may need table structure of last version)
+		$listofmodule=array(
+			'MAIN_MODULE_AGENDA'=>'newboxdefonly',
+			'MAIN_MODULE_BARCODE'=>'newboxdefonly',
+			'MAIN_MODULE_CRON'=>'newboxdefonly',
+			'MAIN_MODULE_COMMANDE'=>'newboxdefonly',
+			'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly',
+			'MAIN_MODULE_DON'=>'newboxdefonly',
+			'MAIN_MODULE_ECM'=>'newboxdefonly',
+			'MAIN_MODULE_FACTURE'=>'newboxdefonly',
+			'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly',
+			'MAIN_MODULE_HOLIDAY'=>'newboxdefonly',
+			'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly',
+			'MAIN_MODULE_PAYBOX'=>'newboxdefonly',
+			'MAIN_MODULE_PRODUIT'=>'newboxdefonly',
+			'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
+			'MAIN_MODULE_SERVICE'=>'newboxdefonly',
+			'MAIN_MODULE_USER'=>'newboxdefonly',
+			'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly',
+			'MAIN_MODULE_BARCODE'=>'newboxdefonly',
+			'MAIN_MODULE_CRON'=>'newboxdefonly',
+			'MAIN_MODULE_PRINTING'=>'newboxdefonly',
+			'MAIN_MODULE_SALARIES'=>'newboxdefonly',
+
+			'MAIN_MODULE_USER'=>'newboxdefonly',        //This one must be always done and only into last targeted version)
+		);
+		migrate_reload_modules($db,$langs,$conf,$listofmodule);
+
+		// Reload menus (this must be always and only into last targeted version)
+		migrate_reload_menu($db,$langs,$conf,$versionto);
+	}
 
     // Can force activation of some module during migration with paramater 'enablemodules=MAIN_MODULE_XXX,MAIN_MODULE_YYY,...'
     if (! $error && $enablemodules)
@@ -4117,216 +4118,227 @@ function migrate_delete_old_dir($db,$langs,$conf)
  */
 function migrate_reload_modules($db,$langs,$conf,$listofmodule=array(),$force=0)
 {
-    dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force);
+	dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force);
 
-    // If no info is provided, we reload all modules with mode newboxdefonly.
-    if (count($listofmodule) == 0)
-    {
-    	$listofmodule=array(
-	    	'MAIN_MODULE_AGENDA'=>'newboxdefonly',
-	    	'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
-	    	'MAIN_MODULE_PRODUIT'=>'newboxdefonly',
-	    	'MAIN_MODULE_SERVICE'=>'newboxdefonly',
-	    	'MAIN_MODULE_COMMANDE'=>'newboxdefonly',
-	    	'MAIN_MODULE_FACTURE'=>'newboxdefonly',
-	    	'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly',
-    		'MAIN_MODULE_HOLIDAY'=>'newboxdefonly',
-    		'MAIN_MODULE_USER'=>'newboxdefonly',
-	    	'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly',
-	    	'MAIN_MODULE_DON'=>'newboxdefonly',
-	    	'MAIN_MODULE_ECM'=>'newboxdefonly',
-	    	'MAIN_MODULE_PAYBOX'=>'newboxdefonly',
-    		'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly'
-    	);
-    }
+	// If no info is provided, we reload all modules with mode newboxdefonly.
+	if (count($listofmodule) == 0)
+	{
+		$listofmodule=array(
+			'MAIN_MODULE_AGENDA'=>'newboxdefonly',
+			'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
+			'MAIN_MODULE_PRODUIT'=>'newboxdefonly',
+			'MAIN_MODULE_SERVICE'=>'newboxdefonly',
+			'MAIN_MODULE_COMMANDE'=>'newboxdefonly',
+			'MAIN_MODULE_FACTURE'=>'newboxdefonly',
+			'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly',
+			'MAIN_MODULE_HOLIDAY'=>'newboxdefonly',
+			'MAIN_MODULE_USER'=>'newboxdefonly',
+			'MAIN_MODULE_DEPLACEMENT'=>'newboxdefonly',
+			'MAIN_MODULE_DON'=>'newboxdefonly',
+			'MAIN_MODULE_ECM'=>'newboxdefonly',
+			'MAIN_MODULE_PAYBOX'=>'newboxdefonly',
+			'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly',
+			'MAIN_MODULE_SALARIES'=>'newboxdefonly'
+		);
+	}
 
-    foreach($listofmodule as $moduletoreload => $reloadmode)
-    {
-    	if (empty($moduletoreload) || (empty($conf->global->$moduletoreload) && ! $force)) continue; // Discard reload if module not enabled
-
-    	$mod=null;
-
-	    if ($moduletoreload == 'MAIN_MODULE_AGENDA')
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Agenda module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modAgenda.class.php';
-	        if ($res) {
-	            $mod=new modAgenda($db);
-	            $mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-        if ($moduletoreload == 'MAIN_MODULE_API')
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Rest API module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modApi.class.php';
-	        if ($res) {
-	            $mod=new modApi($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_BARCODE')
-    	{
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Barcode module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modBarcode.class.php';
-	        if ($res) {
-	            $mod=new modBarcode($db);
-	            $mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_CRON')
-    	{
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Cron module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCron.class.php';
-	        if ($res) {
-	            $mod=new modCron($db);
-	            $mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_SOCIETE')
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php';
-	        if ($res) {
-	            $mod=new modSociete($db);
-	            $mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_PRODUIT')    // Permission has changed into 2.7
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Produit module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modProduct.class.php';
-	        if ($res) {
-	            $mod=new modProduct($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_SERVICE')    // Permission has changed into 2.7
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Service module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
-	        if ($res) {
-	            $mod=new modService($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_COMMANDE')   // Permission has changed into 2.9
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Commande module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
-	        if ($res) {
-	            $mod=new modCommande($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_FACTURE')    // Permission has changed into 2.9
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Facture module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php';
-	        if ($res) {
-	            $mod=new modFacture($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR')    // Permission has changed into 2.9
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Fournisseur module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
-	        if ($res) {
-	            $mod=new modFournisseur($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-    	if ($moduletoreload == 'MAIN_MODULE_HOLIDAY')    // Permission and tabs has changed into 3.8
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Leave Request module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modHoliday.class.php';
-	        if ($res) {
-	            $mod=new modHoliday($db);
-	            $mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT')    // Permission has changed into 3.0
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Deplacement module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php';
-	        if ($res) {
-	            $mod=new modDeplacement($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_DON')    // Permission has changed into 3.0
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Don module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php';
-	        if ($res) {
-	            $mod=new modDon($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_ECM')    // Permission has changed into 3.0 and 3.1
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate ECM module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php';
-	        if ($res) {
-	            $mod=new modECM($db);
-	            $mod->remove('noboxes');	// We need to remove because a permission id has been removed
-	            $mod->init($reloadmode);
-	        }
-	    }
-	    if ($moduletoreload == 'MAIN_MODULE_PAYBOX')    // Permission has changed into 3.0
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Paybox module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php';
-	        if ($res) {
-	            $mod=new modPaybox($db);
-	            $mod->remove('noboxes');  // We need to remove because id of module has changed
-	            $mod->init($reloadmode);
-	        }
-	    }
-    	if ($moduletoreload == 'MAIN_MODULE_OPENSURVEY')    // Permission has changed into 3.0
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Opensurvey module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modOpenSurvey.class.php';
-	        if ($res) {
-	            $mod=new modOpenSurvey($db);
-	            $mod->remove('noboxes');  // We need to remove because menu entries has changed
-	            $mod->init($reloadmode);
-	        }
-	    }
-    	if ($moduletoreload == 'MAIN_MODULE_USER')    // Permission has changed into 3.0
-	    {
-	        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate User module");
-	        $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php';
-	        if ($res) {
-	            $mod=new modUser($db);
-	            //$mod->remove('noboxes');
-	            $mod->init($reloadmode);
-	        }
-	    }
+	foreach($listofmodule as $moduletoreload => $reloadmode)
+	{
+		if (empty($moduletoreload) || (empty($conf->global->$moduletoreload) && ! $force)) continue; // Discard reload if module not enabled
+
+		$mod=null;
+
+		if ($moduletoreload == 'MAIN_MODULE_AGENDA')
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Agenda module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modAgenda.class.php';
+			if ($res) {
+				$mod=new modAgenda($db);
+				$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_API')
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Rest API module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modApi.class.php';
+			if ($res) {
+				$mod=new modApi($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_BARCODE')
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Barcode module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modBarcode.class.php';
+			if ($res) {
+				$mod=new modBarcode($db);
+				$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_CRON')
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Cron module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCron.class.php';
+			if ($res) {
+				$mod=new modCron($db);
+				$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_SOCIETE')
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php';
+			if ($res) {
+				$mod=new modSociete($db);
+				$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_PRODUIT')    // Permission has changed into 2.7
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Produit module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modProduct.class.php';
+			if ($res) {
+				$mod=new modProduct($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_SERVICE')    // Permission has changed into 2.7
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Service module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php';
+			if ($res) {
+				$mod=new modService($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_COMMANDE')   // Permission has changed into 2.9
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Commande module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php';
+			if ($res) {
+				$mod=new modCommande($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_FACTURE')    // Permission has changed into 2.9
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Facture module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php';
+			if ($res) {
+				$mod=new modFacture($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR')    // Permission has changed into 2.9
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Fournisseur module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
+			if ($res) {
+				$mod=new modFournisseur($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_HOLIDAY')    // Permission and tabs has changed into 3.8
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Leave Request module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modHoliday.class.php';
+			if ($res) {
+				$mod=new modHoliday($db);
+				$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT')    // Permission has changed into 3.0
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Deplacement module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php';
+			if ($res) {
+				$mod=new modDeplacement($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_DON')    // Permission has changed into 3.0
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Don module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php';
+			if ($res) {
+				$mod=new modDon($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_ECM')    // Permission has changed into 3.0 and 3.1
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate ECM module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php';
+			if ($res) {
+				$mod=new modECM($db);
+				$mod->remove('noboxes');	// We need to remove because a permission id has been removed
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_PAYBOX')    // Permission has changed into 3.0
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Paybox module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php';
+			if ($res) {
+				$mod=new modPaybox($db);
+				$mod->remove('noboxes');  // We need to remove because id of module has changed
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_OPENSURVEY')    // Permission has changed into 3.0
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Opensurvey module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modOpenSurvey.class.php';
+			if ($res) {
+				$mod=new modOpenSurvey($db);
+				$mod->remove('noboxes');  // We need to remove because menu entries has changed
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_SALARIES')    // Permission has changed into 6.0
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Salaries module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modSalaries.class.php';
+			if ($res) {
+				$mod=new modSalaries($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
+		if ($moduletoreload == 'MAIN_MODULE_USER')    // Permission has changed into 3.0
+		{
+			dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate User module");
+			$res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php';
+			if ($res) {
+				$mod=new modUser($db);
+				//$mod->remove('noboxes');
+				$mod->init($reloadmode);
+			}
+		}
 
 		if (! empty($mod) && is_object($mod))
 		{
-    		print '<tr><td colspan="4">';
-        	print '<b>'.$langs->trans('Upgrade').'</b>: ';
-        	print $langs->trans('MigrationReloadModule').' '.$mod->getName();  // We keep getName outside of trans because getName is already encoded/translated
-        	print "<!-- (".$reloadmode.") -->";
-        	print "<br>\n";
-        	print '</td></tr>';
+			print '<tr><td colspan="4">';
+			print '<b>'.$langs->trans('Upgrade').'</b>: ';
+			print $langs->trans('MigrationReloadModule').' '.$mod->getName();  // We keep getName outside of trans because getName is already encoded/translated
+			print "<!-- (".$reloadmode.") -->";
+			print "<br>\n";
+			print '</td></tr>';
 		}
-    }
+	}
 }
 
 

+ 3 - 1
htdocs/langs/en_US/accountancy.lang

@@ -57,7 +57,7 @@ AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for speci
 AccountancyAreaDescDonation=STEP %s: Define default accounting accounts for donation. For this, use the menu entry %s.
 AccountancyAreaDescMisc=STEP %s: Define mandatory default account and default accounting accounts for miscellaneous transactions. For this, use the menu entry %s.
 AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. For this, use the menu entry %s. 
-AccountancyAreaDescBank=STEP %s: Define accounting accounts for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s.
+AccountancyAreaDescBank=STEP %s: Define accounting accounts and journal code for each bank and financial accounts. For this, go on the card of each financial account. You can start from page %s.
 AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s.
 
 AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in Ledger in one click. Complete missing bindings. For this, use the menu entry %s.
@@ -66,6 +66,7 @@ AccountancyAreaDescAnalyze=STEP %s: Add or edit existing transactions and genera
 
 AccountancyAreaDescClosePeriod=STEP %s: Close period so we can't make modification in a future.
 
+TheJournalCodeIsNotDefinedOnSomeBankAccount=A mandatory step in setup was not complete (accountancy code journal not defined for all bank accounts)
 MenuAccountancy=Accountancy
 Selectchartofaccounts=Select active chart of accounts
 ChangeAndLoad=Change and load
@@ -281,5 +282,6 @@ BookeppingLineAlreayExists=Lines already existing into bookeeping
 NoJournalDefined=No journal defined
 Binded=Lines bound
 ToBind=Lines to bind
+UseMenuToSetBindindManualy=Autodection not possible, use menu <a href="%s">%s</a> to make the binding manually
 
 WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manualy in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate. 

+ 22 - 22
htdocs/societe/list.php

@@ -217,8 +217,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
 
 if (empty($reshook))
 {
-    // Selection of new fields
-    include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
+	// Selection of new fields
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
 
     // Did we click on purge search criteria ?
     if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
@@ -259,24 +259,24 @@ if (empty($reshook))
     	$search_array_options=array();
     }
 
-    // Mass actions
-    $objectclass='Societe';
-    $objectlabel='ThirdParty';
-    $permtoread = $user->rights->societe->lire;
-    $permtodelete = $user->rights->societe->supprimer;
-    $uploaddir = $conf->societe->dir_output;
-    include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
+	// Mass actions
+	$objectclass='Societe';
+	$objectlabel='ThirdParty';
+	$permtoread = $user->rights->societe->lire;
+	$permtodelete = $user->rights->societe->supprimer;
+	$uploaddir = $conf->societe->dir_output;
+	include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
 
-    if ($action == 'setstcomm')
-    {
-        $object = new Client($db);
-        $result=$object->fetch(GETPOST('stcommsocid'));
-        $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
-        $result=$object->update($object->id, $user);
-        if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
+	if ($action == 'setstcomm')
+	{
+		$object = new Client($db);
+		$result=$object->fetch(GETPOST('stcommsocid'));
+		$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
+		$result=$object->update($object->id, $user);
+		if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
 
-        $action='';
-    }
+		$action='';
+	}
 }
 
 if ($search_status=='') $search_status=1; // always display active thirdparty first
@@ -995,12 +995,12 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
     }
 }
 // Hook fields
-$parameters=array('arrayfields'=>$arrayfields);
+$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
 $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters);    // Note that $action and $object may have been modified by hook
 print $hookmanager->resPrint;
-if (! empty($arrayfields['s.datec']['checked']))  print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
-if (! empty($arrayfields['s.tms']['checked']))    print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
-if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
+if (! empty($arrayfields['s.datec']['checked']))      print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
+if (! empty($arrayfields['s.tms']['checked']))        print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
+if (! empty($arrayfields['s.status']['checked']))     print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
 if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'],$_SERVER["PHP_SELF"],"s.import_key","",$param,'align="center"',$sortfield,$sortorder);
 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
 print "</tr>\n";