Browse Source

Merge branch '5.0' of github.com:Dolibarr/dolibarr into 5.0

Laurent Destailleur 8 years ago
parent
commit
a6b05bb4da
55 changed files with 533 additions and 184 deletions
  1. 58 2
      ChangeLog
  2. 4 4
      build/debian/control
  3. 1 1
      htdocs/accountancy/customer/card.php
  4. 4 4
      htdocs/accountancy/expensereport/card.php
  5. 3 3
      htdocs/accountancy/expensereport/lines.php
  6. 6 6
      htdocs/accountancy/expensereport/list.php
  7. 76 13
      htdocs/accountancy/journal/bankjournal.php
  8. 1 1
      htdocs/accountancy/supplier/card.php
  9. 3 3
      htdocs/adherents/agenda.php
  10. 1 1
      htdocs/admin/dict.php
  11. 2 2
      htdocs/admin/facture.php
  12. 3 3
      htdocs/categories/class/categorie.class.php
  13. 8 1
      htdocs/comm/action/index.php
  14. 2 2
      htdocs/compta/bank/bankentries.php
  15. 1 1
      htdocs/compta/bank/categ.php
  16. 2 2
      htdocs/compta/bank/class/account.class.php
  17. 10 2
      htdocs/compta/facture/fiche-rec.php
  18. 3 4
      htdocs/compta/paiement/card.php
  19. 1 1
      htdocs/contact/list.php
  20. 51 32
      htdocs/core/class/CMailFile.class.php
  21. 10 2
      htdocs/core/class/commonobject.class.php
  22. 2 2
      htdocs/core/class/extrafields.class.php
  23. 4 1
      htdocs/core/class/hookmanager.class.php
  24. 23 13
      htdocs/core/class/html.form.class.php
  25. 5 0
      htdocs/core/class/html.formfile.class.php
  26. 16 4
      htdocs/core/class/html.formother.class.php
  27. 41 9
      htdocs/core/class/smtps.class.php
  28. 5 2
      htdocs/core/lib/company.lib.php
  29. 3 2
      htdocs/core/menus/standard/eldy.lib.php
  30. 2 2
      htdocs/core/modules/modAgenda.class.php
  31. 19 5
      htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
  32. 1 1
      htdocs/core/triggers/interface_50_modNotification_Notification.class.php
  33. 1 1
      htdocs/filefunc.inc.php
  34. 1 0
      htdocs/fourn/class/fournisseur.commande.class.php
  35. 14 6
      htdocs/fourn/facture/card.php
  36. 2 5
      htdocs/fourn/facture/paiement.php
  37. 14 11
      htdocs/install/mysql/data/llx_c_action_trigger.sql
  38. 67 9
      htdocs/install/repair.php
  39. 2 2
      htdocs/langs/en_US/admin.lang
  40. 1 0
      htdocs/langs/en_US/agenda.lang
  41. 1 0
      htdocs/langs/en_US/categories.lang
  42. 1 1
      htdocs/langs/en_US/propal.lang
  43. 2 2
      htdocs/product/stock/class/mouvementstock.class.php
  44. 4 3
      htdocs/societe/list.php
  45. 1 1
      htdocs/supplier_proposal/card.php
  46. 5 1
      htdocs/user/agenda_extsites.php
  47. 5 1
      htdocs/user/bank.php
  48. 5 1
      htdocs/user/card.php
  49. 5 1
      htdocs/user/clicktodial.php
  50. 5 2
      htdocs/user/document.php
  51. 5 1
      htdocs/user/info.php
  52. 5 1
      htdocs/user/ldap.php
  53. 5 1
      htdocs/user/note.php
  54. 6 2
      htdocs/user/param_ihm.php
  55. 5 1
      htdocs/user/perms.php

+ 58 - 2
ChangeLog

@@ -2,8 +2,28 @@
 English Dolibarr ChangeLog
 --------------------------------------------------------------
 
-
-
+***** ChangeLog for 5.0.1 compared to 5.0.0 *****
+FIX: #6503: SQL error in "Last pending payment invoices"
+FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled
+FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access
+FIX: #6533 #6590
+FIX: #6535
+FIX: bank account not visible on payment card
+FIX: colspan
+FIX: Data lost during merge of thirdparties
+FIX: Detection of color brightness
+FIX: Filter on date lost after submit on time spent page
+FIX: forgottent fk_unit field on llx_supplier_propaldet
+FIX: list of projects
+FIX: LOG_ERROR does not exists. Use LOG_ERR.
+FIX: Missing total on project overview.
+FIX: multicurrency management on supplier order/invoice
+FIX: Notification sending was broken.
+FIX: origin & origin id on supplier order line
+FIX: param php doc
+FIX: Picto of project on dol_banner and box
+FIX: Some errors when downloading files.
+ 
 ***** ChangeLog for 5.0.0 compared to 4.0.* *****
 For users:
 NEW: Add module mulicurrency.
@@ -156,6 +176,42 @@ Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful o
 feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
 
 
+***** ChangeLog for 4.0.5 to 4.0.4 *****
+FIX: #6234
+FIX: #6259
+FIX: #6330
+FIX: #6360
+FIX: #6411
+FIX: #6443
+FIX: #6444
+FIX: #6453
+FIX: #6503: SQL error in "Last pending payment invoices"
+FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled
+FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access
+FIX: #6533 #6590
+FIX: #6619 Template invoices list do not respect restricted thirdparty user rights
+FIX: #6621 Documents tab shows greyed out upload form even if the option to show actions not available is disabled
+FIX: add entity param to document link
+FIX: Can use quote into supplier ref on order line add
+FIX: Change the customer code only if error on duplicate
+FIX: Creation of credit note on invoice with deposit stole the discount.
+FIX: delete bank class lines when we delete bank_categ
+FIX: deletion of bank tag
+FIX: detail of deposit and credit not was not visible into final invoice
+FIX: Error management during bank account creation
+FIX: error management in bank account deletion.
+FIX: event status is not modified when assign an user
+FIX: forgotten fk_facture_fourn attribute on supplierinvoice line object
+FIX: If bank module on, field must be required to register payment of expense report.
+FIX: load multicurrency informations on supplier order and bill lines fetch
+FIX: Missing total on project overview.
+FIX: multicurrency_subprice
+FIX: param billed when we change page
+FIX: protection against infinite loop on hierarchy
+FIX: Supplier Order list filter by project
+FIX: the dolCopyDir fails if target dir does not exists.
+FIX: use param for http links
+
 ***** ChangeLog for 4.0.4 to 4.0.3 *****
 FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish
 FIX: #6230

+ 4 - 4
build/debian/control

@@ -10,12 +10,12 @@ Build-Depends: debhelper (>= 9), po-debconf
  
 Package: dolibarr
 Architecture: all
-Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
-    php5-cli, 
+Depends: libapache2-mod-php | libapache2-mod-phpfilter | php-cgi | php-fpm | php,
+    php-cli, 
 # Required PHP extensions
-    php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap,
+    php-mysql | php-mysqli, php-curl, php-gd, php-ldap,
 # Required PHP libraries
-    php-pear, php-mail-mime, 
+    php-pear, php-mail-mime, php-xml, php-mbstring,
 #    php-tcpdf,
 #    libfpdf-tpl-php, php-fpdf,
 #    libphp-adodb,

+ 1 - 1
htdocs/accountancy/customer/card.php

@@ -73,7 +73,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
  * View
  */
 
-llxHeader("", "", "FicheVentilation");
+llxHeader("", $langs->trans('FicheVentilation'));
 
 if ($cancel == $langs->trans("Cancel")) {
 	$action = '';

+ 4 - 4
htdocs/accountancy/expensereport/card.php

@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2004		Rodolphe Quiedeville	<rodolphe@quiedeville.org>
  * Copyright (C) 2005		Simon TOSSER			<simon@kornog-computing.com>
- * Copyright (C) 2013-2016	Alexandre Spangaro		<aspangaro@zendsi.com>
+ * Copyright (C) 2013-2017	Alexandre Spangaro		<aspangaro@zendsi.com>
  * Copyright (C) 2013-2014	Olivier Geffroy			<jeff@jeffinfo.com>
  * Copyright (C) 2013-2014	Florian Henry			<florian.henry@open-concept.pro>
  * Copyright (C) 2014		Juanjo Menent			<jmenent@2byte.es>
@@ -76,7 +76,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
 /*
  * View
  */
-llxHeader("", "FicheVentilation");
+llxHeader("", $langs->trans('FicheVentilation'));
 
 if ($cancel == $langs->trans("Cancel")) {
 	$action = '';
@@ -89,7 +89,7 @@ $formventilation = new FormVentilation($db);
 
 if (! empty($id)) {
 	$sql = "SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,";
-	$sql .= " f.id as fees_id, f.label as fees_label,";
+	$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
 	$sql .= " aa.account_number, aa.label";
 	$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
 	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
@@ -132,7 +132,7 @@ if (! empty($id)) {
 			print '<td>' . stripslashes(nl2br($objp->comments)) . '</td></tr>';
 
 			print '<tr><td>' . $langs->trans("TypeFees") . '</td>';
-			print '<td>' . dol_trunc($objp->fees_label, 24) . '</td>';
+			print '<td>' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>';
 
 			print '<tr><td>' . $langs->trans("Account") . '</td><td>';
 			print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);

+ 3 - 3
htdocs/accountancy/expensereport/lines.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2013-2016	Olivier Geffroy		<jeff@jeffinfo.com>
- * Copyright (C) 2013-2016	Alexandre Spangaro	<aspangaro@zendsi.com>
+ * Copyright (C) 2013-2017	Alexandre Spangaro	<aspangaro@zendsi.com>
  * Copyright (C) 2014-2015	Ari Elbaz (elarifr)	<github@accedinfo.com>  
  * Copyright (C) 2013-2016	Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2014		Juanjo Menent		<jmenent@2byte.es>
@@ -148,7 +148,7 @@ print '<script type="text/javascript">
 $sql = "SELECT er.ref, er.rowid as erid,";
 $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.date,";
 $sql .= " aa.label, aa.account_number,";
-$sql .= " f.id as fees_id, f.label as fees_label";
+$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
 $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
 $sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
 $sql .= " , " . MAIN_DB_PREFIX . "expensereport_det as erd";
@@ -282,7 +282,7 @@ if ($result) {
 
 		print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
 		
-		print '<td class="tdoverflow">' . $objp->fees_label . '</td>';
+		print '<td class="tdoverflow">' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>';
 
 		print '<td>';
 		$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));

+ 6 - 6
htdocs/accountancy/expensereport/list.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2013-2014	Olivier Geffroy			<jeff@jeffinfo.com>
- * Copyright (C) 2013-2016	Alexandre Spangaro		<aspangaro.dolibarr@gmail.com>
+ * Copyright (C) 2013-2017	Alexandre Spangaro		<aspangaro@zendsi.com>
  * Copyright (C) 2014-2015	Ari Elbaz (elarifr)		<github@accedinfo.com>
  * Copyright (C) 2013-2014	Florian Henry			<florian.henry@open-concept.pro>
  * Copyright (C) 2014		Juanjo Menent			<jmenent@2byte.es>s
@@ -175,7 +175,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
 // Expense report lines
 $sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
 $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.date,";
-$sql .= " f.id as fees_id, f.label as fees_label, f.accountancy_code as code_buy,";
+$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
 $sql .= " aa.rowid as aarowid";
 $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
 $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
@@ -302,20 +302,20 @@ if ($result) {
 
 		$expensereport_static->ref = $objp->ref;
 		$expensereport_static->id = $objp->erid;
-		
+
 		print '<tr '. $bc[$var].'>';
 
 		// Line id
 		print '<td>' . $objp->rowid . '</td>';
 
-		print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
-		
 		// Ref Expense report
 		print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
 
+		print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
+
 		// Fees label
 		print '<td>';
-		print $objp->fees_label;
+		print ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code)));
 		print '</td>';
 
 		// Fees description -- Can be null

+ 76 - 13
htdocs/accountancy/journal/bankjournal.php

@@ -4,7 +4,7 @@
  * Copyright (C) 2011		Juanjo Menent		<jmenent@2byte.es>
  * Copyright (C) 2012		Regis Houssin		<regis@dolibarr.fr>
  * Copyright (C) 2013		Christophe Battarel	<christophe.battarel@altairis.fr>
- * Copyright (C) 2013-2016	Alexandre Spangaro	<aspangaro.dolibarr@gmail.com>
+ * Copyright (C) 2013-2017	Alexandre Spangaro	<aspangaro@zendsi.com>
  * Copyright (C) 2013-2014	Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2013-2014	Olivier Geffroy		<jeff@jeffinfo.com>
  *
@@ -48,6 +48,9 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
 require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
 require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
 require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
+require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
+require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
+
 
 // Langs
 $langs->load("companies");
@@ -57,6 +60,8 @@ $langs->load("banks");
 $langs->load('bills');
 $langs->load('donations');
 $langs->load("accountancy");
+$langs->load("trips");
+$langs->load("hrm");
 
 $id_bank_account = GETPOST('id_account', 'int');
 
@@ -103,11 +108,14 @@ $idpays = $p[0];
 
 $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,";
 $sql .= " ba.courant, ba.ref as baref, ba.account_number,";
-$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop";
+$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 name, u.firstname as firstname, bu2.type as typeop";
 $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 . "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.rowid=" . $id_bank_account;
 $sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')';        // We don't share object for accountancy
 if ($date_start && $date_end)
@@ -123,6 +131,7 @@ $chargestatic = new ChargeSociales($db);
 $paymentdonstatic = new PaymentDonation($db);
 $paymentvatstatic = new TVA($db);
 $paymentsalstatic = new PaymentSalary($db);
+$paymentexpensereportstatic = new PaymentExpenseReport($db);
 
 // Get code of finance journal
 $bank_code_journal = new Account($db);
@@ -143,6 +152,7 @@ if ($result) {
 	$account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef"));
 
 	$tabcompany = array();
+	$tabuser = array();
 	$tabpay = array ();
 	$tabbq = array ();
 	$tabtp = array ();
@@ -169,6 +179,15 @@ if ($result) {
 				'name' => $obj->name,
 		        'code_compta' => $compta_soc,
 		);
+		
+		$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
+
+		$tabuser[$obj->rowid] = array (
+				'id' => $obj->userid,
+				'lastname' => $obj->lastname,
+				'firstname' => $obj->firstname,
+		        'accountancy_code' => $compta_user,
+		);
 
 		// Variable bookkeeping
 		$tabpay[$obj->rowid]["date"] = $obj->do;
@@ -187,7 +206,7 @@ if ($result) {
 		    // Now loop on each link of record in bank.
 			foreach ( $links as $key => $val ) {
 			    
-			    if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat')))     // So we excluded 'company' here
+			    if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport')))     // So we excluded 'company' here
 			    {
 			        // We save tabtype for a future use, to remember what kind of payment it is 
 			        $tabtype[$obj->rowid] = $links[$key]['type'];
@@ -211,7 +230,7 @@ if ($result) {
 					$userstatic->id = $links[$key]['url_id'];
 					$userstatic->name = $links[$key]['label'];
 					$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
-					// $tabtp[$obj->rowid][$compta_user] += $obj->amount;
+					$tabtp[$obj->rowid][$compta_user] += $obj->amount;
 				} else if ($links[$key]['type'] == 'sc') {
 					$chargestatic->id = $links[$key]['url_id'];
 					$chargestatic->ref = $links[$key]['url_id'];
@@ -256,7 +275,12 @@ if ($result) {
 					$paymentsalstatic->ref = $links[$key]['url_id'];
 					$paymentsalstatic->label = $links[$key]['label'];
 					$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
-					$tabtp[$obj->rowid][$account_employee] += $obj->amount;
+					// $tabtp[$obj->rowid][$account_employee] += $obj->amount;
+				} else if ($links[$key]['type'] == 'payment_expensereport') {
+					$paymentexpensereportstatic->id = $links[$key]['url_id'];
+					$paymentexpensereportstatic->fk_expensereport = $links[$key]['url_id'];
+					$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentexpensereportstatic->getNomUrl(2);
+					$tabpay[$obj->rowid]["fk_expensereport"] = $paymentexpensereportstatic->id;
 				} else if ($links[$key]['type'] == 'banktransfert') {
 					$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
 					$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
@@ -335,10 +359,10 @@ if (! $error && $action == 'writebookkeeping') {
     
     			if ($tabtype[$key] == 'payment') {
     			    $bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
-    			    	
+
     				$sqlmid = 'SELECT fac.facnumber';
-    				$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
-    				$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON  payfac.fk_facture=fac.rowid";
+    				$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac";
+    				$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
     				$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON  payfac.fk_paiement=pay.rowid";
     				$sqlmid .= " WHERE pay.fk_bank=" . $key;
     				dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
@@ -349,10 +373,10 @@ if (! $error && $action == 'writebookkeeping') {
     				}
     			} else if ($tabtype[$key] == 'payment_supplier') {
     			    $bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
-    			    	
+
     				$sqlmid = 'SELECT facf.ref_supplier, facf.ref';
-    				$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
-    				$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON  payfacf.fk_facturefourn=facf.rowid";
+    				$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf";
+    				$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
     				$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON  payfacf.fk_paiementfourn=payf.rowid";
     				$sqlmid .= " WHERE payf.fk_bank=" . $key;
     				dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
@@ -361,6 +385,19 @@ if (! $error && $action == 'writebookkeeping') {
     					$objmid = $db->fetch_object($resultmid);
     					$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice
     				}
+    			} else if ($tabtype[$key] == 'payment_expensereport') {
+    			    $bookkeeping->code_tiers = $tabuser[$key]['accountancy_code'];
+
+    				$sqlmid = 'SELECT e.ref';
+    				$sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e";
+    				$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "payment_expensereport as payer ON payer.fk_expensereport=e.rowid";
+    				$sqlmid .= " WHERE payer.fk_expensereport=" . $val["fk_expensereport"];
+    				dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
+    				$resultmid = $db->query($sqlmid);
+    				if ($resultmid) {
+    					$objmid = $db->fetch_object($resultmid);
+    					$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
+    				}
     			}
     
     			$result = $bookkeeping->create($user);
@@ -481,6 +518,7 @@ if ($action == 'export_csv') {
 	include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
 
 	$companystatic = new Client($db);
+	$userstatic = new User($db);
 
 	// Model Cegid Expert Export
 	if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
@@ -504,12 +542,19 @@ if ($action == 'export_csv') {
 				$reflabel = $langs->trans('Donation');
 			}
 			if ($reflabel == '(SubscriptionPayment)') {
-				$reflabel = $langs->trans('Donation');
+				$reflabel = $langs->trans('Subscription');
+			}
+			if ($reflabel == '(ExpenseReportPayment)') {
+				$reflabel = $langs->trans('Employee');
 			}
 			
 			$companystatic->id = $tabcompany[$key]['id'];
 			$companystatic->name = $tabcompany[$key]['name'];
 
+			$userstatic->id = $tabuser[$key]['id'];
+			$userstatic->lastname = $tabuser[$key]['lastname'];
+			$userstatic->firstname = $tabuser[$key]['firstname'];
+
 			// Bank
 			foreach ( $tabbq[$key] as $k => $mt ) {
 				print $date . $sep;
@@ -646,6 +691,7 @@ $form = new Form($db);
 if (empty($action) || $action == 'view') {
 	$invoicestatic = new Facture($db);
 	$invoicesupplierstatic = new FactureFournisseur($db);
+	$expensereportstatic = new ExpenseReport($db);
 	
 	llxHeader('', $langs->trans("FinanceJournal"));
 
@@ -723,7 +769,10 @@ if (empty($action) || $action == 'view') {
 			$reflabel = $langs->trans('Donation');
 		}
 		if ($reflabel == '(SubscriptionPayment)') {
-			$reflabel = $langs->trans('SubscriptionPayment');
+			$reflabel = $langs->trans('Subscription');
+		}
+		if ($reflabel == '(ExpenseReportPayment)') {
+			$reflabel = $langs->trans('Employee');
 		}
 		
 		$ref=$reflabel;
@@ -755,6 +804,20 @@ if (empty($action) || $action == 'view') {
 		    }
 		    else dol_print_error($db);
 		}
+		elseif ($tabtype[$key] == 'payment_expensereport')
+		{
+		    $sqlmid = 'SELECT payer.fk_expensereport as id';
+		    $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as payer";
+		    $sqlmid .= " WHERE payer.fk_expensereport=" . $val["fk_expensereport"];
+		    dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
+		    $resultmid = $db->query($sqlmid);
+		    if ($resultmid) {
+		        $objmid = $db->fetch_object($resultmid);
+		        $expensereportstatic->fetch($objmid->id);
+		        $ref=$langs->trans("ExpenseReport").' '.$expensereportstatic->getNomUrl(1);
+		    }
+		    else dol_print_error($db);
+		}
 
 
 		/*$invoicestatic->id = $key;

+ 1 - 1
htdocs/accountancy/supplier/card.php

@@ -76,7 +76,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
 /*
  * View
  */
-llxHeader("", "", "FicheVentilation");
+llxHeader("", $langs->trans('FicheVentilation'));
 
 if ($cancel == $langs->trans("Cancel")) {
 	$action = '';

+ 3 - 3
htdocs/adherents/agenda.php

@@ -141,7 +141,7 @@ if ($object->id > 0)
 
     if (! empty($conf->agenda->enabled))
     {
-        print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1">'.$langs->trans("AddAction").'</a></div>';
+        print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a></div>';
     }
 
     print '</div>';
@@ -167,10 +167,10 @@ if ($object->id > 0)
     print load_fiche_titre($langs->trans("ActionsOnMember"),$out,'');
 
     // List of todo actions
-    show_actions_todo($conf,$langs,$db,$object);
+    //show_actions_todo($conf,$langs,$db,$object);
 
     // List of done actions
-    show_actions_done($conf,$langs,$db,$object);
+    show_actions_done($conf,$langs,$db,$object,null,0,'','');
 }
 
 

+ 1 - 1
htdocs/admin/dict.php

@@ -937,7 +937,7 @@ print "<br>\n";
 // Confirmation de la suppression de la ligne
 if ($action == 'delete')
 {
-    print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
+    print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
 }
 //var_dump($elementList);
 

+ 2 - 2
htdocs/admin/facture.php

@@ -638,7 +638,7 @@ if (! empty($conf->banque->enabled))
     $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
     $sql.= " WHERE clos = 0";
     $sql.= " AND courant = 1";
-    $sql.= " AND entity IN (".getEntity('bank', 1).")";
+    $sql.= " AND entity IN (".getEntity('bank_account', 1).")";
     $resql=$db->query($sql);
     if ($resql)
     {
@@ -683,7 +683,7 @@ $sql = "SELECT rowid, label";
 $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
 $sql.= " WHERE clos = 0";
 $sql.= " AND courant = 1";
-$sql.= " AND entity IN (".getEntity('bank', 1).")";
+$sql.= " AND entity IN (".getEntity('bank_account', 1).")";
 $var=True;
 $resql=$db->query($sql);
 if ($resql)

+ 3 - 3
htdocs/categories/class/categorie.class.php

@@ -1532,14 +1532,14 @@ class Categorie extends CommonObject
             {
     			while (($file = readdir($handle)) !== false)
     			{
-    				if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
+    				if (dol_is_file($dir.$file) && preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
     				{
     					$nbphoto++;
     					$photo = $file;
 
     					// On determine nom du fichier vignette
     					$photo_vignette='';
-    					if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
+    					if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
     					{
     						$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0];
     					}
@@ -1582,7 +1582,7 @@ class Categorie extends CommonObject
 		dol_delete_file($file,1);
 
 		// Si elle existe, on efface la vignette
-		if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
+		if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
 		{
 			$photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0];
 			if (file_exists($dirthumb.$photo_vignette))

+ 8 - 1
htdocs/comm/action/index.php

@@ -957,7 +957,14 @@ if (count($listofextcals))
 // Complete $eventarray with events coming from external module
 $parameters=array(); $object=null;
 $reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action);
-if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']);
+if (! empty($hookmanager->resArray['eventarray'])) {
+    foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) {
+        if (!isset($eventarray[$keyDate])) {
+            $eventarray[$keyDate]=array();
+        }
+        $eventarray[$keyDate]=array_merge($eventarray[$keyDate], $events);
+    }
+}
 
 
 

+ 2 - 2
htdocs/compta/bank/bankentries.php

@@ -177,7 +177,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
 
 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
 
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
 {
     $search_dt_start='';
     $search_dt_end='';
@@ -297,7 +297,7 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
     if (! $error)
     {
         $object->fetch($id);
-        $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
+        $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user);
         if ($insertid > 0)
         {
             setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');

+ 1 - 1
htdocs/compta/bank/categ.php

@@ -80,7 +80,7 @@ if ($categid) {
 llxHeader();
 
 
-print load_fiche_titre($langs->trans("Rubriques"), '', 'title_bank.png');
+print load_fiche_titre($langs->trans("RubriquesTransactions"), '', 'title_bank.png');
 
 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

+ 2 - 2
htdocs/compta/bank/class/account.class.php

@@ -390,7 +390,7 @@ class Account extends CommonObject
      *  @param	string		$label			Descripton
      *  @param	float		$amount			Amount
      *  @param	string		$num_chq		Numero cheque ou virement
-     *  @param	string		$categorie		Categorie optionnelle
+     *  @param	int  		$categorie		Category id (optionnal)
      *  @param	User		$user			User that create
      *  @param	string		$emetteur		Name of cheque writer
      *  @param	string		$banque			Bank of cheque writer
@@ -480,8 +480,8 @@ class Account extends CommonObject
 
 				$result = $this->db->query($sql);
 				if (!$result) {
+					$this->error = $this->db->lasterror();
 					$this->db->rollback();
-					$this->error = $this->db->error();
 					return -3;
 				}
 			}

+ 10 - 2
htdocs/compta/facture/fiche-rec.php

@@ -994,7 +994,7 @@ if ($action == 'create')
 		// Bank account
 		if ($object->fk_account > 0)
 		{
-			print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
+			print "<tr><td>".$langs->trans('RIB')."</td><td>";
 			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
 			print "</td></tr>";
 		}
@@ -1268,9 +1268,11 @@ else
 		print '</tr>';
 
 		// Bank Account
+		$langs->load('banks');
+
 		print '<tr><td class="nowrap">';
 		print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
-		print $langs->trans('BankAccount');
+		print $langs->trans('RIB');
 		print '<td>';
 		if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
 		    print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
@@ -1540,8 +1542,14 @@ else
 		$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,";
 		$sql.= " f.date_last_gen, f.date_when";
 		$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
+		if (! $user->rights->societe->client->voir && ! $socid) {
+			$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+		}
 		$sql.= " WHERE f.fk_soc = s.rowid";
 		$sql.= " AND f.entity = ".$conf->entity;
+		if (! $user->rights->societe->client->voir && ! $socid) {
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+		}
 		if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
 		if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
 		if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency);

+ 3 - 4
htdocs/compta/paiement/card.php

@@ -236,7 +236,7 @@ $disable_delete = 0;
 // Bank account
 if (! empty($conf->banque->enabled))
 {
-    if ($object->bank_account)
+    if ($object->fk_account > 0)
     {
     	$bankline=new AccountLine($db);
     	$bankline->fetch($object->bank_line);
@@ -257,9 +257,8 @@ if (! empty($conf->banque->enabled))
     	print '<td>'.$langs->trans('BankAccount').'</td>';
 		print '<td colspan="3">';
 		$accountstatic=new Account($db);
-        $accountstatic->id=$bankline->fk_account;
-	    $accountstatic->label=$bankline->bank_account_ref.' - '.$bankline->bank_account_label;
-        print $accountstatic->getNomUrl(0);
+		$accountstatic->fetch($bankline->fk_account);
+        print $accountstatic->getNomUrl(1);
     	print '</td>';
     	print '</tr>';
 

+ 1 - 1
htdocs/contact/list.php

@@ -787,7 +787,7 @@ while ($i < min($num,$limit))
     print '<td align="right">';
     print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;contactid='.$obj->cidp.'&amp;socid='.$obj->socid.'">'.img_object($langs->trans("AddAction"),"action").'</a>';
     print ' &nbsp; ';
-    print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$obj->cidp.'">';
+    print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$obj->cidp.'">';
     print img_picto($langs->trans("VCard"),'vcard.png').' ';
     print '</a></td>';
 

+ 51 - 32
htdocs/core/class/CMailFile.class.php

@@ -55,7 +55,6 @@ class CMailFile
 
 	var $eol;
 	var $eol2;
-	var $atleastonefile=0;
 	var $error='';
 
 	var $smtps;			// Contains SMTPs object (if this method is used)
@@ -74,7 +73,7 @@ class CMailFile
 	// Image
 	var $html;
 	var $image_boundary;
-	var $atleastoneimage=0;
+	var $atleastoneimage=0;    // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used).
 	var $html_images=array();
 	var $images_encoded=array();
 	var $image_types = array('gif'  => 'image/gif',
@@ -108,7 +107,7 @@ class CMailFile
 	 */
 	function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='')
 	{
-		global $conf;
+		global $conf, $dolibarr_main_data_root;
 
 		// We define end of line (RFC 821).
 		$this->eol="\r\n";
@@ -160,8 +159,12 @@ class CMailFile
 		if ($this->msgishtml)
 		{
 			$this->html = $msg;
-			$findimg = $this->findHtmlImages($conf->fckeditor->dir_output);
 
+            if (! empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS))
+            {
+                $findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias');
+            }
+            
 			// Define if there is at least one file
 			if ($findimg)
 			{
@@ -231,17 +234,6 @@ class CMailFile
 			// Define body in text_body
 			$text_body = $this->write_body($msg);
 
-			// Encode images
-			$images_encoded = '';
-			if ($this->atleastoneimage)
-			{
-				$images_encoded.= $this->write_images($this->images_encoded);
-				// always end related and end alternative after inline images
-				$images_encoded.= "--" . $this->related_boundary . "--" . $this->eol;
-				$images_encoded.= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol;
-				$images_encoded.= $this->eol;
-			}
-
 			// Add attachments to text_encoded
 			if ($this->atleastonefile)
 			{
@@ -255,8 +247,8 @@ class CMailFile
 			// comme des injections mail par les serveurs de messagerie.
 			$this->headers = preg_replace("/([\r\n]+)$/i","",$this->headers);
 
-			$this->message = 'This is a message with multiple parts in MIME format.'.$this->eol;
-			$this->message.= $text_body . $images_encoded . $files_encoded;
+			$this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol;
+			$this->message.= $text_body . $files_encoded;
 			$this->message.= "--" . $this->mixed_boundary . "--" . $this->eol;
 		}
 		else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps')
@@ -917,7 +909,7 @@ class CMailFile
 
 		$out.= "Content-Type: multipart/mixed; boundary=\"".$this->mixed_boundary."\"".$this->eol2;
 		$out.= "Content-Transfer-Encoding: 8bit".$this->eol2;
-
+		
 		dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
 		return $out;
 	}
@@ -973,23 +965,23 @@ class CMailFile
 			$out.= "--" . $this->alternative_boundary . $this->eol;
 		}
 
-		if ($this->msgishtml)
-		{
-			// Check if html header already in message
-			$strContent = $this->checkIfHTML($msgtext);
-		}
-		else
-		{
-			$strContent = $msgtext;
-		}
-
 		// Make RFC821 Compliant, replace bare linefeeds
-		$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
+		$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $msgtext);
 		if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
 		{
 			$strContent = preg_replace("/\r\n/si", "\n", $strContent);
 		}
 
+		$strContentAltText = '';
+		if ($this->msgishtml)
+		{
+			$strContentAltText = html_entity_decode(strip_tags($strContent));
+			$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
+		    
+		    // Check if html header already in message, if not complete the message
+			$strContent = $this->checkIfHTML($strContent);
+		}
+
 		// Make RFC2045 Compliant, split lines
         //$strContent = rtrim(chunk_split($strContent));    // Function chunck_split seems ko if not used on a base64 content
         $strContent = rtrim(wordwrap($strContent));   // TODO Using this method creates unexpected line break on text/plain content.
@@ -999,14 +991,30 @@ class CMailFile
 			if ($this->atleastoneimage)
 			{
 				$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
-				$out.= $this->eol.strip_tags($strContent).$this->eol; // Add plain text message
+				$out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message
 				$out.= "--" . $this->alternative_boundary . $this->eol;
 				$out.= "Content-Type: multipart/related; boundary=\"".$this->related_boundary."\"".$this->eol;
 				$out.= $this->eol;
 				$out.= "--" . $this->related_boundary . $this->eol;
 			}
+			
+			if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART))    // Add plain text message part before html part
+			{
+				$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
+				$out.= $this->eol;
+				$out.= "--" . $this->alternative_boundary . $this->eol;
+				$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
+			    $out.= $this->eol.$strContentAltText.$this->eol;
+			    $out.= "--" . $this->alternative_boundary . $this->eol;
+			}
+			
 			$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
 			$out.= $this->eol.$strContent.$this->eol;
+		
+			if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART))    // Add plain text message part after html part
+			{
+			    $out.= "--" . $this->alternative_boundary . "--". $this->eol;
+			}
 		}
 		else
 		{
@@ -1016,6 +1024,16 @@ class CMailFile
 
 		$out.= $this->eol;
 
+		// Encode images
+		if ($this->atleastoneimage)
+		{
+		    $out .= $this->write_images($this->images_encoded);
+		    // always end related and end alternative after inline images
+		    $out .= "--" . $this->related_boundary . "--" . $this->eol;
+		    $out .= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol;
+		    $out .= $this->eol;
+		}
+		
 		return $out;
 	}
 
@@ -1184,14 +1202,15 @@ class CMailFile
 		$extensions = array_keys($this->image_types);
 
 
-		preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches);
+		preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches);  // If "xxx.ext" or 'xxx.ext' found
 
 		if ($matches)
 		{
 			$i=0;
 			foreach ($matches[1] as $full)
 			{
-				if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs))
+
+                if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs))   // If xxx is 'file=aaa'
 				{
 					$img = $regs[1];
 

+ 10 - 2
htdocs/core/class/commonobject.class.php

@@ -3141,8 +3141,16 @@ abstract class CommonObject
 		$resql = $this->db->query($sql);
 		if ($resql)
 		{
-			$res = $this->db->fetch_object($resql);
-			return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
+			$num = $this->db->num_rows($resql);
+			if ($num > 0)
+			{
+				$res = $this->db->fetch_object($resql);
+				return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
+			}
+			else
+			{
+				return '';
+			}
 		}
 		else
 		{

+ 2 - 2
htdocs/core/class/extrafields.class.php

@@ -112,7 +112,7 @@ class ExtraFields
 	 *
 	 *  @param	string	$attrname           Code of attribute
 	 *  @param  string	$label              label of attribute
-	 *  @param  int		$type               Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')
+	 *  @param  int		$type               Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
 	 *  @param  int		$pos                Position of attribute
 	 *  @param  string	$size               Size/length of attribute
 	 *  @param  string	$elementtype        Element type ('member', 'product', 'thirdparty', ...)
@@ -164,7 +164,7 @@ class ExtraFields
 	 *  This is a private method. For public method, use addExtraField.
 	 *
 	 *	@param	string	$attrname			code of attribute
-	 *  @param	int		$type				Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')
+	 *  @param	int		$type				Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...)
 	 *  @param	string	$length				Size/length of attribute ('5', '24,8', ...)
 	 *  @param  string	$elementtype        Element type ('member', 'product', 'thirdparty', 'contact', ...)
 	 *  @param	int		$unique				Is field unique or not

+ 4 - 1
htdocs/core/class/hookmanager.class.php

@@ -126,7 +126,7 @@ class HookManager
         if (! is_array($this->hooks) || empty($this->hooks)) return '';
 
         $parameters['context']=join(':',$this->contextarray);
-        dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
+        //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
 
         // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray).
         $hooktype='output';
@@ -200,6 +200,9 @@ class HookManager
 
                     // test to avoid running twice a hook, when a module implements several active contexts
                     if (in_array($module,$modulealreadyexecuted)) continue;
+                    
+                    dol_syslog(get_class($this).'::executeHooks a qualified hook was found for method='.$method.' module='.$module." action=".$action." context=".$context);
+                    
                     $modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method to avoid running twice
 
                     // Clean class (an error may have been set from a previous call of another method for same module/hook)

+ 23 - 13
htdocs/core/class/html.form.class.php

@@ -3275,11 +3275,14 @@ class Form
             print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
             print '</form>';
         } else {
+
+        	$langs->load('banks');
+
             if ($selected) {
                 require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
                 $bankstatic=new Account($this->db);
                 $bankstatic->fetch($selected);
-                print $this->textwithpicto($bankstatic->label,$langs->trans("AccountCurrency").'&nbsp;'.$bankstatic->currency_code);
+                print $this->textwithpicto($bankstatic->getNomUrl(1),$langs->trans("AccountCurrency").'&nbsp;'.$bankstatic->currency_code);
             } else {
                 print "&nbsp;";
             }
@@ -5182,7 +5185,7 @@ class Form
      */
     static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage)
     {
-        global $conf,$user;
+        global $conf,$langs,$user;
 
         if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return '';
 
@@ -5215,7 +5218,7 @@ class Form
            }
            if ($val['label'])
 	       {
-	           $lis.='<li><input type="checkbox" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/>'.dol_escape_htmltag($val['label']).'</li>';
+	           $lis.='<li><input type="checkbox" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/>'.dol_escape_htmltag($langs->trans($val['label'])).'</li>';
 	           $listcheckedstring.=(empty($val['checked'])?'':$key.',');
 	       }
         }
@@ -5447,16 +5450,23 @@ class Form
 		
 		if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
 
-		$possiblelinks=array(
-			'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
-			'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
-			'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
-			'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
-			'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
-			'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
-			'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
-			'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id)
-		);
+		$possiblelinks=array();
+		if (is_object($object->thirdparty) && ! empty($object->thirdparty->id) && $object->thirdparty->id > 0)
+		{
+    		$listofidcompanytoscan=$object->thirdparty->id;
+    		if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent;
+    		
+    		$possiblelinks=array(
+    		    'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal',1).')'),
+    		    'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande',1).')'),
+    		    'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture',1).')'),
+    		    'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract',1).')'),
+    		    'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention',1).')'),
+    		    'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal',1).')'),
+    		    'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur',1).')'),
+    		    'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn',1).')')
+    		);
+		}
 		
 		global $action;
 		

+ 5 - 0
htdocs/core/class/html.formfile.class.php

@@ -89,6 +89,11 @@ class FormFile
         }
         else
        	{
+	        //If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed
+	        if (!$perm && !empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
+		        return 1;
+	        }
+
             $maxlength=$size;
 
             $out = "\n\n<!-- Start form attach new file -->\n";

+ 16 - 4
htdocs/core/class/html.formother.class.php

@@ -604,10 +604,22 @@ class FormOther
     	$textcolor='FFF';
     	if ($color)
     	{
-        	$hex=$color;
-        	$r = hexdec($hex[0].$hex[1]);
-        	$g = hexdec($hex[2].$hex[3]);
-        	$b = hexdec($hex[4].$hex[5]);
+    	    $tmp=explode(',', $color);
+    	    if (count($tmp) > 1)   // This is a comma RGB ('255','255','255')
+    	    {
+    	        $r = $tmp[0];
+    	        $g = $tmp[1];
+    	        $b = $tmp[2];
+    	    }
+    	    else
+    	    {
+    	        $hexr=$color[0].$color[1];
+    	        $hexg=$color[2].$color[3];
+    	        $hexb=$color[4].$color[5];
+            	$r = hexdec($hexr);
+            	$g = hexdec($hexg);
+            	$b = hexdec($hexb);
+    	    }
         	$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0;    // HSL algorithm
             if ($bright > 0.6) $textcolor='000';     	   
     	}

+ 41 - 9
htdocs/core/class/smtps.class.php

@@ -1283,15 +1283,23 @@ class SMTPs
 		// Make RFC821 Compliant, replace bare linefeeds
 		$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
 
+		$strContentAltText = '';
+		if ($strType == 'html')
+		{
+			$strContentAltText = html_entity_decode(strip_tags($strContent));
+			$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
+		}
+		
 		// Make RFC2045 Compliant
 		//$strContent = rtrim(chunk_split($strContent));    // Function chunck_split seems ko if not used on a base64 content
 		$strContent = rtrim(wordwrap($strContent, 75, "\r\n"));   // TODO Using this method creates unexpected line break on text/plain content.
-
+		
 		$this->_msgContent[$strType] = array();
 
 		$this->_msgContent[$strType]['mimeType'] = $strMimeType;
 		$this->_msgContent[$strType]['data']     = $strContent;
-
+		$this->_msgContent[$strType]['dataText'] = $strContentAltText;
+		
 		if ( $this->getMD5flag() )
 		$this->_msgContent[$strType]['md5']      = dol_hash($strContent, 3);
 		//}
@@ -1304,6 +1312,8 @@ class SMTPs
 	 */
 	function getBodyContent()
 	{
+	    global $conf;
+	    
 		// Generate a new Boundary string
 		$this->_setBoundary();
 
@@ -1318,7 +1328,7 @@ class SMTPs
 		die ("Sorry, no content");
 
 		// If we have ONE, we can use the simple format
-		else if( $keyCount === 1 )
+		else if( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART))
 		{
 			$_msgData = $this->_msgContent;
 			$_msgData = $_msgData[$_types[0]];
@@ -1336,7 +1346,7 @@ class SMTPs
 		}
 
 		// If we have more than ONE, we use the multi-part format
-		else if( $keyCount > 1 )
+		else if( $keyCount >= 1 || ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART))
 		{
 			// Since this is an actual multi-part message
 			// We need to define a content message Boundary
@@ -1351,14 +1361,18 @@ class SMTPs
 			$content .= "\r\n";
 
 			$content .= "--" . $this->_getBoundary('mixed') . "\r\n";
-
-			if (key_exists('image', $this->_msgContent))
+			
+			if (key_exists('image', $this->_msgContent))     // If inline image found
 			{
 				$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
 				$content .= "\r\n";
 				$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
 			}
 
+			
+			// $this->_msgContent must be sorted with key 'text' or 'html' first then 'image' then 'attachment'
+
+
 			// Loop through message content array
 			foreach ($this->_msgContent as $type => $_content )
 			{
@@ -1409,13 +1423,24 @@ class SMTPs
 					if (key_exists('image', $this->_msgContent))
 					{
 						$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
-						$content.= "\r\n" . strip_tags($_content['data']) . "\r\n"; // Add plain text message
+						$content.= "\r\n" . ($_content['dataText']?$_content['dataText']:strip_tags($_content['data'])) . "\r\n"; // Add plain text message
 						$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
 						$content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n";
 						$content.= "\r\n";
 						$content.= "--" . $this->_getBoundary('related') . "\r\n";
 					}
-
+					
+					if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART))  // Add plain text message part before html part
+					{
+					    $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
+    					$content .= "\r\n";
+	       				$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
+					
+	       				$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
+	       				$content.= "\r\n". $_content['dataText'] . "\r\n";
+	       				$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
+					}	       				
+	       				
 					$content .= 'Content-Type: ' . $_content['mimeType'] . '; '
 					//                             . 'charset="' . $this->getCharSet() . '"';
 					. 'charset=' . $this->getCharSet() . '';
@@ -1431,7 +1456,14 @@ class SMTPs
 					if ( $this->getMD5flag() )
 					$content .= 'Content-MD5: ' . $_content['md5'] . "\r\n";
 
-					$content .= "\r\n"	. $_content['data'] . "\r\n\r\n";
+					$content .= "\r\n"	. $_content['data'] . "\r\n";
+
+					if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART))  // Add plain text message part after html part
+					{
+					    $content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n";
+					}
+					
+					$content .= "\r\n";
 				}
 			}
 

+ 5 - 2
htdocs/core/lib/company.lib.php

@@ -960,7 +960,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
  * 		@param	Contact		       $objcon		   Object contact
  *      @param  int			       $noprint        Return string but does not output it
  *      @param  string		       $actioncode     Filter on actioncode
- *      @param  string             $donetodo       Filter on event 'done' or 'todo' or ''=nofilter.
+ *      @param  string             $donetodo       Filter on event 'done' or 'todo' or ''=nofilter (all).
  *      @param  array              $filters        Filter on other fields
  *      @param  string             $sortfield      Sort field
  *      @param  string             $sortorder      Sort order
@@ -1181,7 +1181,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
 		{
             $out.='<td>';
             if (get_class($filterobj) == 'Societe') $out.='<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$filterobj->id.'&amp;status=done">';
-            $out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort");
+            $out.=($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
+            $out.=($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '');
+            $out.=($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : '');
+            //$out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort");
             if (get_class($filterobj) == 'Societe') $out.='</a>';
             $out.='</td>';
 		}

+ 3 - 2
htdocs/core/menus/standard/eldy.lib.php

@@ -1107,10 +1107,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
 
             if (! empty($conf->categorie->enabled)) {
                 $langs->load("categories");
-                //$newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
                 $newmenu->add("/categories/index.php?type=5",$langs->trans("Rubriques"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags');
                 $newmenu->add("/categories/card.php?action=create&amp;type=5",$langs->trans("NewCategory"),1,$user->rights->categorie->creer);
-            }
+                $newmenu->add("/compta/bank/categ.php",$langs->trans("RubriquesTransactions"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags');
+                $newmenu->add("/compta/bank/categ.php",$langs->trans("NewCategory"),1,$user->rights->categorie->creer, '', $mainmenu, 'tags');
+	    }
 
 			// Prelevements
 			if (! empty($conf->prelevement->enabled))

+ 2 - 2
htdocs/core/modules/modAgenda.class.php

@@ -82,9 +82,9 @@ class modAgenda extends DolibarrModules
 		{
 		    while ($obj = $this->db->fetch_object($sqlreadactions))
 		    {
-		        if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE')))) continue;    // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty or product creation because there is no validation). 
-		        if (preg_match('/^PROJECT_/',$obj->code)) continue;   // We don't track such events by default.
+		        if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue;    // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). 
 		        if (preg_match('/^TASK_/',$obj->code)) continue;      // We don't track such events by default.
+		        if (preg_match('/^_MODIFY/',$obj->code)) continue;    // We don't track such events by default.
 		        $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1");
 		    }
 		}

+ 19 - 5
htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php

@@ -658,6 +658,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
 
 			$object->sendtoid=0;
         }
+		elseif ($action == 'MEMBER_MODIFY')
+        {
+            $langs->load("agenda");
+            $langs->load("other");
+            $langs->load("members");
+
+			$object->actiontypecode='AC_OTH_AUTO';
+            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->ref);
+            $object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->ref);
+            $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+            $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+            $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
+
+            $object->sendtoid=0;
+		}
         elseif ($action == 'MEMBER_SUBSCRIPTION')
         {
             $langs->load("agenda");
@@ -721,21 +736,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
 
         	$object->sendtoid=0;
         }
-        elseif($action == 'PROJECT_CREATE') {
+        elseif($action == 'PROJECT_VALIDATE') {
             $langs->load("agenda");
             $langs->load("other");
             $langs->load("projects");
         
             $object->actiontypecode='AC_OTH_AUTO';
         
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
-            $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
-            $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref);
+            $object->actionmsg=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref);
+            $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
             $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
         
             $object->sendtoid=0;
         }
-        
         elseif($action == 'PROJECT_MODIFY') {
             $langs->load("agenda");
             $langs->load("other");

+ 1 - 1
htdocs/core/triggers/interface_50_modNotification_Notification.class.php

@@ -66,7 +66,7 @@ class InterfaceNotification extends DolibarrTriggers
 		require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
 		$notify = new Notify($this->db);
 		
-		if (! in_array($notifcode, $notify->arrayofnotifsupported)) return 0;
+		if (! in_array($action, $notify->arrayofnotifsupported)) return 0;
 
 		dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
 

+ 1 - 1
htdocs/filefunc.inc.php

@@ -31,7 +31,7 @@
  */
 
 if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
-if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.1');                         // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
+if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.2');                         // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
 
 if (! defined('EURO')) define('EURO',chr(128));
 

+ 1 - 0
htdocs/fourn/class/fournisseur.commande.class.php

@@ -1503,6 +1503,7 @@ class CommandeFournisseur extends CommonOrder
             $this->line->product_type=$product_type;
             $this->line->remise_percent=$remise_percent;
             $this->line->subprice=$pu_ht;
+            $this->line->rang=$this->rang;
             $this->line->info_bits=$info_bits;
             
             $this->line->vat_src_code=$vat_src_code;

+ 14 - 6
htdocs/fourn/facture/card.php

@@ -1087,7 +1087,7 @@ if (empty($reshook))
 	    $action = '';
 	}
 
-	elseif ($action == 'classin')
+	elseif ($action == 'classin' && $user->rights->fournisseur->facture->creer)
 	{
 	    $object->fetch($id);
 	    $result=$object->setProject($projectid);
@@ -2103,7 +2103,9 @@ else
 		print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
 		print $langs->trans('PaymentConditions');
 		print '<td>';
-		if ($action != 'editconditions') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
+		if ($action != 'editconditions' && $user->rights->fournisseur->facture->creer) {
+			print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
+		}
 		print '</tr></table>';
 		print '</td><td colspan="2">';
 		if ($action == 'editconditions')
@@ -2123,7 +2125,9 @@ else
 		print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
 		print $langs->trans('PaymentMode');
 		print '</td>';
-		if ($action != 'editmode') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
+		if ($action != 'editmode' && $user->rights->fournisseur->facture->creer) {
+			print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
+		}
 		print '</tr></table>';
 		print '</td><td colspan="2">';
 		if ($action == 'editmode')
@@ -2198,7 +2202,7 @@ else
         }
         print "</td>";
         print '</tr>';
-		
+
 		// Incoterms
 		if (!empty($conf->incoterm->enabled))
 		{
@@ -2620,13 +2624,17 @@ else
 	 	 		// Reopen a standard paid invoice
 	            if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3))				// A paid invoice (partially or completely)
 	            {
-	                if (! $facidnext && $object->close_code != 'replaced')	// Not replaced by another invoice
+	                if (! $facidnext && $object->close_code != 'replaced' && $user->rights->fournisseur->facture->creer)	// Not replaced by another invoice
 	                {
 	                    print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>';
 	                }
 	                else
 	                {
-	                    print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span></div>';
+	                	if ($user->rights->fournisseur->facture->creer) {
+	                        print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span></div>';
+		                } elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
+			                print '<div class="inline-block divButAction"><span class="butActionRefused">'.$langs->trans('ReOpen').'</span></div>';
+		                }
 	                }
 	            }
 

+ 2 - 5
htdocs/fourn/facture/paiement.php

@@ -615,19 +615,16 @@ if (empty($action))
     if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
     $sql.= ' SUM(f.amount)';
     $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
-    if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
     $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
     $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
     $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
     $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
     $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
     $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
+    if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
     $sql.= " WHERE f.entity = ".$conf->entity;
     if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-    if ($socid)
-    {
-        $sql .= ' AND f.fk_soc = '.$socid;
-    }
+    if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
     // Search criteria
     if ($search_ref)       		    $sql .= natural_search('p.rowid', $search_ref);
     if ($search_account > 0)      	$sql .=" AND b.fk_account=".$search_account;

+ 14 - 11
htdocs/install/mysql/data/llx_c_action_trigger.sql

@@ -68,19 +68,22 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION','Member subscribed','Executed when a member is subscribed','member',23);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19);
--- actions not enabled by default (no constant created for that) when we enable module agenda 
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SUBSCRIPTION','Member subscribed','Executed when a member is subscribed','member',24);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',25);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',27);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',32);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',33);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',34);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',35);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',140);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142);
+-- actions not enabled by default (no constant created for that) when we enable module agenda 
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',26);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',31);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',152);

+ 67 - 9
htdocs/install/repair.php

@@ -76,6 +76,7 @@ print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_log
 print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements')?GETPOST('clean_linked_elements'):'0').'<br>'."\n";
 print 'Option clean_orphelin_dir (1 or confirmed) is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
 print 'Option clean_product_stock_batch (1 or confirmed) is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
+print 'Option set_empty_time_spent_amount (1 or confirmed) is '.(GETPOST('set_empty_time_spent_amount')?GETPOST('set_empty_time_spent_amount'):'0').'<br>'."\n";
 print '<br>';
 
 print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
@@ -151,7 +152,7 @@ if ($ok)
 }
 
 // Show wait message
-print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'</td></tr>';
+print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'<br><br></td></tr>';
 flush();
 
 
@@ -190,7 +191,7 @@ if ($ok)
     // Loop on each file
     foreach($filelist as $file)
     {
-        print '<tr><td class="nowrap">';
+        print '<tr><td class="nowrap">*** ';
         print $langs->trans("Script").'</td><td align="right">'.$file.'</td></tr>';
 
         $name = substr($file, 0, dol_strlen($file) - 4);
@@ -210,7 +211,7 @@ if ($ok)
 				'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
 				'commande_fournisseur'=>'commande_fournisseur', 'actioncomm'=>'actioncomm',
 				'adherent_type'=>'adherent_type','user'=>'user','projet'=>'projet', 'projet_task'=>'projet_task');
-	print '<tr><td colspan="2"><br>Check fields into extra table structure match table of definition. If not add column into table</td></tr>';
+	print '<tr><td colspan="2"><br>*** Check fields into extra table structure match table of definition. If not add column into table</td></tr>';
 	foreach($listofmodulesextra as $tablename => $elementtype)
 	{
 	    // Get list of fields
@@ -324,7 +325,7 @@ if ($ok && GETPOST('restore_thirdparties_logos'))
 
 	$ext='';
 	
-	print '<tr><td colspan="2"><br>';
+	print '<tr><td colspan="2"><br>*** Restore thirdparties logo<br>';
 	//foreach($exts as $ext)
 	//{
 		$sql="SELECT s.rowid, s.nom as name, s.logo FROM ".MAIN_DB_PREFIX."societe as s ORDER BY s.nom";
@@ -395,7 +396,7 @@ if ($ok && GETPOST('restore_thirdparties_logos'))
 // clean_linked_elements: Check and clean linked elements
 if ($ok && GETPOST('clean_linked_elements'))
 {
-    print '<tr><td colspan="2"><br>Check table of linked elements and delete orphelins links</td></tr>';
+    print '<tr><td colspan="2"><br>*** Check table of linked elements and delete orphelins links</td></tr>';
 	// propal => order
 	print '<tr><td colspan="2">'.checkLinkedElements('propal', 'commande')."</td></tr>\n";
 
@@ -435,7 +436,7 @@ if ($ok && GETPOST('clean_orphelin_dir'))
 
         if (empty($upload_dir)) continue;
 
-        print '<tr><td colspan="2"><br>Clean orphelins files into files '.$upload_dir.'</td></tr>';
+        print '<tr><td colspan="2"><br>*** Clean orphelins files into files '.$upload_dir.'</td></tr>';
 
         $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview\.png)$','^temp$','^payments$','^CVS$','^thumbs$'),'',SORT_DESC,1,true);
 
@@ -546,7 +547,7 @@ if ($ok && GETPOST('clean_orphelin_dir'))
 // clean_linked_elements: Check and clean linked elements
 if ($ok && GETPOST('clean_product_stock_batch'))
 {
-    print '<tr><td colspan="2"><br>Clean table product_batch</td></tr>';
+    print '<tr><td colspan="2"><br>*** Clean table product_batch</td></tr>';
     
     $sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
     $sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
@@ -636,12 +637,69 @@ if ($ok && GETPOST('clean_product_stock_batch'))
     {
         dol_print_error($db);
     }
-    
-    
 }
 
 
 
+// clean_linked_elements: Check and clean linked elements
+if ($ok && GETPOST('set_empty_time_spent_amount'))
+{
+    print '<tr><td colspan="2"><br>*** Set value of time spent without amount</td></tr>';
+
+    $sql ="SELECT COUNT(ptt.rowid) as nb, u.rowid as user_id, u.login, u.thm as user_thm";
+    $sql.=" FROM ".MAIN_DB_PREFIX."projet_task_time as ptt, ".MAIN_DB_PREFIX."user as u";
+    $sql.=" WHERE ptt.fk_user = u.rowid";
+    $sql.=" AND ptt.thm IS NULL and u.thm > 0";
+    $sql.=" GROUP BY u.rowid, u.login, u.thm";
+    
+    $resql = $db->query($sql);
+    if ($resql)
+    {
+        $num = $db->num_rows($resql);
+
+        if ($num)
+        {
+            $i = 0;
+            while ($i < $num)
+            {
+                $obj=$db->fetch_object($resql);
+                print '<tr><td>'.$obj->login.'-'.$obj->user_id.' ('.$obj->nb.' lines to fix) -> '.$obj->user_thm;
+
+                $db->begin();
+
+                $sql2 ="UPDATE ".MAIN_DB_PREFIX."projet_task_time";
+                $sql2.=" SET thm = ".$obj->user_thm." WHERE thm IS NULL AND fk_user = ".$obj->user_id;
+                $resql2=$db->query($sql2);
+                if (! $resql2)
+                {
+                    $error++;
+                    dol_print_error($db);
+                }
+
+                if (!$error) $db->commit();
+                else $db->rollback();
+
+                print'</td></tr>';
+
+                if ($error) break;
+                
+                $i++;
+            }
+        }
+        else
+        {
+            print '<tr><td>No time spent with empty line on users with a hourly rate defined</td></tr>';
+        }
+    }
+    else
+    {
+        dol_print_error($db);
+    }
+
+
+}
+
+
 
 
 print '</table>';

+ 2 - 2
htdocs/langs/en_US/admin.lang

@@ -208,7 +208,7 @@ MainDbPasswordFileConfEncrypted=Database password encrypted in conf.php (Activat
 InstrucToEncodePass=To have password encoded into the <b>conf.php</b> file, replace the line <br><b>$dolibarr_main_db_pass="...";</b><br>by<br><b>$dolibarr_main_db_pass="crypted:%s";</b>
 InstrucToClearPass=To have password decoded (clear) into the <b>conf.php</b> file, replace the line <br><b>$dolibarr_main_db_pass="crypted:...";</b><br>by<br><b>$dolibarr_main_db_pass="%s";</b>
 ProtectAndEncryptPdfFiles=Protection of generated pdf files (Activated NOT recommended, breaks mass pdf generation)
-ProtectAndEncryptPdfFilesDesc=Protection of a PDF document keeps it available to read and print with any PDF browser. However, editing and copying is not possible anymore. Note that using this feature make building of a global cumulated pdf not working (like unpaid invoices).
+ProtectAndEncryptPdfFilesDesc=Protection of a PDF document keeps it available to read and print with any PDF browser. However, editing and copying is not possible anymore. Note that using this feature makes building of a global merged PDFs not working.
 Feature=Feature
 DolibarrLicense=License
 Developpers=Developers/contributors
@@ -1583,7 +1583,7 @@ HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
 HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight)
 TextTitleColor=Color of page title
 LinkColor=Color of links
-PressF5AfterChangingThis=Press F5 on keyboard or clear your browser cache after changing this value to have it effective
+PressF5AfterChangingThis=Press CTRL+F5 on keyboard or clear your browser cache after changing this value to have it effective
 NotSupportedByAllThemes=Will works with core themes, may not be supported by external themes
 BackgroundColor=Background color
 TopMenuBackgroundColor=Background color for Top menu

+ 1 - 0
htdocs/langs/en_US/agenda.lang

@@ -47,6 +47,7 @@ InvoiceDeleteDolibarr=Invoice %s deleted
 InvoicePaidInDolibarr=Invoice %s changed to paid
 InvoiceCanceledInDolibarr=Invoice %s canceled
 MemberValidatedInDolibarr=Member %s validated
+MemberModifiedInDolibarr=Member %s modified
 MemberResiliatedInDolibarr=Member %s terminated
 MemberDeletedInDolibarr=Member %s deleted
 MemberSubscriptionAddedInDolibarr=Subscription for member %s added

+ 1 - 0
htdocs/langs/en_US/categories.lang

@@ -1,6 +1,7 @@
 # Dolibarr language file - Source file is en_US - categories
 Rubrique=Tag/Category
 Rubriques=Tags/Categories
+RubriquesTransactions=Tags/Categories of transactions
 categories=tags/categories
 NoCategoryYet=No tag/category of this type created
 In=In

+ 1 - 1
htdocs/langs/en_US/propal.lang

@@ -28,7 +28,7 @@ ShowPropal=Show proposal
 PropalsDraft=Drafts
 PropalsOpened=Open
 PropalStatusDraft=Draft (needs to be validated)
-PropalStatusValidated=Validated (proposal is open)
+PropalStatusValidated=Validated (proposal is opened)
 PropalStatusSigned=Signed (needs billing)
 PropalStatusNotSigned=Not signed (closed)
 PropalStatusBilled=Billed

+ 2 - 2
htdocs/product/stock/class/mouvementstock.class.php

@@ -176,8 +176,8 @@ class MouvementStock extends CommonObject
                         		if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour)    // We test date without hours and with hours for backward compatibility 
                                 {
                                     // If found and eatby/sellby defined into table and provided and differs, return error
-                                    $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby));
-                                    dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR);
+                                    $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatby, 'dayhour'));
+                                    dol_syslog("ThisSerialAlreadyExistWithDifferentDate batch=".$batch.", eatby found into product_lot = ".$obj->eatby." = ".dol_print_date($this->db->jdate($obj->eatby), 'dayhourrfc')." so eatbywithouthour = ".$eatbywithouthour." = ".dol_print_date($eatbywithouthour)." - eatby provided = ".$eatby." = ".dol_print_date($eatby, 'dayhourrfc'), LOG_ERR);
                                     $this->db->rollback();
                                     return -3;
                                 }

+ 4 - 3
htdocs/societe/list.php

@@ -41,6 +41,7 @@ $langs->load("customers");
 $langs->load("suppliers");
 $langs->load("bills");
 $langs->load("compta");
+$langs->load('commercial');
 
 // Security check
 $socid = GETPOST('socid','int');
@@ -167,7 +168,7 @@ $arrayfields=array(
     's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>$checkedprofid4),
     's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>$checkedprofid5),
     's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>$checkedprofid6),
-    'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1),
+    'customerorsupplier'=>array('label'=>$langs->trans('Nature'), 'checked'=>1),
     's.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel),
 	's.fk_stcomm'=>array('label'=>$langs->trans("StatusProsp"), 'checked'=>$checkstcomm),
     's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
@@ -613,7 +614,7 @@ if (! empty($arrayfields['s.ape']['checked']))            print_liste_field_titr
 if (! empty($arrayfields['s.idprof4']['checked']))        print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder);
 if (! empty($arrayfields['s.idprof5']['checked']))        print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder);
 if (! empty($arrayfields['s.idprof6']['checked']))        print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder);
-if (! empty($arrayfields['customerorsupplier']['checked']))        print_liste_field_titre('');   // type of customer
+if (! empty($arrayfields['customerorsupplier']['checked']))        print_liste_field_titre($arrayfields['customerorsupplier']['label']);   // type of customer
 if (! empty($arrayfields['s.fk_prospectlevel']['checked']))        print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
 if (! empty($arrayfields['s.fk_stcomm']['checked']))               print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
 // Extra fields
@@ -624,7 +625,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
        if (! empty($arrayfields["ef.".$key]['checked']))
        {
 			$align=$extrafields->getAlignFlag($key);
-			print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
+			print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
        }
    }
 }

+ 1 - 1
htdocs/supplier_proposal/card.php

@@ -1908,7 +1908,7 @@ if ($action == 'create')
 		$formmail->withtocc = $liste;
 		$formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false);
 
-		$formmail->withtopic = $outputlangs->trans('SendAskRef', '__ASKREF__');
+		$formmail->withtopic = $outputlangs->trans('SendAskRef', '__SUPPLIERPROPREF__');
 
 		$formmail->withfile = 2;
 		$formmail->withbody = 1;

+ 5 - 1
htdocs/user/agenda_extsites.php

@@ -153,7 +153,11 @@ $head=user_prepare_head($object);
 
 dol_fiche_head($head, 'extsites', $langs->trans("User"), 0, 'user');
 
-$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+$linkback = '';
+
+if ($user->rights->user->user->lire || $user->admin) {
+	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+}
 
 dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
 

+ 5 - 1
htdocs/user/bank.php

@@ -133,7 +133,11 @@ if ($id && $action != 'edit')
 	$title = $langs->trans("User");
 	dol_fiche_head($head, 'bank', $title, 0, 'user');
 
-	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	$linkback = '';
+
+	if ($user->rights->user->user->lire || $user->admin) {
+		$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	}
 	
     dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
         

+ 5 - 1
htdocs/user/card.php

@@ -1196,7 +1196,11 @@ else
 		else
 		{
 			$title = $langs->trans("User");
-			$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+			$linkback = '';
+
+			if ($user->rights->user->user->lire || $user->admin) {
+				$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+			}
 		}
 
         $head = user_prepare_head($object);

+ 5 - 1
htdocs/user/clicktodial.php

@@ -98,7 +98,11 @@ if ($id > 0)
 	
 	dol_fiche_head($head, 'clicktodial', $title, 0, 'user');
 
-	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	$linkback = '';
+
+	if ($user->rights->user->user->lire || $user->admin) {
+		$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	}
 	
     dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
 	

+ 5 - 2
htdocs/user/document.php

@@ -131,8 +131,11 @@ if ($object->id)
 
 	dol_fiche_head($head, 'document', $langs->trans("User"),0,'user');
 
-	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
-
+	$linkback = '';
+	if ($user->rights->user->user->lire || $user->admin) {
+		$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	}
+	
     dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
 
     print '<div class="underbanner clearboth"></div>';

+ 5 - 1
htdocs/user/info.php

@@ -68,7 +68,11 @@ $title = $langs->trans("User");
 dol_fiche_head($head, 'info', $title, 0, 'user');
 
 
-$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+$linkback = '';
+
+if ($user->rights->user->user->lire || $user->admin) {
+	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+}
 
 dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
 

+ 5 - 1
htdocs/user/ldap.php

@@ -96,7 +96,11 @@ $head = user_prepare_head($object);
 $title = $langs->trans("User");
 dol_fiche_head($head, 'ldap', $title, 0, 'user');
 
-$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+$linkback = '';
+
+if ($user->rights->user->user->lire || $user->admin) {
+	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+}
 
 dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
 

+ 5 - 1
htdocs/user/note.php

@@ -90,7 +90,11 @@ if ($id)
 	$title = $langs->trans("User");
 	dol_fiche_head($head, 'note', $title, 0, 'user');
 
-	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	$linkback = '';
+
+	if ($user->rights->user->user->lire || $user->admin) {
+		$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	}
 	
     dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
     

+ 6 - 2
htdocs/user/param_ihm.php

@@ -180,8 +180,12 @@ if ($action == 'edit')
 if ($action == 'edit')
 {
     dol_fiche_head($head, 'guisetup', $title, 0, 'user');
-    
-    $linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+
+	$linkback = '';
+
+	if ($user->rights->user->user->lire || $user->admin) {
+		$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+	}
     
     dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
     

+ 5 - 1
htdocs/user/perms.php

@@ -257,7 +257,11 @@ else
  * Ecran ajout/suppression permission
  */
 
-$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+$linkback = '';
+
+if ($user->rights->user->user->lire || $user->admin) {
+	$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
+}
 
 dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);