Browse Source

Merge branch 'develop' into prod-attr

# Conflicts:
#	htdocs/core/class/html.form.class.php
#	htdocs/fourn/commande/card.php
#	htdocs/fourn/facture/card.php
#	htdocs/langs/en_US/products.lang
Marcos García de La Fuente 8 years ago
parent
commit
d06fb423c0
100 changed files with 1082 additions and 651 deletions
  1. 4 0
      .travis.yml
  2. 25 2
      ChangeLog
  3. 6 13
      README-FR.md
  4. 16 6
      README.md
  5. 1 1
      dev/initdemo/initdemo.sh
  6. 13 0
      dev/resources/iso-normes/sample_FEC_file.txt
  7. 1 1
      dev/skeletons/skeleton_list.php
  8. 5 1
      dev/tools/fixaltlanguages.sh
  9. 2 2
      dev/tools/test/testdiv.php
  10. 14 0
      dev/translation/erp_comparison_translation.txt
  11. 143 75
      htdocs/accountancy/admin/account.php
  12. 41 41
      htdocs/accountancy/admin/categories.php
  13. 1 1
      htdocs/accountancy/admin/fiscalyear.php
  14. 1 1
      htdocs/accountancy/admin/fiscalyear_card.php
  15. 1 1
      htdocs/accountancy/admin/productaccount.php
  16. 1 1
      htdocs/accountancy/bookkeeping/balance.php
  17. 1 1
      htdocs/accountancy/bookkeeping/list.php
  18. 1 1
      htdocs/accountancy/bookkeeping/listbyaccount.php
  19. 1 1
      htdocs/accountancy/bookkeeping/listbyyear.php
  20. 4 5
      htdocs/accountancy/class/accountancycategory.class.php
  21. 1 1
      htdocs/accountancy/customer/lines.php
  22. 1 1
      htdocs/accountancy/customer/list.php
  23. 1 1
      htdocs/accountancy/expensereport/lines.php
  24. 1 1
      htdocs/accountancy/expensereport/list.php
  25. 2 2
      htdocs/accountancy/journal/expensereportsjournal.php
  26. 1 1
      htdocs/accountancy/supplier/lines.php
  27. 1 1
      htdocs/accountancy/supplier/list.php
  28. 1 1
      htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
  29. 1 1
      htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php
  30. 1 1
      htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
  31. 1 1
      htdocs/adherents/card.php
  32. 10 12
      htdocs/adherents/class/adherent.class.php
  33. 2 2
      htdocs/adherents/list.php
  34. 1 1
      htdocs/adherents/subscription.php
  35. 1 1
      htdocs/adherents/subscription/list.php
  36. 7 7
      htdocs/adherents/type.php
  37. 32 2
      htdocs/admin/agenda_other.php
  38. 12 3
      htdocs/admin/boxes.php
  39. 2 2
      htdocs/admin/company.php
  40. 3 0
      htdocs/admin/const.php
  41. 27 6
      htdocs/admin/dict.php
  42. 9 7
      htdocs/admin/modules.php
  43. 4 5
      htdocs/admin/multicurrency.php
  44. 3 2
      htdocs/admin/perms.php
  45. 2 2
      htdocs/admin/system/about.php
  46. 2 1
      htdocs/admin/system/browser.php
  47. 10 3
      htdocs/admin/system/database-tables.php
  48. 6 1
      htdocs/admin/system/database.php
  49. 12 1
      htdocs/admin/system/dolibarr.php
  50. 3 0
      htdocs/admin/system/modules.php
  51. 5 3
      htdocs/admin/system/phpinfo.php
  52. 2 2
      htdocs/admin/tools/dolibarr_export.php
  53. 2 2
      htdocs/admin/tools/dolibarr_import.php
  54. 16 2
      htdocs/admin/tools/listevents.php
  55. 4 2
      htdocs/admin/triggers.php
  56. 26 4
      htdocs/api/class/api_access.class.php
  57. 6 4
      htdocs/api/class/api_login.class.php
  58. 10 0
      htdocs/api/index.php
  59. 42 37
      htdocs/bookmarks/card.php
  60. 17 1
      htdocs/bookmarks/class/bookmark.class.php
  61. 4 0
      htdocs/cashdesk/affIndex.php
  62. 14 1
      htdocs/cashdesk/affPied.php
  63. 1 1
      htdocs/cashdesk/css/style.css
  64. 13 1
      htdocs/cashdesk/facturation_verif.php
  65. 12 1
      htdocs/cashdesk/index.php
  66. 7 17
      htdocs/cashdesk/tpl/facturation1.tpl.php
  67. 11 3
      htdocs/cashdesk/tpl/menu.tpl.php
  68. 1 0
      htdocs/cashdesk/tpl/validation1.tpl.php
  69. 12 2
      htdocs/cashdesk/validation_verif.php
  70. 1 1
      htdocs/categories/card.php
  71. 1 1
      htdocs/categories/class/api_categories.class.php
  72. 2 2
      htdocs/categories/class/api_deprecated_category.class.php
  73. 17 2
      htdocs/categories/class/categorie.class.php
  74. 22 19
      htdocs/categories/photos.php
  75. 72 46
      htdocs/categories/traduction.php
  76. 26 19
      htdocs/categories/viewcat.php
  77. 1 1
      htdocs/comm/action/listactions.php
  78. 1 1
      htdocs/comm/action/rapport/index.php
  79. 2 2
      htdocs/comm/address.php
  80. 125 54
      htdocs/comm/card.php
  81. 43 10
      htdocs/comm/mailing/card.php
  82. 2 2
      htdocs/comm/mailing/cibles.php
  83. 20 17
      htdocs/comm/mailing/class/mailing.class.php
  84. 3 2
      htdocs/comm/mailing/list.php
  85. 1 1
      htdocs/comm/multiprix.php
  86. 1 1
      htdocs/comm/propal/card.php
  87. 8 10
      htdocs/comm/propal/class/propal.class.php
  88. 1 1
      htdocs/comm/propal/list.php
  89. 1 1
      htdocs/commande/class/api_deprecated_commande.class.php
  90. 14 15
      htdocs/commande/class/commande.class.php
  91. 1 1
      htdocs/commande/customer.php
  92. 1 0
      htdocs/commande/document.php
  93. 1 1
      htdocs/commande/list.php
  94. 1 1
      htdocs/commande/orderstoinvoice.php
  95. 44 47
      htdocs/commande/stats/index.php
  96. 3 3
      htdocs/compta/bank/annuel.php
  97. 9 8
      htdocs/compta/bank/bankentries.php
  98. 1 1
      htdocs/compta/bank/class/account.class.php
  99. 9 73
      htdocs/compta/bank/document.php
  100. 1 1
      htdocs/compta/bank/index.php

+ 4 - 0
.travis.yml

@@ -51,6 +51,7 @@ env:
 matrix:
   fast_finish: true
   allow_failures:
+  - php: 7.1
   - php: nightly
   # FIXME
   #- env: DB=postgresql
@@ -291,6 +292,9 @@ script:
   php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
   php upgrade2.php 4.0.0 5.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade400500-2.log
   php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
+  php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
+  php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
+  php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
   cd -
   set +e
   echo

+ 25 - 2
ChangeLog

@@ -150,8 +150,31 @@ Dolibarr better:
 - A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters,
   no more required, were also removed. Use this new one if you were using one of them.
 - The trigger that activate or close a contract line is run on a contract line, not on contract.
-
-
+- Method commande->set_availability(user, availability_id) removed from commande class, use method commande->availability(availability_id, notrigger).
+
+Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough
+feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
+
+
+***** ChangeLog for 4.0.4 to 4.0.3 *****
+FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish
+FIX: #6230
+FIX: #6237
+FIX: #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page
+FIX: #6253 Supplier invoice list filter does not respect "thirdparty" filter
+FIX: #6277
+FIX: project list and ajax completion return wrong list.
+FIX: bug margin calculation by user with multicompany
+FIX: Can make a stock transfert on product not on sale/purchase.
+FIX: extrafield input for varchar was not working with special char within (ie double quotes)
+FIX: javascript error
+FIX: link for not found photo when using gravatar. Must use external url.
+FIX: Protection so even if link is output for external user, links is disabled.
+FIX: repair tool was ko to restore extrafields with type select.
+FIX: Security access problem with external users on projects/tasks
+FIX: We must not drop extrafield column if there is still record on other entities.
+FIX: regression with sedning email when introducing security options to restrict nb of email sending.
+t 
 ***** ChangeLog for 4.0.3 to 4.0.2 *****
 FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
 FIX: #5958 no discount on supplier command made by replenishment

+ 6 - 13
README-FR.md

@@ -54,19 +54,10 @@ Pour mettre a jour Dolibarr depuis une vieille version vers celle ci:
 - Ecraser les vieux fichiers dans le vieux repertoire 'dolibarr' par les fichiers
   fournis dans ce nouveau package.
   
-- Si vous venez d'une version x.y.z vers x.y.w (seul le 3eme chiffre varie),
-  il n'y a pas besoin de migration de données.
-  
-- Si vous venez d'une beta ou d'un version x.y.z vers une autre ou les numeros x
-  ou y varient, vous devez appelez la page "install/" de migration dans votre 
-  navigateur (ceci doit se faire automatiquement au premier accès de l'application).
-  Ce sera une URL du genre:
-   http://localhost/dolibarr/htdocs/install/index.php
-  ou
-   http://yourdolibarrhost/install/index.php
+- Au prochain accès, Dolibarr proposera la page de "mise a jour" des données (si necessaire).
+  Si un fichier install.lock existe pour vérouiller le processus de mise à jour, il sera demandé de le supprimer manuellement (vous devriez trouver le fichier install.lock dans le répertoire utilisé pour stocker les documents générés ou transféré sur le serveur. Dans la plupart des cas, c'est le répertoire appelé "documents") 
 
-  Ensuite, choisir l'option de "mise a jour" en rapport avec votre cas.
-  Note: Le processus de migration peut etre lance plusieurs fois sans risque.
+*Note: Le processus de migration peut etre lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
   
 
 ## CE QUI EST NOUVEAU
@@ -86,11 +77,13 @@ Voir fichier ChangeLog.
 - Gestion des factures clients/fournisseurs et paiements
 - Gestion des virements bancaires SEPA
 - Gestion des comptes bancaires
-- Agenda partagé
+- Calendrier/Agenda partagé (avec export ical, vcal) 
 - Suivi des opportunités et/ou projets (suivi de rentabilité incluant les factures, notes de frais, temps consommé valorisé, ...)
 - Gestion de contrats de services
 - Gestion de stock
 - Gestion des expéditions
+- Gestion des demandes de congès
+- Gestion des notes de frais
 - GED (Gestion Electronique de Documents)
 - EMailings de masse
 - Réalisation de sondages

+ 16 - 6
README.md

@@ -26,6 +26,16 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
 
 Releases can be downloaded from [official website](https://www.dolibarr.org/).
 
+### Install from composer
+If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
+
+curl -sS https://getcomposer.org/installer | php
+mv composer.phar /usr/local/bin/composer
+
+On Windows, you'll download and run https://getcomposer.org/Composer-Setup.exe
+
+composer create-project dolibarr/dolibarr erp
+
 ### Simple setup
 
 If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
@@ -60,10 +70,10 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
 ## UPGRADING
 
 - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
-- If you're upgrading from version x.y.z to x.y.w (only third number differs), there is no need to run any migration process.
-- If you're upgrading from a beta version or from any version x.y.z to any other where x or y number differs, you must call the Dolibarr "install/" page in your browser (this should be done automatically at first dolibarr access) and follow the upgrade process.
+- At first next access, Dolibarr will redirect your to the "install/" page to make the upgrade process.
+  If a file install.lock exists to lock any run of upgrade process, the application will ask you to remove the file manually (you should find the install.lock file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "documents").
 
-*Note: migration process can safely be done multiple times.*
+*Note: migration process can safely be done multiple times by calling the page /install/index.php*
 
 ## WHAT'S NEW
 
@@ -80,17 +90,17 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
 - Invoices and payment management
 - Standing orders management (European SEPA)
 - Bank accounts management
-- Shared calendar
+- Shared calendar/agenda (with ical and vcal export for third party tools integration)
 - Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...)
 - Projects management
 - Contracts management
 - Stock management
 - Shipping management
 - Interventions management
-- Agenda with ical and vcal export for third party tools integration
+- Employee's leave requests management
+- Expense report management
 - Electronic Document Management (EDM)
 - Foundations members management
-- Employee's holidays management
 - Mass emailing
 - Surveys
 - Point of Sale

+ 1 - 1
dev/initdemo/initdemo.sh

@@ -174,7 +174,7 @@ then
 	echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
 	cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
 else
-	echo Detection of documents directory $documentdir failed so demo files were not copied. 
+	echo Detection of documents directory from $mydir failed so demo files were not copied. 
 fi
 
 

+ 13 - 0
dev/resources/iso-normes/sample_FEC_file.txt

@@ -0,0 +1,13 @@
+JOURNALCODE	JOURNALLIB	ECRITURENUM	ECRITUREDATE	COMPTENUM	COMPTELIB	COMPAUXNUM	COMPAUXLIB	PIECEREF	PIECEDATE	ECRITURELIB	DEBIT	CREDIT	ECRITURELET	DATELET	VALIDDATE	MONTANTDEVISE	IDEVISE
+Banque	Banque	17293	20170109	401PPRO	PUBLI-PROV			L08	20170109	PPRO domiciliation 1TR	       187,20	         0,00			20170109		
+Banque	Banque	17293	20170109	5121CRA	CR AGRICOLE			L08	20170109	PPRO domiciliation 1TR	         0,00	       187,20			20170109		
+Banque	Banque	17295	20170109	401ORPA	ORANGE PARIS			Report	20170109	ORPA adsl par 12	        96,00	         0,00			20170109		
+Banque	Banque	17295	20170109	5121CRA	CR AGRICOLE			Report	20170109	ORPA adsl par 12	         0,00	        96,00			20170109		
+Banque	Banque	17302	20170105	401ORVI	ORANGE VEBRON INTERNET			Report	20170105	ORVI adsl veb 12	        26,00	         0,00			20170109		
+Banque	Banque	17302	20170105	5121CRA	CR AGRICOLE			Report	20170105	ORVI adsl veb 12	         0,00	        26,00			20170109		
+Fournisseurs	Fournisseurs	17305	20170119	401ZDAV	SANDRA DAVILA			A01	20170119	ZDAV courtage s/ ventes	         0,00	       508,00			20170119		
+Fournisseurs	Fournisseurs	17305	20170119	622200	Courtages s/ ventes			A01	20170119	ZDAV courtage s/ ventes	       508,00	         0,00			20170119		
+Banque	Banque	17306	20170119	5121CRA	CR AGRICOLE			A01	20170119	ZDAV courtage s/ ventes	         0,00	       508,00			20170119		
+Banque	Banque	17306	20170119	401ZDAV	SANDRA DAVILA			A01	20170119	ZDAV courtage s/ ventes	       508,00	         0,00			20170119		
+Banque	Banque	17307	20170119	401ZDAV	SANDRA DAVILA			A01	20170119	ZDAV courtage s/ ventes	       508,00	         0,00			20170131		
+Banque	Banque	17307	20170119	5121CRA	CR AGRICOLE			A01	20170119	ZDAV courtage s/ ventes	         0,00	       508,00			20170131		

+ 1 - 1
dev/skeletons/skeleton_list.php

@@ -247,7 +247,7 @@ $sql.=$db->order($sortfield,$sortorder);
 //$sql.= $db->plimit($conf->liste_limit+1, $offset);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
 	$result = $db->query($sql);

+ 5 - 1
dev/tools/fixaltlanguages.sh

@@ -42,11 +42,15 @@ then
         then
         	aaupper="US"
         fi
+        if [ $aaupper = "EL" ]
+        then
+        	aaupper="GR"
+        fi        
     	bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
     	if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
     	then
     	    reflang="htdocs/langs/"$aa"_"$aaupper
-    	    if [ -d $reflang ]
+    	    if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
     	    then
 		    	echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
     			echo $dirshort is an alternative language of $reflang

+ 2 - 2
dev/tools/test/testdiv.php

@@ -39,8 +39,8 @@
 </tr>
 
 <!-- Password -->
-<tr><td valign="top" class="nowrap"> &nbsp; <strong><label for="password">Mot de passe</label></strong> &nbsp; </td>
-<td valign="top" class="nowrap">
+<tr><td class="tdtop nowrap"> &nbsp; <strong><label for="password">Mot de passe</label></strong> &nbsp; </td>
+<td class="tdtop nowrap">
 <input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="" tabindex="2" />
 </td></tr>
 

+ 14 - 0
dev/translation/erp_comparison_translation.txt

@@ -0,0 +1,14 @@
+
+
+Term Dolibarr		SAP					Odoo							...
+----------------------------------------------------------------------------
+Thirdparty			Contact partner		Partner/Contact (company)
+Contact/address		Contact person		Partner/Contact (individual)
+
+Financial			??					Invoicing
+
+Income / Expense	??					Profit / Loss
+Balance									Net profit
+
+
+

+ 143 - 75
htdocs/accountancy/admin/account.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2013-2016 Olivier Geffroy      <jeff@jeffinfo.com>
- * Copyright (C) 2013-2016 Alexandre Spangaro   <aspangaro.dolibarr@gmail.com>
+ * Copyright (C) 2013-2017 Alexandre Spangaro   <aspangaro@zendsi.com>
  * Copyright (C) 2016      Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -41,6 +41,7 @@ $action = GETPOST('action');
 $cancel = GETPOST('cancel');
 $id = GETPOST('id', 'int');
 $rowid = GETPOST('rowid', 'int');
+
 $search_account = GETPOST("search_account");
 $search_label = GETPOST("search_label");
 $search_accountparent = GETPOST("search_accountparent");
@@ -68,6 +69,15 @@ if (! $sortfield)
 if (! $sortorder)
 	$sortorder = "ASC";
 
+$arrayfields=array(
+    'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
+    'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
+	'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
+    'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0),
+    'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0),
+	'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
+);
+
 $accounting = new AccountingAccount($db);
 
 
@@ -95,6 +105,7 @@ if (empty($reshook))
     	$search_accountparent = "";
     	$search_pcgtype = "";
     	$search_pcgsubtype = "";
+		$search_array_options=array();
     }
     
     if (GETPOST('change_chart'))
@@ -135,6 +146,7 @@ if (empty($reshook))
 /*
  * View
  */
+$form=new Form($db);
 
 llxHeader('', $langs->trans("ListAccounts"));
 
@@ -145,8 +157,6 @@ if ($action == 'delete') {
 
 $pcgver = $conf->global->CHARTOFACCOUNTS;
 
-
-
 $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
 $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
 $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
@@ -154,25 +164,16 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_vers
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON aa.account_parent = a2.rowid";
 $sql .= " WHERE asy.rowid = " . $pcgver;
 
-if (strlen(trim($search_account))) {
-	$sql .= natural_search("aa.account_number", $search_account);
-}
-if (strlen(trim($search_label))) {
-	$sql .= natural_search("aa.label", $search_label);
-}
-if (strlen(trim($search_accountparent))) {
-	$sql .= natural_search("aa.account_parent", $search_accountparent);
-}
-if (strlen(trim($search_pcgtype))) {
-	$sql .= natural_search("aa.pcg_type", $search_pcgtype);
-}
-if (strlen(trim($search_pcgsubtype))) {
-	$sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
-}
+if (strlen(trim($search_account)))			$sql .= natural_search("aa.account_number", $search_account);
+if (strlen(trim($search_label)))			$sql .= natural_search("aa.label", $search_label);
+if (strlen(trim($search_accountparent)))	$sql .= natural_search("aa.account_parent", $search_accountparent);
+if (strlen(trim($search_pcgtype)))			$sql .= natural_search("aa.pcg_type", $search_pcgtype);
+if (strlen(trim($search_pcgsubtype)))		$sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
+
 $sql .= $db->order($sortfield, $sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
 	$resql = $db->query($sql);
@@ -184,18 +185,19 @@ $sql .= $db->plimit($limit + 1, $offset);
 dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
 $resql = $db->query($sql);
 
-if ($resql) {
-    
+if ($resql)
+{
 	$num = $db->num_rows($resql);
-	
+
     $params='';
-	if ($search_account != "") $params.= '&amp;search_account='.urlencode($search_account);
-	if ($search_label != "") $params.= '&amp;search_label='.urlencode($search_label);
-	if ($search_accountparent != "") $params.= '&amp;search_accountparent='.urlencode($search_accountparent);
-	if ($search_pcgtype != "") $params.= '&amp;search_pcgtype='.urlencode($search_pcgtype);
-	if ($search_pcgsubtype != "") $params.= '&amp;search_pcgsubtype='.urlencode($search_pcgsubtype);
-    if ($optioncss != '') $param.='&optioncss='.$optioncss;
-	
+	if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
+	if ($search_account) $params.= '&amp;search_account='.urlencode($search_account);
+	if ($search_label) $params.= '&amp;search_label='.urlencode($search_label);
+	if ($search_accountparent) $params.= '&amp;search_accountparent='.urlencode($search_accountparent);
+	if ($search_pcgtype) $params.= '&amp;search_pcgtype='.urlencode($search_pcgtype);
+	if ($search_pcgsubtype) $params.= '&amp;search_pcgsubtype='.urlencode($search_pcgsubtype);
+    if ($optioncss) $param.='&optioncss='.$optioncss;
+
 	print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy');
 	
 	print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
@@ -207,7 +209,7 @@ if ($resql) {
     $sql = "SELECT rowid, pcg_version, label, active";
     $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
     $sql .= " WHERE active = 1";
-    dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
+    dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
     $resqlchart = $db->query($sql);
     $var = true;
     if ($resqlchart) {
@@ -228,34 +230,53 @@ if ($resql) {
     print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
     print '<br>';    
     print "<br>\n";
+
+	print '</form>';
 	
+	$i = 0;
+    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
+    if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+    print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
+    print '<input type="hidden" name="action" value="list">';
+    print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
+    print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
+
 	print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
 	print '<a class="butAction" href="./categories.php">' . $langs->trans("ApplyMassCategories") . '</a>';
 	// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
 	// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
 	print '<br><br>';
 	
-	print '<table class="noborder" width="100%">';
-	print '<tr class="liste_titre">';
-	print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $params, "", $sortfield, $sortorder);
-	print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $params, "", $sortfield, $sortorder);
-	print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $params, "", $sortfield, $sortorder);
-	print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $params, "", $sortfield, $sortorder);
-	print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $params, "", $sortfield, $sortorder);
-	print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $params, "", $sortfield, $sortorder);
-	print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $params, "", 'width="60" align="center"', $sortfield, $sortorder);
-	print '</tr>';
+	$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
+    $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);	// This also change content of $arrayfields
 	
+    print '<div class="div-table-responsive">';
+    print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
+
 	print '<tr class="liste_titre">';
-	print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
-	print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
-	print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="' . $search_accountparent . '"></td>';
-	print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
-	print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
-	print '<td class="liste_titre">&nbsp;</td>';
+
+	if (! empty($arrayfields['aa.account_number']['checked']))	print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
+	if (! empty($arrayfields['aa.label']['checked']))			print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
+	if (! empty($arrayfields['aa.account_parent']['checked']))	print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
+	if (! empty($arrayfields['aa.pcg_type']['checked']))		print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder);
+	if (! empty($arrayfields['aa.pcg_subtype']['checked']))		print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder);
+	if (! empty($arrayfields['aa.active']['checked']))			print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
+
+	print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
+	print "</tr>\n";
+
+	// Line for search fields
+	print '<tr class="liste_titre">';
+	if (! empty($arrayfields['aa.account_number']['checked']))	print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
+	if (! empty($arrayfields['aa.label']['checked']))			print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
+	if (! empty($arrayfields['aa.account_parent']['checked']))	print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="' . $search_accountparent . '"></td>';
+	if (! empty($arrayfields['aa.pcg_type']['checked']))		print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
+	if (! empty($arrayfields['aa.pcg_subtype']['checked']))		print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
+	if (! empty($arrayfields['aa.active']['checked']))			print '<td class="liste_titre">&nbsp;</td>';
 	print '<td align="right" colspan="2" class="liste_titre">';
-	$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
-	print $searchpitco;
+	$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
+	print $searchpicto;
 	print '</td>';
 	print '</tr>';
 	
@@ -263,8 +284,7 @@ if ($resql) {
 	
 	$accountstatic = new AccountingAccount($db);
 	$accountparent = new AccountingAccount($db);
-	
-	$i = 0;
+
 	while ( $i < min($num, $limit) ) 
 	{
 		$obj = $db->fetch_object($resql);
@@ -274,35 +294,81 @@ if ($resql) {
 		$accountstatic->account_number = $obj->account_number;
 		
 		print '<tr ' . $bc[$var] . '>';
-		print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
-		print '<td>' . $obj->label . '</td>';
-
-		if (! empty($obj->account_parent))
-        {
-			$accountparent->id = $obj->rowid2;
-			$accountparent->label = $obj->label2;
-			$accountparent->account_number = $obj->account_number2;
-		
-			print '<td>' . $accountparent->getNomUrl(1) . '</td>';
+
+		// Account number
+		if (! empty($arrayfields['aa.account_number']['checked']))
+		{
+			print "<td>";
+			print $accountstatic->getNomUrl(1);
+			print "</td>\n";
+			if (! $i) $totalarray['nbfield']++;
 		}
-		else
+
+		// Account label
+		if (! empty($arrayfields['aa.label']['checked']))
 		{
-			print '<td>&nbsp;</td>';
+			print "<td>";
+			print $obj->label;
+			print "</td>\n";
+			if (! $i) $totalarray['nbfield']++;
 		}
-		print '<td>' . $obj->pcg_type . '</td>';
-		print '<td>' . $obj->pcg_subtype . '</td>';
-		print '<td>';
-		if (empty($obj->active)) {
-			print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=enable">';
-			print img_picto($langs->trans("Disabled"), 'switch_off');
-			print '</a>';
-		} else {
-			print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=disable">';
-			print img_picto($langs->trans("Activated"), 'switch_on');
-			print '</a>';
+
+		// Account parent
+		if (! empty($arrayfields['aa.account_parent']['checked']))
+		{
+			if (! empty($obj->account_parent))
+			{
+				$accountparent->id = $obj->rowid2;
+				$accountparent->label = $obj->label2;
+				$accountparent->account_number = $obj->account_number2;
+			
+				print "<td>";
+				print $accountparent->getNomUrl(1);
+				print "</td>\n";
+				if (! $i) $totalarray['nbfield']++;
+			}
+			else
+			{
+				print '<td>&nbsp;</td>';
+				if (! $i) $totalarray['nbfield']++;
+			}
 		}
-		print '</td>';
-		
+
+		// Chart of accounts type
+		if (! empty($arrayfields['aa.pcg_type']['checked']))
+		{
+			print "<td>";
+			print $obj->pcg_type;
+			print "</td>\n";
+			if (! $i) $totalarray['nbfield']++;
+		}
+
+		// Chart of accounts subtype
+		if (! empty($arrayfields['aa.pcg_subtype']['checked']))
+		{
+			print "<td>";
+			print $obj->pcg_subtype;
+			print "</td>\n";
+			if (! $i) $totalarray['nbfield']++;
+		}
+
+		// Activated or not
+		if (! empty($arrayfields['aa.active']['checked']))
+		{
+			print '<td>';
+			if (empty($obj->active)) {
+				print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=enable">';
+				print img_picto($langs->trans("Disabled"), 'switch_off');
+				print '</a>';
+			} else {
+				print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=disable">';
+				print img_picto($langs->trans("Activated"), 'switch_on');
+				print '</a>';
+			}
+			print '</td>';
+			if (! $i) $totalarray['nbfield']++;
+		}
+
 		// Action
 		print '<td align="center">';
 		if ($user->admin) {
@@ -315,6 +381,7 @@ if ($resql) {
 			print '</a>';
 		}
 		print '</td>' . "\n";
+		if (! $i) $totalarray['nbfield']++;
 		
 		print "</tr>\n";
 		$var = ! $var;
@@ -322,6 +389,7 @@ if ($resql) {
 	}
 	
 	print "</table>";
+	print "</div>";
 	print '</form>';
 } else {
 	dol_print_error($db);

+ 41 - 41
htdocs/accountancy/admin/categories.php

@@ -1,5 +1,6 @@
 <?php
-/* Copyright (C) 2016	   Jamal Elbaz		<jamelbaz@gmail.pro>
+/* Copyright (C) 2016		Jamal Elbaz			<jamelbaz@gmail.pro>
+ * Copyright (C) 2017		Alexandre Spangaro	<aspangaro@zendsi.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,24 +17,24 @@
  */
 
 /**
- * \file htdocs/accountancy/admin/categories.php
+ * \file	htdocs/accountancy/admin/categories.php
  * \ingroup Advanced accountancy
- * \brief Page to assign mass categories to accounts
+ * \brief	Page to assign mass categories to accounts
  */
 require '../../main.inc.php';
-
-// Class
 require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
 require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
 
 $error = 0;
 
-// Langs
 $langs->load("bills");
 $langs->load("accountancy");
 
 $mesg = '';
+$id = GETPOST('id', 'int');
+$rowid = GETPOST('rowid', 'int');
+$cancel = GETPOST('cancel');
 $action = GETPOST('action');
 $cat_id = GETPOST('account_category');
 $selectcpt = GETPOST('cpt_bk', 'array');
@@ -43,36 +44,31 @@ if ($cat_id == 0) {
 	$cat_id = null;
 }
 
-$id = GETPOST('id', 'int');
-$rowid = GETPOST('rowid', 'int');
-$cancel = GETPOST('cancel');
-
 // Security check
-if (! $user->admin)
-	accessforbidden();
+if (! $user->admin) accessforbidden();
 
-$AccCat = new AccountancyCategory($db);
+$accountingcategory = new AccountancyCategory($db);
 
 // si ajout de comptes
 if (! empty($selectcpt)) {
 	$cpts = array ();
-	foreach ( $selectcpt as $selectedOption ) {
-		if (! array_key_exists($selectedOption, $cpts))
-			$cpts[$selectedOption] = "'" . $selectedOption . "'";
+	foreach ( $selectcpt as $selectedoption ) {
+		if (! array_key_exists($selectedoption, $cpts))
+			$cpts[$selectedoption] = "'" . $selectedoption . "'";
 	}
 
-	$return= $AccCat->updateAccAcc($cat_id, $cpts);
+	$return= $accountingcategory->updateAccAcc($cat_id, $cpts);
 
 	if ($return<0) {
-		setEventMessages($langs->trans('errors'), $AccCat->errors, 'errors');
+		setEventMessages($langs->trans('errors'), $accountingcategory->errors, 'errors');
 	} else {
 		setEventMessages($langs->trans('Saved'), null, 'mesgs');
 	}
 }
 if ($action == 'delete') {
 	if ($cpt_id) {
-		if ($AccCat->deleteCptCat($cpt_id)) {
-			setEventMessages($langs->trans('Deleted'), null, 'mesgs');
+		if ($accountingcategory->deleteCptCat($cpt_id)) {
+			setEventMessages($langs->trans('CategoryDeleted'), null, 'mesgs');
 		} else {
 			setEventMessages($langs->trans('errors'), null, 'errors');
 		}
@@ -83,12 +79,11 @@ if ($action == 'delete') {
 /*
  * View
  */
+$form = new Form($db);
+$formaccounting = new FormAccounting($db);
 
 llxheader('', $langs->trans('AccountAccounting'));
 
-$formaccounting = new FormAccounting($db);
-$form = new Form($db);
-
 print load_fiche_titre($langs->trans('Categories'));
 
 print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
@@ -102,22 +97,23 @@ print '<table class="border" width="100%">';
 print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
 print '<td>';
 $formaccounting->select_accounting_category($cat_id, 'account_category', 1);
-print '<input class="button" type="submit" value="' . $langs->trans("Display") . '">';
+print '<input class="button" type="submit" value="' . $langs->trans("Show") . '">';
 print '</td></tr>';
 
 if (! empty($cat_id)) {
-	$return = $AccCat->getCptBK($cat_id);
+	$return = $accountingcategory->getCptBK($cat_id);
 	if ($return < 0) {
-		setEventMessages(null, $AccCat->errors, 'errors');
+		setEventMessages(null, $accountingcategory->errors, 'errors');
 	}
-	print '<tr><td>' . $langs->trans("AddCompteFromBK") . '</td>';
+	print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
 	print '<td>';
-	if (is_array($AccCat->lines_cptbk) && count($AccCat->lines_cptbk) > 0) {
+	if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
 		print '<select size="' . count($obj) . '" name="cpt_bk[]" multiple>';
-		foreach ( $AccCat->lines_cptbk as $cpt ) {
+		foreach ( $accountingcategory->lines_cptbk as $cpt ) {
 			print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
 		}
-		print '</select> - <input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("add") . '"> ';
+		print '</select>';
+		print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
 	}
 	print '</td></tr>';
 }
@@ -131,26 +127,30 @@ print '</form>';
 
 if ($action == 'display' || $action == 'delete') {
 
-	print '<table class="noborder" width="100%">';
-
-	print '<tr class="liste_titre"><th class="liste_titre">' . $langs->trans("Numerocompte") . '</th><th class="liste_titre">' . $langs->trans("Description") . '</th><th class="liste_titre" width="60" align="center">Action</th></tr>';
+    print "<table class='noborder' width='100%'>\n";
+    print '<tr class="liste_titre">';
+	print '<td>'.$langs->trans("AccountAccounting")."</td>";
+	print '<td colspan="2">'.$langs->trans("Label")."</td>";
+	print "</tr>\n";
 
 	if (! empty($cat_id)) {
-		$return = $AccCat->display($cat_id);
+		$return = $accountingcategory->display($cat_id);
 		if ($return < 0) {
-			setEventMessages(null, $AccCat->errors, 'errors');
+			setEventMessages(null, $accountingcategory->errors, 'errors');
 		}
-		$j = 1;
-		if (is_array($AccCat->lines_display) && count($AccCat->lines_display) > 0) {
-			foreach ( $AccCat->lines_display as $cpt ) {
+
+		if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) {
+			foreach ( $accountingcategory->lines_display as $cpt ) {
 				$var = ! $var;
 				print '<tr' . $bc[$var] . '>';
 				print '<td>' . length_accountg($cpt->account_number) . '</td>';
 				print '<td>' . $cpt->label . '</td>';
-				print $form->formconfirm($_SERVER["PHP_SELF"] . "?account_category=$cat_id&cptid=" . $cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete" . $j);
-				print '<td><input class="button" type="button" id="action-delete' . $j . '" value="' . $langs->trans("Delete") . '"></td>';
+				print '<td align="right">';
+				print "<a href= '".$_SERVER['PHP_SELF']."?action=delete&account_category=" . $cat_id . "&cptid=" . $cpt->rowid."'>";
+				print img_delete($langs->trans("DeleteFromCat")).' ';
+				print $langs->trans("DeleteFromCat")."</a>";
+				print "</td>";
 				print "</tr>\n";
-				$j ++;
 			}
 		}
 	}

+ 1 - 1
htdocs/accountancy/admin/fiscalyear.php

@@ -90,7 +90,7 @@ $sql .= " WHERE f.entity = " . $conf->entity;
 $sql.=$db->order($sortfield,$sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
 	$result = $db->query($sql);

+ 1 - 1
htdocs/accountancy/admin/fiscalyear_card.php

@@ -268,7 +268,7 @@ if ($action == 'create')
 			print '</td></tr>';
 
 			// Label
-			print '<tr><td valign="top">';
+			print '<tr><td class="tdtop">';
 			print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
 			print '</td><td colspan="2">';
 			print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');

+ 1 - 1
htdocs/accountancy/admin/productaccount.php

@@ -248,7 +248,7 @@ if (strlen(trim($search_desc))) {
 }
 $sql .= $db->order($sortfield, $sortorder);
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

+ 1 - 1
htdocs/accountancy/bookkeeping/balance.php

@@ -143,7 +143,7 @@ else {
     
     // List
 
-    $nbtotalofrecords = -1;
+    $nbtotalofrecords = '';
     if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
         $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
         if ($nbtotalofrecords < 0) {

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

@@ -293,7 +293,7 @@ llxHeader('', $title_page);
 
 // List
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
 	$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
 	if ($nbtotalofrecords < 0) {

+ 1 - 1
htdocs/accountancy/bookkeeping/listbyaccount.php

@@ -162,7 +162,7 @@ llxHeader('', $title_page);
 
 // List
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
 	$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
 	if ($nbtotalofrecords < 0) {

+ 1 - 1
htdocs/accountancy/bookkeeping/listbyyear.php

@@ -158,7 +158,7 @@ if (! empty($search_code_journal)) {
  * Mode List
  */
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
 	$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0);
 	if ($nbtotalofrecords < 0) {

+ 4 - 5
htdocs/accountancy/class/accountancycategory.class.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2016		Jamal Elbaz			<jamelbaz@gmail.pro>
- * Copyright (C) 2016 		Alexandre Spangaro	<aspangaro.dolibarr@gmail.com>
+ * Copyright (C) 2016-2017	Alexandre Spangaro	<aspangaro@zendsi.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,9 +17,9 @@
  */
 
 /**
- * \file htdocs/accountancy/class/accountancycategory.class.php
+ * \file	htdocs/accountancy/class/accountancycategory.class.php
  * \ingroup Advanced accountancy
- * \brief File of class to manage categories of an accounting category_type
+ * \brief	File of class to manage categories of an accounting category_type
  */
 
 // Class
@@ -72,7 +72,6 @@ class AccountancyCategory
 					$this->lines_display[] = $obj;
 				}
 			}
-
 			return $num;
 		} else {
 			$this->error = "Error " . $this->db->lasterror();
@@ -84,7 +83,7 @@ class AccountancyCategory
 	}
 
 	/**
-	 * Function to select accountiing category of an accounting account present in chart of accounts
+	 * Function to select accounting category of an accounting account present in chart of accounts
 	 *
 	 * @param int $id Id category
 	 *

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

@@ -200,7 +200,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")";    // We don't sha
 $sql .= $db->order($sortfield, $sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

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

@@ -220,7 +220,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")";    // We don't sha
 $sql .= $db->order($sortfield, $sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

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

@@ -178,7 +178,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")";  // We don'
 $sql .= $db->order($sortfield, $sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

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

@@ -208,7 +208,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")";  // We don'
 $sql .= $db->order($sortfield, $sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

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

@@ -86,14 +86,14 @@ $idpays = $p[0];
 
 $sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
 $sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation,";
-$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_code,";
+$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
 $sql .= " f.accountancy_code, ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
 $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
 $sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_valid";
+$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
 $sql .= " WHERE er.fk_statut > 0 ";
 $sql .= " AND erd.fk_code_ventilation > 0 ";
 $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")";  // We don't share object for accountancy

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

@@ -182,7 +182,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")";  // We don't
 $sql .= $db->order($sortfield, $sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

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

@@ -217,7 +217,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")";  // We don't
 $sql .= $db->order($sortfield, $sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

+ 1 - 1
htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php

@@ -108,7 +108,7 @@ echo $this->control->tpl['ajax_selectcountry']; ?>
 </tr>
 
 <tr>
-	<td valign="top"><?php echo $langs->trans("Note"); ?></td>
+	<td class="tdtop"><?php echo $langs->trans("Note"); ?></td>
 	<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
 </tr>
 

+ 1 - 1
htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php

@@ -117,7 +117,7 @@ echo $this->control->tpl['ajax_selectcountry'];
 </tr>
 
 <tr>
-	<td valign="top"><?php echo $langs->trans("Note"); ?></td>
+	<td class="tdtop"><?php echo $langs->trans("Note"); ?></td>
 	<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
 </tr>
 

+ 1 - 1
htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php

@@ -102,7 +102,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
 </tr>
 
 <tr>
-	<td valign="top"><?php echo $langs->trans("Note"); ?></td>
+	<td class="tdtop"><?php echo $langs->trans("Note"); ?></td>
 	<td colspan="3"><?php echo $this->control->tpl['note']; ?></td>
 </tr>
 

+ 1 - 1
htdocs/adherents/card.php

@@ -873,7 +873,7 @@ else
 		}
 
 		// Address
-		print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
+		print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
 		print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOST('address','alpha')?GETPOST('address','alpha'):$object->address).'</textarea>';
 		print '</td></tr>';
 

+ 10 - 12
htdocs/adherents/class/adherent.class.php

@@ -1818,18 +1818,16 @@ class Adherent extends CommonObject
     
         $langs->load("orders");
     
-        // Positionne le modele sur le nom du modele a utiliser
-        if (! dol_strlen($modele))
-        {
-            if (! empty($conf->global->ADHERENT_ADDON_PDF))
-            {
-                $modele = $conf->global->ADHERENT_ADDON_PDF;
-            }
-            else
-            {
-                $modele = 'standard';
-            }
-        }
+	    if (! dol_strlen($modele)) {
+
+		    $modele = 'standard';
+
+		    if ($this->modelpdf) {
+			    $modele = $this->modelpdf;
+		    } elseif (! empty($conf->global->ADHERENT_ADDON_PDF)) {
+			    $modele = $conf->global->ADHERENT_ADDON_PDF;
+		    }
+	    }
     
         $modelpath = "core/modules/member/doc/";
     

+ 2 - 2
htdocs/adherents/list.php

@@ -250,7 +250,7 @@ $sql.=$hookmanager->resPrint;
 $sql.= $db->order($sortfield,$sortorder);
 
 // Count total nb of records with no order and no limits
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
 	$resql = $db->query($sql);
@@ -375,7 +375,7 @@ if (! empty($moreforfilter))
 $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
 $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);	// This also change content of $arrayfields
 
-print '<div class="div-table-responsive">';
+print '<div class="div-table-responsive-no-min">';
 print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
 print '<tr class="liste_titre">';
 if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))

+ 1 - 1
htdocs/adherents/subscription.php

@@ -1039,7 +1039,7 @@ if ($rowid > 0)
                 //print '<tr><td colspan="2"><b>'.$langs->trans("Payment").'</b></td></tr>';
 
                 // No more action
-                print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('MoreActions');
+                print '<tr><td class="tdtop fieldrequired">'.$langs->trans('MoreActions');
                 print '</td>';
                 print '<td>';
                 print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice)?' checked':'').'> '.$langs->trans("None").'<br>';

+ 1 - 1
htdocs/adherents/subscription/list.php

@@ -110,7 +110,7 @@ if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account;
 if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1);
 $sql.= $db->order($sortfield,$sortorder);
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

+ 7 - 7
htdocs/adherents/type.php

@@ -251,10 +251,10 @@ if ($action == 'create')
 	print $form->selectyesno("vote",0,1);
 	print '</td></tr>';
 
-	print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
+	print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
 	print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
 
-	print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
+	print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
 	require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
 	$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
 	$doleditor->Create();
@@ -314,10 +314,10 @@ if ($rowid > 0)
 		print yn($object->vote);
 		print '</tr>';
 
-		print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
+		print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
 		print nl2br($object->note)."</td></tr>";
 
-		print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
+		print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
 		print nl2br($object->mail_valid)."</td></tr>";
 
 		// Other attributes
@@ -407,7 +407,7 @@ if ($rowid > 0)
 		    $sql.=" AND datefin < '".$db->idate($now)."'";
 		}
 		// Count total nb of records
-		$nbtotalofrecords = -1;
+		$nbtotalofrecords = '';
 		if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 		{
 			$resql = $db->query($sql);
@@ -647,10 +647,10 @@ if ($rowid > 0)
 		print $form->selectyesno("vote",$object->vote,1);
 		print '</td></tr>';
 
-		print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
+		print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
 		print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
 
-		print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
+		print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
 		require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
 		$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
 		$doleditor->Create();

+ 32 - 2
htdocs/admin/agenda_other.php

@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2008-2016	Laurent Destailleur     <eldy@users.sourceforge.net>
  * Copyright (C) 2011		Regis Houssin           <regis.houssin@capnetworks.com>
- * Copyright (C) 2011-2013  Juanjo Menent           <jmenent@2byte.es>
+ * Copyright (C) 2011-2017  Juanjo Menent           <jmenent@2byte.es>
  * Copyright (C) 2015		Jean-François Ferry	    <jfefe@aternatik.fr>
  * Copyright (C) 2016		Charlie Benke		    <charlie@patas-monkey.com>
  *
@@ -407,6 +407,37 @@ $tmplist=array('show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->tran
 print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
 print '</td></tr>'."\n";
 
+// AGENDA NOTIFICATION
+if ($conf->global->MAIN_FEATURES_LEVEL > 0)
+{
+    $var=!$var;
+    print '<tr '.$bc[$var].'>'."\n";
+    print '<td>'.$langs->trans('AGENDA_NOTIFICATION').'</td>'."\n";
+    print '<td align="center">&nbsp;</td>'."\n";
+    print '<td align="right">'."\n";
+    
+    if (empty($conf->global->AGENDA_NOTIFICATION)) {
+        print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
+        print '</td></tr>'."\n";
+    } else {
+        print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
+        print '</td></tr>'."\n";
+    	$var=!$var;
+        print '<tr '.$bc[$var].'>'."\n";
+        print '<td>'.$langs->trans('AGENDA_NOTIFICATION_SOUND').'</td>'."\n";
+        print '<td align="center">&nbsp;</td>'."\n";
+        print '<td align="right">'."\n";
+    
+        if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) {
+            print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
+        } else {
+            print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
+        }
+    
+        print '</td></tr>'."\n";
+    }
+}
+
 print '</table>';
 
 dol_fiche_end();
@@ -415,7 +446,6 @@ print '<div class="center"><input class="button" type="submit" name="save" value
 
 print '</form>';
 
-
 print "<br>";
 
 llxFooter();

+ 12 - 3
htdocs/admin/boxes.php

@@ -329,7 +329,10 @@ print load_fiche_titre($langs->trans("BoxesAvailable"));
 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
 print '<input type="hidden" name="action" value="add">'."\n";
-print '<table class="noborder" width="100%">'."\n";
+
+print '<div class="div-table-responsive-no-min">';
+print '<table class="tagtable liste centpercent">'."\n";
+
 print '<tr class="liste_titre">';
 print '<td width="300">'.$langs->trans("Box").'</td>';
 print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
@@ -375,6 +378,8 @@ foreach($boxtoadd as $box)
 }
 
 print '</table>'."\n";
+print '</div>';
+
 print '<div class="right">';
 print '<input type="submit" class="button"'.(count($boxtoadd)?'':' disabled').' value="'.$langs->trans("Activate").'">';
 print '</div>'."\n";
@@ -388,7 +393,9 @@ $boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
 print "<br>\n\n";
 print load_fiche_titre($langs->trans("BoxesActivated"));
 
-print '<table class="noborder" width="100%">';
+print '<div class="div-table-responsive-no-min">';
+print '<table class="tagtable liste">'."\n";
+
 print '<tr class="liste_titre">';
 print '<td width="300">'.$langs->trans("Box").'</td>';
 print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
@@ -441,7 +448,9 @@ foreach($boxactivated as $key => $box)
 	print '</tr>'."\n";
 }
 
-print '</table><br>';
+print '</table>';
+print '</div>';
+print '<br>';
 
 
 // Other parameters

+ 2 - 2
htdocs/admin/company.php

@@ -786,7 +786,7 @@ else
 	print '</td></tr>';
 
 	$var=!$var;
-	print '<tr '.$bc[$var].'><td valign="top">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '</td></tr>';
+	print '<tr '.$bc[$var].'><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '</td></tr>';
 
 	print '</table>';
 
@@ -952,7 +952,7 @@ else
 	print '</tr>';
 	
 	$var=!$var;
-	print '<tr '.$bc[$var].'><td valign="top">'.$langs->trans("CompanyObject").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '</td></tr>';
+	print '<tr '.$bc[$var].'><td class="tdtop">'.$langs->trans("CompanyObject").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '</td></tr>';
 
 	print '</table>';
 	print '</form>';

+ 3 - 0
htdocs/admin/const.php

@@ -182,6 +182,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<input type="hidden" id="action" name="action" value="">';
 
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Name").'</td>';
@@ -297,6 +298,7 @@ if ($result)
 
 
 print '</table>';
+print '</div>';
 
 if ($conf->use_javascript_ajax)
 {
@@ -311,6 +313,7 @@ if ($conf->use_javascript_ajax)
 
 print "</form>\n";
 
+
 llxFooter();
 
 $db->close();

+ 27 - 6
htdocs/admin/dict.php

@@ -188,7 +188,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
 $tabsql[22]= "SELECT rowid   as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
 $tabsql[23]= "SELECT t.rowid as rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
 $tabsql[24]= "SELECT rowid   as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
-$tabsql[25]= "SELECT rowid   as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
+$tabsql[25]= "SELECT rowid   as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
 $tabsql[26]= "SELECT rowid   as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
 $tabsql[27]= "SELECT id      as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
 $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
@@ -262,7 +262,7 @@ $tabfield[21]= "code,label";
 $tabfield[22]= "code,label";
 $tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
 $tabfield[24]= "code,label";
-$tabfield[25]= "label,type_template,private,position,topic,content";
+$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
 $tabfield[26]= "code,label,short_label";
 $tabfield[27]= "code,libelle";
 $tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
@@ -299,7 +299,7 @@ $tabfieldvalue[21]= "code,label";
 $tabfieldvalue[22]= "code,label";
 $tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
 $tabfieldvalue[24]= "code,label";
-$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
+$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
 $tabfieldvalue[26]= "code,label,short_label";
 $tabfieldvalue[27]= "code,libelle";
 $tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
@@ -336,7 +336,7 @@ $tabfieldinsert[21]= "code,label";
 $tabfieldinsert[22]= "code,label";
 $tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
 $tabfieldinsert[24]= "code,label";
-$tabfieldinsert[25]= "label,type_template,private,position,topic,content,entity";
+$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
 $tabfieldinsert[26]= "code,label,short_label";
 $tabfieldinsert[27]= "code,libelle";
 $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
@@ -449,7 +449,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
 $tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
 $tabhelp[23] = array();
 $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
-$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
+$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
 $tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
 $tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
 $tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
@@ -557,6 +557,7 @@ if ($id == 25)
 	if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
 	if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
 	if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
+	if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
 
 	$parameters=array('elementList'=>$elementList);
 	$reshook=$hookmanager->executeHooks('emailElementlist',$parameters);    // Note that $action and $object may have been modified by some hooks
@@ -1062,6 +1063,7 @@ if ($id)
 			if ($fieldlist[$field]=='custom_x')        { $valuetoshow=$langs->trans("CustomX"); }
 			if ($fieldlist[$field]=='custom_y')        { $valuetoshow=$langs->trans("CustomY"); }
 			if ($fieldlist[$field]=='content')         { $valuetoshow=$langs->trans("Content"); }
+			if ($fieldlist[$field]=='content_lines')   { $valuetoshow=$langs->trans("ContentLines"); }
 			if ($fieldlist[$field]=='percent')         { $valuetoshow=$langs->trans("Percentage"); }
 			if ($fieldlist[$field]=='affect')          { $valuetoshow=$langs->trans("Info"); }
 			if ($fieldlist[$field]=='delay')           { $valuetoshow=$langs->trans("NoticePeriod"); }
@@ -1253,6 +1255,7 @@ if ($id)
 			if ($fieldlist[$field]=='custom_x')        { $valuetoshow=$langs->trans("CustomX"); }
 			if ($fieldlist[$field]=='custom_y')        { $valuetoshow=$langs->trans("CustomY"); }
 			if ($fieldlist[$field]=='content')         { $valuetoshow=$langs->trans("Content"); }
+			if ($fieldlist[$field]=='content_lines')   { $valuetoshow=$langs->trans("ContentLines"); }
 			if ($fieldlist[$field]=='percent')         { $valuetoshow=$langs->trans("Percentage"); }
 			if ($fieldlist[$field]=='affect')          { $valuetoshow=$langs->trans("Info"); }
 			if ($fieldlist[$field]=='delay')           { $valuetoshow=$langs->trans("NoticePeriod"); }
@@ -1770,6 +1773,24 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
 		elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
 			print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
 		}
+		elseif (in_array($fieldlist[$field], array('content_lines')))
+		{
+			if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
+			{
+				print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">';		// To create an artificial CR for the current tr we are on
+			}
+			else print '<td>';
+			if ($context != 'hide')
+			{
+				//print '<input type="text" size="100" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
+				$okforextended=true;
+				if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
+				$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 100, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_1, '90%');
+				print $doleditor->Create(1);
+			}
+			else print '&nbsp;';
+			print '</td>';
+		}
 		elseif (in_array($fieldlist[$field], array('content')))
 		{
 			if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
@@ -1782,7 +1803,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
 				//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
 				$okforextended=true;
 				if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
-				$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
+				$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_8, '90%');
 				print $doleditor->Create(1);
 			}
 			else print '&nbsp;';

+ 9 - 7
htdocs/admin/modules.php

@@ -203,7 +203,7 @@ foreach ($modulesdir as $dir)
 		    					    }
 		    					    ksort($arrayofnatures);
 		    					}
-		    					
+
 		    					// Define array $categ with categ with at least one qualified module
 		    					if ($modulequalified > 0)
 		    					{
@@ -319,7 +319,7 @@ if ($mode != 'marketplace')
     $moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
     $moreforfilter.= '</div>';
     $moreforfilter.='<div class="divsearchfield">';
-    $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1);
+    $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
     $moreforfilter.= '</div>';
     if (! empty($conf->global->MAIN_FEATURES_LEVEL))
     {
@@ -398,7 +398,7 @@ if ($mode != 'marketplace')
         if ($search_keyword)
         {
             $qualified=0;
-            if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) 
+            if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
                 || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
                 || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
                 || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
@@ -417,7 +417,7 @@ if ($mode != 'marketplace')
             {
                 //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
                 $publisher=dol_escape_htmltag($objMod->getPublisher());
-                if ($reg[1] && $reg[1] != $publisher) continue;
+                if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue;
                 if (! $reg[1] && ! empty($publisher)) continue;
             }
             if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue;
@@ -485,22 +485,23 @@ if ($mode != 'marketplace')
         print '</td>';
 
         // Name
-        print '<td valign="top">'.$objMod->getName();
+        print '<td class="tdtop">'.$objMod->getName();
         print "</td>\n";
 
         // Desc
-        print '<td valign="top">';
+        print '<td class="tdtop">';
         print nl2br($objMod->getDesc());
         print "</td>\n";
 
         // Help
         print '<td align="center" valign="top" class="nowrap" style="width: 82px;">';
         $text='';
+
         if ($objMod->getDescLong()) $text.='<div class="titre">'.$objMod->getDesc().'</div><br>'.$objMod->getDescLong().'<br>';
         else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
 
         $textexternal='';
-	$imginfo="info";
+        $imginfo="info";
         if ($objMod->isCoreOrExternalModule() == 'external')
         {
  	    $imginfo="info_black";
@@ -647,6 +648,7 @@ if ($mode != 'marketplace')
         $text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
         $text.=$langs->trans("DetectionNotPossible");
 
+
         print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20');
 
         print '</td>';

+ 4 - 5
htdocs/admin/multicurrency.php

@@ -183,20 +183,19 @@ print '<td>'.$langs->trans("Parameters").'</td>'."\n";
 print '<td align="center" width="20">&nbsp;</td>';
 print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
 
-/* TODO uncomment when the functionality will integrated
 $var=!$var;
 print '<tr '.$bc[$var].'>';
-print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnInvoiceDate").'</td>';
+print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnDocumentDate").'</td>';
 print '<td align="center" width="20">&nbsp;</td>';
 print '<td align="right" width="400">';
 print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
-print '<input type="hidden" name="action" value="set_MULTICURRENCY_USE_RATE_ON_INVOICE_DATE">';
-print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_INVOICE_DATE",$conf->global->MULTICURRENCY_USE_RATE_ON_INVOICE_DATE,1);
+print '<input type="hidden" name="action" value="set_MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE">';
+print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE",$conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE,1);
 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
 print '</form>';
 print '</td></tr>';
-*/
+
 
 $var=!$var;
 print '<tr '.$bc[$var].'>';

+ 3 - 2
htdocs/admin/perms.php

@@ -124,7 +124,7 @@ dol_fiche_head($head, 'default', $langs->trans("Security"));
 // Show warning about external users
 print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
 
-
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 
 // Affiche lignes des permissions
@@ -215,8 +215,9 @@ if ($result)
 }
 
 print '</table>';
-
 print '</div>';
 
+dol_fiche_end();
+
 llxFooter();
 $db->close();

+ 2 - 2
htdocs/admin/system/about.php

@@ -86,12 +86,12 @@ if ($sfurl)
     	}
     	print ')';
     }
-	print ' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
 }
 else
 {
-    print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
+    print ' ('.$langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b>)<br>';
 }
+print ' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
 
 
 print '</ul>';

+ 2 - 1
htdocs/admin/system/browser.php

@@ -48,6 +48,7 @@ $tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
 
 // Browser
 $var=true;
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
 $var=!$var;
@@ -71,10 +72,10 @@ print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("Screen").'</td><td col
 print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
 print '</td></tr>'."\n";
 print '</table>';
+print '</div>';
 print '<br>';
 
 
-
 llxFooter();
 
 $db->close();

+ 10 - 3
htdocs/admin/system/database-tables.php

@@ -81,7 +81,8 @@ else
 {
 	if ($base == 1)
 	{
-		print '<table class="noborder">';
+        print '<div class="div-table-responsive-no-min">';
+	    print '<table class="noborder">';
 		print '<tr class="liste_titre">';
 		print '<td>'.$langs->trans("TableName").'</td>';
 		print '<td colspan="2">'.$langs->trans("Type").'</td>';
@@ -134,11 +135,13 @@ else
 			}
 		}
 		print '</table>';
+		print '</div>';
 	}
 
 	if ($base == 2)
 	{
-		print '<table class="noborder">';
+        print '<div class="div-table-responsive-no-min">';
+	    print '<table class="noborder">';
 		print '<tr class="liste_titre">';
 		print '<td>'.$langs->trans("TableName").'</td>';
 		print '<td>Nb of tuples</td>';
@@ -173,12 +176,14 @@ else
 			}
 		}
 		print '</table>';
+		print '</div>';
 	}
 
 	if ($base == 4)
 	{
 		// Sqlite by PDO or by Sqlite3
-		print '<table class="noborder">';
+        print '<div class="div-table-responsive-no-min">';
+	    print '<table class="noborder">';
 		print '<tr class="liste_titre">';
 		print '<td>'.$langs->trans("TableName").'</td>';
 		print '<td>'.$langs->trans("NbOfRecord").'</td>';
@@ -207,6 +212,8 @@ else
 			}
 		}
 
+		print '</table>';
+		print '</div>';
 	}
 }
 

+ 6 - 1
htdocs/admin/system/database.php

@@ -42,6 +42,7 @@ llxHeader();
 print load_fiche_titre($langs->trans("InfoDatabase"),'','title_setup');
 
 // Database
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
 print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
@@ -54,14 +55,16 @@ print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Password").'</td><td>'.pr
 print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
 print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n";
 print '</table>';
+print '</div>';
 
 // Tables
 print '<br>';
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n";
 print '<tr '.$bc[0].'><td width="300"><a href="'.DOL_URL_ROOT.'/admin/system/database-tables.php?mainmenu=home">'.$langs->trans("List").'</a></td></tr>'."\n";
 print '</table>';
-
+print '</div>';
 
 $listofvars=$db->getServerParametersValues();
 $listofstatus=$db->getServerStatusValues();
@@ -76,6 +79,7 @@ else
 	foreach($arraylist as $listname)
 	{
 		print '<br>';
+        print '<div class="div-table-responsive-no-min">';
 		print '<table class="noborder" width="100%">';
 		print '<tr class="liste_titre">';
 		print '<td width="300">'.$langs->trans("Parameters").'</td>';
@@ -120,6 +124,7 @@ else
 			print '</tr>'."\n";
 		}
 		print '</table>'."\n";
+		print '</div>';
 	}
 }
 

+ 12 - 1
htdocs/admin/system/dolibarr.php

@@ -48,6 +48,7 @@ print load_fiche_titre($title,'','title_setup');
 
 // Version
 $var=true;
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
 $var=!$var;
@@ -69,10 +70,12 @@ else
 }
 print '</td></tr>'."\n";
 print '</table>';
+print '</div>';
 print '<br>';
 
 // Session
 $var=true;
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
 $var=!$var;
@@ -107,6 +110,7 @@ foreach($_SESSION as $key => $val)
 }
 print '</td></tr>'."\n";
 print '</table>';
+print '</div>';
 print '<br>';
 
 
@@ -116,6 +120,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
 	$shmoparray=dol_listshmop();
 
 	$var=true;
+    print '<div class="div-table-responsive-no-min">';
 	print '<table class="noborder" width="100%">';
 	print '<tr class="liste_titre">';
 	print '<td class="titlefield">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
@@ -133,12 +138,14 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
 	}
 
 	print '</table>';
+	print '</div>';
 	print '<br>';
 }
 
 
 // Localisation
 $var=true;
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
 $var=!$var;
@@ -234,6 +241,7 @@ if (! empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp=$conf->global->MAIN_F
 print '<tr '.$bc[$var].'><td>&nbsp; => '.$langs->trans("File encoding").'</td><td>'.$tmp.'</td></tr>'."\n";	// date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
 
 print '</table>';
+print '</div>';
 print '<br>';
 
 
@@ -292,6 +300,7 @@ $configfileparameters=array(
 );
 
 $var=true;
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td class="titlefield">'.$langs->trans("Parameters").' ';
@@ -353,11 +362,13 @@ foreach($configfileparameters as $key => $value)
 	}
 }
 print '</table>';
+print '</div>';
 print '<br>';
 
 
 
 // Parameters in database
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder">';
 print '<tr class="liste_titre">';
 print '<td class="titlefield">'.$langs->trans("Parameters").' '.$langs->trans("Database").'</td>';
@@ -407,7 +418,7 @@ if ($resql)
 }
 
 print '</table>';
-
+print '</div>';
 
 
 llxFooter();

+ 3 - 0
htdocs/admin/system/modules.php

@@ -102,6 +102,8 @@ foreach($modulesdir as $dir)
     	closedir($handle);
     }
 }
+
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Modules").'</td>';
@@ -148,6 +150,7 @@ foreach($sortorder as $numero=>$name)
 	print "</tr>\n";
 }
 print '</table>';
+print '</div>';
 print '<br>';
 sort($rights_ids);
 $old='';

+ 5 - 3
htdocs/admin/system/phpinfo.php

@@ -68,8 +68,8 @@ print '<br>';
 $phparray=phpinfo_array();
 foreach($phparray as $key => $value)
 {
-	//print load_fiche_titre($key);
-	print '<table class="noborder">';
+    print '<div class="div-table-responsive-no-min">';
+    print '<table class="noborder">';
 	print '<tr class="liste_titre">';
 	//print '<td width="220px">'.$langs->trans("Parameter").'</td>';
 	print '<td width="220px">'.$key.'</td>';
@@ -114,7 +114,9 @@ foreach($phparray as $key => $value)
 			print '</tr>';
 		}
 	}
-	print '</table><br>';
+	print '</table>';
+	print '</div>';
+	print '<br>';
 }
 
 

+ 2 - 2
htdocs/admin/tools/dolibarr_export.php

@@ -145,7 +145,7 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
 ?>
 <table class="centpercent">
 	<tr>
-		<td valign="top">
+		<td class="tdtop">
 
 		<div id="div_container_exportoptions">
 		<fieldset id="exportoptions"><legend><?php echo $langs->trans("ExportMethod"); ?></legend>
@@ -179,7 +179,7 @@ print '<tr '.$bc[false].'><td style="padding-left: 8px">';
 		</div>
 
 		</td>
-		<td valign="top">
+		<td class="tdtop">
 
 
 		<div id="div_container_sub_exportoptions">

+ 2 - 2
htdocs/admin/tools/dolibarr_import.php

@@ -86,7 +86,7 @@ print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'<br><br>';
 
 <?php print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b>'; ?><br><br>
 
-<table><tr><td valign="top">
+<table><tr><td class="tdtop">
 
 <?php if ($conf->use_javascript_ajax) { ?>
 <div id="div_container_exportoptions">
@@ -120,7 +120,7 @@ print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'<br><br>';
 </div>
 <?php } ?>
 
-</td><td valign="top">
+</td><td class="tdtop">
 
 
 <div id="div_container_sub_exportoptions">

+ 16 - 2
htdocs/admin/tools/listevents.php

@@ -174,6 +174,15 @@ if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user,
 if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); }
 if ($search_ua)   { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); }
 $sql.= $db->order($sortfield,$sortorder);
+
+// Count total nb of records
+$nbtotalofrecords = '';
+/*if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+{
+    $result = $db->query($sql);
+    $nbtotalofrecords = $db->num_rows($result);
+}*/
+
 $sql.= $db->plimit($conf->liste_limit+1, $offset);
 //print $sql;
 $result = $db->query($sql);
@@ -195,7 +204,7 @@ if ($result)
         $center='<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
     }
     
-	print_barre_liste($langs->trans("ListOfSecurityEvents").' ('.$num.')', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, 0, 'setup');
+	print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup');
 
 	if ($action == 'purge')
 	{
@@ -204,6 +213,8 @@ if ($result)
 	}
 	
 	print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
+
+	print '<div class="div-table-responsive">';
 	print '<table class="liste" width="100%">';
 	print '<tr class="liste_titre">';
 	print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder);
@@ -303,7 +314,10 @@ if ($result)
 		if ($usefilter) print '<tr><td colspan="6">'.$langs->trans("NoEventFoundWithCriteria").'</td></tr>';
 		else print '<tr><td colspan="6">'.$langs->trans("NoEventOrNoAuditSetup").'</td></tr>';
 	}
-	print "</table></form>";
+	print "</table>";
+	print "</div>";
+	
+	print "</form>";
 	$db->free($result);
 }
 else

+ 4 - 2
htdocs/admin/triggers.php

@@ -52,6 +52,7 @@ $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/';
 $interfaces = new Interfaces($db);
 $triggers = $interfaces->getTriggersList();
 
+print '<div class="div-table-responsive-no-min">';
 print '<table class="noborder">
 <tr class="liste_titre">
 <td colspan="2">'.$langs->trans("File").'</td>
@@ -66,9 +67,9 @@ foreach ($triggers as $trigger)
 	$var=!$var;
 	print '<tr '.$bc[$var].'>';
 	print '<td valign="top" width="14" align="center">'.$trigger['picto'].'</td>';
-	print '<td valign="top">'.$trigger['file'].'</td>';
+	print '<td class="tdtop">'.$trigger['file'].'</td>';
 	print '<td valign="top" align="center">'.$trigger['status'].'</td>';
-	print '<td valign="top">';
+	print '<td class="tdtop">';
 	$text=$trigger['info'];
 	$text.="<br>\n<strong>".$langs->trans("File")."</strong>:<br>\n".$trigger['relpath'];
 	//$text.="\n".$langs->trans("ExternalModule",$trigger['isocreorexternal']);
@@ -78,6 +79,7 @@ foreach ($triggers as $trigger)
 }
 
 print '</table>';
+print '</div>';
 
 llxFooter();
 

+ 26 - 4
htdocs/api/class/api_access.class.php

@@ -76,12 +76,34 @@ class DolibarrApiAccess implements iAuthenticate
 
 		$userClass = Defaults::$userIdentifierClass;
 
+		/*foreach ($_SERVER as $key => $val)
+		{
+		    dol_syslog($key.' - '.$val);
+		}*/
+		
+		// api key can be provided in url with parameter api_key=xxx or ni header with header DOLAPIKEY:xxx
+		$api_key = '';
 		if (isset($_GET['api_key'])) 
+		{
+		    // TODO Add option to disable use of api key on url. Return errors if used.
+		    $api_key = $_GET['api_key'];                         // For backward compatibility
+		}
+		if (isset($_GET['DOLAPIKEY'])) 
+		{
+		    // TODO Add option to disable use of api key on url. Return errors if used.
+		    $api_key = $_GET['DOLAPIKEY'];                     // With GET method
+		}
+		if (isset($_SERVER['HTTP_DOLAPIKEY'])) 
+		{
+		    $api_key = $_SERVER['HTTP_DOLAPIKEY'];     // With header method (recommanded)
+		}
+		
+		if ($api_key) 
 		{
 			$sql = "SELECT u.login, u.datec, u.api_key, ";
 			$sql.= " u.tms as date_modification, u.entity";
 			$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
-			$sql.= " WHERE u.api_key = '".$db->escape($_GET['api_key'])."'";
+			$sql.= " WHERE u.api_key = '".$db->escape($api_key)."'";
 
 			$result = $db->query($sql);
 			if ($result)
@@ -97,8 +119,8 @@ class DolibarrApiAccess implements iAuthenticate
 				throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
 			}
 
-			if ($stored_key != $_GET['api_key']) {
-				$userClass::setCacheIdentifier($_GET['api_key']);
+			if ($stored_key != $api_key) {
+				$userClass::setCacheIdentifier($api_key);
 				return false;
 			}
 
@@ -121,7 +143,7 @@ class DolibarrApiAccess implements iAuthenticate
         }
 		else
 		{
-		    throw new RestException(401, "Failed to login to API. No parameter 'api_key' provided");
+		    throw new RestException(401, "Failed to login to API. No parameter 'DOLAPIKEY' on HTTP header (neither in URL).");
 		}
 
     $userClass::setCacheIdentifier(static::$role);

+ 6 - 4
htdocs/api/class/api_login.class.php

@@ -34,12 +34,14 @@ class Login
 	/**
 	 * Login
 	 *
-	 * Log user with username and password
-	 *
-	 * @param   string  $login			Username
+	 * Request the API token for a couple username / password. 
+	 * Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass into server log file).
+	 * Both method are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "api_key" into field at the top right of page (Note: "api_key" can be found/set on the user page). 
+	 * 
+	 * @param   string  $login			User login
 	 * @param   string  $password		User password
 	 * @param   int     $entity			Entity (when multicompany module is used). Empty means 1=first company.
-	 * @param   int     $reset          Reset token (0=get current token, 1=ask a new token, meaning that all future access using current token will failed)
+	 * @param   int     $reset          Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
      * @return  array                   Response status and user token
      *
 	 * @throws RestException

+ 10 - 0
htdocs/api/index.php

@@ -56,6 +56,16 @@ if (empty($conf->global->MAIN_MODULE_API))
     exit;
 }
 
+// Test if explorer is not disabled
+if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($conf->global->API_EXPLORER_DISABLED))
+{
+    $langs->load("admin");
+    dol_syslog("Call Dolibarr API interfaces with module REST disabled");
+    print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
+    exit;
+}
+
+
 
 $api = new DolibarrApi($db);
 

+ 42 - 37
htdocs/bookmarks/card.php

@@ -44,7 +44,7 @@ $userid=GETPOST("userid","int");
 $position=GETPOST("position","int");
 $backtopage=GETPOST('backtopage','alpha');
 
-$bookmark=new Bookmark($db);
+$object=new Bookmark($db);
 
 
 /*
@@ -69,14 +69,14 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
 		exit;
 	}
 
-	if ($action == 'update') $bookmark->fetch(GETPOST("id",'int'));
+	if ($action == 'update') $object->fetch(GETPOST("id",'int'));
 	// Check if null because user not admin can't set an user and send empty value here.
 	if(!empty($userid))
-		$bookmark->fk_user=$userid;
-	$bookmark->title=$title;
-	$bookmark->url=$url;
-	$bookmark->target=$target;
-	$bookmark->position=$position;
+		$object->fk_user=$userid;
+	$object->title=$title;
+	$object->url=$url;
+	$object->target=$target;
+	$object->position=$position;
 
 	if (! $title) {
 		$error++;
@@ -90,10 +90,10 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
 
 	if (! $error)
 	{
-		$bookmark->favicon='none';
+		$object->favicon='none';
 
-		if ($action == 'update') $res=$bookmark->update();
-		else $res=$bookmark->create();
+		if ($action == 'update') $res=$object->update();
+		else $res=$object->create();
 
 		if ($res > 0)
 		{
@@ -103,14 +103,14 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
 		}
 		else
 		{
-			if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
+			if ($object->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
 			{
 				$langs->load("errors");
 				setEventMessages($langs->transnoentities("WarningBookmarkAlreadyExists"), null, 'warnings');
 			}
 			else
 			{
-				setEventMessages($bookmark->error, $bookmark->errors, 'errors');
+				setEventMessages($object->error, $object->errors, 'errors');
 			}
 			$action = $invertedaction;
 		}
@@ -133,7 +133,7 @@ $form=new Form($db);
 $head = array();
 $h=1;
 
-$head[$h][0] = $_SERVER["PHP_SELF"].($bookmark->id?'id='.$bookmark->id:'');
+$head[$h][0] = $_SERVER["PHP_SELF"].($object->id?'id='.$object->id:'');
 $head[$h][1] = $langs->trans("Card");
 $head[$h][2] = 'card';
 $h++;
@@ -157,7 +157,7 @@ if ($action == 'create')
 
 	print '<table class="border" width="100%">';
 
-	print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
+	print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input class="flat" name="title" size="30" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
 
 	print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat" name="url" size="50" value="'.$url.'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
 
@@ -172,7 +172,7 @@ if ($action == 'create')
 
 	// Position
 	print '<tr><td>'.$langs->trans("Position").'</td><td>';
-	print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$bookmark->position).'">';
+	print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$object->position).'">';
 	print '</td><td class="hideonsmartphone">&nbsp;</td></tr>';
 
 	print '</table>';
@@ -193,8 +193,9 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
 	/*
 	 * Fact bookmark mode or visually edition
 	 */
-	$bookmark->fetch($id);
+	$object->fetch($id);
 
+	$hselected = 'card';
 	$head = array(
 		array(
 			'',
@@ -208,18 +209,22 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
 		print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
 		print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 		print '<input type="hidden" name="action" value="update">';
-		print '<input type="hidden" name="id" value="'.$bookmark->id.'">';
-		print '<input type="hidden" name="urlsource" value="'.DOL_URL_ROOT.'/bookmarks/card.php?id='.$bookmark->id.'">';
+		print '<input type="hidden" name="id" value="'.$object->id.'">';
+		print '<input type="hidden" name="urlsource" value="'.DOL_URL_ROOT.'/bookmarks/card.php?id='.$object->id.'">';
 		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
 	}
 
+
 	dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
 
-	print '<table class="border" width="100%">';
+	$linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>';
+	
+  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0);
 
-	print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bookmark->ref.'</td></tr>';
+  print '<div class="underbanner clearboth"></div>';
+	print '<table class="border" width="100%">';
 
-	print '<tr><td>';
+	print '<tr><td class="titlefield">';
 	if ($action == 'edit') {
 		print '<span class="fieldrequired">';
 	}
@@ -231,8 +236,8 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
 	}
 
 	print '</td><td>';
-	if ($action == 'edit') print '<input class="flat minwidth200" name="title" value="'.(isset($_POST["title"])?GETPOST("title",'',2):$bookmark->title).'">';
-	else print $bookmark->title;
+	if ($action == 'edit') print '<input class="flat minwidth200" name="title" value="'.(isset($_POST["title"])?GETPOST("title",'',2):$object->title).'">';
+	else print $object->title;
 	print '</td></tr>';
 
 	print '<tr><td>';
@@ -244,34 +249,34 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
 		print '</span>';
 	}
 	print '</td><td>';
-	if ($action == 'edit') print '<input class="flat" name="url" size="80" value="'.(isset($_POST["url"])?$_POST["url"]:$bookmark->url).'">';
-	else print '<a href="'.(preg_match('/^http/i',$bookmark->url)?$bookmark->url:DOL_URL_ROOT.$bookmark->url).'"'.($bookmark->target?' target="_blank"':'').'>'.$bookmark->url.'</a>';
+	if ($action == 'edit') print '<input class="flat" name="url" size="80" value="'.(isset($_POST["url"])?$_POST["url"]:$object->url).'">';
+	else print '<a href="'.(preg_match('/^http/i',$object->url)?$object->url:DOL_URL_ROOT.$object->url).'"'.($object->target?' target="_blank"':'').'>'.$object->url.'</a>';
 	print '</td></tr>';
 
 	print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
 	if ($action == 'edit')
 	{
 		$liste=array(1=>$langs->trans("OpenANewWindow"),0=>$langs->trans("ReplaceWindow"));
-		print $form->selectarray('target',$liste,isset($_POST["target"])?$_POST["target"]:$bookmark->target);
+		print $form->selectarray('target',$liste,isset($_POST["target"])?$_POST["target"]:$object->target);
 	}
 	else
 	{
-		if ($bookmark->target == 0) print $langs->trans("ReplaceWindow");
-		if ($bookmark->target == 1) print $langs->trans("OpenANewWindow");
+		if ($object->target == 0) print $langs->trans("ReplaceWindow");
+		if ($object->target == 1) print $langs->trans("OpenANewWindow");
 	}
 	print '</td></tr>';
 
 	print '<tr><td>'.$langs->trans("Owner").'</td><td>';
 	if ($action == 'edit' && $user->admin)
 	{
-		print $form->select_dolusers(isset($_POST['userid'])?$_POST['userid']:($bookmark->fk_user?$bookmark->fk_user:''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
+		print $form->select_dolusers(isset($_POST['userid'])?$_POST['userid']:($object->fk_user?$object->fk_user:''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
 	}
 	else
 	{
-		if ($bookmark->fk_user)
+		if ($object->fk_user)
 		{
 			$fuser=new User($db);
-			$fuser->fetch($bookmark->fk_user);
+			$fuser->fetch($object->fk_user);
 			print $fuser->getNomUrl(1);
 		}
 		else
@@ -283,12 +288,12 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
 
 	// Position
 	print '<tr><td>'.$langs->trans("Position").'</td><td>';
-	if ($action == 'edit') print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$bookmark->position).'">';
-	else print $bookmark->position;
+	if ($action == 'edit') print '<input class="flat" name="position" size="5" value="'.(isset($_POST["position"])?$_POST["position"]:$object->position).'">';
+	else print $object->position;
 	print '</td></tr>';
 
 	// Date creation
-	print '<tr><td>'.$langs->trans("DateCreation").'</td><td>'.dol_print_date($bookmark->datec,'dayhour').'</td></tr>';
+	print '<tr><td>'.$langs->trans("DateCreation").'</td><td>'.dol_print_date($object->datec,'dayhour').'</td></tr>';
 
 	print '</table>';
 
@@ -302,19 +307,19 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
 
 
 	// Buttons
-	
+
 	print "<div class=\"tabsAction\">\n";
 
 	// Edit
 	if ($user->rights->bookmark->creer && $action != 'edit')
 	{
-		print "  <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?id=".$bookmark->id."&amp;action=edit\">".$langs->trans("Edit")."</a>\n";
+		print "  <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?id=".$object->id."&amp;action=edit\">".$langs->trans("Edit")."</a>\n";
 	}
 
 	// Remove
 	if ($user->rights->bookmark->supprimer && $action != 'edit')
 	{
-		print "  <a class=\"butActionDelete\" href=\"list.php?bid=".$bookmark->id."&amp;action=delete\">".$langs->trans("Delete")."</a>\n";
+		print "  <a class=\"butActionDelete\" href=\"list.php?bid=".$object->id."&amp;action=delete\">".$langs->trans("Delete")."</a>\n";
 	}
 
 	print '</div>';

+ 17 - 1
htdocs/bookmarks/class/bookmark.class.php

@@ -26,8 +26,13 @@
 /**
  *		Class to manage bookmarks
  */
-class Bookmark
+class Bookmark extends CommonObject
 {
+    public $element='bookmark';
+    public $table_element='bookmark';
+    protected $ismultientitymanaged = 1;	// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+    public $picto = 'bookmark';
+    
     var $db;
 
     var $id;
@@ -228,4 +233,15 @@ class Bookmark
 		return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
 	}
 
+	/**
+	 *	Return label of contact status
+	 *
+	 *	@param      int			$mode       0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+	 * 	@return 	string					Label of contact status
+	 */
+	function getLibStatut($mode)
+	{
+	    return '';
+	}
+	
 }

+ 4 - 0
htdocs/cashdesk/affIndex.php

@@ -34,6 +34,8 @@ if ( $_SESSION['uid'] <= 0 )
 	exit;
 }
 
+$langs->load("companies");
+$langs->load("compta");
 $langs->load("cashdesk");
 
 
@@ -41,6 +43,8 @@ $langs->load("cashdesk");
  * View
  */
 
+$form = new Form($db);
+
 //header("Content-type: text/html; charset=UTF-8");
 //header("Content-type: text/html; charset=".$conf->file->character_set_client);
 

+ 14 - 1
htdocs/cashdesk/affPied.php

@@ -22,8 +22,21 @@
  */
 
 ?>
+<!-- affPied.php -->
 <div class="pied">
-<?php
+<?php 
+
+// Wrapper to show tooltips
+if (! empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover))
+{
+	print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
+	print '<script type="text/javascript">
+    	jQuery(document).ready(function () {
+    		jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(($conf->browser->layout == 'phone' ? 400 : 700),'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
+    	});
+    </script>' . "\n";
+}
+
 printCommonFooter('private');
 ?>
 </div>

+ 1 - 1
htdocs/cashdesk/css/style.css

@@ -19,7 +19,6 @@ body {
 	color: #333;
 	margin: 0;
 	padding: 0;
-	text-align: center;
 }
 
 p {
@@ -214,6 +213,7 @@ p.titre {
 
 .blocksellfinished {
 	min-width: 215px;
+	margin-top: 8px;
 }
 .titre1 {
 	font-weight: bold;

+ 13 - 1
htdocs/cashdesk/facturation_verif.php

@@ -28,11 +28,13 @@ require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
 
+$action = GETPOST('action','alpha');
+
 $obj_facturation = unserialize($_SESSION['serObjFacturation']);
 unset ($_SESSION['serObjFacturation']);
 
 
-switch ( $_GET['action'] )
+switch($action)
 {
 	default:
 		if ( $_POST['hdnSource'] != 'NULL' )
@@ -162,6 +164,16 @@ switch ( $_GET['action'] )
 
 		break;
 
+	case 'change_thirdparty':	// We have clicked on button "Modify" a thirdparty
+		$newthirdpartyid = GETPOST('CASHDESK_ID_THIRDPARTY','int');
+		if ($newthirdpartyid > 0)
+		{
+		    $_SESSION["CASHDESK_ID_THIRDPARTY"] = $newthirdpartyid;
+		}
+		
+		$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
+        break;	    
+	    
 	case 'ajout_article':	// We have clicked on button "Add product"
 
 		if (! empty($obj_facturation->id))	// A product was previously selected and stored in session, so we can add it

+ 12 - 1
htdocs/cashdesk/index.php

@@ -59,7 +59,18 @@ top_htmlhead('','',0,0,'',$arrayofcss);
 <div class="conteneur_img_droite">
 
 <div class="menu_principal hideonsmartphone">
-<div class="logo"><?php print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
+<div class="logo">
+<?php
+if (! empty($mysoc->logo_small))
+{
+    print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">';
+}
+else
+{
+    print '<div class="logopos">'.$mysoc->name.'</div>';
+}
+?>
+</div>
 </div>
 
 <div class="contenu">

+ 7 - 17
htdocs/cashdesk/tpl/facturation1.tpl.php

@@ -125,23 +125,13 @@ $langs->load("cashdesk");
     			<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
                 <!-- Choix du taux de TVA -->
                 <td class="select_tva">
-                <?php //var_dump($tab_tva); ?>
-                <select name="selTva" onchange="javascript: modif();" >
-                    <?php
-                        $tva_tx = $obj_facturation->tva();  // Try to get a previously entered VAT rowid. First time, this will return empty.
-
-                        $tab_tva_size=count($tab_tva);      // $tab_tva contains list of possible vat array('rowid'=> , 'taux'=> ) 
-                        for ($i=0;$i < $tab_tva_size;$i++) 
-                        {
-                            if ($tva_tx == $tab_tva[$i]['rowid'])
-                                $selected = 'selected';
-                            else
-                                $selected = '';
-
-                            echo '<option '.$selected.' value="'.$tab_tva[$i]['rowid'].'">'.$tab_tva[$i]['taux'].'</option>'."\n               ";
-                        }
-                    ?>
-                </select>
+                <?php //var_dump($tab_tva); 
+					$tva_tx = $obj_facturation->tva();  // Try to get a previously entered VAT rowid. First time, this will return empty.
+					$buyer = new Societe($db);
+					if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
+					
+					echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):-1), $mysoc, $buyer, 0, 0, '', false, -1);
+			    ?>
                 </td>
 			</tr>
 		</table>

+ 11 - 3
htdocs/cashdesk/tpl/menu.tpl.php

@@ -23,12 +23,12 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
 include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
 
-if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))
+/*if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))
 {
 	$company=new Societe($db);
 	$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
 	$companyLink = $company->getNomUrl(1);
-}
+}*/
 if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
 {
 	$bankcash=new Account($db);
@@ -59,6 +59,7 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled)
 $langs->load("cashdesk");
 $langs->load("main");
 
+print "\n".'<!-- menu.tpl.php -->'."\n";
 print '<div class="menu_bloc">';
 print '<ul class="menu">';
 // Link to new sell
@@ -68,7 +69,13 @@ print '<li class="menu_choix2"><a href=".." target="backoffice"><span class="hid
 // Disconnect
 print '<li class="menu_choix0">'.$langs->trans("User").': '.$_SESSION['firstname'].' '.$_SESSION['lastname'];
 print ' <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a><br>';
-print $langs->trans("CashDeskThirdParty").': '.$companyLink.'<br>';
+print '<form id="frmThirdparty" class="formulaire1 inline-block" method="post" action="facturation_verif.php?action=change_thirdparty">';
+print $langs->trans("CashDeskThirdParty").': ';
+print $form->select_company($_SESSION["CASHDESK_ID_THIRDPARTY"], 'CASHDESK_ID_THIRDPARTY', 's.client IN (1,3)', '', 0, 0, null, 0, 'valignmiddle inline-block');
+print '<input class="button bouton_change_thirdparty inline-block valignmiddle" type="submit" id="bouton_change_thirdparty" value="'.$langs->trans("Modify").'">';
+//print $companyLink;
+print '<br>';
+print '</form>';
 /*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>';
 print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
 print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/
@@ -78,3 +85,4 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled)
 }
 print '</li></ul>';
 print '</div>';
+print "\n".'<!-- menu.tpl.php end -->'."\n";

+ 1 - 0
htdocs/cashdesk/tpl/validation1.tpl.php

@@ -18,6 +18,7 @@
 
 $langs->load("main");
 $langs->load("bills");
+$langs->load("banks");
 
 // Object $form must de defined
 

+ 12 - 2
htdocs/cashdesk/validation_verif.php

@@ -47,15 +47,25 @@ switch ($action)
 
 
 	case 'valide_achat':
-
+        
+	    $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
+	    
 		$company=new Societe($db);
-		$company->fetch($conf->global->CASHDESK_ID_THIRDPARTY);
+		$company->fetch($thirdpartyid);
 
 		$invoice=new Facture($db);
 		$invoice->date=dol_now();
 		$invoice->type= Facture::TYPE_STANDARD;
+		
+		// TODO
+		// To use a specific numbering module for POS, reset $conf->global->FACTURE_ADDON and other vars here
+		// and restore after values just after
+		
 		$num=$invoice->getNextNumRef($company);
 
+		// TODO Restore save values
+		
+		
 		$obj_facturation->numInvoice($num);
 
 		$obj_facturation->getSetPaymentMode($_POST['hdnChoix']);

+ 1 - 1
htdocs/categories/card.php

@@ -250,7 +250,7 @@ if ($user->rights->categorie->creer)
 		print'</td></tr>';
 
 		// Description
-		print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
+		print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
 		require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
 		$doleditor=new DolEditor('description',$description,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,ROWS_6,'90%');
 		$doleditor->Create();

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

@@ -209,7 +209,7 @@ class Categories extends DolibarrApi
         $sql.= ' AND s.rowid = sub.fk_categorie';
         $sql.= ' AND sub.'.$subcol_name.' = '.$item;
 
-        $nbtotalofrecords = -1;
+        $nbtotalofrecords = '';
         if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
         {
             $result = $db->query($sql);

+ 2 - 2
htdocs/categories/class/api_deprecated_category.class.php

@@ -124,7 +124,7 @@ class CategoryApi extends DolibarrApi
         $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')';
         $sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES);
 
-        $nbtotalofrecords = -1;
+        $nbtotalofrecords = '';
         if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
         {
             $result = $db->query($sql);
@@ -205,7 +205,7 @@ class CategoryApi extends DolibarrApi
         $sql.= ' AND s.rowid = sub.fk_categorie';
         $sql.= ' AND sub.'.$subcol_name.' = '.$item;
 
-        $nbtotalofrecords = -1;
+        $nbtotalofrecords = '';
         if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
         {
             $result = $db->query($sql);

+ 17 - 2
htdocs/categories/class/categorie.class.php

@@ -49,8 +49,10 @@ class Categorie extends CommonObject
 	const TYPE_MEMBER = 3;     // TODO Replace this value with 'member'
 	const TYPE_CONTACT = 4;    // TODO Replace this value with 'contact'
 	const TYPE_USER = 4;       // categorie contact and user are same !   TODO Replace this value with 'user'
-    	const TYPE_ACCOUNT = 5;    // for bank account TODO Replace this value with 'account'
-    	const TYPE_PROJECT = 6;
+    const TYPE_ACCOUNT = 5;    // for bank account TODO Replace this value with 'account'
+    const TYPE_PROJECT = 6;
+    public $picto = 'category';
+    
 
 	/**
 	 * @var array ID mapping from type string
@@ -205,6 +207,7 @@ class Categorie extends CommonObject
 				$res = $this->db->fetch_array($resql);
 
 				$this->id			= $res['rowid'];
+				//$this->ref			= $res['rowid'];
 				$this->fk_parent	= $res['fk_parent'];
 				$this->label		= $res['label'];
 				$this->description	= $res['description'];
@@ -1703,6 +1706,18 @@ class Categorie extends CommonObject
 	    }
 	}
 
+	/**
+	 *	Return label of contact status
+	 *
+	 *	@param      int			$mode       0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+	 * 	@return 	string					Label of contact status
+	 */
+	function getLibStatut($mode)
+	{
+	    return '';
+	}
+	
+	
     /**
      *  Initialise an instance with random values.
      *  Used to build previews or test instances.

+ 22 - 19
htdocs/categories/photos.php

@@ -36,8 +36,6 @@ $langs->load("categories");
 $langs->load("bills");
 
 
-$mesg = '';
-
 $id=GETPOST('id','int');
 $ref=GETPOST('ref');
 $type=GETPOST('type');
@@ -105,33 +103,38 @@ if ($object->id)
     else                                        $title=$langs->trans("Category");
 
 	$head = categories_prepare_head($object,$type);
-	dol_fiche_head($head, 'photos', $title, 0, 'category');
 
+
+	dol_fiche_head($head, 'photos', $title, 0, 'category');
+	
+	$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
+	
+	$object->ref = $object->label;
+	$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
+	$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
+	foreach ($ways as $way)
+	{
+	    $morehtmlref.=$way."<br>\n";
+	}
+	$morehtmlref.='</div>';
+	
+	dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+	
 	/*
 	 * Confirmation de la suppression de photo
 	*/
 	if ($action == 'delete')
 	{
-		print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
+	    print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
 	}
 
-	print($mesg);
-
+	print '<br>';
+	
+	print '<div class="underbanner clearboth"></div>';
 	print '<table class="border" width="100%">';
 
-	// Path of category
-	print '<tr><td class="titlefield notopnoleft">';
-	$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
-	print $langs->trans("Ref").'</td><td>';
-	print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
-	foreach ($ways as $way)
-	{
-		print $way."<br>\n";
-	}
-	print '</td></tr>';
-
 	// Description
-	print '<tr><td class="notopnoleft">';
+	print '<tr><td class="titlefield notopnoleft">';
 	print $langs->trans("Description").'</td><td>';
 	print dol_htmlentitiesbr($object->description);
 	print '</td></tr>';
@@ -144,7 +147,7 @@ if ($object->id)
 
 	print "</table>\n";
 
-	print "</div>\n";
+	print dol_fiche_end();
 
 
 

+ 72 - 46
htdocs/categories/traduction.php

@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2005-2012  Regis Houssin           <regis.houssin@capnetworks.com>
  * Copyright (C) 2007       Rodolphe Quiedeville    <rodolphe@quiedeville.org>
- * Copyright (C) 2010-2012  Destailleur Laurent     <eldy@users.sourceforge.net>
+ * Copyright (C) 2010-2016  Destailleur Laurent     <eldy@users.sourceforge.net>
  * Copyright (C) 2015       Raphaël Doursenaud      <rdoursenaud@gpcsolutions.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -156,25 +156,40 @@ elseif ($type == Categorie::TYPE_PROJECT)   $title=$langs->trans("ProjectsCatego
 else                                        $title=$langs->trans("Category");
 
 $head = categories_prepare_head($object,$type);
+
+// Calculate $cnt_trans
+$cnt_trans = 0;
+if (! empty($object->multilangs))
+{
+    foreach ($object->multilangs as $key => $value)
+    {
+        $cnt_trans++;
+    }
+}
+
 dol_fiche_head($head, 'translation', $title, 0, 'category');
 
-print '<table class="border" width="100%">';
+$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
 
-// Reference
-print '<tr>';
-print '<td class="titlefield notopnoleft">';
+$object->ref = $object->label;
+$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
 $ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
-print $langs->trans("Ref").'</td><td>';
-print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
 foreach ($ways as $way)
 {
-    print $way."<br>\n";
+    $morehtmlref.=$way."<br>\n";
 }
-print '</td>';
-print '</tr>';
+$morehtmlref.='</div>';
+
+dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+
+print '<br>';
+
+print '<div class="underbanner clearboth"></div>';
+
+print '<table class="border" width="100%">';
 
 // Description
-print '<tr><td class="notopnoleft tdtop">';
+print '<tr><td class="titlefield notopnoleft">';
 print $langs->trans("Description").'</td><td>';
 print dol_htmlentitiesbr($object->description);
 print '</td></tr>';
@@ -187,6 +202,32 @@ print '</td></tr>';
 
 print '</table>';
 
+dol_fiche_end();
+
+
+
+
+/* ************************************************************************** */
+/*                                                                            */
+/* Barre d'action                                                             */
+/*                                                                            */
+/* ************************************************************************** */
+
+print "\n<div class=\"tabsAction\">\n";
+
+if ($action == '')
+{
+    if ($user->rights->produit->creer || $user->rights->service->creer)
+    {
+        print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'">'.$langs->trans("Add").'</a>';
+        if ($cnt_trans > 0) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("Update").'</a>';
+    }
+}
+
+print "\n</div>\n";
+
+
+
 if ($action == 'edit')
 {
 	//WYSIWYG Editor
@@ -201,9 +242,9 @@ if ($action == 'edit')
 	{
 		foreach ($object->multilangs as $key => $value)
 		{
-			print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
+		    print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
 			print '<table class="border" width="100%">';
-			print '<tr><td class="fieldtitlecreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
+			print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
 			print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
 			$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3,'90%');
 			$doleditor->Create();
@@ -213,7 +254,9 @@ if ($action == 'edit')
 			print '</table>';
 		}
 	}
-
+    
+	print '<br>';
+	
 	print '<div class="center">';
 	print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
 	print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@@ -223,46 +266,29 @@ if ($action == 'edit')
 	print '</form>';
 
 }
-else
+else if ($action != 'add')
 {
-	$cnt_trans = 0;
-	if (! empty($object->multilangs))
+    if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
+    
+    if (! empty($object->multilangs))
 	{
 		foreach ($object->multilangs as $key => $value)
 		{
-			$cnt_trans++;
-			$s=picto_from_langcode($key);
-			print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b><br>";
+		    $s=picto_from_langcode($key);
 			print '<table class="border" width="100%">';
-			print '<tr><td class="fieldtitlecreate>'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
-			print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
-			print '<tr><td>'.$langs->trans('Note').'</td><td>'.$object->multilangs[$key]["note"].'</td></tr>';
+			print '<tr class="liste_titre"><td colspan="2">'.($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', '').'</a></td></tr>';
+			print '<tr><td class="titlefield">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
+			print '<tr><td>'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
+			if (! empty($conf->global->CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION))
+			{
+                print '<tr><td>'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')</td><td>'.$object->multilangs[$key]["other"].'</td></tr>';
+			}
 			print '</table>';
 		}
 	}
-	if (! $cnt_trans) print '<br>'. $langs->trans('NoTranslation');
-}
-
-print "</div>\n";
-
-
-/* ************************************************************************** */
-/*                                                                            */
-/* Barre d'action                                                             */
-/*                                                                            */
-/* ************************************************************************** */
-
-print "\n<div class=\"tabsAction\">\n";
-
-if ($action == '')
-if ($user->rights->produit->creer || $user->rights->service->creer)
-{
-	print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'">'.$langs->trans("Add").'</a>';
-	print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("Update").'</a>';
+	if (! $cnt_trans && $action != 'add') print '<div class="opacitymedium">'. $langs->trans('NoTranslation').'</div>';
 }
 
-print "\n</div>\n";
-
 
 /*
  * Form to add a new translation
@@ -280,11 +306,11 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
 	print '<input type="hidden" name="id" value="'.$id.'">';
 
 	print '<table class="border" width="100%">';
-	print '<tr><td class="fieldtitlecreate fieldrequired">'.$langs->trans('Translation').'</td><td>';
+	print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Translation').'</td><td>';
     print $formadmin->select_language('','forcelangprod',0,$object->multilangs);
 	print '</td></tr>';
 	print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
-	print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
+	print '<tr><td>'.$langs->trans('Description').'</td><td>';
 	$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3,'90%');
 	$doleditor->Create();
 	print '</td></tr>';

+ 26 - 19
htdocs/categories/viewcat.php

@@ -68,6 +68,7 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
 $hookmanager->initHooks(array('categorycard'));
 
+
 /*
  *	Actions
  */
@@ -190,8 +191,22 @@ else                                        $title=$langs->trans("Category");
 
 $head = categories_prepare_head($object,$type);
 
+
 dol_fiche_head($head, 'card', $title, 0, 'category');
 
+$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
+
+$object->ref = $object->label;
+$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
+$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
+foreach ($ways as $way)
+{
+    $morehtmlref.=$way."<br>\n";
+}
+$morehtmlref.='</div>';
+
+dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+
 
 /*
  * Confirmation suppression
@@ -202,21 +217,13 @@ if ($action == 'delete')
 	print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;type='.$type, $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1);
 }
 
-print '<table width="100%" class="border">';
+print '<br>';
 
-// Path of category
-print '<tr><td class="titlefield notopnoleft">';
-$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
-print $langs->trans("Ref").'</td><td>';
-print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
-foreach ($ways as $way)
-{
-	print $way."<br>\n";
-}
-print '</td></tr>';
+print '<div class="underbanner clearboth"></div>';
+print '<table width="100%" class="border">';
 
 // Description
-print '<tr><td class="notopnoleft">';
+print '<tr><td class="titlefield notopnoleft">';
 print $langs->trans("Description").'</td><td>';
 print dol_htmlentitiesbr($object->description);
 print '</td></tr>';
@@ -359,7 +366,7 @@ if ($object->type == Categorie::TYPE_PRODUCT)
 				print '<td class="nowrap" valign="top">';
 				print $prod->getNomUrl(1);
 				print "</td>\n";
-				print '<td valign="top">'.$prod->label."</td>\n";
+				print '<td class="tdtop">'.$prod->label."</td>\n";
 				// Link to delete from category
 				print '<td align="right">';
 				$typeid=$object->type;
@@ -520,8 +527,8 @@ if ($object->type == Categorie::TYPE_MEMBER)
 				$member->ref=$member->login;
 				print $member->getNomUrl(1,0);
 				print "</td>\n";
-				print '<td valign="top">'.$member->lastname."</td>\n";
-				print '<td valign="top">'.$member->firstname."</td>\n";
+				print '<td class="tdtop">'.$member->lastname."</td>\n";
+				print '<td class="tdtop">'.$member->firstname."</td>\n";
 				// Link to delete from category
 				print '<td align="right">';
 				$typeid=$object->type;
@@ -628,8 +635,8 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
                 print '<td class="nowrap" valign="top">';
                 print $account->getNomUrl(1,0);
                 print "</td>\n";
-                print '<td valign="top">'.$account->bank."</td>\n";
-                print '<td valign="top">'.$account->number."</td>\n";
+                print '<td class="tdtop">'.$account->bank."</td>\n";
+                print '<td class="tdtop">'.$account->number."</td>\n";
                 // Link to delete from category
                 print '<td align="right">';
                 $typeid=$object->type;
@@ -683,8 +690,8 @@ if ($object->type == Categorie::TYPE_PROJECT)
 				print '<td class="nowrap" valign="top">';
 				print $project->getNomUrl(1,0);
 				print "</td>\n";
-				print '<td valign="top">'.$project->ref."</td>\n";
-				print '<td valign="top">'.$project->title."</td>\n";
+				print '<td class="tdtop">'.$project->ref."</td>\n";
+				print '<td class="tdtop">'.$project->title."</td>\n";
 				// Link to delete from category
 				print '<td align="right">';
 				$typeid=$object->type;

+ 1 - 1
htdocs/comm/action/listactions.php

@@ -245,7 +245,7 @@ if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AN
 if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'";
 $sql.= $db->order($sortfield,$sortorder);
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

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

@@ -85,7 +85,7 @@ $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
 $sql.= " GROUP BY year, month, df";
 $sql.= " ORDER BY year DESC, month DESC, df DESC";
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

+ 2 - 2
htdocs/comm/address.php

@@ -253,7 +253,7 @@ if ($action == 'create')
         print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input type="text" size="30" name="label" id="label" value="'.($object->label?$object->label:$langs->trans('RequiredField')).'"></td></tr>';
         print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($object->name?$object->name:$langs->trans('RequiredField')).'"></td></tr>';
 
-        print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
+        print '<tr><td class="tdtop">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
         print $object->address;
         print '</textarea></td></tr>';
 
@@ -353,7 +353,7 @@ elseif ($action == 'edit')
         print '<tr><td>'.$langs->trans('AddressLabel').'</td><td colspan="3"><input type="text" size="40" name="label" value="'.$object->label.'"></td></tr>';
         print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" size="40" name="name" value="'.$object->name.'"></td></tr>';
 
-        print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
+        print '<tr><td class="tdtop">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
         print $object->address;
         print '</textarea></td></tr>';
 

+ 125 - 54
htdocs/comm/card.php

@@ -366,6 +366,21 @@ if ($id > 0)
 	print '</td>';
 	print '</tr>';
 
+	// Max outstanding bill
+	if ($object->client)
+	{
+	    print '<tr class="nowrap">';
+	    print '<td>';
+	    print $form->editfieldkey("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer);
+	    print '</td><td>';
+	    $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
+	    print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
+	    //if (empty($object->outstanding_limit)) print $langs->trans("NoLimit");
+	
+	    print '</td>';
+	    print '</tr>';
+	}
+	
 	// Multiprice level
 	if (! empty($conf->global->PRODUIT_MULTIPRICES))
 	{
@@ -469,72 +484,120 @@ if ($id > 0)
 	    print '</tr></table>';
 	    print '</td><td>';
 	    if ($action == 'editlevel')
+	    {
 	        $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1);
-	        else
-	            print $object->getLibProspLevel();
-	            print "</td>";
-	            print '</tr>';
-	
-	            // Status
-	            $object->loadCacheOfProspStatus();
-	            print '<tr><td>'.$langs->trans("StatusProsp").'</td><td colspan="3">'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
-	            print ' &nbsp; &nbsp; ';
-	            print '<div class="floatright">';
-	            foreach($object->cacheprospectstatus as $key => $val)
-	            {
-	                $titlealt='default';
-	                if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
-	                if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt,$val['code']).'</a>';
-	            }
-	            print '</div></td></tr>';
+	    }
+	    else
+	    {
+	        print $object->getLibProspLevel();
+	    }
+        print "</td>";
+        print '</tr>';
+
+        // Status
+        $object->loadCacheOfProspStatus();
+        print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
+        print ' &nbsp; &nbsp; ';
+        print '<div class="floatright">';
+        foreach($object->cacheprospectstatus as $key => $val)
+        {
+            $titlealt='default';
+            if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label'];
+            if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt,$val['code']).'</a>';
+        }
+        print '</div></td></tr>';
 	   print "</table>";
 	}
 	
 	print '</div><div class="fichehalfright"><div class="ficheaddleft">';
 
 
+	$boxstat = '';
+	
 	// Nbre max d'elements des petites listes
 	$MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
 
 	// Lien recap
-	$outstandingBills = $object->get_OutstandingBill();
-	$warn = '';
-	if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingBills) 
+	$boxstat.='<div class="box">';
+	$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable" width="100%">';
+	$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
+	
+	if ($conf->propal->enabled)
 	{
-		$warn = img_warning($langs->trans("OutstandingBillReached"));
+    	// Box proposals
+    	$tmp = $object->getOutstandingProposals();
+    	$outstandingOpened=$tmp['opened'];
+    	$outstandingTotal=$tmp['total_ht'];
+    	$outstandingTotalIncTax=$tmp['total_ttc'];
+	    $text=$langs->trans("OverAllProposals");
+    	$link='';
+    	$icon='bill';
+    	if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
+    	$boxstat.='<div class="boxstats">';
+    	$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
+    	$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
+    	$boxstat.='</div>';
+    	if ($link) $boxstat.='</a>';
 	}
-	
-	print '<table class="noborder" width="100%">';
 
-	print '<tr class="liste_titre">';
-	print '<td>'.$langs->trans("Summary").'</td>';
-	print '<td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id.'">'.$langs->trans("ShowCustomerPreview").'</a></td>';
-	print '</tr>';
-	
-	// Max outstanding bill
-	if ($object->client)
+	if ($conf->commande->enabled)
 	{
-	    print '<tr class="impair">';
-	    print '<td>';
-	    print $form->editfieldkey("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer);
-	    print '</td><td>';
-	    $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
-	    print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
-	    //if (empty($object->outstanding_limit)) print $langs->trans("NoLimit");
+	    // Box proposals
+	    $tmp = $object->getOutstandingOrders();
+	    $outstandingOpened=$tmp['opened'];
+	    $outstandingTotal=$tmp['total_ht'];
+	    $outstandingTotalIncTax=$tmp['total_ttc'];
+	    $text=$langs->trans("OverAllOrders");
+	    $link='';
+	    $icon='bill';
+	    if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
+	    $boxstat.='<div class="boxstats">';
+	    $boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
+	    $boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
+	    $boxstat.='</div>';
+	    if ($link) $boxstat.='</a>';
+	}
 	
-	    print '</td>';
-	    print '</tr>';
+	if ($conf->facture->enabled)
+	{
+    	$tmp = $object->getOutstandingBills();
+    	$outstandingOpened=$tmp['opened'];
+    	$outstandingTotal=$tmp['total_ht'];
+    	$outstandingTotalIncTax=$tmp['total_ttc'];
+	    
+    	$text=$langs->trans("OverAllInvoices");
+    	$link='';
+    	$icon='bill';
+    	if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
+    	$boxstat.='<div class="boxstats">';
+    	$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
+    	$boxstat.='<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
+    	$boxstat.='</div>';
+    	if ($link) $boxstat.='</a>';
+    	
+    	// Box outstanding bill
+    	$warn = '';
+    	if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened)
+    	{
+    	    $warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
+    	}
+    	$text=$langs->trans("CurrentOutstandingBill");
+    	$link=DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
+    	$icon='bill';
+    	if ($link) $boxstat.='<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
+    	$boxstat.='<div class="boxstats">';
+    	$boxstat.='<span class="boxstatstext">'.img_object("",$icon).' '.$text.'</span><br>';
+    	$boxstat.='<span class="boxstatsindicator'.($outstandingOpened>0?' amountremaintopay':'').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
+    	$boxstat.='</div>';
+    	if ($link) $boxstat.='</a>';
 	}
 	
-	// Outstanding bill
-	print '<tr class="pair">';
-	print '<td>'.$langs->trans("CurrentOutstandingBill").'</td>';
-	print '<td>'.price($outstandingBills).$warn.'</td>';
-	print '</tr>';
+	$boxstat.='</td></tr>';
+	$boxstat.='</table>';
+	$boxstat.='</div>';
 	
-	print '</table>';
-	print '<br>';
-
+    print $boxstat;
+    
 	$now=dol_now();
 
 	/*
@@ -776,7 +839,9 @@ if ($id > 0)
 
 			    print '<tr class="liste_titre">';
 				print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
-				print '<td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td></tr></table></td>';
+				print '<td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td>';
+				//print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
+				print '</tr></table></td>';
 				print '</tr>';
 			}
 			$i = 0;
@@ -837,7 +902,9 @@ if ($id > 0)
 		        print '<table class="noborder" width="100%">';
 
 			    print '<tr class="liste_titre">';
-				print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td></tr></table></td>';
+				print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
+				print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
+				print '</tr></table></td>';
 				print '</tr>';
 				$var=!$var;
 			}
@@ -1007,7 +1074,15 @@ if ($id > 0)
     
     		if (! empty($conf->facture->enabled))
     		{
-    			if ($user->rights->facture->creer && $object->status==1)
+    			if (empty($user->rights->facture->creer))
+    			{
+    			    print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
+    			}
+    			else if ($object->status != 1)
+    			{
+    			    print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
+    			}
+    			else
     			{
     				$langs->load("bills");
     				$langs->load("orders");
@@ -1022,10 +1097,6 @@ if ($id > 0)
     				else print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
     
     			}
-    			else
-    			{
-    				print '<div class="inline-block divButAction"><a class="butActionRefused" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
-    			}
     		}
     	}
     

+ 43 - 10
htdocs/comm/mailing/card.php

@@ -602,6 +602,29 @@ if (empty($reshook))
 		}
 	}
 
+	// Action confirmation validation
+	if ($action == 'confirm_settodraft' && $confirm == 'yes')
+	{
+		if ($object->id > 0)
+		{
+			$result = $object->setStatut(0);
+            if ($result > 0)
+            {
+    			//setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs');
+    			header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
+    			exit;
+            }
+            else
+            {
+                setEventMessages($object->error, $object->errors, 'errors');
+            }
+		}
+		else
+		{
+			dol_print_error($db);
+		}
+	}
+
 	// Resend
 	if ($action == 'confirm_reset' && $confirm == 'yes')
 	{
@@ -707,7 +730,7 @@ if ($action == 'create')
 	print '<div style="padding-top: 10px">';
 	// Editeur wysiwyg
 	require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
-	$doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
+	$doleditor=new DolEditor('body',$_POST['body'],'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
 	$doleditor->Create();
 	print '</div>';
 	
@@ -727,7 +750,12 @@ else
 
 		dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email');
 
-		// Confirmation de la validation du mailing
+		// Confirmation back to draft
+		if ($action == 'settodraft')
+		{
+			print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("SetToDraft"),$langs->trans("ConfirmUnvalidateEmailing"),"confirm_settodraft",'','',1);
+		}
+		// Confirmation validation of mailing
 		if ($action == 'valid')
 		{
 			print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1);
@@ -758,7 +786,7 @@ else
 
 				// MAILING_NO_USING_PHPMAIL may be defined or not.
 				// MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden).
-				// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit).
+				// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit).
 				if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
 				{
 					// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
@@ -772,8 +800,8 @@ else
 				}
 				else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1')
 				{
-				    if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
-				    if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
+				    if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
+				    if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
 				    
 					// The feature is forbidden from GUI, we show just message to use from command line.
 				    setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
@@ -786,8 +814,8 @@ else
 				}
 				else
 				{
-				    if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
-				    if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
+				    if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
+				    if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
 				    
 				    $text='';
 				    if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
@@ -900,10 +928,15 @@ else
 			 * Boutons d'action
 			 */
 
-			if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('valid','delete','sendall','clone')))
+			if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('settodraft', 'valid','delete','sendall','clone')))
 			{
 				print "\n\n<div class=\"tabsAction\">\n";
 
+				if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id))
+				{
+					print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&amp;id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
+				}
+
 				if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
 				{
 					print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditMailing").'</a>';
@@ -1065,7 +1098,7 @@ else
 				$readonly=1;
 				// Editeur wysiwyg
 				require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
-				$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
+				$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
 				$doleditor->Create();
 			}
 			else print dol_htmlentitiesbr($object->body);
@@ -1212,7 +1245,7 @@ else
 			print '<div style="padding-top: 10px">';
 			// Editeur wysiwyg
 			require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
-			$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
+			$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
 			$doleditor->Create();
 			print '</div>';
 

+ 2 - 2
htdocs/comm/mailing/cibles.php

@@ -412,7 +412,7 @@ if ($object->fetch($id) >= 0)
 	$sql .= $db->order($sortfield,$sortorder);
 
 	// Count total nb of records
-	$nbtotalofrecords = -1;
+	$nbtotalofrecords = '';
 	if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 	{
 	    $result = $db->query($sql);
@@ -533,7 +533,7 @@ if ($object->fetch($id) >= 0)
 				print '<td align="center">';
                 if (empty($obj->source_id) || empty($obj->source_type))
                 {
-                    print $obj->source_url; // For backward compatibility
+                    print empty($obj->source_url)?'':$obj->source_url; // For backward compatibility
                 }
                 else
                 {

+ 20 - 17
htdocs/comm/mailing/class/mailing.class.php

@@ -601,35 +601,38 @@ class Mailing extends CommonObject
 		if ($mode == 2)
 		{
 			if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
-			if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
-			if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
-			if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
+			if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
+			if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
+			if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
 		}
 		if ($mode == 3)
 		{
 			if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
-			if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
-			if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
-			if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
+			if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
+			if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
+			if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
 		}
 		if ($mode == 4)
 		{
 			if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
-			if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
-			if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
-			if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
+			if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
+			if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
+			if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
 		}
 		if ($mode == 5)
 		{
-			if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
-			if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
-			if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
-			if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
+		    if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
+		    if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
+		    if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
+		    if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
+		}
+		if ($mode == 6)
+		{
+		    if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
+		    if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
+		    if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4');
+		    if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3');
 		}
-
-
-
-
 	}
 
 }

+ 3 - 2
htdocs/comm/mailing/list.php

@@ -174,7 +174,7 @@ if ($result)
 		{
 			print '<td align="center">';
 			$nbemail = $obj->nbemail;
-			if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
+			/*if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
 			{
 				$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
 				print $form->textwithpicto($nbemail,$text,1,'warning');
@@ -182,7 +182,8 @@ if ($result)
 			else
 			{
 				print $nbemail;
-			}
+			}*/
+			print $nbemail;
 			print '</td>';
 		}
 		// Last send

+ 1 - 1
htdocs/comm/multiprix.php

@@ -91,7 +91,7 @@ if ($_socid > 0)
 	dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company');
 
 	print '<table width="100%" border="0">';
-	print '<tr><td valign="top">';
+	print '<tr><td class="tdtop">';
 	print '<table class="border" width="100%">';
 
 	print '<tr><td colspan="2" width="25%">';

+ 1 - 1
htdocs/comm/propal/card.php

@@ -1621,7 +1621,7 @@ if ($action == 'create')
 		}
 		print '</td></tr>';
 
-		print '<tr><td valign="top"><input type="radio" name="createmode" value="empty" checked></td>';
+		print '<tr><td class="tdtop"><input type="radio" name="createmode" value="empty" checked></td>';
 		print '<td valign="top" colspan="2">' . $langs->trans("CreateEmptyPropal") . '</td></tr>';
 	}
 

+ 8 - 10
htdocs/comm/propal/class/propal.class.php

@@ -824,7 +824,7 @@ class Propal extends CommonObject
         if (empty($this->demand_reason_id)) $this->demand_reason_id=0;
 
 		// Multicurrency
-		if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
+		if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
 		if (empty($this->fk_multicurrency))
 		{
 			$this->multicurrency_code = $conf->currency;
@@ -3434,17 +3434,15 @@ class Propal extends CommonObject
 
 		$langs->load("propale");
 
-		// Positionne le modele sur le nom du modele a utiliser
-		if (! dol_strlen($modele))
-		{
-			if (! empty($conf->global->PROPALE_ADDON_PDF))
-			{
+		if (! dol_strlen($modele)) {
+
+			$modele = 'azur';
+
+			if ($this->modelpdf) {
+				$modele = $this->modelpdf;
+			} elseif (! empty($conf->global->PROPALE_ADDON_PDF)) {
 				$modele = $conf->global->PROPALE_ADDON_PDF;
 			}
-			else
-			{
-				$modele = 'azur';
-			}
 		}
 
 		$modelpath = "core/modules/propale/doc/";

+ 1 - 1
htdocs/comm/propal/list.php

@@ -333,7 +333,7 @@ $sql.= $db->order($sortfield,$sortorder);
 $sql.=', p.ref DESC';
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

+ 1 - 1
htdocs/commande/class/api_deprecated_commande.class.php

@@ -139,7 +139,7 @@ class CommandeApi extends DolibarrApi
             $sql .= " AND sc.fk_user = ".$search_sale;
         }
 
-        $nbtotalofrecords = -1;
+        $nbtotalofrecords = '';
         if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
         {
             $result = $db->query($sql);

+ 14 - 15
htdocs/commande/class/commande.class.php

@@ -242,7 +242,8 @@ class Commande extends CommonOrder
             }
             else
 			{
-            	dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
+				$this->error=$obj->error;
+            	//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
             	return "";
             }
         }
@@ -704,9 +705,12 @@ class Commande extends CommonOrder
 
         // Clean parameters
         $this->brouillon = 1;		// set command as draft
-
+		
+		// $date_commande is deprecated
+        $date = ($this->date_commande ? $this->date_commande : $this->date);
+		
 		// Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate)
-		if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
+		if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date);
 		else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
 		if (empty($this->fk_multicurrency))
 		{
@@ -745,9 +749,6 @@ class Commande extends CommonOrder
             return -1;
         }
 
-        // $date_commande is deprecated
-        $date = ($this->date_commande ? $this->date_commande : $this->date);
-
         $now=dol_now();
 
         $this->db->begin();
@@ -3641,17 +3642,15 @@ class Commande extends CommonOrder
 
 		$langs->load("orders");
 
-		// Positionne le modele sur le nom du modele a utiliser
-		if (! dol_strlen($modele))
-		{
-			if (! empty($conf->global->COMMANDE_ADDON_PDF))
-			{
+		if (! dol_strlen($modele)) {
+
+			$modele = 'einstein';
+
+			if ($this->modelpdf) {
+				$modele = $this->modelpdf;
+			} elseif (! empty($conf->global->COMMANDE_ADDON_PDF)) {
 				$modele = $conf->global->COMMANDE_ADDON_PDF;
 			}
-			else
-			{
-				$modele = 'einstein';
-			}
 		}
 
 		$modelpath = "core/modules/commande/doc/";

+ 1 - 1
htdocs/commande/customer.php

@@ -97,7 +97,7 @@ $sql.= " GROUP BY s.nom";
 $sql.= $db->order($sortfield,$sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
 	$result = $db->query($sql);

+ 1 - 0
htdocs/commande/document.php

@@ -182,6 +182,7 @@ if ($id > 0 || ! empty($ref))
 else
 {
 	header('Location: index.php');
+	exit;
 }
 
 

+ 1 - 1
htdocs/commande/list.php

@@ -560,7 +560,7 @@ $sql.=$hookmanager->resPrint;
 $sql.= $db->order($sortfield,$sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
 	$result = $db->query($sql);

+ 1 - 1
htdocs/commande/orderstoinvoice.php

@@ -421,7 +421,7 @@ if ($action == 'create' && !$error)
 	print '</tr>'."\n";
 
 	// Type
-	print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
+	print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
 	print '<table class="nobordernopadding">'."\n";
 
 	// Standard invoice

+ 44 - 47
htdocs/commande/stats/index.php

@@ -259,52 +259,50 @@ dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
 print '<div class="fichecenter"><div class="fichethirdleft">';
 
 
-//if (empty($socid))
-//{
-	// Show filter box
-	print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
-	print '<input type="hidden" name="mode" value="'.$mode.'">';
-	print '<table class="noborder" width="100%">';
-	print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
-	// Company
-	print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
-	if ($mode == 'customer') $filter='s.client in (1,2,3)';
-	if ($mode == 'supplier') $filter='s.fournisseur = 1';
-	print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
-	print '</td></tr>';
-	// User
-	print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
-	print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
-	// Status
-	print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
-	if ($mode == 'customer')
-	{
-	    $liststatus=array(
-	        Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"),
-	        Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
-	        Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"),
-	        Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
-	        Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
-	    );
-	    print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4);
-	}
-	if ($mode == 'supplier')
-	{
-	    $formorder->selectSupplierOrderStatus((strstr($object_status, ',')?-1:$object_status), 0, 'object_status');
-	}
-	print '</td></tr>';
-	// Year
-	print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
-	if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
-	if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
-	arsort($arrayyears);
-	print $form->selectarray('year',$arrayyears,$year,0);
-	print '</td></tr>';
-	print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
-	print '</table>';
-	print '</form>';
-	print '<br><br>';
-//}
+// Show filter box
+print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
+print '<input type="hidden" name="mode" value="'.$mode.'">';
+print '<table class="noborder" width="100%">';
+print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
+// Company
+print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
+if ($mode == 'customer') $filter='s.client in (1,2,3)';
+if ($mode == 'supplier') $filter='s.fournisseur = 1';
+print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
+print '</td></tr>';
+// User
+print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
+print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
+// Status
+print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
+if ($mode == 'customer')
+{
+    $liststatus=array(
+        Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"),
+        Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
+        Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"),
+        Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
+        Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
+    );
+    print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4);
+}
+if ($mode == 'supplier')
+{
+    $formorder->selectSupplierOrderStatus((strstr($object_status, ',')?-1:$object_status), 0, 'object_status');
+}
+print '</td></tr>';
+// Year
+print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
+if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
+if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
+arsort($arrayyears);
+print $form->selectarray('year',$arrayyears,$year,0);
+print '</td></tr>';
+print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
+print '</table>';
+print '</form>';
+print '<br><br>';
+
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre" height="24">';
@@ -328,7 +326,6 @@ foreach ($data as $val)
 		$var=!$var;
 		print '<tr '.$bc[$var].' height="24">';
 		print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
-
 		print '<td align="right">0</td>';
 		print '<td align="right"></td>';
 		print '<td align="right">0</td>';

+ 3 - 3
htdocs/compta/bank/annuel.php

@@ -188,7 +188,7 @@ print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
 for ($annee = $year_start ; $annee <= $year_end ; $annee++)
 {
-	print '<td align="center" width="20%" colspan="2">'.$annee.'</td>';
+	print '<td align="center" width="20%" colspan="2" class="liste_titre borderrightlight">'.$annee.'</td>';
 }
 print '</tr>';
 
@@ -196,7 +196,7 @@ print '<tr class="liste_titre">';
 print '<td class="liste_titre">&nbsp;</td>';
 for ($annee = $year_start ; $annee <= $year_end ; $annee++)
 {
-	print '<td align="right">'.$langs->trans("Debit").'</td><td align="right">'.$langs->trans("Credit").'</td>';
+	print '<td class="liste_titre" align="center">'.$langs->trans("Debit").'</td><td class="liste_titre" align="center">'.$langs->trans("Credit").'</td>';
 }
 print '</tr>';
 
@@ -218,7 +218,7 @@ for ($mois = 1 ; $mois < 13 ; $mois++)
 		}
 		print "</td>";
 
-		print '<td align="right" width="10%">&nbsp;';
+		print '<td align="right" class="borderrightlight" width="10%">&nbsp;';
 		if ($encaiss[$case]>0)
 		{
 			print price($encaiss[$case]);

+ 9 - 8
htdocs/compta/bank/bankentries.php

@@ -5,6 +5,7 @@
  * Copyright (C) 2012       Vinícius Nogueira    <viniciusvgn@gmail.com>
  * Copyright (C) 2014       Florian Henry    	 <florian.henry@open-cooncept.pro>
  * Copyright (C) 2015       Jean-François Ferry	<jfefe@aternatik.fr>
+ * Copyright (C) 2016       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
@@ -502,7 +503,7 @@ $sql.=$hookmanager->resPrint;
 
 $sql.= $db->order($sortfield,$sortorder);
 
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 $nbtotalofpages = 0;
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
@@ -621,7 +622,7 @@ if ($resql)
 	                $last_ok=1;
 	            }
 	            $i++;
-	            $liste='<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$acct->id.'&amp;num='.$objr->num_releve.'">'.$objr->num_releve.'</a> &nbsp; '.$liste;
+	            $liste='<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$id.'&amp;num='.$objr->num_releve.'">'.$objr->num_releve.'</a> &nbsp; '.$liste;
 	        }
 	        if ($numr >= $nbmax) $liste="... &nbsp; ".$liste;
 	        print $liste;
@@ -773,7 +774,7 @@ if ($resql)
 	if (! empty($arrayfields['ba.ref']['checked']))             print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
 	if (! empty($arrayfields['b.debit']['checked']))            print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
 	if (! empty($arrayfields['b.credit']['checked']))           print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
-	if (! empty($arrayfields['balance']['checked']))            print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'balance','',$param,'align="right"',$sortfield,$sortorder);
+	if (! empty($arrayfields['balance']['checked']))            print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
 	if (! empty($arrayfields['b.num_releve']['checked']))       print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
 	// Extra fields
 	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@@ -1208,7 +1209,7 @@ if ($resql)
         	{
             	if ($objp->rappro)  // If line not conciliated and account can be conciliated
             	{
-            	    print '<a href="releve.php?num='.$objp->num_releve.'&amp;account='.$object->id.'">'.$objp->num_releve.'</a>';
+            	    print '<a href="releve.php?num='.$objp->num_releve.'&amp;account='.$objp->bankid.'">'.$objp->num_releve.'</a>';
             	}
             	else if ($action == 'reconcile')
             	{ 
@@ -1224,7 +1225,7 @@ if ($resql)
     	// Transaction reconciliated or edit link
     	if ($objp->rappro && $bankaccount->canBeConciliated() > 0)  // If line not conciliated and account can be conciliated
     	{
-    	    print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'&amp;page='.$page.'">';
+    	    print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
     	    print img_edit();
     	    print '</a>';
     	}
@@ -1232,13 +1233,13 @@ if ($resql)
     	{
     	    if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
     	    {
-    	        print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'&amp;page='.$page.'">';
+    	        print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
     	        print img_edit();
     	        print '</a>';
     	    }
     	    else
     	    {
-    	        print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'&amp;page='.$page.'">';
+    	        print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
     	        print img_view();
     	        print '</a>';
     	    }
@@ -1252,7 +1253,7 @@ if ($resql)
     	    print '&nbsp;';
     	    if ($user->rights->banque->modifier)
     	    {
-    	        print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;rowid='.$objp->rowid.'&amp;id='.$object->id.'&amp;page='.$page.'">';
+    	        print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&amp;rowid='.$objp->rowid.'&amp;id='.$objp->bankid.'&amp;page='.$page.'">';
     	        print img_delete();
     	        print '</a>';
     	    }

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

@@ -662,7 +662,7 @@ class Account extends CommonObject
      *
      *    	@param	User	$user       Object user making action
      *      @param  int     $notrigger  1=Disable triggers
-     *		@return	int					<0 si ko, >0 si ok
+     *		@return	int					<0 if KO, >0 if OK
      */
     function update(User $user = null, $notrigger = 0)
     {

+ 9 - 73
htdocs/compta/bank/document.php

@@ -81,59 +81,13 @@ if ($id)
  * Actions
  */
 
-// Envoi fichier
-if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
-    if ($object->fetch($id)) {
-
-        $upload_dir = $conf->bank->dir_output . "/" . $object->ref;
-
-        if (dol_mkdir($upload_dir) >= 0) {
-            $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'],
-                    $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),
-                    0, 0, $_FILES['userfile']['error']);
-            if (is_numeric($resupload) && $resupload > 0) {
-                if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) 
-                {
-                    // Create thumbs
-                    $object->addThumbs($upload_dir . "/" . $_FILES['userfile']['name']);
-                }
-                $mesg = '<div class="ok">' . $langs->trans("FileTransferComplete") . '</div>';
-            }
-            else {
-                $langs->load("errors");
-                if ($resupload < 0) { // Unknown error
-                    $mesg = '<div class="error">' . $langs->trans("ErrorFileNotUploaded") . '</div>';
-                }
-                else if (preg_match('/ErrorFileIsInfectedWithAVirus/',
-                                $resupload)) { // Files infected by a virus
-                    $mesg = '<div class="error">' . $langs->trans("ErrorFileIsInfectedWithAVirus") . '</div>';
-                }
-                else { // Known error
-                    $mesg = '<div class="error">' . $langs->trans($resupload) . '</div>';
-                }
-            }
-        }
-    }
+if ($object->id > 0)
+{
+    $object->fetch_thirdparty();
+    $upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref);
 }
 
-// Delete
-else if ($action == 'confirm_deletefile' && $confirm == 'yes') {
-    if ($object->fetch($id)) {
-
-        $upload_dir = $conf->bank->dir_output;
-        $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
-        
-            $ret = dol_delete_file($file, 0, 0, 0, $object);
-            if ($ret) {
-                setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
-            } else {
-                setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
-            }
-            
-        Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
-        exit;
-    }
-}
+include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
 
 
 /*
@@ -182,30 +136,12 @@ if ($id > 0 || !empty($ref)) {
         
         dol_fiche_end();
 
-        dol_htmloutput_mesg($mesg, $mesgs);
-
         
-        /*
-         * Confirmation suppression fichier
-         */
-        if ($action == 'delete') {
-            $ret = $form->form_confirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode($_GET["urlfile"]),
-                    $langs->trans('DeleteFile'),
-                    $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile',
-                    '', 0, 1);
-            if ($ret == 'html')
-                print '<br>';
-        }
-
-        // Affiche formulaire upload
-        $formfile = new FormFile($db);
-        $formfile->form_attach_new_file(DOL_URL_ROOT . '/compta/bank/document.php?id=' . $object->id,
-                '', 0, 0, $user->rights->banque, 50, $object);
-
-
-        // List of document
+        $modulepart = 'bank';
+        $permission = $user->rights->banque->modifier;
+        $permtoedit = $user->rights->banque->modifier;
         $param = '&id=' . $object->id;
-        $formfile->list_of_documents($filearray, $object, 'bank', $param);
+        include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
     }
     else {
         dol_print_error($db);

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

@@ -175,7 +175,7 @@ $sql.=$hookmanager->resPrint;
 $sql.= $db->order($sortfield,$sortorder);
 
 // Count total nb of records
-$nbtotalofrecords = -1;
+$nbtotalofrecords = '';
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
 {
     $result = $db->query($sql);

Some files were not shown because too many files changed in this diff