Browse Source

Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/accountancy/bookkeeping/listbyyear.php
	htdocs/accountancy/journal/bankjournal.php
	htdocs/compta/facture/list.php
	htdocs/filefunc.inc.php
	htdocs/fourn/facture/list.php
	htdocs/install/mysql/migration/3.9.0-4.0.0.sql
	htdocs/projet/activity/index.php
Laurent Destailleur 9 years ago
parent
commit
3a58613e45
50 changed files with 464 additions and 350 deletions
  1. 7 7
      build/makepack-dolibarr.pl
  2. 25 10
      htdocs/accountancy/admin/account.php
  3. 37 29
      htdocs/accountancy/bookkeeping/card.php
  4. 19 16
      htdocs/accountancy/bookkeeping/list.php
  5. 18 21
      htdocs/accountancy/bookkeeping/listbyyear.php
  6. 54 54
      htdocs/accountancy/journal/bankjournal.php
  7. 7 7
      htdocs/accountancy/journal/sellsjournal.php
  8. 10 9
      htdocs/admin/dict.php
  9. 1 1
      htdocs/categories/class/categorie.class.php
  10. 21 12
      htdocs/comm/card.php
  11. 14 7
      htdocs/commande/list.php
  12. 2 9
      htdocs/compta/facture.php
  13. 10 2
      htdocs/compta/facture/list.php
  14. 1 1
      htdocs/compta/index.php
  15. 7 9
      htdocs/compta/prelevement/class/bonprelevement.class.php
  16. 4 4
      htdocs/contact/list.php
  17. 3 3
      htdocs/contrat/card.php
  18. 2 2
      htdocs/core/class/html.form.class.php
  19. 17 21
      htdocs/core/lib/admin.lib.php
  20. 1 0
      htdocs/don/list.php
  21. 1 0
      htdocs/expedition/list.php
  22. 1 1
      htdocs/fourn/card.php
  23. 1 0
      htdocs/fourn/commande/list.php
  24. 1 1
      htdocs/fourn/facture/card.php
  25. 9 1
      htdocs/fourn/facture/list.php
  26. 1 1
      htdocs/includes/jquery/plugins/select2/select2.css
  27. 2 0
      htdocs/index.php
  28. 1 0
      htdocs/install/mysql/data/llx_c_currencies.sql
  29. 4 4
      htdocs/install/mysql/data/llx_c_payment_term.sql
  30. 6 0
      htdocs/install/mysql/migration/3.8.0-3.9.0.sql
  31. 1 0
      htdocs/langs/en_US/projects.lang
  32. 1 1
      htdocs/langs/es_ES/admin.lang
  33. 3 3
      htdocs/langs/es_ES/boxes.lang
  34. 2 2
      htdocs/langs/es_ES/companies.lang
  35. 2 2
      htdocs/langs/es_ES/cron.lang
  36. 1 0
      htdocs/langs/es_ES/projects.lang
  37. 1 0
      htdocs/langs/fr_FR/projects.lang
  38. 3 3
      htdocs/main.inc.php
  39. 3 1
      htdocs/product/admin/product.php
  40. 124 74
      htdocs/projet/activity/index.php
  41. 1 1
      htdocs/projet/card.php
  42. 1 1
      htdocs/societe/commerciaux.php
  43. 1 1
      htdocs/societe/consumption.php
  44. 4 4
      htdocs/societe/document.php
  45. 7 7
      htdocs/societe/note.php
  46. 3 3
      htdocs/societe/rib.php
  47. 8 13
      htdocs/societe/soc.php
  48. 3 2
      htdocs/theme/eldy/img/menus/README.md
  49. 4 0
      htdocs/theme/eldy/style.css.php
  50. 4 0
      htdocs/theme/md/style.css.php

+ 7 - 7
build/makepack-dolibarr.pl

@@ -148,9 +148,9 @@ $FILENAMEEXEDOLIWAMP = "DoliWamp-$MAJOR.$MINOR.$BUILD";
 $ARCH='noarch';
 $newbuild = $BUILD;
 $newbuild =~ s/(dev|alpha)/0.1.a/gi;			# dev (fedora)
-$newbuild =~ s/beta/0.2.beta1/gi;				# beta (fedora)
-$newbuild =~ s/rc./0.3.rc1/gi;					# rc (fedora)
-if ($newbuild !~ /-/) { $newbuild.='-0.3'; }	# finale (fedora)
+$newbuild =~ s/beta(.?)/0.2.beta/gi;			# beta (fedora)    (we want beta1, beta2, betax to be same package name)
+$newbuild =~ s/rc(.?)/0.3.rc/gi;				# rc (fedora)      (we want rc1, rc2, rcx to be same package name)
+if ($newbuild !~ /-/) { $newbuild.='-0.4'; }	# finale (fedora)
 #$newbuild =~ s/(dev|alpha)/0/gi;				# dev
 #$newbuild =~ s/beta/1/gi;						# beta
 #$newbuild =~ s/rc./2/gi;						# rc
@@ -162,10 +162,10 @@ $FILENAMERPM=$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm";
 # For Deb
 $newbuild = $BUILD;
 $newbuild =~ s/(dev|alpha)/1/gi;                # dev
-$newbuild =~ s/beta/2/gi;                       # beta
-$newbuild =~ s/rc./3/gi;                        # rc
-if ($newbuild !~ /-/) { $newbuild.='-3'; }      # finale is same than rc. 
-# now newbuild is 0-1 or 0-3 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management
+$newbuild =~ s/beta(.?)/2/gi;                   # beta    			(we want beta1, beta2, betax to be same package name)
+$newbuild =~ s/rc(.?)/3/gi;                     # rc				(we want rc1, rc2, rcx to be same package name)
+if ($newbuild !~ /-/) { $newbuild.='-4'; }      # finale is same than rc. 
+# now newbuild is 0-1 or 0-4 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management
 $build = $newbuild;
 $build =~ s/-.*$//g;
 # now build is 0 for example

+ 25 - 10
htdocs/accountancy/admin/account.php

@@ -1,6 +1,6 @@
 <?php
-/* Copyright (C) 2013-2014 Olivier Geffroy      <jeff@jeffinfo.com>
- * Copyright (C) 2013-2015 Alexandre Spangaro   <aspangaro.dolibarr@gmail.com>
+/* Copyright (C) 2013-2016 Olivier Geffroy      <jeff@jeffinfo.com>
+ * Copyright (C) 2013-2016 Alexandre Spangaro   <aspangaro.dolibarr@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,9 +17,9 @@
  */
 
 /**
- * \file htdocs/accountancy/admin/account.php
- * \ingroup Accounting Expert
- * \brief List accounting account
+ * \file 		htdocs/accountancy/admin/account.php
+ * \ingroup		Advanced accountancy
+ * \brief		List accounting account
  */
 require '../../main.inc.php';
 
@@ -104,10 +104,12 @@ llxHeader('', $langs->trans("ListAccounts"));
 
 $pcgver = $conf->global->CHARTOFACCOUNTS;
 
-$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active ";
-$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa, " . MAIN_DB_PREFIX . "accounting_system as asy";
-$sql .= " WHERE aa.fk_pcg_version = asy.pcg_version";
-$sql .= " AND asy.rowid = " . $pcgver;
+$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
+$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
+$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON aa.account_parent = a2.rowid";
+$sql .= " WHERE asy.rowid = " . $pcgver;
 
 if (strlen(trim($search_account))) {
 	$sql .= " AND aa.account_number like '%" . $search_account . "%'";
@@ -175,6 +177,7 @@ if ($result) {
 	$var = false;
 	
 	$accountstatic = new AccountingAccount($db);
+	$accountparent = new AccountingAccount($db);
 	
 	while ( $i < min($num, $limit) ) {
 		$obj = $db->fetch_object($resql);
@@ -186,7 +189,19 @@ if ($result) {
 		print '<tr ' . $bc[$var] . '>';
 		print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
 		print '<td>' . $obj->label . '</td>';
-		print '<td>' . $obj->account_parent . '</td>';
+
+		if ($obj->account_parent)
+        {
+			$accountparent->id = $obj->rowid2;
+			$accountparent->label = $obj->label2;
+			$accountparent->account_number = $obj->account_number2;
+		
+			print '<td>' . $accountparent->getNomUrl(1) . '</td>';
+		}
+		else
+		{
+			print '<td>&nbsp;</td>';
+		}
 		print '<td>' . $obj->pcg_type . '</td>';
 		print '<td>' . $obj->pcg_subtype . '</td>';
 		print '<td>';

+ 37 - 29
htdocs/accountancy/bookkeeping/card.php

@@ -1,7 +1,7 @@
 <?php
-/* Copyright (C) 2013-2014 Olivier Geffroy      <jeff@jeffinfo.com>
- * Copyright (C) 2013-2014 Florian Henry        <florian.henry@open-concept.pro>
- * Copyright (C) 2013-2015 Alexandre Spangaro   <aspangaro.dolibarr@gmail.com>
+/* Copyright (C) 2013-2016 Olivier Geffroy      <jeff@jeffinfo.com>
+ * Copyright (C) 2013-2016 Florian Henry        <florian.henry@open-concept.pro>
+ * Copyright (C) 2013-2016 Alexandre Spangaro   <aspangaro.dolibarr@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,13 +18,14 @@
  */
 
 /**
- * \file htdocs/accountancy/bookkeeping/card.php
- * \ingroup Accounting Expert
- * \brief Page to show account
+ * \file 		htdocs/accountancy/bookkeeping/card.php
+ * \ingroup 	Advanced accountancy
+ * \brief 		Page to show book-entry
  */
 require '../../main.inc.php';
 
 // Class
+require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
 require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
 require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
 
@@ -190,6 +191,9 @@ else if ($action == "confirm_create") {
 	}
 }
 
+/*
+ * View
+ */
 llxHeader();
 
 $html = new Form($db);
@@ -237,29 +241,32 @@ if ($action == 'create') {
 	
 	print '<table class="border" width="100%">';
 	print '<tr>';
-	print '<td>' . $langs->trans("NumMvts") . '</td>';
+	print '<td width="25%">' . $langs->trans("NumMvts") . '</td>';
 	print '<td>' . $next_num_mvt . '</td>';
 	print '</tr>';
+	
 	print '<tr>';
 	print '<td>' . $langs->trans("Docdate") . '</td>';
 	print '<td>';
 	print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
 	print '</td>';
-	
 	print '</tr>';
+	
 	print '<tr>';
 	print '<td>' . $langs->trans("Codejournal") . '</td>';
-	
 	print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
 	print '</tr>';
+	
 	print '<tr>';
 	print '<td>' . $langs->trans("Docref") . '</td>';
 	print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
 	print '</tr>';
+	
 	print '<tr>';
 	print '<td>' . $langs->trans("Doctype") . '</td>';
 	print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
 	print '</tr>';
+	
 	print '</table>';
 	
 	dol_fiche_end();
@@ -281,7 +288,7 @@ if ($action == 'create') {
 		
 		print '<table class="border" width="100%">';
 		print '<tr class="pair">';
-		print '<td>' . $langs->trans("NumMvts") . '</td>';
+		print '<td width="25%">' . $langs->trans("NumMvts") . '</td>';
 		print '<td>' . $book->piece_num . '</td>';
 		print '</tr>';
 		print '<tr class="impair">';
@@ -301,6 +308,7 @@ if ($action == 'create') {
 		print '<td>' . $book->doc_type . '</td>';
 		print '</tr>';
 		print '</table>';
+		print '<br />';
 		
 		$result = $book->fetch_all_per_mvt($piece_num);
 		if ($result < 0) {
@@ -328,11 +336,11 @@ if ($action == 'create') {
 				print_liste_field_titre($langs->trans("Numerocompte"));
 				print_liste_field_titre($langs->trans("Code_tiers"));
 				print_liste_field_titre($langs->trans("Labelcompte"));
-				print_liste_field_titre($langs->trans("Debit"));
-				print_liste_field_titre($langs->trans("Credit"));
-				print_liste_field_titre($langs->trans("Amount"));
-				print_liste_field_titre($langs->trans("Sens"));
-				print_liste_field_titre('');
+				print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');
+				print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="center"');
+				print_liste_field_titre($langs->trans("Amount"), "", "", "", "", 'align="center"');
+				print_liste_field_titre($langs->trans("Sens"), "", "", "", "", 'align="center"');
+				print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
 				
 				print "</tr>\n";
 				
@@ -352,24 +360,24 @@ if ($action == 'create') {
 						print $formventilation->select_auxaccount($line->code_tiers, 'code_tiers', 1);
 						print '</td>';
 						print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
-						print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
-						print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
-						print '<td>' . $line->montant . '</td>';
-						print '<td>' . $line->sens . '</td>';
+						print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
+						print '<td align="right"><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
+						print '<td align="right">' . price($line->montant) . '</td>';
+						print '<td align="center">' . $line->sens . '</td>';
 						print '<td>';
 						print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
 						print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
 						print '</td>';
 					} else {
-						print '<td>' . $line->numero_compte . '</td>';
-						print '<td>' . $line->code_tiers . '</td>';
+						print '<td>' . length_accountg($line->numero_compte) . '</td>';
+						print '<td>' . length_accounta($line->code_tiers) . '</td>';
 						print '<td>' . $line->label_compte . '</td>';
-						print '<td>' . $line->debit . '</td>';
-						print '<td>' . $line->credit . '</td>';
-						print '<td>' . $line->montant . '</td>';
-						print '<td>' . $line->sens . '</td>';
+						print '<td align="right">' . price($line->debit) . '</td>';
+						print '<td align="right">' . price($line->credit) . '</td>';
+						print '<td align="right">' . price($line->montant) . '</td>';
+						print '<td align="center">' . $line->sens . '</td>';
 						
-						print '<td>';
+						print '<td align="center">';
 						print '<a href="./card.php?action=update&amp;id=' . $line->id . '&amp;piece_num=' . $line->piece_num . '">';
 						print img_edit();
 						print '</a>&nbsp;';
@@ -400,8 +408,8 @@ if ($action == 'create') {
 					print $formventilation->select_auxaccount($code_tiers, 'code_tiers', 1);
 					print '</td>';
 					print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
-					print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
-					print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
+					print '<td align="right"><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
+					print '<td align="right"><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
 					print '<td></td>';
 					print '<td></td>';
 					print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '"></td>';
@@ -417,4 +425,4 @@ if ($action == 'create') {
 }
 
 llxFooter();
-$db->close();
+$db->close();

+ 19 - 16
htdocs/accountancy/bookkeeping/list.php

@@ -1,7 +1,7 @@
 <?php
-/* Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
- * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
- * Copyright (C) 2013-2015 Alexandre Spangaro	<aspangaro.dolibarr@gmail.com> 
+/* Copyright (C) 2013-2016 Olivier Geffroy		<jeff@jeffinfo.com>
+ * Copyright (C) 2013-2016 Florian Henry		<florian.henry@open-concept.pro>
+ * Copyright (C) 2013-2016 Alexandre Spangaro	<aspangaro.dolibarr@gmail.com> 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,9 +19,9 @@
  */
 
 /**
- * \file htdocs/accountancy/bookkeeping/list.php
- * \ingroup Accounting Expert
- * \brief List operation of book keeping
+ * \file 		htdocs/accountancy/bookkeeping/list.php
+ * \ingroup 	Advanced accountancy
+ * \brief 		List operation of book keeping
  */
 require '../../main.inc.php';
 
@@ -260,8 +260,8 @@ if ($action == 'delbookkeeping') {
 			$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
 			print $date . $sep;
 			print $line->doc_ref . $sep;
-			print length_accounta($line->numero_compte) . $sep;
-			print length_accountg($line->code_tiers) . $sep;
+			print length_accountg($line->numero_compte) . $sep;
+			print length_accounta($line->code_tiers) . $sep;
 			print price($line->debit) . $sep;
 			print price($line->credit) . $sep;
 			
@@ -277,7 +277,7 @@ if ($action == 'delbookkeeping') {
 			$date = dol_print_date($line->doc_date, '%d/%m/%Y');
 			print $date . $sep;
 			print $line->code_journal . $sep;
-			print length_accounta($line->numero_compte) . $sep;
+			print length_accountg($line->numero_compte) . $sep;
 			print $line->piece_num . $sep;
 			print $line->doc_ref . $sep;
 			print price($line->debit) . $sep;
@@ -289,6 +289,9 @@ if ($action == 'delbookkeeping') {
 	}
 } 
 
+/*
+ * View
+ */
 else {
 	
 	$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
@@ -352,8 +355,8 @@ else {
 	
 	print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
 	print '<div class="tabsAction">' . "\n";
-	print '<div class="inline-block divButAction"><input type="submit"  name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
-	print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
+	print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
+	print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
 	// print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=export_csv">' . $langs->trans("Export") . '</a>';
 	print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
 	
@@ -396,12 +399,12 @@ else {
 	
 	print '<tr class="liste_titre">';
 	print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
-	print '<td><input type="text" name="search_mvt_num" size="8" value="' . $search_mvt_num . '"></td>';
+	print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
 	print '<td class="liste_titre">';
 	print $langs->trans('From') . ': ';
 	print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
 	print '<br>';
-	print $langs->trans('To') . ': ';
+	print $langs->trans('to') . ': ';
 	print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
 	// print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
 	print '</td>';
@@ -412,7 +415,7 @@ else {
 	print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
 	// print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
 	print '<br>';
-	print $langs->trans('To');
+	print $langs->trans('to');
 	print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
 	print '</td>';
 	// print '<td><input type="text" name="search_accountancy_code" size="8" value="' . $search_accountancy_code . '"></td>';
@@ -422,7 +425,7 @@ else {
 	print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
 	// print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
 	print '<br>';
-	print $langs->trans('To');
+	print $langs->trans('to');
 	print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
 	print '</td>';
 	// print '<td><input type="text" name="search_accountancy_aux_code" size="8" value="' . $search_accountancy_aux_code . '"></td>';
@@ -468,7 +471,7 @@ else {
 		// print '<td align="center">' . $line->sens . '</td>';
 		print '<td align="right">' . $line->code_journal . '</td>';
 		print '<td align="center">';
-		print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>';
+		print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
 		print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
 		print '</td>';
 		print "</tr>\n";

+ 18 - 21
htdocs/accountancy/bookkeeping/listbyyear.php

@@ -1,7 +1,7 @@
 <?php
-/* Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
- * Copyright (C) 2013-2014 Alexandre Spangaro	<aspangaro.dolibarr@gmail.com> 
- * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
+/* Copyright (C) 2013-2016 Olivier Geffroy		<jeff@jeffinfo.com>
+ * Copyright (C) 2013-2016 Alexandre Spangaro	<aspangaro.dolibarr@gmail.com> 
+ * Copyright (C) 2013-2016 Florian Henry		<florian.henry@open-concept.pro>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,9 +19,9 @@
  */
 
 /**
- * \file htdocs/accountancy/bookkeeping/listbyyear.php
- * \ingroup Accounting Expert
- * \brief Book keeping by year
+ * \file 		htdocs/accountancy/bookkeeping/listbyyear.php
+ * \ingroup 	Advanced accountancy
+ * \brief 		Book keeping by year
  */
 require '../../main.inc.php';
 
@@ -184,13 +184,13 @@ print '</div>';
 print '<div class="liste_titre">';
 print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
 print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
-print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
+print $langs->trans('to') . ' ' . $langs->trans('AccountAccounting') . ': ';
 print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
 print '</div>';
 print '<div class="liste_titre">';
 print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
 print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1);
-print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
+print $langs->trans('to') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
 print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1);
 print '</div>';
 print "<table class=\"noborder\" width=\"100%\">";
@@ -204,16 +204,14 @@ print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF']
 print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
 print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
 print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
-print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, "", $sortfield, $sortorder);
-print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, "", $sortfield, $sortorder);
-print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, "", $sortfield, $sortorder);
-print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, "", $sortfield, $sortorder);
-print '<th class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
-print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '"></td>';
+print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
+print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
+print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
+print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
+print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
 print "</tr>\n";
 
 print '<tr class="liste_titre">';
-
 print '<td class="liste_titre">';
 print '<input type="text" size=4 class="flat" name="search_piece_num" value="' . $search_piece_num . '"/>';
 print '</td>';
@@ -251,11 +249,11 @@ print '</td>';
 print '<td class="liste_titre">';
 print '</td>';
 
-print '<td class="liste_titre">';
+print '<td class="liste_titre" align="center">';
 print '<input type="text" size=2 class="flat" name="search_sens" value="' . $search_sens . '"/>';
 print '</td>';
 
-print '<td class="liste_titre">';
+print '<td class="liste_titre" align="center">';
 print '<input type="text" size=3 class="flat" name="search_code_journal" value="' . $search_code_journal . '"/>';
 print '</td>';
 
@@ -272,7 +270,6 @@ foreach ( $object->lines as $line ) {
 	$var = ! $var;
 	
 	print "<tr $bc[$var]>";
-	
 	print '<td>' . $line->piece_num . '</td>' . "\n";
 	print '<td>' . $line->doc_type . '</td>' . "\n";
 	print '<td>' . dol_print_date($line->doc_date) . '</td>';
@@ -283,9 +280,9 @@ foreach ( $object->lines as $line ) {
 	print '<td align="right">' . price($line->debit) . '</td>';
 	print '<td align="right">' . price($line->credit) . '</td>';
 	print '<td align="right">' . price($line->montant) . '</td>';
-	print '<td>' . $line->sens . '</td>';
-	print '<td>' . $line->code_journal . '</td>';
-	print '<td><a href="./card.php?action=update&amp;piece_num=' . $line->piece_num . '">' . img_edit() . '</a></td>';
+	print '<td align="center">' . $line->sens . '</td>';
+	print '<td align="right">' . $line->code_journal . '</td>';
+	print '<td align="center"><a href="./card.php?action=update&amp;piece_num=' . $line->piece_num . '">' . img_edit() . '</a></td>';
 	print "</tr>\n";
 }
 print "</table>";

+ 54 - 54
htdocs/accountancy/journal/bankjournal.php

@@ -23,9 +23,9 @@
  */
 
 /**
- * \file htdocs/accountancy/journal/bankjournal.php
- * \ingroup Accounting Expert
- * \brief Page with bank journal
+ * \file 		htdocs/accountancy/journal/bankjournal.php
+ * \ingroup 	Advanced accountancy
+ * \brief 		Page with bank journal
  */
 require '../../main.inc.php';
 
@@ -72,7 +72,7 @@ $now = dol_now();
 if ($user->societe_id > 0 && empty($id_bank_account))
 	accessforbidden();
 	
-	/*
+/*
  * View
  */
 $year_current = strftime("%Y", dol_now());
@@ -127,7 +127,7 @@ $journal = $bank_code_journal->ref;
 dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
 $result = $db->query($sql);
 if ($result) {
-	
+
 	$num = $db->num_rows($result);
 	// Variables
 	$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
@@ -135,22 +135,22 @@ if ($result) {
 	$accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
 	$accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
 	$accountancy_account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef"));
-	
+
 	$tabpay = array ();
 	$tabbq = array ();
 	$tabtp = array ();
 	$tabtype = array ();
-	
+
 	$i = 0;
 	while ( $i < $num ) {
 		$obj = $db->fetch_object($result);
-		
+
 		$tabcompany[$obj->rowid] = array (
 				'id' => $obj->socid,
 				'name' => $obj->name,
 				'code_client' => $obj->code_compta 
 		);
-		
+
 		// Controls
 		$compta_bank = $obj->account_number;
 		if ($obj->label == '(SupplierInvoicePayment)')
@@ -159,8 +159,8 @@ if ($result) {
 			$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli);
 		if ($obj->typeop == '(BankTransfert)')
 			$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
-			
-			// Variable bookkeeping
+
+		// Variable bookkeeping
 		$tabpay[$obj->rowid]["date"] = $obj->do;
 		$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type;
 		$tabpay[$obj->rowid]["ref"] = $obj->label;
@@ -171,12 +171,12 @@ if ($result) {
 			$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
 		}
 		$links = $object->get_url($obj->rowid);
-		
+
 		// get_url may return -1 which is not traversable
 		if (is_array($links)) {
 			foreach ( $links as $key => $val ) {
 				$tabtype[$obj->rowid] = $links[$key]['type'];
-				
+
 				if ($links[$key]['type'] == 'payment') {
 					$paymentstatic->id = $links[$key]['url_id'];
 					$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
@@ -197,7 +197,7 @@ if ($result) {
 				} else if ($links[$key]['type'] == 'sc') {
 					$chargestatic->id = $links[$key]['url_id'];
 					$chargestatic->ref = $links[$key]['url_id'];
-					
+
 					$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
 					if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
 						if ($reg[1] == 'socialcontribution')
@@ -208,14 +208,14 @@ if ($result) {
 					}
 					$chargestatic->ref = $chargestatic->lib;
 					$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
-					
+
 					$sqlmid = 'SELECT cchgsoc.accountancy_code';
 					$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
 					$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON  chgsoc.fk_type=cchgsoc.id";
 					$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON  paycharg.fk_charge=chgsoc.rowid";
 					$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON  bkurl.url_id=paycharg.rowid";
 					$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
-					
+
 					dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
 					$resultmid = $db->query($sqlmid);
 					if ($resultmid) {
@@ -247,9 +247,9 @@ if ($result) {
 				 }*/
 			}
 		}
-		
+
 		$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
-		
+
 		// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
 		
 		$i ++;
@@ -265,7 +265,7 @@ if ($result) {
 // Write bookkeeping
 if ($action == 'writebookkeeping') {
 	$now = dol_now();
-	
+
 	$error = 0;
 	foreach ( $tabpay as $key => $val ) {
 		// Bank
@@ -286,9 +286,9 @@ if ($action == 'writebookkeeping') {
 			$bookkeeping->code_journal = $journal;
 			$bookkeeping->fk_user_author = $user->id;
 			$bookkeeping->date_create = $now;
-			
+
 			if ($tabtype[$key] == 'payment') {
-				
+
 				$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";
@@ -301,7 +301,7 @@ if ($action == 'writebookkeeping') {
 					$bookkeeping->doc_ref = $objmid->facnumber;
 				}
 			} else if ($tabtype[$key] == 'payment_supplier') {
-				
+
 				$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";
@@ -315,7 +315,7 @@ if ($action == 'writebookkeeping') {
 					;
 				}
 			}
-			
+
 			$result = $bookkeeping->create($user);
 			if ($result < 0) {
 				$error ++;
@@ -338,12 +338,12 @@ if ($action == 'writebookkeeping') {
 			$bookkeeping->code_journal = $journal;
 			$bookkeeping->fk_user_author = $user->id;
 			$bookkeeping->date_create = $now;
-			
+
 			if ($tabtype[$key] == 'sc') {
 				$bookkeeping->code_tiers = '';
 				$bookkeeping->numero_compte = $k;
 			} else if ($tabtype[$key] == 'payment') {
-				
+
 				$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";
@@ -358,7 +358,7 @@ if ($action == 'writebookkeeping') {
 				$bookkeeping->code_tiers = $k;
 				$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
 			} else if ($tabtype[$key] == 'payment_supplier') {
-				
+
 				$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";
@@ -373,7 +373,7 @@ if ($action == 'writebookkeeping') {
 				$bookkeeping->code_tiers = $k;
 				$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
 			} else if ($tabtype[$key] == 'company') {
-				
+
 				$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";
@@ -392,7 +392,7 @@ if ($action == 'writebookkeeping') {
 				$bookkeeping->doc_ref = $k;
 				$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
 			}
-			
+
 			$result = $bookkeeping->create($user);
 			if ($result < 0) {
 				$error ++;
@@ -400,7 +400,7 @@ if ($action == 'writebookkeeping') {
 			}
 		}
 	}
-	
+
 	if (empty($error)) {
 		setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
 	}
@@ -408,25 +408,25 @@ if ($action == 'writebookkeeping') {
 // Export
 if ($action == 'export_csv') {
 	$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
-	
+
 	include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
-	
+
 	$companystatic = new Client($db);
-	
+
 	// Model Cegid Expert Export
 	if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) 
 	{
 		$sep = ";";
-		
+
 		foreach ( $tabpay as $key => $val ) {
 			$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
-			
+
 			$companystatic->id = $tabcompany[$key]['id'];
 			$companystatic->name = $tabcompany[$key]['name'];
 			$companystatic->client = $tabcompany[$key]['code_client'];
-			
+
 			$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
-			
+
 			// Bank
 			foreach ( $tabbq[$key] as $k => $mt ) {
 				print $date . $sep;
@@ -439,7 +439,7 @@ if ($action == 'export_csv') {
 				print $val["ref"] . $sep;
 				print "\n";
 			}
-			
+
 			// Third party
 			if (is_array($tabtp[$key])) {
 				foreach ( $tabtp[$key] as $k => $mt ) {
@@ -477,10 +477,10 @@ if ($action == 'export_csv') {
 		// Model Classic Export
 		foreach ( $tabpay as $key => $val ) {
 			$date = dol_print_date($db->jdate($val["date"]), 'day');
-			
+
 			$companystatic->id = $tabcompany[$key]['id'];
 			$companystatic->name = $tabcompany[$key]['name'];
-			
+
 			// Bank
 			foreach ( $tabbq[$key] as $k => $mt ) {
 				print '"' . $date . '"' . $sep;
@@ -491,7 +491,7 @@ if ($action == 'export_csv') {
 				print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
 				print "\n";
 			}
-			
+
 			// Third party
 			if (is_array($tabtp[$key])) {
 				foreach ( $tabtp[$key] as $k => $mt ) {
@@ -521,23 +521,23 @@ if ($action == 'export_csv') {
 }
 else {
 	$form = new Form($db);
-	
+
 	llxHeader('', $langs->trans("FinanceJournal"));
 	
 	$nom = $langs->trans("FinanceJournal") . ' - ' . $bank_code_journal->getNomUrl(1);
 	$builddate = time();
 	$description = $langs->trans("DescFinanceJournal") . '<br>';
 	$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
-	
+
 	$varlink = 'id_account=' . $id_bank_account;
 	report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
 			'action' => '' 
 	), '', $varlink);
-	
+
 	print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
-	
+
 	print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
-	
+
 	print '
 	<script type="text/javascript">
 		function launch_export() {
@@ -551,12 +551,12 @@ else {
 		    $("div.fiche div.tabBar form input[name=\"action\"]").val("");
 		}
 	</script>';
-	
+
 	/*
 	 * Show result array
 	 */
 	print '<br><br>';
-	
+
 	$i = 0;
 	print "<table class=\"noborder\" width=\"100%\">";
 	print "<tr class=\"liste_titre\">";
@@ -567,10 +567,10 @@ else {
 	print "<td>" . $langs->trans("PaymentMode") . "</td>";
 	print "<td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
 	print "</tr>\n";
-	
+
 	$var = true;
 	$r = '';
-	
+
 	foreach ( $tabpay as $key => $val ) {
 		$date = dol_print_date($db->jdate($val["date"]), 'day');
 		
@@ -580,8 +580,8 @@ else {
 		if ($val["lib"] == '(CustomerInvoicePayment)') {
 			$reflabel = $langs->trans('CustomerInvoicePayment');
 		}
-			
-			// Bank
+
+		// Bank
 		foreach ( $tabbq[$key] as $k => $mt ) {
 			print "<tr " . $bc[$var] . ">";
 			print "<td>" . $date . "</td>";
@@ -593,7 +593,7 @@ else {
 			print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
 			print "</tr>";
 		}
-		
+
 		// Third party
 		if (is_array($tabtp[$key])) {
 			foreach ( $tabtp[$key] as $k => $mt ) {
@@ -624,9 +624,9 @@ else {
 		}
 		$var = ! $var;
 	}
-	
+
 	print "</table>";
-	
+
 	llxFooter();
 }
 $db->close();

+ 7 - 7
htdocs/accountancy/journal/sellsjournal.php

@@ -4,9 +4,9 @@
  * 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-2015	Alexandre Spangaro		<aspangaro.dolibarr@gmail.com>
- * Copyright (C) 2013-2014	Florian Henry			<florian.henry@open-concept.pro>
- * Copyright (C) 2013-2014	Olivier Geffroy			<jeff@jeffinfo.com>
+ * Copyright (C) 2013-2016	Alexandre Spangaro		<aspangaro.dolibarr@gmail.com>
+ * Copyright (C) 2013-2016	Florian Henry			<florian.henry@open-concept.pro>
+ * Copyright (C) 2013-2016	Olivier Geffroy			<jeff@jeffinfo.com>
  * Copyright (C) 2014       Raphaël Doursenaud      <rdoursenaud@gpcsolutions.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -24,9 +24,9 @@
  */
 
 /**
- * \file htdocs/accountancy/journal/sellsjournal.php
- * \ingroup Accounting Expert
- * \brief Page with sells journal
+ * \file 		htdocs/accountancy/journal/sellsjournal.php
+ * \ingroup 	Advanced accountancy
+ * \brief 		Page with sells journal
  */
 require '../../main.inc.php';
 
@@ -40,10 +40,10 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
 require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
 
 // Langs
+$langs->load("commercial");
 $langs->load("compta");
 $langs->load("bills");
 $langs->load("other");
-$langs->load("main");
 $langs->load("accountancy");
 
 $date_startmonth = GETPOST('date_startmonth');

+ 10 - 9
htdocs/admin/dict.php

@@ -1337,18 +1337,19 @@ if ($id)
                     }
 
                     // Can an entry be erased or disabled ?
-                    $iserasable=1;$isdisable=1;	// true by default
-
+                    $iserasable=1;$canbedisabled=1;$canbemodified=1;	// true by default
                     if (isset($obj->code) && $id != 10)
                     {
-                    	if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; }
-                    	else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; }
-                    	else if ($obj->code == 'EF0')   { $iserasable = 0; $isdisable = 0; }
+                    	if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
+                    	else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
+                    	else if ($obj->code == 'EF0')   { $iserasable = 0; $canbedisabled = 0; }
                     }
 
                     if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
-                    if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; }
-
+                    if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
+                    $canbemodified=$iserasable;
+                    if ($obj->code == 'RECEP') $canbemodified=1;
+                        
                     $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?urlencode($obj->code):'').'&amp;id='.$id.'&amp;';
 
 					// Favorite
@@ -1363,7 +1364,7 @@ if ($id)
 
                     // Active
                     print '<td align="center" class="nowrap">';
-                    if ($isdisable) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
+                    if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
                     else
                  	{
                  		if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
@@ -1374,7 +1375,7 @@ if ($id)
                     print "</td>";
 
                     // Modify link
-                    if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
+                    if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
                     else print '<td>&nbsp;</td>';
 
                     // Delete link

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

@@ -1287,7 +1287,7 @@ class Categorie extends CommonObject
 
 		$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
 		$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
-		$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type];
+		$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type];
 		$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
 
 		$res = $this->db->query($sql);

+ 21 - 12
htdocs/comm/card.php

@@ -556,7 +556,7 @@ if ($id > 0)
                 if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) {
                     print " ".img_warning();
                 }
-				print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
+				print '</td><td align="right" width="80px">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
 				print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
 				print '<td align="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut,5).'</td></tr>';
 				$i++;
@@ -637,7 +637,7 @@ if ($id > 0)
                 $commande_static->total_tva = $objp->total_tva;
                 $commande_static->total_ttc = $objp->total_ttc;
                 print $commande_static->getNomUrl(1);
-				print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
+				print '</td><td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
 				print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
 				print '<td align="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'</td></tr>';
 				$i++;
@@ -700,7 +700,7 @@ if ($id > 0)
                 print $sendingstatic->getNomUrl(1);
                 print '</td>';
                 if ($objp->date_creation > 0) {
-                    print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->date_creation),'day').'</td>';
+                    print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation),'day').'</td>';
                 } else {
                     print '<td align="right"><b>!!!</b></td>';
                 }
@@ -760,8 +760,8 @@ if ($id > 0)
 				print $contrat->getNomUrl(1,12);
 				print "</td>\n";
 				print '<td class="nowrap">'.dol_trunc($objp->refsup,12)."</td>\n";
-				print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
-				print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->dcon),'day')."</td>\n";
+				print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
+				print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dcon),'day')."</td>\n";
 				print '<td width="20">&nbsp;</td>';
 				print '<td align="right" class="nowrap">';
 				$contrat->fetch_lines();
@@ -818,9 +818,9 @@ if ($id > 0)
 
 				print "<tr ".$bc[$var].">";
 				print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/fichinter/card.php?id='.$objp->id.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.'</a></td>'."\n";
-                //print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
-				print '<td align="right" width="120">'.convertSecondToTime($objp->duration).'</td>'."\n";
-				print '<td align="right" width="100">'.$fichinter_static->getLibStatut(5).'</td>'."\n";
+                //print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
+				print '<td align="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
+				print '<td align="right" class="nowrap" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).'</td>'."\n";
 				print '</tr>';
 				$var=!$var;
 				$i++;
@@ -869,7 +869,7 @@ if ($id > 0)
 		        print '<table class="noborder" width="100%">';
 
 				print '<tr class="liste_titre">';
-				print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
+				print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
                 print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
 				print '</tr></table></td>';
 				print '</tr>';
@@ -891,15 +891,24 @@ if ($id > 0)
 				print '</td>';
 				if ($objp->df > 0)
 				{
-					print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->df),'day').'</td>';
+					print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->df),'day').'</td>';
 				}
 				else
 				{
 					print '<td align="right"><b>!!!</b></td>';
 				}
-				print '<td align="right" width="120">'.price($objp->total_ht).'</td>';
+				print '<td align="right" style="min-width: 60px">';
+				print price($objp->total_ht);
+				print '</td>';
 
-				print '<td align="right" class="nowrap" width="100" >'.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am)).'</td>';
+				if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
+				{
+    				print '<td align="right" style="min-width: 60px">';
+    				print price($objp->total_ttc);
+    				print '</td>';
+				}
+				
+				print '<td align="right" class="nowrap" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye,$objp->statut,5,$objp->am)).'</td>';
 				print "</tr>\n";
 				$i++;
 			}

+ 14 - 7
htdocs/commande/list.php

@@ -9,6 +9,7 @@
  * Copyright (C) 2015      Frederic France        <frederic.france@free.fr>
  * Copyright (C) 2015      Marcos García          <marcosgdf@gmail.com>
  * Copyright (C) 2015      Jean-François Ferry    <jfefe@aternatik.fr>
+ * Copyright (C) 2016	   Ferran Marcet		  <fmarcet@2byte.es>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,8 +47,10 @@ $langs->load('bills');
 
 $orderyear=GETPOST("orderyear","int");
 $ordermonth=GETPOST("ordermonth","int");
+$orderday=GETPOST("orderday","int");
 $deliveryyear=GETPOST("deliveryyear","int");
 $deliverymonth=GETPOST("deliverymonth","int");
+$deliveryday=GETPOST("deliveryday","int");
 $search_product_category=GETPOST('search_product_category','int');
 $search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha');
 $search_ref_customer=GETPOST('search_ref_customer','alpha');
@@ -122,7 +125,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
     $search_total_ht='';
     $orderyear='';
     $ordermonth='';
-    $deliverymonth='';
+	$orderday='';
+	$deliveryday='';
+	$deliverymonth='';
     $deliveryyear='';
     $viewstatut='';
     $billed='';
@@ -195,10 +200,10 @@ if ($viewstatut <> '')
 }
 if ($ordermonth > 0)
 {
-    if ($orderyear > 0 && empty($day))
+    if ($orderyear > 0 && empty($orderday))
     $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,$ordermonth,false))."' AND '".$db->idate(dol_get_last_day($orderyear,$ordermonth,false))."'";
-    else if ($orderyear > 0 && ! empty($day))
-    $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $day, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $day, $orderyear))."'";
+    else if ($orderyear > 0 && ! empty($orderday))
+    $sql.= " AND c.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $orderday, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $orderday, $orderyear))."'";
     else
     $sql.= " AND date_format(c.date_commande, '%m') = '".$ordermonth."'";
 }
@@ -208,10 +213,10 @@ else if ($orderyear > 0)
 }
 if ($deliverymonth > 0)
 {
-    if ($deliveryyear > 0 && empty($day))
+    if ($deliveryyear > 0 && empty($deliveryday))
     $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,$deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,$deliverymonth,false))."'";
-    else if ($deliveryyear > 0 && ! empty($day))
-    $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $day, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $day, $deliveryyear))."'";
+    else if ($deliveryyear > 0 && ! empty($deliveryday))
+    $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $deliveryday, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $deliveryday, $deliveryyear))."'";
     else
     $sql.= " AND date_format(c.date_livraison, '%m') = '".$deliverymonth."'";
 }
@@ -270,8 +275,10 @@ if ($resql)
     if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
 	if ($socid > 0)             $param.='&socid='.$socid;
 	if ($viewstatut != '')      $param.='&viewstatut='.$viewstatut;
+	if ($orderday)      		$param.='&orderday='.$orderday;
 	if ($ordermonth)      		$param.='&ordermonth='.$ordermonth;
 	if ($orderyear)       		$param.='&orderyear='.$orderyear;
+	if ($deliveryday)   		$param.='&deliveryday='.$deliveryday;
 	if ($deliverymonth)   		$param.='&deliverymonth='.$deliverymonth;
 	if ($deliveryyear)    		$param.='&deliveryyear='.$deliveryyear;
 	if ($search_ref)      		$param.='&search_ref='.$search_ref;

+ 2 - 9
htdocs/compta/facture.php

@@ -1882,14 +1882,7 @@ $now = dol_now();
 llxHeader('', $langs->trans('Bill'), 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
 
 
-
-/**
- * *******************************************************************
- *
- * Mode creation
- *
- * ********************************************************************
- */
+// Mode creation
 
 if ($action == 'create')
 {
@@ -2046,7 +2039,7 @@ if ($action == 'create')
 	else
 	{
 		print '<td colspan="2">';
-		print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 1);
+		print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty');
 		// Option to reload page to retrieve customer informations. Note, this clear other input
 		if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
 		{

+ 10 - 2
htdocs/compta/facture/list.php

@@ -10,7 +10,7 @@
  * Copyright (C) 2013      Florian Henry		  	<florian.henry@open-concept.pro>
  * Copyright (C) 2013      Cédric Salvador       <csalvador@gpcsolutions.fr>
  * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
- * Copyright (C) 2015	   Ferran Marcet		<fmarcet@2byte.es>
+ * Copyright (C) 2015-2016 Ferran Marcet		<fmarcet@2byte.es>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -83,6 +83,7 @@ if ($page == -1) {
     $page = 0;
 }
 $offset = $limit * $page;
+if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
 if (! $sortorder) $sortorder='DESC';
 if (! $sortfield) $sortfield='f.datef';
 $pageprev = $page - 1;
@@ -542,7 +543,6 @@ if (empty($reshook))
 // Do we click on purge search criteria ?
 if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
 {
-    $search_categ='';
     $search_user='';
     $search_sale='';
     $search_product_category='';
@@ -559,6 +559,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
     $toselect='';
     $option='';
     $filter='';
+    $day_lim='';
+    $year_lim='';
+    $month_lim='';
 }
 
     
@@ -695,13 +698,18 @@ if ($resql)
 
     $param='&socid='.$socid;
     if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
+    if ($day)                $param.='&day='.$day;
     if ($month)              $param.='&month='.$month;
     if ($year)               $param.='&year=' .$year;
+    if ($day_lim)            $param.='&day_lim='.$day_lim;
+    if ($month_lim)          $param.='&month_lim='.$month_lim;
+    if ($year_lim)           $param.='&year_lim=' .$year_lim;
     if ($search_ref)         $param.='&search_ref=' .$search_ref;
     if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer;
     if ($search_societe)     $param.='&search_societe=' .$search_societe;
     if ($search_sale > 0)    $param.='&search_sale=' .$search_sale;
     if ($search_user > 0)    $param.='&search_user=' .$search_user;
+    if ($search_product_category > 0)   $param.='$search_product_category=' .$search_product_category;
     if ($search_montant_ht != '')  $param.='&search_montant_ht='.$search_montant_ht;
     if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
 	if ($search_status != '') $param.='&search_status='.$search_status;

+ 1 - 1
htdocs/compta/index.php

@@ -628,7 +628,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
 /*
  * Customers orders to be billed
  */
-if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $user->rights->commande->lire)
+if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER))
 {
 	$commandestatic=new Commande($db);
 	$langs->load("orders");

+ 7 - 9
htdocs/compta/prelevement/class/bonprelevement.class.php

@@ -1260,26 +1260,24 @@ class BonPrelevement extends CommonObject
 			$fileDebiteurSection = '';
 			$fileEmetteurSection = '';
 			$i = 0;
-			$j = 0;
 			$this->total = 0;
 
 			/*
 			 * section Debiteur (sepa Debiteurs bloc lines)
 			 */
 
+			$tmp_invoices = array();
+
 			$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
 			$resql=$this->db->query($sql);
-			if ($resql)
-			{
-				$num = $this->db->num_rows($resql);
-				while ($j < $num)
-				{
-					$objfac = $this->db->fetch_object($resql);
-					$ListOfFactures = $ListOfFactures . $objfac->fac . ",";
-					$j++;
+			if ($resql) {
+				while ($objfac = $this->db->fetch_object($resql)) {
+					$tmp_invoices[] = $objfac->fac;
 				}
 			}
 
+	        $ListOfFactures = implode($tmp_invoices);
+
 			$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
 			$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
 			$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";

+ 4 - 4
htdocs/contact/list.php

@@ -620,23 +620,23 @@ if ($result)
         if (! empty($arrayfields['p.lastname']['checked']))
         {
             print '<td valign="middle">';
-		  print $contactstatic->getNomUrl(1,'',20);
+		  print $contactstatic->getNomUrl(1,'',0);
 		  print '</td>';
         }
 		// Firstname
         if (! empty($arrayfields['p.firstname']['checked']))
         {
-            print '<td>'.dol_trunc($obj->firstname,20).'</td>';
+            print '<td>'.$obj->firstname.'</td>';
         }
     	// Zip
         if (! empty($arrayfields['p.zip']['checked']))
         {
-            print '<td>'.dol_trunc($obj->zip,20).'</td>';
+            print '<td>'.$obj->zip.'</td>';
         }
     	// Town
         if (! empty($arrayfields['p.town']['checked']))
         {
-            print '<td>'.dol_trunc($obj->town,20).'</td>';
+            print '<td>'.$obj->town.'</td>';
         }
         // Function
         if (! empty($arrayfields['p.poste']['checked']))

+ 3 - 3
htdocs/contrat/card.php

@@ -1426,9 +1426,9 @@ else
             print '<form name="update" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
             print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
             print '<input type="hidden" name="action" value="updateligne">';
-            print '<input type="hidden" name="elrowid" value="'.GETPOST('rowid').'">';
-            print '<input type="hidden" name="idprod" value="'.($objp->fk_product?$objp->fk_product:'0').'">';
-            print '<input type="hidden" name="fournprice" value="'.($objp->fk_fournprice?$objp->fk_fournprice:'0').'">';
+            print '<input type="hidden" name="elrowid" value="'.$object->lines[$cursorline-1]->id.'">';
+            print '<input type="hidden" name="idprod" value="'.(!empty($object->lines[$cursorline-1]->fk_product) ? $object->lines[$cursorline-1]->fk_product : 0).'">';
+            print '<input type="hidden" name="fournprice" value="'.(!empty($object->lines[$cursorline-1]->fk_fournprice) ? $object->lines[$cursorline-1]->fk_fournprice : 0).'">';
 
             // Area with common detail of line
             print '<table class="notopnoleftnoright allwidth tableforservicepart1" width="100%">';

+ 2 - 2
htdocs/core/class/html.form.class.php

@@ -895,7 +895,7 @@ class Form
      *	@param	string	$selected       Preselected type
      *	@param  string	$htmlname       Name of field in form
      *  @param  string	$filter         optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)')
-     *	@param	string	$showempty		Add an empty field (Can be '1' or text to use on empty line)
+     *	@param	string	$showempty		Add an empty field (Can be '1' or text to use on empty line like 'SelectThirdParty')
      * 	@param	int		$showtype		Show third party type in combolist (customer, prospect or supplier)
      * 	@param	int		$forcecombo		Force to use combo box
      *  @param	array	$events			Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
@@ -950,7 +950,7 @@ class Form
      *	@param	string	$selected       Preselected type
      *	@param  string	$htmlname       Name of field in form
      *  @param  string	$filter         optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)')
-     *	@param	string	$showempty		Add an empty field (Can be '1' or text to use on empty line)
+     *	@param	string	$showempty		Add an empty field (Can be '1' or text to use on empty line like 'SelectThirdParty')
      * 	@param	int		$showtype		Show third party type in combolist (customer, prospect or supplier)
      * 	@param	int		$forcecombo		Force to use combo box
      *  @param	array	$events			Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))

+ 17 - 21
htdocs/core/lib/admin.lib.php

@@ -593,7 +593,7 @@ function listOfSessions()
                     //$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f";dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920";dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";';
                     
                     if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session
-                    (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity
+                        (preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity
                     preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name
                     {
                         $tmp=explode('_', $file);
@@ -909,27 +909,24 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
                             if (! empty($objMod->dictionaries))
                             {
                                 //var_dump($objMod->dictionaries['tabname']);
-                                $taborder[] = 0;
-                                $tabfieldcheck[] = array(); $tabhelp[] = array();
-                                foreach($objMod->dictionaries['tabname'] as $val)
+                                $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp=0;
+                                foreach($objMod->dictionaries['tabname'] as $val)        { $nbtabname++; $taborder[] = count($tabname)+1; $tabname[] = $val; }
+                                foreach($objMod->dictionaries['tablib'] as $val)         { $nbtablib++; $tablib[] = $val; }
+                                foreach($objMod->dictionaries['tabsql'] as $val)         { $nbtabsql++; $tabsql[] = $val; }
+                                foreach($objMod->dictionaries['tabsqlsort'] as $val)     { $nbtabsqlsort++; $tabsqlsort[] = $val; }
+                                foreach($objMod->dictionaries['tabfield'] as $val)       { $nbtabfield++; $tabfield[] = $val; }
+                                foreach($objMod->dictionaries['tabfieldvalue'] as $val)  { $nbtabfieldvalue++; $tabfieldvalue[] = $val; }
+                                foreach($objMod->dictionaries['tabfieldinsert'] as $val) { $nbtabfieldinsert++; $tabfieldinsert[] = $val; }
+                                foreach($objMod->dictionaries['tabrowid'] as $val)       { $nbtabrowid++; $tabrowid[] = $val; }
+                                foreach($objMod->dictionaries['tabcond'] as $val)        { $nbtabcond++; $tabcond[] = $val; }
+                                if (! empty($objMod->dictionaries['tabhelp']))       foreach($objMod->dictionaries['tabhelp'] as $val)       { $nbtabhelp++; $tabhelp[] = $val; }
+                                if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) { $nbtabfieldcheck++; $tabfieldcheck[] = $val; }
+                                
+                                if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort)
                                 {
-                                    $taborder[] = count($tabname)+1;
-                                    $tabname[] = $val;
+                                    print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
+                                    //print "$const_name: $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp\n";
                                 }
-                                foreach($objMod->dictionaries['tablib'] as $val) $tablib[] = $val;
-                                foreach($objMod->dictionaries['tabsql'] as $val) $tabsql[] = $val;
-                                foreach($objMod->dictionaries['tabsqlsort'] as $val) $tabsqlsort[] = $val;
-                                foreach($objMod->dictionaries['tabfield'] as $val) $tabfield[] = $val;
-                                foreach($objMod->dictionaries['tabfieldvalue'] as $val) $tabfieldvalue[] = $val;
-                                foreach($objMod->dictionaries['tabfieldinsert'] as $val) $tabfieldinsert[] = $val;
-                                foreach($objMod->dictionaries['tabrowid'] as $val) $tabrowid[] = $val;
-                                foreach($objMod->dictionaries['tabcond'] as $val) $tabcond[] = $val;
-                                if (! empty($objMod->dictionaries['tabfieldcheck'])) foreach($objMod->dictionaries['tabfieldcheck'] as $val) $tabfieldcheck[] = $val;
-                                if (! empty($objMod->dictionaries['tabhelp'])) foreach($objMod->dictionaries['tabhelp'] as $val) $tabhelp[] = $val;
-                                //foreach($objMod->dictionaries['tabsqlsort'] as $val) $tablib[] = $val;
-                                //$tabname = array_merge ($tabname, $objMod->dictionaries['tabname']);
-                                //var_dump($tabcond);
-                                //exit;
                             }
 
                             $j++;
@@ -1031,7 +1028,6 @@ function complete_elementList_with_modules(&$elementList)
                             if (! empty($objMod->module_parts['contactelement']))
                             {
                             	$elementList[$objMod->name] = $langs->trans($objMod->name);
-                                //exit;
                             }
 
                             $j++;

+ 1 - 0
htdocs/don/list.php

@@ -79,6 +79,7 @@ $fieldstosearchall = array(
  * View
  */
 
+$form=new Form($db);
 if (! empty($conf->projet->enabled)) $projectstatic=new Project($db);
 
 llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones');

+ 1 - 0
htdocs/expedition/list.php

@@ -88,6 +88,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
  * View
  */
 
+$form=new Form($db);
 $companystatic=new Societe($db);
 $shipment=new Expedition($db);
 

+ 1 - 1
htdocs/fourn/card.php

@@ -139,7 +139,7 @@ if ($object->id > 0)
 	print '<table width="100%" class="border">';
 
 	// Alias names (commercial, trademark or alias names)
-	print '<tr><td class="titlefield">'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
+	print '<tr><td class="titlefield" width="25%">'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
 	print $object->name_alias;
 	print "</td></tr>";
 

+ 1 - 0
htdocs/fourn/commande/list.php

@@ -93,6 +93,7 @@ if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate";
  *	View
  */
 
+$form=new Form($db);
 $thirdpartytmp = new Fournisseur($db);
 $commandestatic=new CommandeFournisseur($db);
 $formfile = new FormFile($db);

+ 1 - 1
htdocs/fourn/facture/card.php

@@ -1361,7 +1361,7 @@ if ($action == 'create')
     print '<table class="border" width="100%">';
 
     // Ref
-    print '<tr><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
+    print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
 
     // Third party
     print '<tr><td class="fieldrequired">'.$langs->trans('Supplier').'</td>';

+ 9 - 1
htdocs/fourn/facture/list.php

@@ -8,7 +8,7 @@
  * Copyright (C) 2015      Marcos García        <marcosgdf@gmail.com>
  * Copyright (C) 2015	   juanjo Menent		<jmenent@2byte.es>
  * Copyright (C) 2015 	   Abbes Bahfir 	<bafbes@gmail.com>
- * Copyright (C) 2015	   Ferran Marcet		<fmarcet@2byte.es>
+ * Copyright (C) 2015-2016 Ferran Marcet		<fmarcet@2byte.es>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -97,6 +97,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter"))		// Both
 	$search_status="";
 	$year="";
 	$month="";
+	$day="";
+	$year_lim="";
+	$month_lim="";
+	$day_lim="";
 }
 
 // List of fields to search into when doing a "search in all"
@@ -248,8 +252,12 @@ if ($resql)
 	}
 
 	$param='&socid='.$socid;
+	if ($day) 					$param.='&day='.urlencode($day);
 	if ($month) 				$param.='&month='.urlencode($month);
 	if ($year)  				$param.='&year=' .urlencode($year);
+	if ($day_lim) 				$param.='&day_lim='.urlencode($day_lim);
+	if ($month_lim) 			$param.='&month_lim='.urlencode($month_lim);
+	if ($year_lim)  			$param.='&year_lim=' .urlencode($year_lim);
 	if ($search_ref)          	$param.='&search_ref='.urlencode($search_ref);
 	if ($search_ref_supplier) 	$param.='&search_ref_supplier'.urlencode($search_ref_supplier);
 	if ($search_label)      	$param.='&search_label='.urlencode($search_label);

+ 1 - 1
htdocs/includes/jquery/plugins/select2/select2.css

@@ -28,7 +28,7 @@ Version: 3.5.2 Timestamp: Sat Nov  1 14:43:36 EDT 2014
 .select2-container .select2-choice {
     display: block;
     height: 26px;
-    padding: 0 0 0 8px;
+    padding: 0 0 0 5px;
     overflow: hidden;
     position: relative;
 

+ 2 - 0
htdocs/index.php

@@ -66,6 +66,8 @@ if (GETPOST('addbox'))	// Add box (when submit is done from a form when ajax dis
  * View
  */
 
+if (! is_object($form)) $form=new Form($db);
+
 // Title
 $title=$langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
 if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;

+ 1 - 0
htdocs/install/mysql/data/llx_c_currencies.sql

@@ -69,6 +69,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'EUR'
 INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FKP', '[163]', 1,				'Falkland Islands (Malvinas) Pound');
 INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'FJD', '[36]', 1,				'Fiji Dollar');
 INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GHC', '[162]', 1,				'Ghana Cedis');
+INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GNF', '[70,71]', 1,				'Franc Guinéen');
 INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GIP', '[163]', 1,				'Gibraltar Pound');
 INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GTQ', '[81]', 1,				'Guatemala Quetzal');
 INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'GGP', '[163]', 1,				'Guernsey Pound');

+ 4 - 4
htdocs/install/mysql/data/llx_c_payment_term.sql

@@ -27,11 +27,11 @@
 -- de l'install et tous les sigles '--' sont supprimés.
 --
 
-insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (1,'RECEP',       1,1, 'A réception de facture','Réception de facture',0,0);
+insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (1,'RECEP',       1,1, 'A réception de facture','Réception de facture',0,1);
 insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (2,'30D',         2,1, '30 jours','Réglement à 30 jours',0,30);
 insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (3,'30DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 30 jours fin de mois',1,30);
 insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (4,'60D',         4,1, '60 jours','Réglement à 60 jours',0,60);
 insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (5,'60DENDMONTH', 5,1, '60 jours fin de mois','Réglement à 60 jours fin de mois',1,60);
-insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (6,'PT_ORDER',    6,1, 'A réception de commande','A réception de commande',0,0);
-insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (7,'PT_DELIVERY', 7,1, 'Livraison','Règlement à la livraison',0,0);
-insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (8,'PT_5050',     8,1, '50 et 50','Règlement 50% à la commande, 50% à la livraison',0,0);
+insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (6,'PT_ORDER',    6,1, 'A réception de commande','A réception de commande',0,1);
+insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (7,'PT_DELIVERY', 7,1, 'Livraison','Règlement à la livraison',0,1);
+insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (8,'PT_5050',     8,1, '50 et 50','Règlement 50% à la commande, 50% à la livraison',0,1);

+ 6 - 0
htdocs/install/mysql/migration/3.8.0-3.9.0.sql

@@ -597,3 +597,9 @@ ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL;
 -- Fix Argentina provences
 INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2326', 2305, '', 0, 'MISIONES', 'Misiones', 1);
 UPDATE llx_c_departements SET ncc = "FORMOSA", nom = "Formosa" WHERE nom = "Formosa Misiones";
+
+-- MALTA VATS (id country=148)
+INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1481,  148, '18','0','VAT standard rate',1);
+INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1482,  148, '7','0','VAT reduced rate',1);
+INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1483,  148, '5','0','VAT super-reduced rate', 1);
+INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (1484,  148, '0','0','VAT Rate 0', 1);

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

@@ -201,3 +201,4 @@ OppStatusNEGO=Negociation
 OppStatusPENDING=Pending
 OppStatusWIN=Won
 OppStatusLOST=Lost
+Budget=Budget

+ 1 - 1
htdocs/langs/es_ES/admin.lang

@@ -1091,7 +1091,7 @@ SendmailOptionMayHurtBuggedMTA=La funcionalidad de enviar correo electrónico a
 TranslationSetup=Configuración traducción
 TranslationDesc=La elección del idioma mostrado en pantalla se modifica:<br>* A nivel global desde el menú <strong>Inicio - Configuración - Entorno</strong><br>* De manera específica al usuario desde la pestaña <strong>Interfaz usuario</strong> de su ficha de usuario (hacer clic en su login en la parte superior izquierda de la pantalla).
 TranslationOverwriteDesc=También puede sobreescribir algún valor completando/editando la tabla siguiente. Debe utilizar  "%s" para el código de idioma, "%s" para la clave que encuentra en el archivo langs/xx_XX/somefile.lang y "%s" para el nuevo valor que desea utilizar como nueva traducción.
-TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b> / <b>%s</b>
+TotalNumberOfActivatedModules=Número total de módulos activados: <b>%s</b> / <b>%s</b>
 YouMustEnableOneModule=Debe activar al menos un módulo.
 ClassNotFoundIntoPathWarning=No se ha encontrado la clase %s en su path PHP
 YesInSummer=Sí en verano

+ 3 - 3
htdocs/langs/es_ES/boxes.lang

@@ -45,13 +45,13 @@ BoxTitleLastModifiedProspects=Los %s últimos clientes potenciales modificados
 BoxTitleLastProductsInContract=Los %s últimos productos/servicios contratados
 BoxTitleLastModifiedMembers=Últimos %s miembros 
 BoxTitleLastFicheInter=Las %s últimas intervenciones modificadas
-BoxTitleOldestUnpaidCustomerBills=%s facturas a clientes más antiguras pendientes de cobro
-BoxTitleOldestUnpaidSupplierBills=%s facturas de proveedores más antiguas pendientes de pago
+BoxTitleOldestUnpaidCustomerBills=Las %s facturas a clientes más antiguras pendientes de cobro
+BoxTitleOldestUnpaidSupplierBills=Las %s facturas de proveedores más antiguas pendientes de pago
 BoxTitleCurrentAccounts=Balance de cuentas abiertas
 BoxTitleSalesTurnover=Volumen de ventas realizado
 BoxTitleTotalUnpaidCustomerBills=Facturas a clientes pendientes de cobro
 BoxTitleTotalUnpaidSuppliersBills=Facturas de proveedores pendientes de pago
-BoxTitleLastModifiedContacts=Los %s últimos contactos/direcciones modificadas
+BoxTitleLastModifiedContacts=Los %s últimos contactos/direcciones modificados
 BoxMyLastBookmarks=Mis %s últimos marcadores
 BoxOldestExpiredServices=Servicios antiguos expirados
 BoxLastExpiredServices=Los %s contratos más antiguos con servicios activos expirados

+ 2 - 2
htdocs/langs/es_ES/companies.lang

@@ -266,8 +266,8 @@ CustomerRelativeDiscountShort=Descuento relativo
 CustomerAbsoluteDiscountShort=Descuento fijo
 CompanyHasRelativeDiscount=Este cliente tiene un descuento por defecto de <b>%s%%</b>
 CompanyHasNoRelativeDiscount=Este cliente no tiene descuentos relativos por defecto
-CompanyHasAbsoluteDiscount=Este cliente tiene <b>%s %s</b> descuentos disponibles (descuentos, anticipos...)
-CompanyHasCreditNote=Este cliente tiene <b>%s %s</b> anticipos disponibles
+CompanyHasAbsoluteDiscount=Este cliente tiene <b>%s %s</b> en descuentos o anticipos disponibles
+CompanyHasCreditNote=Este cliente tiene <b>%s %s</b> en anticipos disponibles
 CompanyHasNoAbsoluteDiscount=Este cliente no tiene más descuentos fijos disponibles
 CustomerAbsoluteDiscountAllUsers=Descuentos fijos en curso (acordado por todos los usuarios)
 CustomerAbsoluteDiscountMy=Descuentos fijos en curso (acordados personalmente)

+ 2 - 2
htdocs/langs/es_ES/cron.lang

@@ -40,8 +40,8 @@ CronNone=Ninguna
 CronDtStart=No antes de
 CronDtEnd=No después de
 CronDtNextLaunch=Sig. ejec.
-CronDtLastLaunch=Start date of last execution
-CronDtLastResult=End date of last execution
+CronDtLastLaunch=Fecha inicio última ejec.
+CronDtLastResult=Fecha finalización última ejec.
 CronFrequency=Frecuencia
 CronClass=Clase
 CronMethod=Metodo

+ 1 - 0
htdocs/langs/es_ES/projects.lang

@@ -198,3 +198,4 @@ OppStatusNEGO=Negociación
 OppStatusPENDING=Pendiente
 OppStatusWIN=Ganado
 OppStatusLOST=Perdido
+Budget=Presupuesto

+ 1 - 0
htdocs/langs/fr_FR/projects.lang

@@ -198,3 +198,4 @@ OppStatusNEGO=Négociation
 OppStatusPENDING=En attente
 OppStatusWIN=Gagné
 OppStatusLOST=Perdu
+Budget=Budget

+ 3 - 3
htdocs/main.inc.php

@@ -1447,7 +1447,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
 	    // Show menu entries
     	print '<div id="tmenu_tooltip'.(empty($conf->global->MAIN_MENU_INVERT)?'':'invert').'" class="tmenu">'."\n";
 	    $menumanager->atarget=$target;
-	    $menumanager->showmenu('top');      // This contains a \n
+	    $menumanager->showmenu('top', array('searchform'=>$searchform, 'bookmarks'=>$bookmarks));      // This contains a \n
 	    print "</div>\n";
 
 	    //$form=new Form($db);
@@ -1611,7 +1611,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
 
 	    print "\n";
 
-	    if ($conf->use_javascript_ajax && $conf->browser->layout != 'phone')
+	    if ($conf->use_javascript_ajax && $conf->browser->layout != 'phone' && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM))
 	    {
     	    if (! is_object($form)) $form=new Form($db);
     	    $selected=-1;
@@ -1657,7 +1657,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
     	        $searchform.=printSearchForm(DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user'));
     	    }
 	    }
-        
+  
 	    // Execute hook printSearchForm
 	    $parameters=array('searchform'=>$searchform);
 	    $reshook=$hookmanager->executeHooks('printSearchForm',$parameters);    // Note that $action and $object may have been modified by some hooks

+ 3 - 1
htdocs/product/admin/product.php

@@ -61,7 +61,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
 }
 
 // Clean param
-if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) $conf->global->PRODUIT_MULTIPRICES_LIMIT = 5;
+if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) {
+	dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity);
+}
 
 
 

+ 124 - 74
htdocs/projet/activity/index.php

@@ -46,10 +46,15 @@ $langs->load("projects");
  */
 
 $now = dol_now();
+$tmp=dol_getdate($now);
+$day=$tmp['mday'];
+$month=$tmp['mon'];
+$year=$tmp['year'];
 
 $projectstatic=new Project($db);
 $taskstatic=new Task($db);
 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);  // Return all projects I have permission on because I want my tasks and some of my task may be on a public projet that is not my project
+$taskstatic=new Task($db);
 $tasktmp=new Task($db);
 
 $title=$langs->trans("Activities");
@@ -104,7 +109,7 @@ print '<td width="50%">'.$langs->trans('ActivityOnProjectToday').'</td>';
 print '<td width="50%" align="right">'.$langs->trans("Time").'</td>';
 print "</tr>\n";
 
-$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
+$sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
 $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
 $sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
 $sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -112,9 +117,9 @@ $sql.= " WHERE t.fk_projet = p.rowid";
 $sql.= " AND p.entity = ".$conf->entity;
 $sql.= " AND tt.fk_task = t.rowid";
 $sql.= " AND tt.fk_user = ".$user->id;
-$sql.= " AND date_format(task_date,'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'";
+$sql.= " AND task_date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
 $sql.= " AND p.rowid in (".$projectsListId.")";
-$sql.= " GROUP BY p.rowid, p.ref, p.title";
+$sql.= " GROUP BY p.rowid, p.ref, p.title, p.public";
 
 $resql = $db->query($sql);
 if ( $resql )
@@ -130,9 +135,10 @@ if ( $resql )
 		$projectstatic->id=$row->rowid;
 		$projectstatic->ref=$row->ref;
 		$projectstatic->title=$row->title;
+		$projectstatic->public=$row->public;
 		print $projectstatic->getNomUrl(1, '', 1);
 		print '</td>';
-		print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
+		print '<td align="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
 		print "</tr>\n";
 		$total += $row->nb;
 	}
@@ -145,80 +151,79 @@ else
 }
 print '<tr class="liste_total">';
 print '<td>'.$langs->trans('Total').'</td>';
-print '<td align="right">'.convertSecondToTime($total).'</td>';
+print '<td align="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
 print "</tr>\n";
 print "</table>";
 
-// TODO Do not use date_add function to be compatible with all database
-if ($db->type != 'pgsql')
-{
-	/* Affichage de la liste des projets d'hier */
-	print '<br><table class="noborder" width="100%">';
-	print '<tr class="liste_titre">';
-	print '<td>'.$langs->trans('ActivityOnProjectYesterday').'</td>';
-	print '<td align="right">'.$langs->trans("Time").'</td>';
-	print "</tr>\n";
 
-	$sql = "SELECT p.rowid, p.ref, p.title, sum(tt.task_duration) as nb";
-	$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
-	$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
-	$sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
-	$sql.= " WHERE t.fk_projet = p.rowid";
-	$sql.= " AND p.entity = ".$conf->entity;
-	$sql.= " AND tt.fk_task = t.rowid";
-	$sql.= " AND tt.fk_user = ".$user->id;
-	$sql.= " AND date_format(date_add(task_date, INTERVAL 1 DAY),'%y-%m-%d') = '".strftime("%y-%m-%d",$now)."'";
-	$sql.= " AND p.rowid in (".$projectsListId.")";
-	$sql.= " GROUP BY p.rowid, p.ref, p.title";
+/* Affichage de la liste des projets d'hier */
+print '<br><table class="noborder" width="100%">';
+print '<tr class="liste_titre">';
+print '<td>'.$langs->trans('ActivityOnProjectYesterday').'</td>';
+print '<td align="right">'.$langs->trans("Time").'</td>';
+print "</tr>\n";
 
-	$resql = $db->query($sql);
-	if ( $resql )
-	{
-		$var=true;
-		$total=0;
+$sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
+$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
+$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
+$sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
+$sql.= " WHERE t.fk_projet = p.rowid";
+$sql.= " AND p.entity = ".$conf->entity;
+$sql.= " AND tt.fk_task = t.rowid";
+$sql.= " AND tt.fk_user = ".$user->id;
+$sql.= " AND task_date BETWEEN '".$db->idate(dol_time_plus_duree(dol_mktime(0, 0, 0, $month, $day, $year), -1, 'd'))."' AND '".$db->idate(dol_time_plus_duree(dol_mktime(23, 59, 59, $month, $day, $year), -1, 'd'))."'";
+$sql.= " AND p.rowid in (".$projectsListId.")";
+$sql.= " GROUP BY p.rowid, p.ref, p.title, p.public";
 
-		while ($row = $db->fetch_object($resql))
-		{
-			$var=!$var;
-			print "<tr ".$bc[$var].">";
-			print '<td>';
-			$projectstatic->id=$row->rowid;
-			$projectstatic->ref=$row->ref;
-			$projectstatic->title=$row->title;
-			print $projectstatic->getNomUrl(1, '', 1);
-			print '</td>';
-			print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
-			print "</tr>\n";
-			$total += $row->nb;
-		}
+$resql = $db->query($sql);
+if ( $resql )
+{
+	$var=true;
+	$total=0;
 
-		$db->free($resql);
-	}
-	else
+	while ($row = $db->fetch_object($resql))
 	{
-		dol_print_error($db);
+		$var=!$var;
+		print "<tr ".$bc[$var].">";
+		print '<td>';
+		$projectstatic->id=$row->rowid;
+		$projectstatic->ref=$row->ref;
+		$projectstatic->title=$row->title;
+		$projectstatic->public=$row->public;
+		print $projectstatic->getNomUrl(1, '', 1);
+		print '</td>';
+		print '<td align="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
+		print "</tr>\n";
+		$total += $row->nb;
 	}
-	print '<tr class="liste_total">';
-	print '<td>'.$langs->trans('Total').'</td>';
-	print '<td align="right">'.convertSecondToTime($total).'</td>';
-	print "</tr>\n";
-	print "</table>";
+
+	$db->free($resql);
 }
+else
+{
+	dol_print_error($db);
+}
+print '<tr class="liste_total">';
+print '<td>'.$langs->trans('Total').'</td>';
+print '<td align="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
+print "</tr>\n";
+print "</table>";
 
 
-// TODO Do not use week function to be compatible with all database
+
+/*
 if ($db->type != 'pgsql')
 {
     print '<br>';
     
-    /* Affichage de la liste des projets de la semaine */
+    // Affichage de la liste des projets de la semaine
     print '<table class="noborder" width="100%">';
     print '<tr class="liste_titre">';
     print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
     print '<td align="right">'.$langs->trans("Time").'</td>';
     print "</tr>\n";
     
-    $sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
+    $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
     $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
     $sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
     $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -226,7 +231,7 @@ if ($db->type != 'pgsql')
     $sql.= " AND p.entity = ".$conf->entity;
     $sql.= " AND tt.fk_task = t.rowid";
     $sql.= " AND tt.fk_user = ".$user->id;
-    $sql.= " AND week(task_date) = '".strftime("%W",time())."'";
+    $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ...";
     $sql.= " AND p.rowid in (".$projectsListId.")";
     $sql.= " GROUP BY p.rowid, p.ref, p.title";
     
@@ -244,9 +249,10 @@ if ($db->type != 'pgsql')
     		$projectstatic->id=$row->rowid;
     		$projectstatic->ref=$row->ref;
     		$projectstatic->title=$row->title;
+    		$projectstatic->public=$row->public;
     		print $projectstatic->getNomUrl(1, '', 1);
     		print '</td>';
-    		print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
+    		print '<td align="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
     		print "</tr>\n";
     		$total += $row->nb;
     	}
@@ -259,10 +265,12 @@ if ($db->type != 'pgsql')
     }
     print '<tr class="liste_total">';
     print '<td>'.$langs->trans('Total').'</td>';
-    print '<td align="right">'.convertSecondToTime($total).'</td>';
+    print '<td align="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
     print "</tr>\n";
     print "</table><br>";
+
 }
+*/
 
 /* Affichage de la liste des projets du mois */
 if (! empty($conf->global->PROJECT_TASK_TIME_MONTH))
@@ -273,7 +281,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH))
     print '<td align="right">'.$langs->trans("Time").'</td>';
     print "</tr>\n";
     
-    $sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
+    $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
     $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
     $sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
     $sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -281,9 +289,9 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH))
     $sql.= " AND p.entity = ".$conf->entity;
     $sql.= " AND tt.fk_task = t.rowid";
     $sql.= " AND tt.fk_user = ".$user->id;
-    $sql.= " AND date_format(task_date,'%y-%m') = '".strftime("%y-%m",$now)."'";
+	$sql.= " AND task_date BETWEEN '".$db->idate(dol_get_first_day($year, $month))."' AND '".$db->idate(dol_get_last_day($year, $month))."'";
     $sql.= " AND p.rowid in (".$projectsListId.")";
-    $sql.= " GROUP BY p.rowid, p.ref, p.title";
+    $sql.= " GROUP BY p.rowid, p.ref, p.title, p.public";
     
     $resql = $db->query($sql);
     if ( $resql )
@@ -299,7 +307,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH))
     		$projectstatic->title=$row->title;
     		print $projectstatic->getNomUrl(1, '', 1);
     		print '</td>';
-    		print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
+    		print '<td align="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
     		print "</tr>\n";
     		$var=!$var;
     	}
@@ -311,7 +319,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH))
     }
     print '<tr class="liste_total">';
     print '<td>'.$langs->trans('Total').'</td>';
-    print '<td align="right">'.convertSecondToTime($total).'</td>';
+    print '<td align="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
     print "</tr>\n";
     print "</table>";
 }
@@ -325,7 +333,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
 	print '<td align="right">'.$langs->trans("Time").'</td>';
 	print "</tr>\n";
 
-	$sql = "SELECT p.rowid, p.ref, p.title, SUM(tt.task_duration) as nb";
+	$sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
 	$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
 	$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
 	$sql.= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -335,7 +343,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
 	$sql.= " AND tt.fk_user = ".$user->id;
 	$sql.= " AND YEAR(task_date) = '".strftime("%Y",$now)."'";
 	$sql.= " AND p.rowid in (".$projectsListId.")";
-	$sql.= " GROUP BY p.rowid, p.ref, p.title";
+	$sql.= " GROUP BY p.rowid, p.ref, p.title, p.public";
 
 	$var=false;
 	$resql = $db->query($sql);
@@ -348,9 +356,10 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
 			$projectstatic->id=$row->rowid;
 			$projectstatic->ref=$row->ref;
 			$projectstatic->title=$row->title;
+			$projectstatic->public=$row->public;
 			print $projectstatic->getNomUrl(1, '', 1);
 			print '</td>';
-			print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
+			print '<td align="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
 			print "</tr>\n";
 			$var=!$var;
 		}
@@ -362,31 +371,71 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR))
 	}
 	print '<tr class="liste_total">';
 	print '<td>'.$langs->trans('Total').'</td>';
-	print '<td align="right">'.convertSecondToTime($total).'</td>';
+	print '<td align="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
 	print "</tr>\n";
 	print "</table>";
 }
 
 if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA))
 {
+    // Get id of types of contacts for projects (This list never contains a lot of elements)
+    $listofprojectcontacttype=array();
+    $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
+    $sql.= " WHERE ctc.element = '" . $projectstatic->element . "'";
+    $sql.= " AND ctc.source = 'internal'";
+    $resql = $db->query($sql);
+    if ($resql)
+    {
+        while($obj = $db->fetch_object($resql))
+        {
+            $listofprojectcontacttype[$obj->rowid]=$obj->code;
+        }
+    }
+    else dol_print_error($db);
+    if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0';    // To avoid sql syntax error if not found
+    // Get id of types of contacts for tasks (This list never contains a lot of elements)
+    $listoftaskcontacttype=array();
+    $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
+    $sql.= " WHERE ctc.element = '" . $taskstatic->element . "'";
+    $sql.= " AND ctc.source = 'internal'";
+    $resql = $db->query($sql);
+    if ($resql)
+    {
+        while($obj = $db->fetch_object($resql))
+        {
+            $listoftaskcontacttype[$obj->rowid]=$obj->code;
+        }
+    }
+    else dol_print_error($db);
+    if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0';         // To avoid sql syntax error if not found
+    
+
 	// Tasks for all resources of all opened projects and time spent for each task/resource
 	// This list can be very long, so we don't show it by default on task area. We prefer to use the list page.
     // Add constant PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA to show this list
     
 	$max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA);
 
-	$sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.dateo as projdateo, p.datee as projdatee,";
+	$sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, p.dateo as projdateo, p.datee as projdatee,";
 	$sql.= " t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
 	$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
 	$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
 	$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
 	$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid";
 	$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid";
+	if ($mine)
+	{
+	    $sql.= ", " . MAIN_DB_PREFIX . "element_contact as ect";
+	}
 	$sql.= " WHERE p.entity = ".$conf->entity;
-	if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";
-	if ($socid)	$sql.= "  AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
+	if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";  // project i have permission on
+	if ($mine)     // this may duplicate record if we are contact twice
+	{
+        $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$user->id;
+	}
+	if ($socid)	$sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
 	$sql.= " AND p.fk_statut=1";
-	$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee";
+	$sql.= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee";
 	$sql.= " ORDER BY t.dateo desc, t.rowid desc, t.datee";
 	$sql.= $db->plimit($max+1);	// We want more to know if we have more than limit
 
@@ -435,6 +484,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S
 			$projectstatic->ref=$obj->ref;
 			$projectstatic->title=$obj->title;
 			$projectstatic->statut = $obj->status;
+			$projectstatic->public = $obj->public;
 			$projectstatic->dateo = $db->jdate($obj->projdateo);
 			$projectstatic->datee = $db->jdate($obj->projdatee);
 				
@@ -468,10 +518,10 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S
 			if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
 			print '</td>';
 			print '<td align="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
-			print convertSecondToTime($obj->planned_workload, 'all');
+			print convertSecondToTime($obj->planned_workload, 'allhourmin');
 			print '</a></td>';
 			print '<td align="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
-			print convertSecondToTime($obj->timespent, 'all');
+			print convertSecondToTime($obj->timespent, 'allhourmin');
 			print '</a></td>';
 			print '<td align="right">';
 			if (! empty($obj->taskid))

+ 1 - 1
htdocs/projet/card.php

@@ -465,7 +465,7 @@ if ($action == 'create' && $user->rights->projet->creer)
     print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
     $filteronlist='';
     if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
-   	$text=$form->select_thirdparty_list(GETPOST('socid','int'),'socid',$filteronlist,1,1);
+   	$text=$form->select_thirdparty_list(GETPOST('socid','int'),'socid',$filteronlist,'SelectThirdParty',1);
     if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
     {
     	$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");

+ 1 - 1
htdocs/societe/commerciaux.php

@@ -126,7 +126,7 @@ if ($socid)
 	print '<table class="border centpercent">';
 
 	print '<tr>';
-    print '<td class="titlefield">'.$langs->trans('CustomerCode').'</td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>';
+    print '<td class="titlefield" width="25%">'.$langs->trans('CustomerCode').'</td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>';
     print $object->code_client;
     if ($object->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode");
     print '</td>';

+ 1 - 1
htdocs/societe/consumption.php

@@ -124,7 +124,7 @@ print '<div class="underbanner clearboth"></div>';
 print '<table class="border" width="100%">';
 
 // Alias names (commercial, trademark or alias names)
-print '<tr id="name_alias"><td class="titlefield"><label for="name_alias_input">'.$langs->trans('AliasNames').'</label></td>';
+print '<tr id="name_alias"><td class="titlefield" width="25%"><label for="name_alias_input">'.$langs->trans('AliasNames').'</label></td>';
 print '<td colspan="3">'.$object->name_alias.'</td></tr>';
 
 if (! empty($conf->global->SOCIETE_USEPREFIX))  // Old not used prefix field

+ 4 - 4
htdocs/societe/document.php

@@ -91,7 +91,7 @@ llxHeader('',$title,$help_url);
 if ($object->id)
 {
 	/*
-	 * Affichage onglets
+	 * Show tabs
 	 */
 	if (! empty($conf->notification->enabled)) $langs->load("mails");
 	$head = societe_prepare_head($object);
@@ -117,7 +117,7 @@ if ($object->id)
 	print '<table class="border centpercent">';
 
 	// Alias names (commercial, trademark or alias names)
-	print '<tr><td class="titlefield">'.$langs->trans('AliasNames').'</td><td colspan="3">';
+	print '<tr><td class="titlefield" width="25%">'.$langs->trans('AliasNames').'</td><td colspan="3">';
 	print $object->name_alias;
 	print "</td></tr>";
 
@@ -145,10 +145,10 @@ if ($object->id)
 		print '</td></tr>';
 	}
 
-	// Nbre fichiers
+	// Number of files
 	print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
 
-	//Total taille
+	// Total size
 	print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
 
 	print '</table>';

+ 7 - 7
htdocs/societe/note.php

@@ -1,10 +1,10 @@
 <?php
-/* Copyright (C) 2001-2003,2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2011      Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2012      Regis Houssin        <regis.houssin@capnetworks.com>
- * Copyright (C) 2010           Juanjo Menent        <jmenent@2byte.es>
- * Copyright (C) 2013      Florian Henry		  	<florian.henry@open-concept.pro>
- * Copyright (C) 2015      Marcos García            <marcosgdf@gmail.com>
+/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C) 2010      Juanjo Menent        <jmenent@2byte.es>
+ * Copyright (C) 2013      Florian Henry	  	<florian.henry@open-concept.pro>
+ * Copyright (C) 2015      Marcos García        <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -83,7 +83,7 @@ if ($id > 0)
     print '<table class="border centpercent">';
 
 	// Alias names (commercial, trademark or alias names)
-	print '<tr><td class="titlefield">'.$langs->trans('AliasNames').'</td><td colspan="3">';
+	print '<tr><td class="titlefield" width="25%">'.$langs->trans('AliasNames').'</td><td colspan="3">';
 	print $object->name_alias;
 	print "</td></tr>";
 

+ 3 - 3
htdocs/societe/rib.php

@@ -247,7 +247,7 @@ if ($socid && $action != 'edit' && $action != "create")
     print '<div class="underbanner clearboth"></div>';
     print '<table class="border centpercent">';
 
-    print '<tr><td class="titlefield">'.$langs->trans("LabelRIB").'</td>';
+    print '<tr><td class="titlefield" width="25%">'.$langs->trans("LabelRIB").'</td>';
     print '<td colspan="4">'.$account->label.'</td></tr>';
 
 	print '<tr><td>'.$langs->trans("BankName").'</td>';
@@ -466,7 +466,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
     print '<div class="underbanner clearboth"></div>';
 	print '<table class="border centpercent">';
 
-    print '<tr><td valign="top" width="35%" class="fieldrequired">'.$langs->trans("LabelRIB").'</td>';
+    print '<tr><td valign="top" width="25%" class="fieldrequired">'.$langs->trans("LabelRIB").'</td>';
     print '<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.'"></td></tr>';
 
     print '<tr><td class="fieldrequired">'.$langs->trans("BankName").'</td>';
@@ -600,7 +600,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
     print '<div class="underbanner clearboth"></div>';
 	print '<table class="border centpercent">';
 
-    print '<tr><td valign="top" width="35%" class="fieldrequired">'.$langs->trans("LabelRIB").'</td>';
+    print '<tr><td valign="top" width="25%" class="fieldrequired">'.$langs->trans("LabelRIB").'</td>';
     print '<td colspan="4"><input size="30" type="text" name="label" value="'.GETPOST('label').'"></td></tr>';
 
     print '<tr><td class="fieldrequired">'.$langs->trans("Bank").'</td>';

+ 8 - 13
htdocs/societe/soc.php

@@ -757,7 +757,7 @@ else
          *  Creation
          */
 		$private=GETPOST("private","int");
-		if (! empty($conf->global->MAIN_THIRPARTY_CREATION_INDIVIDUAL) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1;
+		if (! empty($conf->global->MAIN_THIRDPARTY_CREATION_INDIVIDUAL) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1;
     	if (empty($private)) $private=0;
 
         // Load object modCodeTiers
@@ -987,6 +987,10 @@ else
             print '<td colspan=2>&nbsp;</td></tr>';
         }
 
+        // Alias names (commercial, trademark or alias names)
+        print '<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans('AliasNames').'</label></td>';
+	    print '<td colspan="3"><input type="text" size="60" name="name_alias" id="name_alias_input" value="'.$object->name_alias.'" size="32"></td></tr>';
+
         // Prospect/Customer
         print '<tr><td width="25%">'.fieldLabel('ProspectCustomer','customerprospect',1).'</td>';
 	    print '<td width="25%" class="maxwidthonsmartphone"><select class="flat" name="client" id="customerprospect">';
@@ -1041,10 +1045,6 @@ else
             print '</td></tr>';
         }
 
-        // Alias names (commercial, trademark or alias names)
-        print '<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans('AliasNames').'</label></td>';
-	    print '<td colspan="3"><input type="text" name="name_alias" id="name_alias_input" value="'.$object->name_alias.'" size="32"></td></tr>';
-
         // Address
         print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
 	    print '<td colspan="3"><textarea name="address" id="address" cols="80" rows="'._ROWS_2.'" wrap="soft">';
@@ -1497,12 +1497,12 @@ else
 			}
 			
             // Name
-            print '<tr><td>'.fieldLabel('ThirdPartyName','name',1).'</td>';
+            print '<tr><td width="25%">'.fieldLabel('ThirdPartyName','name',1).'</td>';
 	        print '<td colspan="3"><input type="text" size="60" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>';
 
 	        // Alias names (commercial, trademark or alias names)
 	        print '<tr id="name_alias"><td><label for="name_alias_input">'.$langs->trans('AliasNames').'</label></td>';
-	        print '<td colspan="3"><input type="text" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag($object->name_alias).'" size="32"></td></tr>';
+	        print '<td colspan="3"><input type="text" size="60" name="name_alias" id="name_alias_input" value="'.dol_escape_htmltag($object->name_alias).'"></td></tr>';
 
             // Prefix
             if (! empty($conf->global->SOCIETE_USEPREFIX))  // Old not used prefix field
@@ -1933,11 +1933,6 @@ else
         print '<div class="underbanner clearboth"></div>';
         print '<table class="border tableforfield" width="100%">';
 
-	    // Alias names (commercial, trademark or alias names)
-	    print '<tr><td class="titlefield">'.$langs->trans('AliasNames').'</td><td>';
-	    print $object->name_alias;
-	    print "</td></tr>";
-
     	// Prospect/Customer
     	print '<tr><td>'.$langs->trans('ProspectCustomer').'</td><td>';
     	print $object->getLibCustProspStatut();
@@ -2177,7 +2172,7 @@ else
         print '<table class="border tableforfield" width="100%">';
         
         // Legal
-        print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td>'.$object->forme_juridique.'</td></tr>';
+        print '<tr><td width="25%">'.$langs->trans('JuridicalStatus').'</td><td>'.$object->forme_juridique.'</td></tr>';
 
         // Capital
         print '<tr><td>'.$langs->trans('Capital').'</td><td>';

+ 3 - 2
htdocs/theme/eldy/img/menus/README.md

@@ -4,9 +4,10 @@ Tutorial to create a new image for menu:
 1) First find an image.
 2) With Gimp, open image and check there is a alpha channel. If not add one.
 3) Convert image into back and white (Menu Image - Mode - Grey levels).
-4) Use the degrade tool with option:
-* Erase color
+4) Use the degrade tool with option (Menu Tools - Paint - Degrade - CTRL+L):
+* Mode: Erase color (you can also try "Elear only") 
 * Opacity: 50 +/-
 * Offset: 0
 * Shape: Linear
+* Select on image top of file and drag to bottom.
 Il est possible aussi d'augmenter la transparence globale depuis le calque.

+ 4 - 0
htdocs/theme/eldy/style.css.php

@@ -536,10 +536,14 @@ div.myavailability {
 .minwidth100 { min-width: 100px; }
 .minwidth200 { min-width: 200px; }
 .minwidth300 { min-width: 300px; }
+.minwidth400 { min-width: 400px; }
+.minwidth500 { min-width: 500px; }
 .maxwidth100 { max-width: 100px; }
 .maxwidth150 { max-width: 150px; }
 .maxwidth200 { max-width: 200px; }
 .maxwidth300 { max-width: 300px; }
+.maxwidth400 { max-width: 400px; }
+.maxwidth500 { max-width: 500px; }
 .titlefield { width: 30%; }
 <?php if (! empty($dol_optimize_smallscreen)) { ?>
 .hideonsmartphone { display: none; }

+ 4 - 0
htdocs/theme/md/style.css.php

@@ -524,10 +524,14 @@ div.myavailability {
 .minwidth100 { min-width: 100px; }
 .minwidth200 { min-width: 200px; }
 .minwidth300 { min-width: 300px; }
+.minwidth400 { min-width: 400px; }
+.minwidth500 { min-width: 500px; }
 .maxwidth100 { max-width: 100px; }
 .maxwidth150 { max-width: 150px; }
 .maxwidth200 { max-width: 200px; }
 .maxwidth300 { max-width: 300px; }
+.maxwidth400 { max-width: 400px; }
+.maxwidth500 { max-width: 500px; }
 .titlefield { width: 30%; }
 <?php if (! empty($dol_optimize_smallscreen)) { ?>
 .hideonsmartphone { display: none; }