瀏覽代碼

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

Conflicts:
	htdocs/accountancy/customer/card.php
	htdocs/accountancy/journal/sellsjournal.php
	htdocs/admin/menus.php
	htdocs/fourn/commande/card.php
	htdocs/install/check.php
Laurent Destailleur 10 年之前
父節點
當前提交
4fdc287717
共有 58 個文件被更改,包括 496 次插入318 次删除
  1. 1 1
      build/exe/doliwamp/config.inc.php.install
  2. 0 0
      dev/initdata/mysqldump_dolibarr_3.7.0.sql
  3. 13 8
      htdocs/accountancy/admin/export.php
  4. 3 3
      htdocs/accountancy/bookkeeping/balancebymonth.php
  5. 2 2
      htdocs/accountancy/bookkeeping/list.php
  6. 3 4
      htdocs/accountancy/bookkeeping/listbyyear.php
  7. 0 1
      htdocs/accountancy/class/accountingaccount.class.php
  8. 1 1
      htdocs/accountancy/class/html.formventilation.class.php
  9. 18 19
      htdocs/accountancy/customer/card.php
  10. 10 4
      htdocs/accountancy/customer/index.php
  11. 3 3
      htdocs/accountancy/customer/lines.php
  12. 20 4
      htdocs/accountancy/customer/list.php
  13. 2 2
      htdocs/accountancy/journal/bankjournal.php
  14. 2 2
      htdocs/accountancy/journal/cashjournal.php
  15. 12 8
      htdocs/accountancy/journal/purchasesjournal.php
  16. 17 11
      htdocs/accountancy/journal/sellsjournal.php
  17. 1 1
      htdocs/accountancy/supplier/card.php
  18. 4 4
      htdocs/accountancy/supplier/index.php
  19. 6 6
      htdocs/accountancy/supplier/lines.php
  20. 39 6
      htdocs/accountancy/supplier/list.php
  21. 22 16
      htdocs/admin/menus.php
  22. 0 1
      htdocs/cache.manifest
  23. 2 1
      htdocs/categories/categorie.php
  24. 6 6
      htdocs/comm/action/card.php
  25. 38 35
      htdocs/comm/action/index.php
  26. 2 1
      htdocs/comm/card.php
  27. 22 21
      htdocs/core/class/html.formprojet.class.php
  28. 1 1
      htdocs/core/lib/agenda.lib.php
  29. 7 5
      htdocs/core/lib/functions.lib.php
  30. 4 0
      htdocs/core/lib/sendings.lib.php
  31. 4 2
      htdocs/core/menus/init_menu_auguria.sql
  32. 2 2
      htdocs/core/menus/standard/auguria.lib.php
  33. 8 8
      htdocs/core/modules/expedition/doc/pdf_merou.modules.php
  34. 10 4
      htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
  35. 49 24
      htdocs/core/modules/modAccounting.class.php
  36. 2 2
      htdocs/core/modules/modAdherent.class.php
  37. 2 3
      htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php
  38. 1 1
      htdocs/expedition/class/expedition.class.php
  39. 1 0
      htdocs/expedition/note.php
  40. 2 1
      htdocs/fourn/card.php
  41. 0 1
      htdocs/fourn/class/fournisseur.commande.class.php
  42. 37 30
      htdocs/fourn/commande/card.php
  43. 6 2
      htdocs/install/check.php
  44. 8 3
      htdocs/install/mysql/migration/3.6.0-3.7.0.sql
  45. 6 6
      htdocs/langs/en_US/admin.lang
  46. 2 2
      htdocs/langs/en_US/agenda.lang
  47. 6 6
      htdocs/langs/en_US/bills.lang
  48. 1 0
      htdocs/langs/en_US/install.lang
  49. 5 5
      htdocs/langs/en_US/orders.lang
  50. 4 4
      htdocs/langs/en_US/sendings.lang
  51. 1 1
      htdocs/langs/en_US/stocks.lang
  52. 11 9
      htdocs/product/stock/product.php
  53. 5 5
      htdocs/projet/element.php
  54. 2 0
      htdocs/societe/admin/societe.php
  55. 2 1
      htdocs/societe/agenda.php
  56. 1 1
      htdocs/societe/class/societe.class.php
  57. 3 0
      htdocs/theme/eldy/style.css.php
  58. 54 18
      test/phpunit/FunctionsLibTest.php

+ 1 - 1
build/exe/doliwamp/config.inc.php.install

@@ -376,7 +376,7 @@ $cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci';
 //        libraries/select_lang.lib.php
 // $cfg['Lang']     = 'en-iso-8859-1';
 
-// Regullar expression to limit listed languages, eg. '^(cs|en)' for Czech and
+// Regular expression to limit listed languages, eg. '^(cs|en)' for Czech and
 // English only
 $cfg['FilterLanguages'] = '';
 

文件差異過大導致無法顯示
+ 0 - 0
dev/initdata/mysqldump_dolibarr_3.7.0.sql


+ 13 - 8
htdocs/accountancy/admin/export.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
- * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
+ * Copyright (C) 2013-2015 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014	   Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2014      Marcos García        <marcosgdf@gmail.com>
  * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
@@ -44,7 +44,13 @@ $action = GETPOST('action', 'alpha');
 
 // Other parameters ACCOUNTING_*
 $list = array (
-		'ACCOUNTING_SEPARATORCSV'
+		'ACCOUNTING_EXPORT_SEPARATORCSV',
+		'ACCOUNTING_EXPORT_DATE',
+		'ACCOUNTING_EXPORT_PIECE',
+		'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
+		'ACCOUNTING_EXPORT_LABEL',
+		'ACCOUNTING_EXPORT_AMOUNT',
+		'ACCOUNTING_EXPORT_DEVISE'
 );
 
 /*
@@ -57,7 +63,7 @@ if ($action == 'update') {
 
 	if (! empty($modelcsv)) {
 
-		if (! dolibarr_set_const($db, 'ACCOUNTING_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
+		if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
 			$error ++;
 		}
 	} else {
@@ -112,12 +118,12 @@ print "<td>" . $langs->trans("Selectmodelcsv") . "</td>";
 print "<td>";
 print '<select class="flat" name="modelcsv" id="modelcsv">';
 print '<option value="0"';
-if ($conf->global->ACCOUNTING_MODELCSV == 0) {
+if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 0) {
 	print ' selected="selected"';
 }
 print '>' . $langs->trans("Modelcsv_normal") . '</option>';
 print '<option value="1"';
-if ($conf->global->ACCOUNTING_MODELCSV == 1) {
+if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
 	print ' selected="selected"';
 }
 print '>' . $langs->trans("Modelcsv_CEGID") . '</option>';
@@ -128,8 +134,7 @@ print "</table>";
 print "<br>\n";
 
 /*
- *  Params
- *
+ *  Parameters
  */
 
 $num = count($list);
@@ -161,4 +166,4 @@ print '<br /><div style="text-align:center"><input type="submit" class="button"
 print '</form>';
 
 llxFooter();
-$db->close();
+$db->close();

+ 3 - 3
htdocs/accountancy/bookkeeping/balancebymonth.php

@@ -50,10 +50,10 @@ if ($year == 0) {
 /*
  * View
  */
-llxHeader('', $langs->trans("CustomersVentilation"));
+llxHeader('', $langs->trans("Bookkeeping"));
 
-$textprevyear = "<a href=\"balancebymonth.php?year=" . ($year_current - 1) . "\">" . img_previous() . "</a>";
-$textnextyear = " <a href=\"balancebymonth.php?year=" . ($year_current + 1) . "\">" . img_next() . "</a>";
+$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
+$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
 
 print_fiche_titre($langs->trans("AccountBalanceByMonth") . ' ' . $textprevyear . ' ' . $langs->trans("Year") . ' ' . $year_start . ' ' . $textnextyear);
 

+ 2 - 2
htdocs/accountancy/bookkeeping/list.php

@@ -151,7 +151,7 @@ else {
 		
 		print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey'));
 		
-		print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" />';
+		print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
 		
 		print '</form>';
 		
@@ -231,4 +231,4 @@ else {
 }
 
 llxFooter();
-$db->close();
+$db->close();

+ 3 - 4
htdocs/accountancy/bookkeeping/listbyyear.php

@@ -56,12 +56,11 @@ $offset = $conf->liste_limit * $page;
 
 llxHeader('', $langs->trans("Bookkeeping"));
 
-$textprevyear = "<a href=\"listbyyear.php?year=" . ($year_current - 1) . "\">" . img_previous() . "</a>";
-$textnextyear = " <a href=\"listbyyear.php?year=" . ($year_current + 1) . "\">" . img_next() . "</a>";
+$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
+$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
 
 /*
- * Mode Liste
- *
+ * Mode List
  */
 
 $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens, bk.code_journal";

+ 0 - 1
htdocs/accountancy/class/accountingaccount.class.php

@@ -53,7 +53,6 @@ class AccountingAccount extends CommonObject
 	 * @param 	DoliDB	$db		Database handle
 	 */
 	function __construct($db)
-
 	{
 		$this->db = $db;
 	}

+ 1 - 1
htdocs/accountancy/class/html.formventilation.class.php

@@ -128,7 +128,7 @@ class FormVentilation extends Form
 					$label = $obj->account_number . ' - ' . $obj->label;
 
 					// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
-					// Bacause same account_number can be share between different accounting_system and do have the same meaning
+					// Because same account_number can be share between different accounting_system and do have the same meaning
 					if (($selectid != '') && $selectid == $obj->rowid) {
 						// $out .= '<option value="' . $obj->account_number . '" selected="selected">' . $label . '</option>';
 						$out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';

+ 18 - 19
htdocs/accountancy/customer/card.php

@@ -24,7 +24,7 @@
  */
 
 require '../../main.inc.php';
-	
+
 // Class
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
@@ -40,19 +40,18 @@ $id = GETPOST('id');
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-	
+
 /*
  * Actions
  */
 
-if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) 
-{
+if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
 	if (! GETPOST('cancel', 'alpha'))
 	{
 		$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
 		$sql .= " SET fk_code_ventilation = " . $codeventil;
 		$sql .= " WHERE rowid = " . $id;
-	
+
 		dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
 		$resql = $db->query($sql);
 		if (! $resql) {
@@ -61,7 +60,7 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch)
 	} else {
 		header("Location: ./lines.php");
 		exit();
-	}		
+	}
 }
 
 llxHeader("", "", "FicheVentilation");
@@ -86,38 +85,38 @@ if (! empty($id)) {
 	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid";
 	$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture";
 	$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
-	
+
 	if (! empty($conf->multicompany->enabled)) {
 		$sql .= " AND f.entity = '" . $conf->entity . "'";
 	}
-	
+
 	dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
 	$result = $db->query($sql);
-	
+
 	if ($result) {
 		$num_lines = $db->num_rows($result);
 		$i = 0;
-		
+
 		if ($num_lines) {
-			
+
 			$objp = $db->fetch_object($result);
-			
+
 			print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
 			print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
 			print '<input type="hidden" name="action" value="ventil">';
-			
+
 			$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
 			print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'setup');
-			
+
 			print '<table class="border" width="100%">';
-			
+
 			// Ref facture
 			print '<tr><td>' . $langs->trans("Invoice") . '</td>';
 			$facture_static->ref = $objp->facnumber;
 			$facture_static->id = $objp->facid;
 			print '<td>' . $facture_static->getNomUrl(1) . '</td>';
 			print '</tr>';
-			
+
 			print '<tr><td width="20%">' . $langs->trans("Line") . '</td>';
 			print '<td>' . nl2br($objp->description) . '</td></tr>';
 			print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>';
@@ -126,13 +125,13 @@ if (! empty($id)) {
 			print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
 			print '</td></tr>';
 			print '</table>';
-			
+
 			print '<br><div class="center">';
 			print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
 			print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
 			print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
 			print '</div>';
-	
+
 			print '</form>';
 		} else {
 			print "Error";
@@ -145,4 +144,4 @@ if (! empty($id)) {
 }
 
 llxFooter();
-$db->close();
+$db->close();

+ 10 - 4
htdocs/accountancy/customer/index.php

@@ -22,7 +22,7 @@
 /**
  * \file		htdocs/accountancy/customer/index.php
  * \ingroup		Accounting Expert
- * \brief		Page accueil clients ventilation comptable
+ * \brief		Home customer ventilation
  */
 
 require '../../main.inc.php';
@@ -75,6 +75,8 @@ if ($action == 'validatehistory') {
 		$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
 		$sql1 .= " AND fd.fk_code_ventilation = 0";
 	}
+	
+	dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
 
 	$resql1 = $db->query($sql1);
 	if (! $resql1) {
@@ -93,7 +95,7 @@ if ($action == 'validatehistory') {
 llxHeader('', $langs->trans("CustomersVentilation"));
 
 $textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
-$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
+$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
 
 print_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
 
@@ -105,6 +107,7 @@ $sql .= " , " . MAIN_DB_PREFIX . "facture as f";
 $sql .= " WHERE fd.fk_code_ventilation = 0";
 $sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;";
 
+dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
 $result = $db->query($sql);
 if ($result) {
 	$row = $db->fetch_row($result);
@@ -160,6 +163,7 @@ if (! empty($conf->multicompany->enabled)) {
 
 $sql .= " GROUP BY fd.fk_code_ventilation";
 
+dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
 $resql = $db->query($sql);
 if ($resql) {
 	$i = 0;
@@ -194,7 +198,7 @@ print "</table>\n";
 
 print "<br>\n";
 print '<table class="noborder" width="100%">';
-print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
+print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
 print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
 print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
 print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
@@ -232,6 +236,7 @@ if (! empty($conf->multicompany->enabled)) {
 	$sql .= " AND f.entity = '" . $conf->entity . "'";
 }
 
+dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
 $resql = $db->query($sql);
 if ($resql) {
 	$i = 0;
@@ -303,7 +308,8 @@ if (! empty($conf->margin->enabled)) {
 	if (! empty($conf->multicompany->enabled)) {
 		$sql .= " AND f.entity = '" . $conf->entity . "'";
 	}
-
+	
+	dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
 	$resql = $db->query($sql);
 	if ($resql) {
 		$i = 0;

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

@@ -133,7 +133,7 @@ if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
 }
 $sql .= $db->plimit($limit + 1, $offset);
 
-dol_syslog("/accountancy/customer/linges.php sql=" . $sql, LOG_DEBUG);
+dol_syslog("/accountancy/customer/lines.php sql=" . $sql, LOG_DEBUG);
 $result = $db->query($sql);
 if ($result) {
 	$num_lines = $db->num_rows($result);
@@ -220,5 +220,5 @@ if ($result) {
 
 print "</table></form>";
 
-$db->close();
-llxFooter();
+llxFooter();
+$db->close();

+ 20 - 4
htdocs/accountancy/customer/list.php

@@ -52,9 +52,25 @@ $formventilation = new FormVentilation($db);
 
 llxHeader('', $langs->trans("Ventilation"));
 
+print  '<script type="text/javascript">
+			$(function () {
+				$(\'#select-all\').click(function(event) {
+				    // Iterate each checkbox
+				    $(\':checkbox\').each(function() {
+				    	this.checked = true;
+				    });
+			    });
+			    $(\'#unselect-all\').click(function(event) {
+				    // Iterate each checkbox
+				    $(\':checkbox\').each(function() {
+				    	this.checked = false;
+				    });
+			    });
+			});
+			 </script>';
 /*
  * Action
-*/
+ */
 
 if ($action == 'ventil') {
 	print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
@@ -113,8 +129,8 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_fac
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
-$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
-$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)";
+$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
+$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
 if (! empty($conf->multicompany->enabled)) {
 	$sql .= " AND f.entity = '" . $conf->entity . "'";
 }
@@ -147,7 +163,7 @@ if ($result) {
 	print '<td align="right">' . $langs->trans("Amount") . '</td>';
 	print '<td align="right">' . $langs->trans("AccountAccounting") . '</td>';
 	print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
-	print '<td align="center">' . $langs->trans("Ventilate") . '</td>';
+	print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
 	print '</tr>';
 
 	$facture_static = new Facture($db);

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

@@ -450,14 +450,14 @@ if ($action == 'writeBookKeeping')
 // export csv
 if ($action == 'export_csv')
 {
-	$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
+	$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
 
 	header('Content-Type: text/csv');
 	header('Content-Disposition: attachment;filename=journal_banque.csv');
 
 	$companystatic = new Client($db);
 
-	if ($conf->global->ACCOUNTING_MODELCSV == 1) 	// Modèle Export Cegid Expert
+	if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) 	// Modèle Export Cegid Expert
 	{
 		foreach ( $tabpay as $key => $val ) {
 			$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');

+ 2 - 2
htdocs/accountancy/journal/cashjournal.php

@@ -367,12 +367,12 @@ if ($action == 'writeBookKeeping')
 }
 // export csv
 if ($action == 'export_csv') {
-	$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
+	$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
 
 	header('Content-Type: text/csv');
 	header('Content-Disposition:attachment;filename=journal_caisse.csv');
 
-	if ($conf->global->ACCOUNTING_MODELCSV == 1) 	// Modèle Export Cegid Expert
+	if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) 	// Modèle Export Cegid Expert
 	{
 		foreach ( $tabpay as $key => $val ) {
 			$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');

+ 12 - 8
htdocs/accountancy/journal/purchasesjournal.php

@@ -185,8 +185,8 @@ if ($action == 'writebookkeeping') {
 		foreach ( $tabht[$key] as $k => $mt ) {
 			if ($mt) {
 				// get compte id and label
-				$compte = new AccountingAccount($db);
-				if ($compte->fetch(null, $k)) {
+				$accountingaccount = new AccountingAccount($db);
+				if ($accountingaccount->fetch(null, $k)) {
 					$bookkeeping = new BookKeeping($db);
 					$bookkeeping->doc_date = $val["date"];
 					$bookkeeping->doc_ref = $val["ref"];
@@ -195,7 +195,7 @@ if ($action == 'writebookkeeping') {
 					$bookkeeping->fk_doc = $key;
 					$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
 					$bookkeeping->code_tiers = '';
-					$bookkeeping->label_compte = dol_trunc($val["description"], 128);
+					$bookkeeping->label_compte = $accountingaccount->label;
 					$bookkeeping->numero_compte = $k;
 					$bookkeeping->montant = $mt;
 					$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@@ -213,7 +213,6 @@ if ($action == 'writebookkeeping') {
 		foreach ( $tabtva[$key] as $k => $mt ) {
 			if ($mt) {
 				// get compte id and label
-
 				$bookkeeping = new BookKeeping($db);
 				$bookkeeping->doc_date = $val["date"];
 				$bookkeeping->doc_ref = $val["ref"];
@@ -246,12 +245,12 @@ $companystatic = new Fournisseur($db);
 // export csv
 if ($action == 'export_csv')
 {
-	$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
+	$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
 
 	header('Content-Type: text/csv');
 	header('Content-Disposition: attachment;filename=journal_achats.csv');
 
-	if ($conf->global->ACCOUNTING_MODELCSV == 1) 	// Modèle Export Cegid Expert
+	if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) 	// Modèle Export Cegid Expert
 	{
 		foreach ( $tabfac as $key => $val ) {
 			$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
@@ -314,11 +313,13 @@ if ($action == 'export_csv')
 
 			// Product / Service
 			foreach ( $tabht[$key] as $k => $mt ) {
+			$accountingaccount = new AccountingAccount($db);
+		    $accountingaccount->fetch(null, $k);	
 				if ($mt) {
 					print '"' . $date . '"' . $sep;
 					print '"' . $val["ref"] . '"' . $sep;
 					print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
-					print '"' . dol_trunc($val["description"], 32) . '"' . $sep;
+					print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
 					print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
 					print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
 					print "\n";
@@ -417,12 +418,15 @@ if ($action == 'export_csv')
 
 		// Product / Service
 		foreach ( $tabht[$key] as $k => $mt ) {
+		$accountingaccount = new AccountingAccount($db);
+		$accountingaccount->fetch(null, $k);
+
 			if ($mt) {
 				print "<tr " . $bc[$var] . " >";
 				print "<td>" . $date . "</td>";
 				print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
 				print "<td>" . length_accountg($k) . "</td>";
-				print "<td>" . $invoicestatic->description . "</td>";
+				print "<td>" . $accountingaccount->label . "</td>";
 				print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
 				print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
 				print "</tr>";

+ 17 - 11
htdocs/accountancy/journal/sellsjournal.php

@@ -151,7 +151,7 @@ if ($result) {
 		$tabfac[$obj->rowid]["date"] = $obj->df;
 		$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
 		$tabfac[$obj->rowid]["type"] = $obj->type;
-		$tabfac[$obj->rowid]["description"] = $obj->description;
+		$tabfac[$obj->rowid]["description"] = $obj->label_compte;
 		$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
 		if (! isset($tabttc[$obj->rowid][$compta_soc]))
 			$tabttc[$obj->rowid][$compta_soc] = 0;
@@ -207,8 +207,8 @@ if ($action == 'writebookkeeping') {
 		foreach ( $tabht[$key] as $k => $mt ) {
 			if ($mt) {
 				// get compte id and label
-				$compte = new AccountingAccount($db);
-				if ($compte->fetch(null, $k)) {
+				$accountingaccount = new AccountingAccount($db);
+				if ($accountingaccount->fetch(null, $k)) {
 					$bookkeeping = new BookKeeping($db);
 					$bookkeeping->doc_date = $val["date"];
 					$bookkeeping->doc_ref = $val["ref"];
@@ -218,7 +218,7 @@ if ($action == 'writebookkeeping') {
 					$bookkeeping->fk_docdet = $val["fk_facturedet"];
 					$bookkeeping->code_tiers = '';
 					$bookkeeping->numero_compte = $k;
-					$bookkeeping->label_compte = dol_trunc($val["description"], 128);
+					$bookkeeping->label_compte = $accountingaccount->label;
 					$bookkeeping->montant = $mt;
 					$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
 					$bookkeeping->debit = ($mt < 0) ? $mt : 0;
@@ -258,14 +258,14 @@ if ($action == 'writebookkeeping') {
 }
 // export csv
 if ($action == 'export_csv') {
-	$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
+	$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
 
 	header('Content-Type: text/csv');
 	header('Content-Disposition: attachment;filename=journal_ventes.csv');
 
 	$companystatic = new Client($db);
 
-	if ($conf->global->ACCOUNTING_MODELCSV == 1) 	// Modèle Export Cegid Expert
+	if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) 	// Modèle Export Cegid Expert
 	{
 		foreach ( $tabfac as $key => $val ) {
 			$companystatic->id = $tabcompany[$key]['id'];
@@ -335,11 +335,14 @@ if ($action == 'export_csv') {
 
 			// Product / Service
 			foreach ( $tabht[$key] as $k => $mt ) {
+				$accountingaccount = new AccountingAccount($db);
+				$accountingaccount->fetch(null, $k);
+
 				if ($mt) {
 					print '"' . $date . '"' . $sep;
 					print '"' . $val["ref"] . '"' . $sep;
 					print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
-					print '"' . dol_trunc($val["description"], 32) . '"' . $sep;
+					print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
 					print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
 					print '"' . ($mt >= 0 ? price($mt) : '') . '"';
 					print "\n";
@@ -447,12 +450,15 @@ if ($action == 'export_csv') {
 
 		// Product / Service
 		foreach ( $tabht[$key] as $k => $mt ) {
+			$accountingaccount = new AccountingAccount($db);
+			$accountingaccount->fetch(null, $k);
+
 			if ($mt) {
 				print "<tr " . $bc[$var] . ">";
 				print "<td>" . $date . "</td>";
 				print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
 				print "<td>" . length_accountg($k) . "</td>";
-				print "<td>" . $invoicestatic->description . "</td>";
+				print "<td>" . $accountingaccount->label . "</td>";
 				print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
 				print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
 				print "</tr>";
@@ -478,8 +484,8 @@ if ($action == 'export_csv') {
 	}
 
 	print "</table>";
-
-	// End of page
-	llxFooter();
 }
+
+llxFooter();
+
 $db->close();

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

@@ -4,7 +4,7 @@
  * Copyright (C) 2013-2014  Alexandre Spangaro    <alexandre.spangaro@gmail.com>
  * Copyright (C) 2013-2014  Olivier Geffroy       <jeff@jeffinfo.com>
  * Copyright (C) 2013-2014	Florian Henry	      <florian.henry@open-concept.pro>
- * Copyright (C) 2014	    Juanjo Menent		s<jmenent@2byte.es>
+ * Copyright (C) 2014	    Juanjo Menent		  <jmenent@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

+ 4 - 4
htdocs/accountancy/supplier/index.php

@@ -21,7 +21,7 @@
 /**
  * \file		htdocs/accountancy/supplier/index.php
  * \ingroup		Accounting Expert
- * \brief		Page accueil ventilation
+ * \brief		Home supplier ventilation
  */
 
 require '../../main.inc.php';
@@ -93,9 +93,9 @@ if ($action == 'validatehistory') {
 llxHeader('', $langs->trans("SuppliersVentilation"));
 
 $textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
-$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
+$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
 
-print_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
+print_fiche_titre($langs->trans("SuppliersVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear);
 
 print '<b>' . $langs->trans("DescVentilSupplier") . '</b>';
 print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=validatehistory">' . $langs->trans("ValidateHistory") . '</a></div>';
@@ -105,7 +105,7 @@ $y = $year_current;
 $var = true;
 
 print '<table class="noborder" width="100%">';
-print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
+print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
 print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
 print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
 print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';

+ 6 - 6
htdocs/accountancy/supplier/lines.php

@@ -1,7 +1,5 @@
 <?php
-/* Copyright (C) 2002-2005 Rodolphe Quiedeville	<rodolphe@quiedeville.org>
- * Copyright (C) 2005      Simon TOSSER			<simon@kornog-computing.com>
- * Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
+/* Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014      Ari Elbaz (elarifr)	<github@accedinfo.com>  
  * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
@@ -48,6 +46,7 @@ if ($user->societe_id > 0)
 if (! $user->rights->accounting->ventilation->dispatch)
 	accessforbidden();
 
+
 $formventilation = new FormVentilation($db);
 
 $changeaccount = GETPOST('changeaccount');
@@ -107,7 +106,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product
 $sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
 $sql .= " AND aa.rowid = l.fk_code_ventilation";
 if (strlen(trim($_GET["search_facture"]))) {
-	$sql .= " AND f.facnumber like '%" . $_GET["search_facture"] . "%'";
+	$sql .= " AND f.ref like '%" . $_GET["search_facture"] . "%'";
 }
 if (strlen(trim($_GET["search_ref"]))) {
 	$sql .= " AND p.ref like '%" . $_GET["search_ref"] . "%'";
@@ -218,7 +217,8 @@ if ($result) {
 	print $db->error();
 }
 
+
 print "</table></form>";
 
-$db->close();
-llxFooter();
+llxFooter();
+$db->close();

+ 39 - 6
htdocs/accountancy/supplier/list.php

@@ -22,7 +22,7 @@
 /**
  * \file		htdocs/accountancy/supplier/list.php
  * \ingroup		Accounting Expert
- * \brief		Page de ventilation des lignes de facture
+ * \brief		Ventilation page from suppliers invoices
  */
 
 require '../../main.inc.php';
@@ -53,6 +53,22 @@ $formventilation = new FormVentilation($db);
 
 llxHeader('', $langs->trans("Ventilation"));
 
+print  '<script type="text/javascript">
+			$(function () {
+				$(\'#select-all\').click(function(event) {
+				    // Iterate each checkbox
+				    $(\':checkbox\').each(function() {
+				    	this.checked = true;
+				    });
+			    });
+			    $(\'#unselect-all\').click(function(event) {
+				    // Iterate each checkbox
+				    $(\':checkbox\').each(function() {
+				    	this.checked = false;
+				    });
+			    });
+			});
+			 </script>';
 /*
  * Action
  */
@@ -115,8 +131,8 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
-$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
-$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)";
+$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
+$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
 
 if (! empty($conf->multicompany->enabled)) {
 	$sql .= " AND f.entity = '" . $conf->entity . "'";
@@ -150,7 +166,7 @@ if ($result) {
 	print '<td align="right">' . $langs->trans("Amount") . '</td>';
 	print '<td align="right">' . $langs->trans("Compte") . '</td>';
 	print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
-	print '<td align="center">' . $langs->trans("Ventilate") . '</td>';
+	print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
 	print "</tr>\n";
 
 	$facturefourn_static = new FactureFournisseur($db);
@@ -161,6 +177,23 @@ if ($result) {
 	while ( $i < min($num_lines, $limit) ) {
 		$objp = $db->fetch_object($result);
 		$var = ! $var;
+		
+		// product_type: 0 = service ? 1 = product
+		// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
+		// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
+		$code_buy_notset = '';
+		
+		if (empty($objp->code_buy)) {
+			$code_buy_notset = 'color:red';
+			if ($objp->type == 1) {
+				$objp->code_buy = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
+			} else {
+				$objp->code_buy = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));					
+			}
+		}else {
+			$code_buy_notset = 'color:blue';
+		}
+		
 		print "<tr $bc[$var]>";
 
 		// Ref facture
@@ -191,7 +224,7 @@ if ($result) {
 		print price($objp->price);
 		print '</td>';
 
-		print '<td align="right">';
+		print '<td align="center" style="' . $code_buy_notset . '">';
 		print $objp->code_buy;
 		print '</td>';
 
@@ -216,4 +249,4 @@ if ($result) {
 }
 
 llxFooter();
-$db->close();
+$db->close();

+ 22 - 16
htdocs/admin/menus.php

@@ -65,7 +65,7 @@ error_reporting($err);
 if ($action == 'update' && empty($_POST["cancel"]))
 {
 	$_SESSION["mainmenu"]="home";   // Le gestionnaire de menu a pu changer
-	
+
 	dolibarr_set_const($db, "MAIN_MENU_STANDARD",      $_POST["MAIN_MENU_STANDARD"],'chaine',0,'',$conf->entity);
 	dolibarr_set_const($db, "MAIN_MENU_SMARTPHONE",     $_POST["MAIN_MENU_SMARTPHONE"],'chaine',0,'',$conf->entity);
 
@@ -89,11 +89,11 @@ if ($action == 'update' && empty($_POST["cancel"]))
 			$file='init_menu_'.$key.'.sql';
 		    $fullpath=dol_buildpath($dirmenu.$file);
 		    //print 'action='.$action.' Search menu into fullpath='.$fullpath.'<br>';exit;
-		    
+
 			if (file_exists($fullpath))
 			{
 				$db->begin();
-	
+
 				$result=run_sql($fullpath,1,'',1,$key,'none');
 				if ($result > 0)
 				{
@@ -152,6 +152,10 @@ $head[$h][2] = 'misc';
 $h++;
 
 
+print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
+print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+print '<input type="hidden" name="action" value="update">';
+
 dol_fiche_head($head, 'handler', $langs->trans("Menus"));
 
 print $langs->trans("MenusDesc")."<br>\n";
@@ -160,10 +164,6 @@ print "<br>\n";
 
 if ($action == 'edit')
 {
-	print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
-	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
-	print '<input type="hidden" name="action" value="update">';
-
 	clearstatcache();
 
 	// Gestionnaires de menu
@@ -202,14 +202,6 @@ if ($action == 'edit')
 	print '</tr>';
 
 	print '</table>';
-
-	print '<br><div class="center">';
-	print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
-	print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
-	print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
-	print '</div>';
-
-	print '</form>';
 }
 else
 {
@@ -264,7 +256,21 @@ else
 	print '</table>';
 }
 
-print '</div>';
+dol_fiche_end();
+
+
+if ($action == 'edit')
+{
+	print '<div class="center">';
+	print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
+	print ' &nbsp; &nbsp; &nbsp; ';
+	print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
+	print '</div>';
+}
+
+print '</form>';
+
+
 
 if ($action != 'edit')
 {

+ 0 - 1
htdocs/cache.manifest

@@ -14,7 +14,6 @@ support/index.php
 support/online.php
 
 support/default.css
-support/dolibarr_logo2.png
 support/headbg.jpg
 support/helpcenter.png
 support/internet.png

+ 2 - 1
htdocs/categories/categorie.php

@@ -289,7 +289,8 @@ if ($socid)
 	if ($soc->country)
 	{
 		print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
-		$img=picto_from_langcode($soc->country_code);
+		//$img=picto_from_langcode($soc->country_code);
+		$img='';
 		print ($img?$img.' ':'');
 		print $soc->country;
 		print '</td></tr>';

+ 6 - 6
htdocs/comm/action/card.php

@@ -881,15 +881,15 @@ if ($id > 0)
 
 		// Date start
 		print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td colspan="3">';
-		if (GETPOST("afaire") == 1) $form->select_date($object->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart');
-		else if (GETPOST("afaire") == 2) $form->select_date($object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
-		else $form->select_date($object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
+		if (GETPOST("afaire") == 1) $form->select_date($datep?$datep:$object->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart');
+		else if (GETPOST("afaire") == 2) $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
+		else $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
 		print '</td></tr>';
 		// Date end
 		print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
-		if (GETPOST("afaire") == 1) $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
-		else if (GETPOST("afaire") == 2) $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
-		else $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
+		if (GETPOST("afaire") == 1) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
+		else if (GETPOST("afaire") == 2) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
+		else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
 		print '</td></tr>';
 
 		// Status

+ 38 - 35
htdocs/comm/action/index.php

@@ -339,7 +339,7 @@ dol_fiche_end();
 
 $showextcals=$listofextcals;
 // Legend
-if ($conf->use_javascript_ajax)
+if (! empty($conf->use_javascript_ajax))
 {
 	$s='';
 	$s.='<script type="text/javascript">' . "\n";
@@ -349,29 +349,27 @@ if ($conf->use_javascript_ajax)
 	$s.='jQuery(".family_birthday").toggle();' . "\n";
 	if ($action=="show_week" || $action=="show_month" || empty($action))
 	{
-    	$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
+    	$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {';
     	$s.='var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
 	}
   	$s.='});' . "\n";
 	$s.='</script>' . "\n";
-	if (! empty($conf->use_javascript_ajax))
+
+	$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
+	if (is_array($showextcals) && count($showextcals) > 0)
 	{
-		$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
-		if (is_array($showextcals) && count($showextcals) > 0)
+		foreach ($showextcals as $val)
 		{
-			foreach ($showextcals as $val)
-			{
-				$htmlname = dol_string_nospecial($val['name']);
-				$s.='<script type="text/javascript">' . "\n";
-				$s.='jQuery(document).ready(function () {' . "\n";
-				$s.='		jQuery("#check_' . $htmlname . '").click(function() {';
-				$s.=' 		/* alert("'.$htmlname.'"); */';
-				$s.=' 		jQuery(".family_' . $htmlname . '").toggle();';
-				$s.='		});' . "\n";
-				$s.='});' . "\n";
-				$s.='</script>' . "\n";
-				$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' &nbsp; </div>';
-			}
+			$htmlname = dol_string_nospecial($val['name']);
+			$s.='<script type="text/javascript">' . "\n";
+			$s.='jQuery(document).ready(function () {' . "\n";
+			$s.='		jQuery("#check_' . $htmlname . '").click(function() {';
+			$s.=' 		/* alert("'.$htmlname.'"); */';
+			$s.=' 		jQuery(".family_' . $htmlname . '").toggle();';
+			$s.='		});' . "\n";
+			$s.='});' . "\n";
+			$s.='</script>' . "\n";
+			$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' &nbsp; </div>';
 		}
 	}
 	$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' &nbsp; </div>';
@@ -1092,11 +1090,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
     global $theme_datacolor;
     global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
 
-    print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
+    print "\n".'<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">';
 
     // Line with title of day
     $curtime = dol_mktime(0, 0, 0, $month, $day, $year);
-    print '<table class="nobordernopadding" width="100%">';
+    print '<table class="nobordernopadding" width="100%">'."\n";
+
     print '<tr><td align="left" class="nowrap">';
     print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?';
     print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
@@ -1116,7 +1115,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
         print img_picto($langs->trans("NewAction"),'edit_add.png');
         print '</a>';
     }
-    print '</td></tr>';
+    print '</td></tr>'."\n";
 
     // Line with td contains all div of each events
     print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
@@ -1171,11 +1170,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
                     		$numicals[dol_string_nospecial($event->icalname)]++;
                     	}
                     	$color=$event->icalcolor;
-                    	$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
+                    	$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unmovable');
                     }
                     else if ($event->type_code == 'BIRTHDAY')
                     {
-                    	$numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
+                    	$numbirthday++; $colorindex=2; $cssclass='family_birthday unmovable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
                     }
                     else
                  	{
@@ -1213,32 +1212,35 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
                     $cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
 
                     // Defined style to disable drag and drop feature
-                    if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
+                    if ($event->type_code =='AC_OTH_AUTO')
+                    {
+                        $cssclass.= " unmovable";
+                    }
+                    else if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
                     {
                         $tmpyearend    = date('Y',$event->date_end_in_calendar);
                         $tmpmonthend   = date('m',$event->date_end_in_calendar);
                         $tmpdayend     = date('d',$event->date_end_in_calendar);
                         if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
                         {
-                            $cssclass.= " unsortable";
+                            $cssclass.= " unmovable";
                         }
                     }
-                    if ($event->type_code =='AC_OTH_AUTO')
-                    {
-                        $cssclass.= " unsortable";
-                    }
+                    else $cssclass.= " movable";
 
                     $h=''; $nowrapontd=1;
                     if ($action == 'show_day')  { $h='height: 100%; '; $nowrapontd=0; }
                     if ($action == 'show_week') { $h='height: 100%; '; $nowrapontd=0; }
 
                     // Show rect of event
-                    print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
+                    print "\n";
+                    print '<!-- start event '.$i.' --><div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
                     //print ' style="height: 100px;';
                     //print ' position: absolute; top: 40px; width: 50%;';
                     //print '"';
                     print '>';
-                    print '<ul class="cal_event" style="'.$h.'"><li class="cal_event" style="'.$h.'">';
+                    print '<ul class="cal_event" style="'.$h.'">';	// always 1 li per ul, 1 ul per event
+                    print '<li class="cal_event" style="'.$h.'">';
                     print '<table class="cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
                     print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
                     //if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
@@ -1369,8 +1371,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
                     if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1);
                     else print '&nbsp;';
                     print '</td></tr></table>';
-                    print '</li></ul>';
-                    print '</div>';
+                    print '</li>';
+                    print '</ul>';
+                    print '</div><!-- end event '.$i.' -->'."\n";
                     $i++;
                 }
                 else
@@ -1413,8 +1416,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
 
     print '</div>';
     print '</td></tr>';
-    print '</table>';
-    print '</div>'."\n";
+
+    print '</table></div>'."\n";
 }
 
 

+ 2 - 1
htdocs/comm/card.php

@@ -265,7 +265,8 @@ if ($id > 0)
 	print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
 	if (! empty($object->country_code))
 	{
-		$img=picto_from_langcode($object->country_code);
+		//$img=picto_from_langcode($object->country_code);
+		$img='';
 		if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
 		else print ($img?$img.' ':'').$object->country;
 	}

+ 22 - 21
htdocs/core/class/html.formprojet.class.php

@@ -51,7 +51,7 @@ class FormProjets
 	 *	@param	int		$maxlength		Maximum length of label
 	 *	@param	int		$option_only	Return only html options lines without the select tag
 	 *	@param	int		$show_empty		Add an empty line
-	 *  @param	int		$discard_closed Discard closed projects
+	 *  @param	int		$discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
 	 *	@return int         			Nber of project if OK, <0 if KO
 	 */
 	function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0)
@@ -105,7 +105,7 @@ class FormProjets
 					}
 					else
 					{
-						if ($discard_closed && $obj->fk_statut == 2)
+						if ($discard_closed == 1 && $obj->fk_statut == 2)
 						{
 							$i++;
 							continue;
@@ -114,30 +114,31 @@ class FormProjets
 						$labeltoshow=dol_trunc($obj->ref,18);
 						//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
 						//else $labeltoshow.=' ('.$langs->trans("Private").')';
+						$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
+
+						$disabled=0;
+						if ($obj->fk_statut == 0)
+						{
+							$disabled=1;
+							$labeltoshow.=' - '.$langs->trans("Draft");
+						}
+						else if ($obj->fk_statut == 2)
+						{
+							if ($discard_close == 2) $disabled=1;
+							$labeltoshow.=' - '.$langs->trans("Closed");
+						}
+						else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
+						{
+							$disabled=1;
+							$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
+						}
+						
 						if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
 						{
-							$out.= '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.' '.dol_trunc($obj->title,$maxlength).'</option>';
+							$out.= '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
 						}
 						else
 						{
-							$disabled=0;
-							$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
-							if ($obj->fk_statut == 0)
-							{
-								$disabled=1;
-								$labeltoshow.=' - '.$langs->trans("Draft");
-							}
-							else if ($obj->fk_statut == 2)
-							{
-								$disabled=1;
-								$labeltoshow.=' - '.$langs->trans("Closed");
-							}
-							else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
-							{
-								$disabled=1;
-								$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
-							}
-
 							if ($hideunselectables && $disabled)
 							{
 								$resultat='';

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

@@ -114,7 +114,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
 		print '<td class="nowrap">';
 		print $langs->trans("Project").' &nbsp; ';
 		print '</td><td class="nowrap maxwidthonsmartphone">';
-		$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 64);
+		$formproject->select_projects($socid?$socid:-1, $pid, 'projectid');
 		print '</td></tr>';
 	}
 

+ 7 - 5
htdocs/core/lib/functions.lib.php

@@ -488,13 +488,15 @@ function dolEscapeXML($string)
  *
  *  @param      string		$stringtoescape		String to escape
  *  @param		string		$mode				0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \
+ *  @param		string		$noescapebackslashn	0=Escape also \n. 1=Do not escape \n.
  *  @return     string     		 				Escaped string. Both ' and " are escaped into ' if they are escaped.
  */
-function dol_escape_js($stringtoescape, $mode=0)
+function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
 {
 	// escape quotes and backslashes, newlines, etc.
-	$substitjs=array("&#039;"=>"\\'",'\\'=>'\\\\',"\r"=>'\\r',"\n"=>'\\n');
+	$substitjs=array("&#039;"=>"\\'","\r"=>'\\r');
 	//$substitjs['</']='<\/';	// We removed this. Should be useless.
+	if (empty($noescapebackslashn)) { $substitjs["\n"]='\\n'; $substitjs['\\']='\\\\'; }
 	if (empty($mode)) { $substitjs["'"]="\\'"; $substitjs['"']="\\'"; }
 	else if ($mode == 1) $substitjs["'"]="\\'";
 	else if ($mode == 2) { $substitjs['"']='\\"'; }
@@ -1119,7 +1121,7 @@ function dol_getdate($timestamp,$fast=false)
  *	@param	int			$year			Year
  *	@param	mixed		$gm				True or 1 or 'gmt'=Input informations are GMT values, False or 0 or 'server' = local to server TZ, 'user' = local to user TZ
  *	@param	int			$check			0=No check on parameters (Can use day 32, etc...)
- *	@return	timestamp|string			Date as a timestamp, '' if error
+ *	@return	timestamp|string			Date as a timestamp, '' or false if error
  * 	@see 								dol_print_date, dol_stringtotime, dol_getdate
  */
 function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
@@ -3389,7 +3391,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
 			$sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'";
 			$sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC";
 			$sql.= $db->plimit(1);
-
+print $sql;
 			$resql=$db->query($sql);
 			if ($resql)
 			{
@@ -3515,7 +3517,7 @@ function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr
 	// we use the buyer VAT.
 	if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC))
 	{
-		if (! $seller_in_cee && $buyer_in_cee && ! $thirdparty_buyer->isACompany())
+		if ($seller_in_cee && $buyer_in_cee && ! $thirdparty_buyer->isACompany())
 		{
 			//print 'VATRULE 0';
 			return get_product_vat_for_country($idprod,$thirdparty_buyer,$idprodfournprice);

+ 4 - 0
htdocs/core/lib/sendings.lib.php

@@ -64,8 +64,12 @@ function shipping_prepare_head($object)
 	$head[$h][2] = 'contact';
 	$h++;
 
+    $nbNote = 0;
+    if (!empty($object->note_private)) $nbNote++;
+    if (!empty($object->note_public)) $nbNote++;
 	$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id;
 	$head[$h][1] = $langs->trans("Notes");
+	if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
 	$head[$h][2] = 'note';
 	$h++;
 

+ 4 - 2
htdocs/core/menus/init_menu_auguria.sql

@@ -11,7 +11,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__;
 insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home',        '', 0, '/index.php?mainmenu=home&amp;leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__);
 insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)',  2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies',   '', 0, '/societe/index.php?mainmenu=companies&amp;leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
 insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products',    '', 0, '/product/index.php?mainmenu=products&amp;leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
-insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled || $conf->tax->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial',  '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
+insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->fournisseur->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial',  '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
 insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|deplacement|don|tax|salaries', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled || $conf->don->enabled  || $conf->tax->enabled || $conf->salaries->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->deplacement->lire || $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read', '', 2, 50, __ENTITY__);
 insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
 insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project',     '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
@@ -53,8 +53,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 309__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 310__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__);
+-- Home - Module Tools
+-- Added by ???
 -- Home - Menu users and groups
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/card.php?leftmenu=users&amp;action=create', 'NewUser', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/index.php?leftmenu=users', 'Groups', 1, 'users', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin', '', 2, 1, __ENTITY__);

+ 2 - 2
htdocs/core/menus/standard/auguria.lib.php

@@ -149,7 +149,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla
 	if ($showmode == 1)
 	{
 		print '<a class="tmenuimage" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
-		print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
+		print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
 		print '</a>';
 		print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
 		print '<span class="mainmenuaspan">';
@@ -273,7 +273,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
 		else dol_print_error($db);
 		$db->free($resql);
 	}
-	
+
 	if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') 	// Entry in accountancy journal for each bank account
 	{
 		$newmenu->add('/accountancy/journal/index.php?leftmenu=journal',$langs->trans("Journaux"),0,$user->rights->banque->lire);

+ 8 - 8
htdocs/core/modules/expedition/doc/pdf_merou.modules.php

@@ -557,13 +557,18 @@ class pdf_merou extends ModelePdfExpedition
 
 		// Date Expedition
 		$Yoff = $Yoff+7;
-		$pdf->SetXY($blSocX-80,$blSocY+20);
+		$pdf->SetXY($blSocX-80,$blSocY+17);
 		$pdf->SetFont('','B', $default_font_size - 2);
 		$pdf->SetTextColor(0,0,0);
 		$pdf->MultiCell(50, 8, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,'day',false,$outputlangs,true), '', 'L');
 
+		$pdf->SetXY($blSocX-80,$blSocY+20);
+		$pdf->SetFont('','B', $default_font_size - 2);
+		$pdf->SetTextColor(0,0,0);
+		$pdf->MultiCell(50, 8, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, '', 'L');
+
 		// Deliverer
-		$pdf->SetXY($blSocX-80,$blSocY+23);
+		$pdf->SetXY($blSocX-80,$blSocY+24);
 		$pdf->SetFont('','', $default_font_size - 2);
 		$pdf->SetTextColor(0,0,0);
 
@@ -577,13 +582,8 @@ class pdf_merou extends ModelePdfExpedition
 					// Get code using getLabelFromKey
 					$code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
 					$label=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
+					$pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L');
 				}
-				else
-				{
-					$label=$outputlangs->transnoentities("Deliverer");
-				}
-
-				$pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L');
 			}
 		}
 		else

+ 10 - 4
htdocs/core/modules/expedition/doc/pdf_rouget.modules.php

@@ -191,11 +191,17 @@ class pdf_rouget extends ModelePdfExpedition
 				$tab_height = 130;
 				$tab_height_newpage = 150;
 
-				if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id)))
+				if (! empty($object->note_public) || ! empty($object->tracking_number))
 				{
 					$tab_top = 88;
 					$tab_top_alt = $tab_top;
 
+					$pdf->SetFont('','B', $default_font_size - 2);
+					$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, 0, 1, false, true, 'L');
+
+					$tab_top_alt = $pdf->GetY();
+					//$tab_top_alt += 1;
+
 					// Tracking number
 					if (! empty($object->tracking_number))
 					{
@@ -209,14 +215,14 @@ class pdf_rouget extends ModelePdfExpedition
 								$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
 								$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
 								$pdf->SetFont('','B', $default_font_size - 2);
-								$pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
+								$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top+6, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
 
-								$tab_top_alt += 7;
+								$tab_top_alt = $pdf->GetY();
 							}
 						}
 					}
 
-					// Affiche notes
+					// Notes
 					if (! empty($object->note_public))
 					{
 						$pdf->SetFont('','', $default_font_size - 1);   // Dans boucle pour gerer multi-page

+ 49 - 24
htdocs/core/modules/modAccounting.class.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
- * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
+ * Copyright (C) 2013-2015 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014      Ari Elbaz (elarifr)	<github@accedinfo.com>
  * Copyright (C) 2014 	   Florian Henry        <florian.henry@open-concept.pro>
  *
@@ -19,14 +19,14 @@
  */
 
 /**
- * \file		accountingex/core/modules/modAccounting.class.php
+ * \file		htdocs/core/modules/modAccounting.class.php
  * \ingroup		Accounting Expert
  * \brief		Module to activate Accounting Expert module
  */
 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
 
 /**
- * \class	modAccountingExpert
+ * \class	modAccounting
  * \brief	Description and activation class for module accounting expert
  */
 class modAccounting extends DolibarrModules
@@ -68,7 +68,7 @@ class modAccounting extends DolibarrModules
 		$this->depends = array("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled
 		$this->requiredby = array(); // List of modules id to disable if this one is disabled
 		$this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
-		$this->phpmin = array(5, 2); // Minimum version of PHP required by module
+		$this->phpmin = array(5, 3); // Minimum version of PHP required by module
 		$this->need_dolibarr_version = array(3, 6); // Minimum version of Dolibarr required by module
 		$this->langfiles = array("accountancy");
 
@@ -87,7 +87,7 @@ class modAccounting extends DolibarrModules
 				"With this constants on, bank account number is always required"
 		);
 		$this->const[1] = array(
-				"ACCOUNTING_SEPARATORCSV",
+				"ACCOUNTING_EXPORT_SEPARATORCSV",
 				"string",
 				","
 		);
@@ -112,60 +112,85 @@ class modAccounting extends DolibarrModules
 				"SOC"
 		);
 		$this->const[6] = array(
-				"ACCOUNTING_CASH_JOURNAL",
-				"chaine",
-				"CAI"
-		);
-		$this->const[7] = array(
 				"ACCOUNTING_MISCELLANEOUS_JOURNAL",
 				"chaine",
 				"OD"
 		);
-		$this->const[8] = array(
-				"ACCOUNTING_BANK_JOURNAL",
-				"chaine",
-				"BQ"
-		); // Deprecated Move into llx_bank_account
-		$this->const[9] = array(
+		$this->const[7] = array(
 				"ACCOUNTING_ACCOUNT_TRANSFER_CASH",
 				"chaine",
 				"58"
 		);
-		$this->const[10] = array(
+		$this->const[8] = array(
 				"CHARTOFACCOUNTS",
 				"chaine",
 				"2"
 		);
-		$this->const[11] = array(
-				"ACCOUNTING_MODELCSV",
+		$this->const[9] = array(
+				"ACCOUNTING_EXPORT_MODELCSV",
 				"chaine",
 				"0"
 		);
-		$this->const[12] = array(
+		$this->const[10] = array(
 				"ACCOUNTING_LENGTH_GACCOUNT",
 				"chaine",
 				""
 		);
-		$this->const[13] = array(
+		$this->const[11] = array(
 				"ACCOUNTING_LENGTH_AACCOUNT",
 				"chaine",
 				""
 		);
-		$this->const[14] = array(
+		$this->const[12] = array(
 				"ACCOUNTING_LIMIT_LIST_VENTILATION",
 				"chaine",
 				"50"
 		);
-		$this->const[15] = array(
+		$this->const[13] = array(
 				"ACCOUNTING_LIST_SORT_VENTILATION_TODO",
 				"yesno",
 				"1"
 		);
-		$this->const[16] = array(
+		$this->const[14] = array(
 				"ACCOUNTING_LIST_SORT_VENTILATION_DONE",
 				"yesno",
 				"1"
 		);
+		$this->const[15] = array (
+				"ACCOUNTING_GROUPBYACCOUNT",
+				"yesno",
+				"1"
+		);
+		$this->const[16] = array (
+				"ACCOUNTING_EXPORT_DATE",
+				"chaine",
+				"%d%m%Y"
+		);
+		$this->const[17] = array (
+				"ACCOUNTING_EXPORT_PIECE",
+				"yesno",
+				"1"
+		);
+		$this->const[18] = array (
+				"ACCOUNTING_EXPORT_GLOBAL_ACCOUNT",
+				"yesno",
+				"1" 
+		);
+		$this->const[19] = array (
+				"ACCOUNTING_EXPORT_LABEL",
+				"yesno",
+				"1"
+		);
+		$this->const[20] = array (
+				"ACCOUNTING_EXPORT_AMOUNT",
+				"yesno",
+				"1" 
+		);
+		$this->const[21] = array (
+				"ACCOUNTING_EXPORT_DEVISE",
+				"yesno",
+				"1" 
+		);
 
 		// Tabs
 		$this->tabs = array();

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

@@ -50,7 +50,7 @@ class modAdherent extends DolibarrModules
         $this->family = "hr";
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
 		$this->name = preg_replace('/^mod/i','',get_class($this));
-        $this->description = "Gestion des adhérents d'une association";
+        $this->description = "Management of members of a foundation or association";
         $this->version = 'dolibarr';                        // 'experimental' or 'dolibarr' or version
         $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
         $this->special = 0;
@@ -137,7 +137,7 @@ class modAdherent extends DolibarrModules
 
         $r++;
         $this->rights[$r][0] = 75;
-        $this->rights[$r][1] = 'Setup types and attributes of members';
+        $this->rights[$r][1] = 'Setup types of membership';
         $this->rights[$r][2] = 'w';
         $this->rights[$r][3] = 0;
         $this->rights[$r][4] = 'configurer';

+ 2 - 3
htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php

@@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/modules_commandefo
 
 
 /**
-	\class      mod_commande_fournisseur_orchidee
-	\brief      Classe du modele de numerotation de reference de commande fournisseur Orchidee
-*/
+ *	Classe du modele de numerotation de reference de commande fournisseur Orchidee
+ */
 class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
 {
 	var $version='dolibarr';		// 'development', 'experimental', 'dolibarr'

+ 1 - 1
htdocs/expedition/class/expedition.class.php

@@ -1523,7 +1523,7 @@ class Expedition extends CommonObject
     }
 
 	/**
-	 * Get tracking url status
+	 * Forge an set tracking url
 	 *
 	 * @param	string	$value		Value
 	 * @return	void

+ 1 - 0
htdocs/expedition/note.php

@@ -157,6 +157,7 @@ if ($id > 0 || ! empty($ref))
 
 	print '<br>';
 
+	$colwidth=20;
 	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
 
 	dol_fiche_end();

+ 2 - 1
htdocs/fourn/card.php

@@ -167,7 +167,8 @@ if ($object->id > 0)
 
 	// Country
 	print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
-	$img=picto_from_langcode($object->country_code);
+	//$img=picto_from_langcode($object->country_code);
+	$img='';
 	if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
 	else print ($img?$img.' ':'').$object->country;
 	print '</td></tr>';

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

@@ -592,7 +592,6 @@ class CommandeFournisseur extends CommonOrder
             else
 			{
                 $this->error = $obj->error;
-                dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error);
                 return -1;
             }
         }

+ 37 - 30
htdocs/fourn/commande/card.php

@@ -130,13 +130,13 @@ if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer)
 }
 
 // mode de reglement
-else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
+if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
 {
     $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
 }
 
 // bank account
-else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer)
+if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer)
 {
      $result=$object->setBankAccount(GETPOST('fk_account', 'int'));
 }
@@ -154,17 +154,17 @@ if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->cree
 }
 
 // Set project
-else if ($action ==	'classin' && $user->rights->fournisseur->commande->creer)
+if ($action ==	'classin' && $user->rights->fournisseur->commande->creer)
 {
     $object->setProject($projectid);
 }
 
-else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer)
+if ($action == 'setremisepercent' && $user->rights->fournisseur->commande->creer)
 {
     $result = $object->set_remise($user, $_POST['remise_percent']);
 }
 
-else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
+if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
 {
     if (in_array($object->statut, array(1, 2, 5, 6, 7, 9)))
     {
@@ -191,7 +191,7 @@ else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver)
 /*
  *	Add a line into product
  */
-else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
+if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
 {
     $langs->load('errors');
     $error = 0;
@@ -402,7 +402,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
 /*
  *	Mise a jour	d'une ligne	dans la	commande
  */
-else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer &&	! GETPOST('cancel'))
+if ($action == 'update_line' && $user->rights->fournisseur->commande->creer &&	! GETPOST('cancel'))
 {
     if ($_POST["elrowid"])
     {
@@ -473,7 +473,7 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer
     }
 }
 
-else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer)
+if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer)
 {
 
     $result = $object->deleteline(GETPOST('lineid'));
@@ -506,7 +506,7 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r
     }
 }
 
-else if ($action == 'confirm_valid' && $confirm == 'yes' &&
+if ($action == 'confirm_valid' && $confirm == 'yes' &&
     ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer))
     || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate)))
 	)
@@ -545,7 +545,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' &&
     }
 }
 
-else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
+if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
 {
     $idwarehouse=GETPOST('idwarehouse', 'int');
 
@@ -596,7 +596,7 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou
     }
 }
 
-else if ($action == 'confirm_refuse' &&	$confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
+if ($action == 'confirm_refuse' &&	$confirm == 'yes' && $user->rights->fournisseur->commande->approuver)
 {
     $result = $object->refuse($user);
     if ($result > 0)
@@ -610,7 +610,7 @@ else if ($action == 'confirm_refuse' &&	$confirm == 'yes' && $user->rights->four
     }
 }
 
-else if ($action == 'confirm_commande' && $confirm	== 'yes' &&	$user->rights->fournisseur->commande->commander)
+if ($action == 'confirm_commande' && $confirm	== 'yes' &&	$user->rights->fournisseur->commande->commander)
 {
     $result	= $object->commande($user, $_REQUEST["datecommande"],	$_REQUEST["methode"], $_REQUEST['comment']);
     if ($result > 0)
@@ -628,7 +628,7 @@ else if ($action == 'confirm_commande' && $confirm	== 'yes' &&	$user->rights->fo
 }
 
 
-else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->commande->supprimer)
+if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->commande->supprimer)
 {
     $result=$object->delete($user);
     if ($result > 0)
@@ -643,7 +643,7 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->four
 }
 
 // Action clone object
-else if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer)
+if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer)
 {
 	if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
 	{
@@ -669,7 +669,7 @@ else if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->fourn
 }
 
 // Receive
-else if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner)
+if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner)
 {
 
     if ($_POST["type"])
@@ -698,7 +698,7 @@ else if ($action == 'livraison' && $user->rights->fournisseur->commande->recepti
     }
 }
 
-else if ($action == 'confirm_cancel' && $confirm == 'yes' &&	$user->rights->fournisseur->commande->commander)
+if ($action == 'confirm_cancel' && $confirm == 'yes' &&	$user->rights->fournisseur->commande->commander)
 {
     $result	= $object->cancel($user);
     if ($result > 0)
@@ -713,7 +713,7 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' &&	$user->rights->four
 }
 
 // Line ordering
-else if ($action == 'up'	&& $user->rights->fournisseur->commande->creer)
+if ($action == 'up'	&& $user->rights->fournisseur->commande->creer)
 {
     $object->line_up($_GET['rowid']);
 
@@ -729,7 +729,7 @@ else if ($action == 'up'	&& $user->rights->fournisseur->commande->creer)
     header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
     exit;
 }
-else if ($action == 'down' && $user->rights->fournisseur->commande->creer)
+if ($action == 'down' && $user->rights->fournisseur->commande->creer)
 {
     $object->line_down($_GET['rowid']);
 
@@ -746,7 +746,7 @@ else if ($action == 'down' && $user->rights->fournisseur->commande->creer)
     exit;
 }
 
-else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer)	// En get ou en	post
+if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer)	// En get ou en	post
 {
     // Build document
 
@@ -768,7 +768,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer)	/
 }
 
 // Delete file in doc form
-else if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisseur->commande->creer)
+if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisseur->commande->creer)
 {
     require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
     $langs->load("other");
@@ -779,7 +779,7 @@ else if ($action == 'remove_file' && $object->id > 0 && $user->rights->fournisse
     else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
 }
 
-elseif ($action == 'update_extras')
+if ($action == 'update_extras')
 {
 	// Fill array 'array_options' with data from add form
 	$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
@@ -821,7 +821,7 @@ elseif ($action == 'update_extras')
 /*
  * Create an order
  */
-else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
+if ($action == 'add' && $user->rights->fournisseur->commande->creer)
 {
  	$error=0;
 
@@ -1367,17 +1367,24 @@ elseif (! empty($object->id))
 		if (preg_match('/^[\(]?PROV/i',$object->ref)) $newref = $object->getNextNumRef($object->thirdparty);
 		else $newref = $object->ref;
 
-		$text=$langs->trans('ConfirmValidateOrder',$newref);
-		if (! empty($conf->notification->enabled))
+		if ($newref < 0)
 		{
-			require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
-			$notify=new	Notify($db);
-			$text.='<br>';
-			$text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid);
+			setEventMessages($object->error, $object->errors, 'errors');
+			$action='';
 		}
+		else
+		{
+			$text=$langs->trans('ConfirmValidateOrder',$newref);
+			if (! empty($conf->notification->enabled))
+			{
+				require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
+				$notify=new	Notify($db);
+				$text.='<br>';
+				$text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid);
+			}
 
-		print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1);
-
+			print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1);
+		}
 	}
 
 	/*

+ 6 - 2
htdocs/install/check.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2004-2005	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
- * Copyright (C) 2004-2014	Laurent Destailleur		<eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2015	Laurent Destailleur		<eldy@users.sourceforge.net>
  * Copyright (C) 2005		Marc Barilley / Ocebo	<marc@ocebo.com>
  * Copyright (C) 2005-2012	Regis Houssin			<regis.houssin@capnetworks.com>
  * Copyright (C) 2013-2014	Juanjo Menent			<jmenent@2byte.es>
@@ -454,7 +454,7 @@ else
 			if ($allowupgrade)
 			{
 				// If it's not last updagre script, action = upgrade_tmp, if last action = upgrade
-                $choice .= '<a class="button" href="upgrade.php?action=upgrade'.($count<count($migrationscript)?'_'.$versionto:'').'&amp;selectlang='.$setuplang.'&amp;versionfrom='.$versionfrom.'&amp;versionto='.$versionto.'">'.$langs->trans("Start").'</a>';
+                $choice .= '<a class="button runupgrade" href="upgrade.php?action=upgrade'.($count<count($migrationscript)?'_'.$versionto:'').'&amp;selectlang='.$setuplang.'&amp;versionfrom='.$versionfrom.'&amp;versionto='.$versionto.'">'.$langs->trans("Start").'</a>';
 			}
 			else
 			{
@@ -523,6 +523,10 @@ $("div#AShowChoices a").click(function() {
 
 });
 
+$(".runupgrade").click(function() {
+	return confirm("'.dol_escape_js($langs->transnoentitiesnoconv("WarningUpgrade"), 0, 1).'");
+});
+
 </script>';
 
 pFooter(true);	// Never display next button

+ 8 - 3
htdocs/install/mysql/migration/3.6.0-3.7.0.sql

@@ -106,15 +106,20 @@ UPDATE llx_const SET name = 'ACCOUNTING_VAT_ACCOUNT' WHERE name = 'COMPTA_VAT_AC
 UPDATE llx_const SET name = 'ACCOUNTING_VAT_BUY_ACCOUNT' WHERE name = 'COMPTA_VAT_BUY_ACCOUNT';
 
 -- Compatibility with module Accounting Expert
-UPDATE llx_const SET name = 'ACCOUNTING_SEPARATORCSV' WHERE name = 'ACCOUNTINGEX_SEPARATORCSV';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_MODELCSV' WHERE name = 'ACCOUNTINGEX_MODELCSV';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_SEPARATORCSV' WHERE name = 'ACCOUNTINGEX_SEPARATORCSV';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DATE' WHERE name = 'ACCOUNTINGEX_EXP_DATE';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_PIECE' WHERE name = 'ACCOUNTINGEX_EXP_PIECE';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT' WHERE name = 'ACCOUNTINGEX_EXP_GLOBAL_ACCOUNT';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_LABEL' WHERE name = 'ACCOUNTINGEX_EXP_LABEL';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_AMOUNT' WHERE name = 'ACCOUNTINGEX_EXP_AMOUNT';
+UPDATE llx_const SET name = 'ACCOUNTING_EXPORT_DEVISE' WHERE name = 'ACCOUNTINGEX_EXP_DEVISE';
 UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_SUSPENSE' WHERE name = 'ACCOUNTINGEX_ACCOUNT_SUSPENSE';
 UPDATE llx_const SET name = 'ACCOUNTING_SELL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SELL_JOURNAL';
 UPDATE llx_const SET name = 'ACCOUNTING_PURCHASE_JOURNAL' WHERE name = 'ACCOUNTINGEX_PURCHASE_JOURNAL';
 UPDATE llx_const SET name = 'ACCOUNTING_SOCIAL_JOURNAL' WHERE name = 'ACCOUNTINGEX_SOCIAL_JOURNAL';
-UPDATE llx_const SET name = 'ACCOUNTING_CASH_JOURNAL' WHERE name = 'ACCOUNTINGEX_CASH_JOURNAL';
 UPDATE llx_const SET name = 'ACCOUNTING_MISCELLANEOUS_JOURNAL' WHERE name = 'ACCOUNTINGEX_MISCELLANEOUS_JOURNAL';
 UPDATE llx_const SET name = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH' WHERE name = 'ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH';
-UPDATE llx_const SET name = 'ACCOUNTING_MODELCSV' WHERE name = 'ACCOUNTINGEX_MODELCSV';
 UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_GACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_GACCOUNT';
 UPDATE llx_const SET name = 'ACCOUNTING_LENGTH_AACCOUNT' WHERE name = 'ACCOUNTINGEX_LENGTH_AACCOUNT';
 UPDATE llx_const SET name = 'ACCOUNTING_LIMIT_LIST_VENTILATION' WHERE name = 'ACCOUNTINGEX_LIMIT_LIST_VENTILATION';

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

@@ -574,7 +574,7 @@ Permission67=Export interventions
 Permission71=Read members
 Permission72=Create/modify members
 Permission74=Delete members
-Permission75=Setup types and attributes for members
+Permission75=Setup types of membership
 Permission76=Export datas
 Permission78=Read subscriptions
 Permission79=Create/modify subscriptions
@@ -597,8 +597,8 @@ Permission106=Export sendings
 Permission109=Delete sendings
 Permission111=Read financial accounts
 Permission112=Create/modify/delete and compare transactions
-Permission113=Setup financiel accounts (create, manage categories)
-Permission114=Consolidate transactions
+Permission113=Setup financial accounts (create, manage categories)
+Permission114=Reconciliate transactions
 Permission115=Export transactions and account statements
 Permission116=Transfers between accounts
 Permission117=Manage cheques dispatching
@@ -1059,7 +1059,7 @@ BrowserIsOK=You are using the web browser %s. This browser is ok for security an
 BrowserIsKO=You are using the web browser %s. This browser is known to be a bad choice for security, performance and reliability. We recommand you to use Firefox, Chrome, Opera or Safari.
 XDebugInstalled=XDebug is loaded.
 XCacheInstalled=XCache is loaded.
-AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink
+AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink. Third parties will appears with name "CC12345 - SC45678 - The big company coorp", instead of "The big company coorp".
 FieldEdition=Edition of field %s
 FixTZ=TimeZone fix
 FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
@@ -1405,9 +1405,9 @@ FixedEmailTarget=Fixed email target
 SendingsSetup=Sending module setup
 SendingsReceiptModel=Sending receipt model
 SendingsNumberingModules=Sendings numbering modules
-SendingsAbility=Support sendings sheets for customer deliveries
+SendingsAbility=Support shipment sheets for customer deliveries
 NoNeedForDeliveryReceipts=In most cases, sendings receipts are used both as sheets for customer deliveries (list of products to send) and sheets that is recevied and signed by customer. So product deliveries receipts is a duplicated feature and is rarely activated.
-FreeLegalTextOnShippings=Free text on shippings
+FreeLegalTextOnShippings=Free text on shipments
 ##### Deliveries #####
 DeliveryOrderNumberingModules=Products deliveries receipt numbering module
 DeliveryOrderModel=Products deliveries receipt model

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

@@ -58,8 +58,8 @@ OrderSentByEMail=Customer order %s sent by EMail
 InvoiceSentByEMail=Customer invoice %s sent by EMail
 SupplierOrderSentByEMail=Supplier order %s sent by EMail
 SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail
-ShippingSentByEMail=Shipping %s sent by EMail
-ShippingValidated= Shipping %s validated
+ShippingSentByEMail=Shipment %s sent by EMail
+ShippingValidated= Shipment %s validated
 NewCompanyToDolibarr= Third party created
 DateActionPlannedStart= Planned start date
 DateActionPlannedEnd= Planned end date

+ 6 - 6
htdocs/langs/en_US/bills.lang

@@ -1,16 +1,16 @@
 # Dolibarr language file - Source file is en_US - bills
 Bill=Invoice
 Bills=Invoices
-BillsCustomers=Customer's invoices
-BillsCustomer=Customer's invoice
-BillsSuppliers=Supplier's invoices
-BillsCustomersUnpaid=Unpaid customer's invoices
+BillsCustomers=Customers invoices
+BillsCustomer=Customers invoice
+BillsSuppliers=Suppliers invoices
+BillsCustomersUnpaid=Unpaid customers invoices
 BillsCustomersUnpaidForCompany=Unpaid customer's invoices for %s
 BillsSuppliersUnpaid=Unpaid supplier's invoices
 BillsSuppliersUnpaidForCompany=Unpaid supplier's invoices for %s
 BillsLate=Late payments
-BillsStatistics=Customer's invoices statistics
-BillsStatisticsSuppliers=Supplier's invoices statistics
+BillsStatistics=Customers invoices statistics
+BillsStatisticsSuppliers=Suppliers invoices statistics
 DisabledBecauseNotErasable=Disabled because can not be erased
 InvoiceStandard=Standard invoice
 InvoiceStandardAsk=Standard invoice

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

@@ -155,6 +155,7 @@ MigrationFinished=Migration finished
 LastStepDesc=<strong>Last step</strong>: Define here login and password you plan to use to connect to software. Do not loose this as it is the account to administer all others.
 ActivateModule=Activate module %s
 ShowEditTechnicalParameters=Click here to show/edit advanced parameters (expert mode)
+WarningUpgrade=Warning:\nDid your run a database backup first ?\nThis is highly recommanded: for example, due to some bugs into databases systems (for example mysql version 5.5.40), some data or tables may be lost during this process, so it is highly recommanded to have a complete dump of your database before starting migration.\n\nClick OK to start migration process...
 
 #########
 # upgrade

+ 5 - 5
htdocs/langs/en_US/orders.lang

@@ -16,13 +16,13 @@ SupplierOrder=Supplier order
 SuppliersOrders=Suppliers orders
 SuppliersOrdersRunning=Current suppliers orders
 CustomerOrder=Customer order
-CustomersOrders=Customer's orders
+CustomersOrders=Customers orders
 CustomersOrdersRunning=Current customer's orders
 CustomersOrdersAndOrdersLines=Customer orders and order's lines
-OrdersToValid=Customer's orders to validate
-OrdersToBill=Customer's orders delivered
-OrdersInProcess=Customer's orders in process
-OrdersToProcess=Customer's orders to process
+OrdersToValid=Customers orders to validate
+OrdersToBill=Customers orders delivered
+OrdersInProcess=Customers orders in process
+OrdersToProcess=Customers orders to process
 SuppliersOrdersToProcess=Supplier's orders to process
 StatusOrderCanceledShort=Canceled
 StatusOrderDraftShort=Draft

+ 4 - 4
htdocs/langs/en_US/sendings.lang

@@ -4,7 +4,7 @@ Sending=Shipment
 Sendings=Shipments
 Shipment=Shipment
 Shipments=Shipments
-Receivings=Receivings
+Receivings=Receipts
 SendingsArea=Shipments area
 ListOfSendings=List of shipments
 SendingMethod=Shipping method
@@ -14,7 +14,7 @@ SearchASending=Search for shipment
 StatisticsOfSendings=Statistics for shipments
 NbOfSendings=Number of shipments
 NumberOfShipmentsByMonth=Number of shipments by month
-SendingCard=Shipping card
+SendingCard=Shipment card
 NewSending=New shipment
 CreateASending=Create a shipment
 CreateSending=Create shipment
@@ -37,7 +37,7 @@ StatusSendingCanceledShort=Canceled
 StatusSendingDraftShort=Draft
 StatusSendingValidatedShort=Validated
 StatusSendingProcessedShort=Processed
-SendingSheet=Sending sheet
+SendingSheet=Shipment sheet
 Carriers=Carriers
 Carrier=Carrier
 CarriersArea=Carriers area
@@ -58,7 +58,7 @@ SendShippingRef=Submission of shipment %s
 ActionsOnShipping=Events on shipment
 LinkToTrackYourPackage=Link to track your package
 ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card.
-RelatedShippings=Related shippings
+RelatedShippings=Related shipments
 ShipmentLine=Shipment line
 CarrierList=List of transporters
 SendingRunning=Product from customer order already sent

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

@@ -116,7 +116,7 @@ MassMovement=Mass movement
 MassStockMovement=Mass stock movement
 SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s".
 RecordMovement=Record transfert
-ReceivingForSameOrder=Receivings for this order
+ReceivingForSameOrder=Receipts for this order
 StockMovementRecorded=Stock movements recorded
 RuleForStockAvailability=Rules on stock requirements
 StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice 

+ 11 - 9
htdocs/product/stock/product.php

@@ -441,7 +441,16 @@ if ($id > 0 || $ref)
 
         // Real stock
         $product->load_stock();
-		print '<tr><td>'.$langs->trans("PhysicalStock").'</td>';
+        $text_stock_options = '';
+        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'<br>':'');
+        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'<br>':'');
+        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_BILL)?$langs->trans("DeStockOnBill").'<br>':'');
+        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)?$langs->trans("ReStockOnBill").'<br>':'');
+        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)?$langs->trans("ReStockOnValidateOrder").'<br>':'');
+        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)?$langs->trans("ReStockOnDispatchOrder").'<br>':'');
+        print '<tr><td>';
+        print $form->textwithtooltip($langs->trans("PhysicalStock"),$text_stock_options,2,1,img_picto('', 'info'),'',0);
+        print '</td>';
 		print '<td>'.$product->stock_reel;
 		if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit"));
 		print '</td>';
@@ -457,14 +466,7 @@ if ($id > 0 || $ref)
         print '</tr>';
 
         print '<tr><td>';
-        $text_stock_options = '';
-        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'<br>':'');
-        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'<br>':'');
-        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_BILL)?$langs->trans("DeStockOnBill").'<br>':'');
-        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)?$langs->trans("ReStockOnBill").'<br>':'');
-        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)?$langs->trans("ReStockOnValidateOrder").'<br>':'');
-        $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)?$langs->trans("ReStockOnDispatchOrder").'<br>':'');
-        print $form->textwithtooltip($langs->trans("StockDiffPhysicTeoric"),$text_stock_options,2,1,img_picto('', 'info'),'',0);;
+        print $langs->trans("StockDiffPhysicTeoric");
         print '</td>';
         print '<td>';
 

+ 5 - 5
htdocs/projet/element.php

@@ -164,21 +164,21 @@ dol_fiche_end();
 
 $listofreferent=array(
 'propal'=>array(
-	'name'=>"Proposalq",
+	'name'=>"Proposals",
 	'title'=>"ListProposalsAssociatedProject",
 	'class'=>'Propal',
 	'table'=>'propal',
     'datefieldname'=>'datep',
 	'test'=>$conf->propal->enabled && $user->rights->propale->lire),
 'order'=>array(
-	'name'=>"CustomerOrderq",
+	'name'=>"CustomersOrders",
 	'title'=>"ListOrdersAssociatedProject",
 	'class'=>'Commande',
 	'table'=>'commande',
 	'datefieldname'=>'date_commande',
 	'test'=>$conf->commande->enabled && $user->rights->commande->lire),
 'invoice'=>array(
-	'name'=>"CustomerInvoiceq",
+	'name'=>"CustomersInvoices",
 	'title'=>"ListInvoicesAssociatedProject",
 	'class'=>'Facture',
 	'margin'=>'add',
@@ -193,7 +193,7 @@ $listofreferent=array(
 	'datefieldname'=>'datec',
 	'test'=>$conf->facture->enabled && $user->rights->facture->lire),
 'order_supplier'=>array(
-	'name'=>"SuplierOrders",
+	'name'=>"SuppliersOrders",
 	'title'=>"ListSupplierOrdersAssociatedProject",
 	'class'=>'CommandeFournisseur',
 	'table'=>'commande_fournisseur',
@@ -223,7 +223,7 @@ $listofreferent=array(
 	'disableamount'=>1,
 	'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
 'trip'=>array(
-	'name'=>"TripAndExpenses",
+	'name'=>"TripsAndExpenses",
 	'title'=>"ListTripAssociatedProject",
 	'class'=>'Deplacement',
 	'table'=>'deplacement',

+ 2 - 0
htdocs/societe/admin/societe.php

@@ -395,6 +395,7 @@ print '<td align="center" width="80">'.$langs->trans("Status").'</td>';
 print '<td align="center" width="60">'.$langs->trans("ShortInfo").'</td>';
 print "</tr>\n";
 
+$var=true;
 foreach ($dirsociete as $dirroot)
 {
 	$dir = dol_buildpath($dirroot,0);
@@ -488,6 +489,7 @@ print '<td align="center" width="60">'.$langs->trans("ShortInfo").'</td>';
 print '<td align="center" width="60">'.$langs->trans("Preview").'</td>';
 print "</tr>\n";
 
+$var=true;
 foreach ($dirsociete as $dirroot)
 {
 	$dir = dol_buildpath($dirroot.'doc/',0);

+ 2 - 1
htdocs/societe/agenda.php

@@ -121,7 +121,8 @@ if ($socid)
 	// Country
 	if ($object->country) {
 		print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
-		$img=picto_from_langcode($object->country_code);
+		//$img=picto_from_langcode($object->country_code);
+		$img='';
 		print ($img?$img.' ':'');
 		print $object->country;
 		print '</td></tr>';

+ 1 - 1
htdocs/societe/class/societe.class.php

@@ -2648,7 +2648,7 @@ class Societe extends CommonObject
     {
         global $conf;
 
-        // Define if third party is treated as company of not when nature is unknown
+        // Define if third party is treated as company (or not) when nature is unknown
         $isacompany=empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES)?0:1; // 0 by default
         if (! empty($this->tva_intra)) $isacompany=1;
         else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_PRIVATE'))) $isacompany=0;

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

@@ -428,6 +428,9 @@ th .button {
 	background-color: #777;
 	border-radius: 10px;
 }
+.movable {
+	cursor: move;
+}
 
 .borderrightlight
 {

+ 54 - 18
test/phpunit/FunctionsLibTest.php

@@ -646,6 +646,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
         $this->savlangs=$langs;
         $this->savdb=$db;
 
+        // Sellers
         $companyfrnovat=new Societe($db);
         $companyfrnovat->country_code='FR';
         $companyfrnovat->tva_assuj=0;
@@ -653,53 +654,88 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
         $companyfr=new Societe($db);
         $companyfr->country_code='FR';
         $companyfr->tva_assuj=1;
+		$companyfr->tva_intra='FR9999';
 
+        // Buyers
         $companymc=new Societe($db);
         $companymc->country_code='MC';
         $companymc->tva_assuj=1;
+		$companyfr->tva_intra='MC9999';
 
         $companyit=new Societe($db);
         $companyit->country_code='IT';
         $companyit->tva_assuj=1;
         $companyit->tva_intra='IT99999';
 
-        $notcompanyit=new Societe($db);
-        $notcompanyit->country_code='IT';
-        $notcompanyit->tva_assuj=1;
-        $notcompanyit->tva_intra='';
-        $notcompanyit->typent_code='TE_PRIVATE';
+        $companyde=new Societe($db);
+        $companyde->country_code='DE';
+        $companyde->tva_assuj=1;
+        $companyde->tva_intra='DE99999';
+
+        $notcompanyde=new Societe($db);
+        $notcompanyde->country_code='DE';
+        $notcompanyde->tva_assuj=0;
+        $notcompanyde->tva_intra='';
+        $notcompanyde->typent_code='TE_PRIVATE';
 
         $companyus=new Societe($db);
         $companyus->country_code='US';
         $companyus->tva_assuj=1;
         $companyus->tva_intra='';
 
-        // Test RULE 0 (FR-IT)
+
+        // Test RULE 0 (FR-DE)
         // Not tested
 
         // Test RULE 1
         $vat=get_default_tva($companyfrnovat,$companymc,0);
-        $this->assertEquals(0,$vat);
+        $this->assertEquals(0,$vat,'RULE 1');
 
         // Test RULE 2 (FR-FR)
         $vat=get_default_tva($companyfr,$companyfr,0);
-        $this->assertEquals(20,$vat);
+        $this->assertEquals(20,$vat,'RULE 2');
 
         // Test RULE 2 (FR-MC)
         $vat=get_default_tva($companyfr,$companymc,0);
-        $this->assertEquals(20,$vat);
+        $this->assertEquals(20,$vat,'RULE 2');
 
-        // Test RULE 3 (FR-IT)
+        // Test RULE 3 (FR-DE company)
         $vat=get_default_tva($companyfr,$companyit,0);
-        $this->assertEquals(0,$vat);
+        $this->assertEquals(0,$vat,'RULE 3');
+
+        // Test RULE 4 (FR-DE not a company)
+        $vat=get_default_tva($companyfr,$notcompanyde,0);
+        $this->assertEquals(20,$vat,'RULE 4');
+
+        // Test RULE 5 (FR-US)
+        $vat=get_default_tva($companyfr,$companyus,0);
+        $this->assertEquals(0,$vat,'RULE 5');
+
+
+        // We do same tests but with option SERVICE_ARE_ECOMMERCE_200238EC on.
+        $conf->global->SERVICE_ARE_ECOMMERCE_200238EC = 1;
+
 
-        // Test RULE 4 (FR-IT)
-        $vat=get_default_tva($companyfr,$notcompanyit,0);
-        $this->assertEquals(20,$vat);
+        // Test RULE 1 (FR-US)
+        $vat=get_default_tva($companyfr,$companyus,0);
+        $this->assertEquals(0,$vat,'RULE 1 ECOMMERCE_200238EC');
+
+        // Test RULE 2 (FR-FR)
+        $vat=get_default_tva($companyfr,$companyfr,0);
+        $this->assertEquals(20,$vat,'RULE 2 ECOMMERCE_200238EC');
+
+        // Test RULE 3 (FR-DE company)
+        $vat=get_default_tva($companyfr,$companyde,0);
+        $this->assertEquals(0,$vat,'RULE 3 ECOMMERCE_200238EC');
+
+        // Test RULE 4 (FR-DE not a company)
+        $vat=get_default_tva($companyfr,$notcompanyde,0);
+        $this->assertEquals(19,$vat,'RULE 4 ECOMMERCE_200238EC');
 
         // Test RULE 5 (FR-US)
         $vat=get_default_tva($companyfr,$companyus,0);
-        $this->assertEquals(0,$vat);
+        $this->assertEquals(0,$vat,'RULE 5 ECOMMERCE_200238EC');
+
     }
 
     /**
@@ -836,7 +872,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
 		$this->assertEquals(1000, price2num('1 000.0'));
 		$this->assertEquals(1000, price2num('1 000','MT'));
 		$this->assertEquals(1000, price2num('1 000','MU'));
-		
+
 		$this->assertEquals(1000.123456, price2num('1 000.123456'));
 
 		// Round down
@@ -850,8 +886,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
 		// Text can't be converted
 		$this->assertEquals('12.4$',price2num('12.4$'));
 		$this->assertEquals('12r.4$',price2num('12r.4$'));
-		
-		return true;		
+
+		return true;
 	}
 
 }

部分文件因文件數量過多而無法顯示