diff -Nru dolibarr-3.5.4+dfsg2/build/debian/changelog dolibarr-3.5.5+dfsg1/build/debian/changelog
--- dolibarr-3.5.4+dfsg2/build/debian/changelog	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/debian/changelog	2014-09-23 09:18:23.000000000 +0200
@@ -1,3 +1,10 @@
+dolibarr (3.5.5-3) unstable; urgency=low
+
+  [ Laurent Destailleur (eldy) ]
+  * New upstream release.
+    
+ -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net>  Tue, 8 July 2014 12:00:00 +0100     
+
 dolibarr (3.5.4-3) unstable; urgency=low
 
   [ Laurent Destailleur (eldy) ]
diff -Nru dolibarr-3.5.4+dfsg2/build/debian/control dolibarr-3.5.5+dfsg1/build/debian/control
--- dolibarr-3.5.4+dfsg2/build/debian/control	2014-04-12 01:32:02.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/debian/control	2014-09-23 09:18:23.000000000 +0200
@@ -39,10 +39,10 @@
  It's a web software you can install as a standalone program or on any web
  hosting provider to use it from anywhere with any web browser.
  .
- Dolibarr was designed to be easy to use. Only the features that you need are 
- visible, depending on which modules were activated.
+ Dolibarr was designed to be easy to use. Only the features that you need
+ are visible, depending on which modules were activated.
  .
- Most common used modules are:
+ This is an example of most common used modules:
  .
  Customers, Suppliers or Prospects directory,
  Contacts directory,
@@ -66,6 +66,6 @@
  Wizards to export and import data,
  LDAP connectivity,
  PDF exports,
- And a lot of more modules...
+ And a lot more modules...
  .
- You can also add third parties external modules or develop yours.
+ You can also add external modules from third parties or develop yours.
diff -Nru dolibarr-3.5.4+dfsg2/build/debian/copyright dolibarr-3.5.5+dfsg1/build/debian/copyright
--- dolibarr-3.5.4+dfsg2/build/debian/copyright	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/debian/copyright	2014-09-23 09:18:23.000000000 +0200
@@ -61,7 +61,7 @@
 Files: htdocs/includes/adodbtime/*
 Copyright: 2003-2005, John Lim
            unknown, jackbbs
-License: BSD
+License: BSD-3-Clause
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:
@@ -272,7 +272,7 @@
 
 Files: htdocs/includes/jquery/plugins/flot/*
 Copyright: Flot team
-License: Public Domain
+License: Public-Domain
  This work is not subject to copyright in any jurisdiction
 Comment:
  Those files are not shipped in the binary package because we configure
diff -Nru dolibarr-3.5.4+dfsg2/build/debian/dolibarr.postinst dolibarr-3.5.5+dfsg1/build/debian/dolibarr.postinst
--- dolibarr-3.5.4+dfsg2/build/debian/dolibarr.postinst	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/debian/dolibarr.postinst	2014-09-23 09:18:23.000000000 +0200
@@ -131,19 +131,19 @@
 			setup_empty_conf
 		else
 			# File already exist. We add params not found.
-			echo Add new params to overwrite path to use shared libraries/fonts
-			grep -q -c "dolibarr_lib_ADODB_PATH" $config    || [ ! -d "/usr/share/php/adodb" ]  || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
-			grep -q -c "dolibarr_lib_FPDI_PATH" $config     || [ ! -d "/usr/share/php/fpdi" ]   || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
-			#grep -q -c "dolibarr_lib_GEOIP_PATH" $config    || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
-			grep -q -c "dolibarr_lib_NUSOAP_PATH" $config   || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
-			grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ]  || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
-			#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
-			#grep -q -c "dolibarr_lib_TCPDF_PATH" $config    || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
-			grep -q -c "dolibarr_js_CKEDITOR" $config       || [ ! -d "/usr/share/javascript/ckeditor" ]  || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
-			grep -q -c "dolibarr_js_JQUERY" $config         || [ ! -d "/usr/share/javascript/jquery" ]    || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
-			grep -q -c "dolibarr_js_JQUERY_UI" $config      || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
-			grep -q -c "dolibarr_js_JQUERY_FLOT" $config    || [ ! -d "/usr/share/javascript/flot" ]      || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
-			grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config			
+			#echo Add new params to overwrite path to use shared libraries/fonts
+			#grep -q -c "dolibarr_lib_ADODB_PATH" $config    || [ ! -d "/usr/share/php/adodb" ]  || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
+			#grep -q -c "dolibarr_lib_FPDI_PATH" $config     || [ ! -d "/usr/share/php/fpdi" ]   || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
+			##grep -q -c "dolibarr_lib_GEOIP_PATH" $config    || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
+			#grep -q -c "dolibarr_lib_NUSOAP_PATH" $config   || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
+			#grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ]  || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
+			##grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
+			##grep -q -c "dolibarr_lib_TCPDF_PATH" $config    || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
+			#grep -q -c "dolibarr_js_CKEDITOR" $config       || [ ! -d "/usr/share/javascript/ckeditor" ]  || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
+			#grep -q -c "dolibarr_js_JQUERY" $config         || [ ! -d "/usr/share/javascript/jquery" ]    || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config
+			#grep -q -c "dolibarr_js_JQUERY_UI" $config      || [ ! -d "/usr/share/javascript/jquery-ui" ] || echo "<?php \$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; ?>" >> $config
+			#grep -q -c "dolibarr_js_JQUERY_FLOT" $config    || [ ! -d "/usr/share/javascript/flot" ]      || echo "<?php \$dolibarr_js_JQUERY_FLOT='/javascript/flot'; ?>" >> $config
+			#grep -q -c "dolibarr_font_DOL_DEFAULT_TTF_BOLD" $config || echo "<?php \$dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf'; ?>" >> $config			
 		fi
 	
 		db_get dolibarr/reconfigure-webserver
diff -Nru dolibarr-3.5.4+dfsg2/build/debian/get-orig-source.sh dolibarr-3.5.5+dfsg1/build/debian/get-orig-source.sh
--- dolibarr-3.5.4+dfsg2/build/debian/get-orig-source.sh	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/debian/get-orig-source.sh	2014-09-23 09:18:23.000000000 +0200
@@ -8,16 +8,20 @@
 if [ -n "$1" ]; then
     uscan_opts="--download-version=$1"
 fi
-uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
+#uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
 
 cd $tmpdir
 
+# Other method to download (comment uscan if you use this)
+wget http://www.dolibarr.org/files/stable/standard/dolibarr-3.5.4.tgz
+
+# Rename file to add +dfsg
 tgzfile=$(echo *.tgz)
 version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ')
 
 cd - >/dev/null
 
 mv $tmpdir/dolibarr-${version}.tgz ../
-echo "File ../dolibarr-${version}.tgz is ready for git-import"
+echo "File ../dolibarr-${version}.tgz is ready for git-import-orig"
 
 rm -rf $tmpdir
diff -Nru dolibarr-3.5.4+dfsg2/build/doxygen/dolibarr-doxygen-build.pl dolibarr-3.5.5+dfsg1/build/doxygen/dolibarr-doxygen-build.pl
--- dolibarr-3.5.4+dfsg2/build/doxygen/dolibarr-doxygen-build.pl	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/doxygen/dolibarr-doxygen-build.pl	2014-09-23 09:18:23.000000000 +0200
@@ -30,8 +30,25 @@
     exit 1;   
 }
 
-print "Running doxygen, please wait...\n";
-$result=`doxygen $OPTIONS $CONFFILE 2>&1`;
+$SOURCE="../..";
+
+# Get version $MAJOR, $MINOR and $BUILD
+$result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" );
+if ( !$result ) { die "Error: Can't open descriptor file " . $SOURCE . "/htdocs/filefunc.inc.php\n"; }
+while (<IN>) {
+	if ( $_ =~ /define\('DOL_VERSION','([\d\.a-z\-]+)'\)/ ) { $PROJVERSION = $1; break; }
+}
+close IN;
+($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
+if ($MINOR eq '') { die "Error can't detect version into ".$SOURCE . "/htdocs/filefunc.inc.php"; }
+
+
+$version=$MAJOR.".".$MINOR.".".$BUILD;
+
+
+print "Running doxygen for version ".$version.", please wait...\n";
+print "cat $CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n";
+$result=`cat $CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
 
 print $result;
 
diff -Nru dolibarr-3.5.4+dfsg2/build/doxygen/dolibarr-doxygen.doxyfile dolibarr-3.5.5+dfsg1/build/doxygen/dolibarr-doxygen.doxyfile
--- dolibarr-3.5.4+dfsg2/build/doxygen/dolibarr-doxygen.doxyfile	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/doxygen/dolibarr-doxygen.doxyfile	2014-09-23 09:18:23.000000000 +0200
@@ -31,7 +31,7 @@
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER = 3.5.3
+PROJECT_NUMBER = x.y.z
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.
diff -Nru dolibarr-3.5.4+dfsg2/build/doxygen/doxygen_header.html dolibarr-3.5.5+dfsg1/build/doxygen/doxygen_header.html
--- dolibarr-3.5.4+dfsg2/build/doxygen/doxygen_header.html	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/doxygen/doxygen_header.html	2014-09-23 09:18:23.000000000 +0200
@@ -35,15 +35,15 @@
 				<div class="bannergroupmybanner">
 
 				<div class="banneritemmybanner">
-<script type="text/javascript"><!--
-google_ad_client = "pub-1071905880519467";
-/* PUBBANDEAUDOLIBARR */
-google_ad_slot = "1421205532";
-google_ad_width = 468;
-google_ad_height = 60;
-//-->
+<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
+<!-- BAN_728x90_DOXYGEN -->
+<ins class="adsbygoogle"
+     style="display:inline-block;width:728px;height:90px"
+     data-ad-client="ca-pub-1465985984238664"
+     data-ad-slot="4297390217"></ins>
+<script>
+(adsbygoogle = window.adsbygoogle || []).push({});
 </script>
-<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
 				<div class="clr"></div>
 				</div>
 
diff -Nru dolibarr-3.5.4+dfsg2/build/makepack-dolibarr.pl dolibarr-3.5.5+dfsg1/build/makepack-dolibarr.pl
--- dolibarr-3.5.4+dfsg2/build/makepack-dolibarr.pl	2014-07-14 23:46:50.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/makepack-dolibarr.pl	2014-10-03 19:07:35.000000000 +0200
@@ -434,6 +434,7 @@
 	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
 	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
 	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
+	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
 	    $ret=`rm -fr $BUILDROOT/$PROJECT/test`;
 	    $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
 	    $ret=`rm -f  $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
diff -Nru dolibarr-3.5.4+dfsg2/build/makepack-howto.txt dolibarr-3.5.5+dfsg1/build/makepack-howto.txt
--- dolibarr-3.5.4+dfsg2/build/makepack-howto.txt	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/makepack-howto.txt	2014-09-23 09:18:23.000000000 +0200
@@ -13,8 +13,7 @@
 - Update version number with x.y.z-w in build/debian/changelog
 - Update version number with x.y.z-w in build/exe/doliwamp/doliwamp.iss
 - Update version number with x.y.z-w in build/rpm/*.spec
-- Update version number with x.y.z   in build/doxygen/dolibarr-doxygen.doxyfile
-- Update version number with x.y.z   in build/perl/virtualmin/dolibarr.pl
+- Update version number with x.y     in build/doxygen/dolibarr-doxygen.doxyfile
 - Commit all changes.
 - Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
 - Create a branch (x.y).
diff -Nru dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_fedora.spec dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_fedora.spec
--- dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_fedora.spec	2014-07-11 12:39:17.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_fedora.spec	2014-09-23 09:18:23.000000000 +0200
@@ -331,6 +331,9 @@
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
+* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
+- Upstream release
+
 * Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
diff -Nru dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_generic.spec dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_generic.spec
--- dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_generic.spec	2014-07-11 12:39:22.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_generic.spec	2014-09-23 09:18:23.000000000 +0200
@@ -567,6 +567,9 @@
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
+* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
+- Upstream release
+
 * Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
diff -Nru dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_mandriva.spec dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_mandriva.spec
--- dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_mandriva.spec	2014-07-11 12:39:28.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_mandriva.spec	2014-09-23 09:18:23.000000000 +0200
@@ -336,6 +336,9 @@
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
+* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
+- Upstream release
+
 * Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
diff -Nru dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_opensuse.spec dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_opensuse.spec
--- dolibarr-3.5.4+dfsg2/build/rpm/dolibarr_opensuse.spec	2014-07-11 12:39:33.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_opensuse.spec	2014-09-23 09:18:23.000000000 +0200
@@ -347,6 +347,9 @@
 
 # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
 %changelog
+* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3
+- Upstream release
+
 * Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3
 - Upstream release
 
diff -Nru dolibarr-3.5.4+dfsg2/ChangeLog dolibarr-3.5.5+dfsg1/ChangeLog
--- dolibarr-3.5.4+dfsg2/ChangeLog	2014-07-14 23:11:17.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/ChangeLog	2014-09-23 09:18:23.000000000 +0200
@@ -2,6 +2,36 @@
 English Dolibarr ChangeLog
 --------------------------------------------------------------
 
+***** ChangeLog for 3.5.5 compared to 3.5.4 *****
+Fix: Holiday module was broken. Initializaion of amount of holidays failed.
+Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.
+Fix: Fusion PDF button on unpaid invoice is no more displayed.
+Fix: Unpaid invoice launch fusion PDF action even if it is only search (with enter keyboard input instead of lens click).
+Fix: Pb when showing log list of holiday module with some mysql versions.
+Fix: Error with bad timezone pushed by some browsers.
+Fix: shipping list SQL request was not filtering on shipping element
+Fix: debian package provided by dolibarr team must use embedded libraries.
+Fix: [ bug #1528 ] Leopard Services numeration module description is not translated.
+Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.
+Fix: [ bug #1534 ] Unknown error when deleting a product photo under special circumstances.
+Fix: Update impayees.php
+Fix: Link product, In list view and label product.
+Fix: visible task into area "time" for "My task" must limit task to tasks i am assigned to.
+Fix: When disabled, all fields to add time into task line must be disabled.
+Fix: Missing include files.lib.php in some pages to use dol_delete_recursive.
+Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old ref.
+Fix: [ bug #1553 ] Saving User displays setup removes menu.
+Fix: [ bug #1544 ] Can remove date from invoice.
+Fix: list event view lost type event filter.
+Fix: Add code save on create event.
+Fix: SQL injection.
+Fix: [ bug #1589 ] Menu type in "Edit menu" page is not translated
+Fix: [ bug #1591 ] Linked object block shows Total HT/TTC even if not having permission to read them
+Fix: [ bug #1577 ] When creating new Private individual third, selected third type is ignored
+Fix: [ bug #1555 ] Update accountancy code of products does not throw PRODUCT_MODIFY trigger
+Fix: [ bug #1548 ] Supplier payment card shows type in French
+Fix: [ bug #1546 ] Incorrect page number when searching in the list of bank transactions
+
 ***** ChangeLog for 3.5.4 compared to 3.5.3 *****
 Fix: Hide title of event when agenda module disabled.
 Fix: When using option MAIN_MAIL_ALLOW_SENDMAIL_F, a mail was sent to sender.
@@ -318,6 +348,7 @@
 Fix: [ bug #1212 ] 'jqueryFileTree.php' directory traversal vulnerability
 Fix: Agenda and Banks module were not working with multicompany module
 Fix: [ bug #1317 ] Removing a category does not remove all child categories
+Fix: [ bug #1380 ] Customer invoices are not grouped in company results report.
 
 ***** ChangeLog for 3.4.2 compared to 3.4.1 *****
 Fix: field's problem into company's page (RIB).
diff -Nru dolibarr-3.5.4+dfsg2/debian/changelog dolibarr-3.5.5+dfsg1/debian/changelog
--- dolibarr-3.5.4+dfsg2/debian/changelog	2014-09-14 14:26:57.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/debian/changelog	2014-12-07 15:52:53.000000000 +0100
@@ -1,3 +1,11 @@
+dolibarr (3.5.5+dfsg1-1) unstable; urgency=medium
+
+  * New upstream release with 3.5.5
+  * Fixed security CVE-2014-7137 (Closes: #770313)
+  * Fixed typo error (Closes: #761936)
+
+ -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net>  Fri, 05 Dec 2014 18:24:54 +0100
+
 dolibarr (3.5.4+dfsg2-1) unstable; urgency=medium
 
   * Reimport upstream an revert a change done into an original file
diff -Nru dolibarr-3.5.4+dfsg2/debian/control dolibarr-3.5.5+dfsg1/debian/control
--- dolibarr-3.5.4+dfsg2/debian/control	2014-09-14 14:26:57.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/debian/control	2014-12-07 15:52:53.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
 Uploaders: Raphaël Hertzog <hertzog@debian.org>
-Standards-Version: 3.9.5
+Standards-Version: 3.9.6
 Homepage: http://www.dolibarr.org
 Build-Depends: debhelper (>= 9), dh-linktree, libjs-jquery-cookie
 Vcs-Git: git://anonscm.debian.org/collab-maint/dolibarr.git
@@ -64,4 +64,4 @@
   * PDF exports,
   * And a lot more modules...
  .
- You can also add third parties external modules or develop yours.
+ You can also add external modules from third parties or develop yours.
diff -Nru dolibarr-3.5.4+dfsg2/debian/copyright dolibarr-3.5.5+dfsg1/debian/copyright
--- dolibarr-3.5.4+dfsg2/debian/copyright	2014-09-14 14:26:57.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/debian/copyright	2014-12-07 15:52:53.000000000 +0100
@@ -64,7 +64,7 @@
 Files: htdocs/includes/adodbtime/*
 Copyright: 2003-2005, John Lim
            unknown, jackbbs
-License: BSD
+License: BSD-3-Clause
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:
@@ -274,7 +274,7 @@
 
 Files: htdocs/includes/jquery/plugins/flot/*
 Copyright: Flot team
-License: Public Domain
+License: Public-Domain
  This work is not subject to copyright in any jurisdiction
 Comment:
  Those files are not shipped in the binary package because we configure
diff -Nru dolibarr-3.5.4+dfsg2/debian/get-orig-source.sh dolibarr-3.5.5+dfsg1/debian/get-orig-source.sh
--- dolibarr-3.5.4+dfsg2/debian/get-orig-source.sh	2014-09-14 14:26:57.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/debian/get-orig-source.sh	2014-12-07 15:52:53.000000000 +0100
@@ -8,12 +8,13 @@
 if [ -n "$1" ]; then
     uscan_opts="--download-version=$1"
 fi
-#uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
+echo uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
+uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_opts
 
 cd $tmpdir
 
 # Other method to download (comment uscan if you use this)
-wget http://www.dolibarr.org/files/stable/standard/dolibarr-3.5.4.tgz
+#wget http://www.dolibarr.org/files/stable/standard/dolibarr-$1.tgz
 
 # Rename file to add +dfsg
 tgzfile=$(echo *.tgz)
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/adherents/class/adherent.class.php dolibarr-3.5.5+dfsg1/htdocs/adherents/class/adherent.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/adherents/class/adherent.class.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/adherents/class/adherent.class.php	2014-09-23 09:18:23.000000000 +0200
@@ -1072,7 +1072,7 @@
         if ($rowid) $sql.= " AND d.rowid=".$rowid;
         elseif ($ref || $fk_soc) {
         	$sql.= " AND d.entity IN (".getEntity().")";
-        	if ($ref) $sql.= " AND d.rowid='".$ref."'";
+        	if ($ref) $sql.= " AND d.rowid='".$this->db->escape($ref)."'";
         	elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'";
         }
         elseif ($ref_ext)
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/adherents/fiche.php dolibarr-3.5.5+dfsg1/htdocs/adherents/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/adherents/fiche.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/adherents/fiche.php	2014-09-23 09:18:23.000000000 +0200
@@ -328,6 +328,7 @@
 			{
 				if (GETPOST('deletephoto'))
 				{
+					require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
 					$fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/'.$object->photo;
 					$dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/thumbs';
 					dol_delete_file($fileimg);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/adherents/liste.php dolibarr-3.5.5+dfsg1/htdocs/adherents/liste.php
--- dolibarr-3.5.4+dfsg2/htdocs/adherents/liste.php	2014-04-09 00:10:42.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/adherents/liste.php	2014-09-23 09:18:23.000000000 +0200
@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2002-2003 Jean-Louis Bergamo   <jlb@j1b.org>
- * Copyright (C) 2004-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2014 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2013      Raphaël Doursenaud   <rdoursenaud@gpcsolutions.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -118,24 +118,24 @@
 }
 if (isset($_GET["statut"]) || isset($_POST["statut"]))
 {
-	$sql.=" AND d.statut in (".$statut.")";     // Peut valoir un nombre ou liste de nombre separes par virgules
+	$sql.=" AND d.statut in (".$db->escape($statut).")";     // Peut valoir un nombre ou liste de nombre separes par virgules
 }
 if ($search_ref)
 {
-	if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$search_ref.")";
+	if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
 	else $sql.=" AND 1 = 2";    // Always wrong
 }
 if ($search_lastname)
 {
-	$sql.= " AND (d.firstname LIKE '%".$search_lastname."%' OR d.lastname LIKE '%".$search_lastname."%')";
+	$sql.= " AND (d.firstname LIKE '%".$db->escape($search_lastname)."%' OR d.lastname LIKE '%".$db->escape($search_lastname)."%')";
 }
 if ($search_login)
 {
-	$sql.= " AND d.login LIKE '%".$search_login."%'";
+	$sql.= " AND d.login LIKE '%".$db->escape($search_logi)."%'";
 }
 if ($search_email)
 {
-	$sql.= " AND (d.email LIKE '%".$search_email."%')";
+	$sql.= " AND (d.email LIKE '%".$db->escape($search_email)."%')";
 }
 if ($filter == 'uptodate')
 {
@@ -188,7 +188,7 @@
 	}
 
 	$param="";
-	if (isset($_GET["statut"]))       $param.="&statut=".$statut;
+	if ($statut != "") $param.="&statut=".$statut;
 	if ($search_nom)   $param.="&search_nom=".$search_nom;
 	if ($search_login) $param.="&search_login=".$search_login;
 	if ($search_email) $param.="&search_email=".$search_email;
@@ -201,7 +201,7 @@
 		print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
 	}
 
-	print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].($param?'?'.$param:'').'">';
 	print "<table class=\"noborder\" width=\"100%\">";
 
 	// Filter on categories
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/admin/menus/edit.php dolibarr-3.5.5+dfsg1/htdocs/admin/menus/edit.php
--- dolibarr-3.5.4+dfsg2/htdocs/admin/menus/edit.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/admin/menus/edit.php	2014-09-23 09:18:23.000000000 +0200
@@ -317,7 +317,7 @@
     print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>';
     if ($parent_rowid)
     {
-        print 'Left';
+        print $langs->trans('Left');
         print '<input type="hidden" name="type" value="left">';
     }
     else
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/admin/tools/update.php dolibarr-3.5.5+dfsg1/htdocs/admin/tools/update.php
--- dolibarr-3.5.4+dfsg2/htdocs/admin/tools/update.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/admin/tools/update.php	2014-09-23 09:18:23.000000000 +0200
@@ -23,7 +23,7 @@
  */
 
 require '../../main.inc.php';
-include_once $dolibarr_main_document_root.'/core/lib/files.lib.php';
+include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
 
 $langs->load("admin");
 $langs->load("other");
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/cashdesk/index.php dolibarr-3.5.5+dfsg1/htdocs/cashdesk/index.php
--- dolibarr-3.5.4+dfsg2/htdocs/cashdesk/index.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/cashdesk/index.php	2014-09-23 09:18:23.000000000 +0200
@@ -39,6 +39,7 @@
 }
 
 $usertxt=GETPOST('user','',1);
+$err=GETPOST("err");
 
 
 /*
@@ -64,7 +65,7 @@
 
 <div class="contenu">
 <div class="principal_login">
-<?php if (! empty($_GET["err"])) print $_GET["err"]."<br><br>\n"; ?>
+<?php if ($err) print dol_escape_htmltag($err)."<br><br>\n"; ?>
 <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend>
 <form id="frmLogin" method="POST" action="index_verif.php">
 	<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/categories/class/categorie.class.php dolibarr-3.5.5+dfsg1/htdocs/categories/class/categorie.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/categories/class/categorie.class.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/categories/class/categorie.class.php	2014-09-23 09:18:23.000000000 +0200
@@ -1122,12 +1122,29 @@
 	{
 		$cats = array();
 
-		$table=''; $type='';
-		if ($typeid == 0 || $typeid == 'product')         { $typeid=0; $table='product'; $type='product'; }
-		else if ($typeid == 1 || $typeid == 'supplier')  { $typeid=1; $table='societe'; $type='fournisseur'; }
-		else if ($typeid == 2 || $typeid == 'customer')  { $typeid=2; $table='societe'; $type='societe'; }
-		else if ($typeid == 3 || $typeid == 'member')    { $typeid=3; $table='member';  $type='member'; }
-        else if ($typeid == 4 || $typeid == 'contact')    { $typeid=4; $table='socpeople';  $type='contact'; }
+        $table = '';
+        $type = '';
+        if ($typeid === 0 || $typeid === '0' || $typeid == 'product') {
+            $typeid = 0;
+            $table = 'product';
+            $type = 'product';
+        } else if ($typeid === 1 || $typeid === '1' || $typeid == 'supplier') {
+            $typeid = 1;
+            $table = 'societe';
+            $type = 'fournisseur';
+        } else if ($typeid === 2 || $typeid === '2' || $typeid == 'customer') {
+            $typeid = 2;
+            $table = 'societe';
+            $type = 'societe';
+        } else if ($typeid === 3 || $typeid === '3' || $typeid == 'member') {
+            $typeid = 3;
+            $table = 'member';
+            $type = 'member';
+        } else if ($typeid === 4 || $typeid === '4' || $typeid == 'contact') {
+            $typeid = 4;
+            $table = 'socpeople';
+            $type = 'contact';
+        }
 
 		$sql = "SELECT ct.fk_categorie, c.label";
 		$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c";
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/categories/fiche.php dolibarr-3.5.5+dfsg1/htdocs/categories/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/categories/fiche.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/categories/fiche.php	2014-09-23 09:18:23.000000000 +0200
@@ -132,7 +132,7 @@
 	// Create category in database
 	if (! $error)
 	{
-		$result = $object->create();
+		$result = $object->create($user);
 		if ($result > 0)
 		{
 			$action = 'confirmed';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/comm/action/class/actioncomm.class.php dolibarr-3.5.5+dfsg1/htdocs/comm/action/class/actioncomm.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/comm/action/class/actioncomm.class.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/comm/action/class/actioncomm.class.php	2014-09-23 09:18:23.000000000 +0200
@@ -140,6 +140,7 @@
             if ($result > 0)
             {
                 $this->type_id=$cactioncomm->id;
+                $this->code=$cactioncomm->code;
             }
             else if ($result == 0)
             {
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/comm/action/listactions.php dolibarr-3.5.5+dfsg1/htdocs/comm/action/listactions.php
--- dolibarr-3.5.4+dfsg2/htdocs/comm/action/listactions.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/comm/action/listactions.php	2014-09-23 09:18:23.000000000 +0200
@@ -211,7 +211,7 @@
     $head = calendars_prepare_head('');
 
     dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list');
-    print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1);
+    print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1,$actioncode);
     dol_fiche_end();
 
     // Add link to show birthdays
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/comm/propal/class/propal.class.php dolibarr-3.5.5+dfsg1/htdocs/comm/propal/class/propal.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/comm/propal/class/propal.class.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/comm/propal/class/propal.class.php	2014-09-26 13:24:15.000000000 +0200
@@ -8,7 +8,7 @@
  * Copyright (C) 2008      Raphael Bertrand			<raphael.bertrand@resultic.fr>
  * Copyright (C) 2010-2013 Juanjo Menent			<jmenent@2byte.es>
  * Copyright (C) 2010-2011 Philippe Grand			<philippe.grand@atoo-net.com>
- * Copyright (C) 2012      Christophe Battarel  	<christophe.battarel@altairis.fr>
+ * Copyright (C) 2012-2014 Christophe Battarel  	<christophe.battarel@altairis.fr>
  * Copyright (C) 2013      Florian Henry		  	<florian.henry@open-concept.pro>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -787,7 +787,10 @@
 							$fk_parent_line,
 							$this->lines[$i]->fk_fournprice,
 							$this->lines[$i]->pa_ht,
-							$this->lines[$i]->label
+							$this->lines[$i]->label,
+                            $this->lines[$i]->date_start,
+							$this->lines[$i]->date_end,
+							$this->lines[$i]->array_options
 						);
 
                         if ($result < 0)
@@ -922,6 +925,10 @@
 
         $this->db->begin();
 
+		// get extrafields so they will be clone
+		foreach($this->lines as $line)
+			$line->fetch_optionals($line->rowid);
+
         // Load source object
         $objFrom = dol_clone($this);
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php dolibarr-3.5.5+dfsg1/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php
--- dolibarr-3.5.4+dfsg2/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,6 +1,7 @@
 <?php
 /* Copyright (C) 2010-2011  Regis Houssin <regis.houssin@capnetworks.com>
- * Copyright (C) 2013		Juanjo Menent <jmenent@2byte.es>
+ * Copyright (C) 2013       Juanjo Menent <jmenent@2byte.es>
+ * Copyright (C) 2014       Marcos García <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +28,8 @@
 
 <?php
 
+global $user;
+
 $langs = $GLOBALS['langs'];
 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
 
@@ -52,17 +55,23 @@
 	<a href="<?php echo DOL_URL_ROOT.'/comm/propal.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowPropal"),"propal").' '.$object->ref; ?></a></td>
 	<td><?php echo $object->ref_client; ?></td>
 	<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
-	<td align="right"><?php echo price($object->total_ht); ?></td>
+	<td align="right"><?php
+		if ($user->rights->propale->lire) {
+			$total = $total + $object->total_ht;
+			echo price($object->total_ht);
+		} ?></td>
 	<td align="right"><?php echo $object->getLibStatut(3); ?></td>
 </tr>
 <?php
-$total = $total + $object->total_ht;
 }
 
 ?>
 <tr class="liste_total">
 	<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
-	<td align="right"><?php echo price($total); ?></td>
+	<td align="right"><?php
+		if ($user->rights->propale->lire) {
+			echo price($total);
+		} ?></td>
 	<td>&nbsp;</td>
 </tr>
 </table>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/comm/propal.php dolibarr-3.5.5+dfsg1/htdocs/comm/propal.php
--- dolibarr-3.5.4+dfsg2/htdocs/comm/propal.php	2014-06-21 00:27:13.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/comm/propal.php	2014-10-03 19:04:41.000000000 +0200
@@ -738,8 +738,6 @@
 					$pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
 					$price_min = $prod->multiprices_min[$object->client->price_level];
 					$price_base_type = $prod->multiprices_base_type[$object->client->price_level];
-					$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
-					$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
 				}
 				else
 				{
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/commande/class/commande.class.php dolibarr-3.5.5+dfsg1/htdocs/commande/class/commande.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/commande/class/commande.class.php	2014-06-25 20:05:51.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/commande/class/commande.class.php	2014-09-26 13:24:15.000000000 +0200
@@ -1,15 +1,15 @@
 <?php
 /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2013 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C) 2005-2014 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2006      Andre Cianfarani     <acianfa@free.fr>
  * Copyright (C) 2010-2013 Juanjo Menent        <jmenent@2byte.es>
  * Copyright (C) 2011      Jean Heimburger      <jean@tiaris.info>
- * Copyright (C) 2012      Christophe Battarel  <christophe.battarel@altairis.fr>
+ * Copyright (C) 2012-2014 Christophe Battarel  <christophe.battarel@altairis.fr>
  * Copyright (C) 2013      Florian Henry		<florian.henry@open-concept.pro>
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU  *General Public License as published by
+ * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
@@ -290,6 +290,13 @@
             }
         }
 
+        // Set new ref and current status
+        if (! $error)
+        {
+        	$this->ref = $num;
+        	$this->statut = 1;
+        }
+
         if (! $error)
         {
             // Appel des triggers
@@ -300,13 +307,6 @@
             // Fin appel triggers
         }
 
-        // Set new ref and current status
-        if (! $error)
-        {
-            $this->ref = $num;
-            $this->statut = 1;
-        }
-
         if (! $error)
         {
             $this->db->commit();
@@ -712,7 +712,8 @@
                         $fk_parent_line,
                         $this->lines[$i]->fk_fournprice,
                         $this->lines[$i]->pa_ht,
-                    	$this->lines[$i]->label
+                    	$this->lines[$i]->label,
+						$this->lines[$i]->array_options
                     );
                     if ($result < 0)
                     {
@@ -850,6 +851,10 @@
 
         $this->db->begin();
 
+		// get extrafields so they will be clone
+		foreach($this->lines as $line)
+			$line->fetch_optionals($line->rowid);
+
         // Load source object
         $objFrom = dol_clone($this);
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/commande/fiche.php dolibarr-3.5.5+dfsg1/htdocs/commande/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/commande/fiche.php	2014-06-23 11:44:27.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/commande/fiche.php	2014-10-03 19:04:41.000000000 +0200
@@ -686,8 +686,6 @@
 					$pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
 					$price_min = $prod->multiprices_min[$object->client->price_level];
 					$price_base_type = $prod->multiprices_base_type[$object->client->price_level];
-					$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
-					$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
 				}
 				else
 				{
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/commande/info.php dolibarr-3.5.5+dfsg1/htdocs/commande/info.php
--- dolibarr-3.5.4+dfsg2/htdocs/commande/info.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/commande/info.php	2014-09-23 09:18:24.000000000 +0200
@@ -34,7 +34,7 @@
 
 // Security check
 $socid=0;
-$comid = isset($_GET["id"])?$_GET["id"]:'';
+$comid = GETPOST("id",'int');
 if ($user->societe_id) $socid=$user->societe_id;
 $result=restrictedArea($user,'commande',$comid,'');
 
@@ -47,8 +47,8 @@
 llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
 
 $commande = new Commande($db);
-$commande->fetch($_GET["id"]);
-$commande->info($_GET["id"]);
+$commande->fetch($comid);
+$commande->info($comid);
 $soc = new Societe($db);
 $soc->fetch($commande->socid);
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/commande/liste.php dolibarr-3.5.5+dfsg1/htdocs/commande/liste.php
--- dolibarr-3.5.4+dfsg2/htdocs/commande/liste.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/commande/liste.php	2014-09-23 09:18:24.000000000 +0200
@@ -334,7 +334,7 @@
 		print '</td>';
 
 		print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
-		if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_valid),$db->jdate($objp->date_livraison)) < ($now - $conf->commande->client->warning_delay))
+		if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_commande),$db->jdate($objp->date_livraison)) < ($now - $conf->commande->client->warning_delay))
 			print img_picto($langs->trans("Late"),"warning");
 		if(!empty($objp->note_private))
 		{
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/commande/orderstoinvoice.php dolibarr-3.5.5+dfsg1/htdocs/commande/orderstoinvoice.php
--- dolibarr-3.5.4+dfsg2/htdocs/commande/orderstoinvoice.php	2014-07-11 12:33:11.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/commande/orderstoinvoice.php	2014-09-23 09:18:24.000000000 +0200
@@ -45,7 +45,7 @@
 if (! $user->rights->facture->creer)
 	accessforbidden();
 
-$id				= (GETPOST('id')?GETPOST("id"):GETPOST("facid"));  // For backward compatibility
+$id				= (GETPOST('id')?GETPOST('id','int'):GETPOST("facid"));  // For backward compatibility
 $ref			= GETPOST('ref','alpha');
 $action			= GETPOST('action','alpha');
 $confirm		= GETPOST('confirm','alpha');
@@ -97,7 +97,7 @@
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
 	require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
 	if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
-	
+
 	$langs->load('bills');
 	$langs->load('products');
 	$langs->load('main');
@@ -213,7 +213,7 @@
 							$result=$objectsrc->fetch($orders_id[$ii]);
 							if ($result > 0)
 							{
-								if ($closeOrders) 
+								if ($closeOrders)
 								{
 									$objectsrc->classifyBilled();
 									$objectsrc->setStatut(3);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/commande/tpl/linkedobjectblock.tpl.php dolibarr-3.5.5+dfsg1/htdocs/commande/tpl/linkedobjectblock.tpl.php
--- dolibarr-3.5.4+dfsg2/htdocs/commande/tpl/linkedobjectblock.tpl.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/commande/tpl/linkedobjectblock.tpl.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,6 +1,7 @@
 <?php
 /* Copyright (C) 2010-2011	Regis Houssin <regis.houssin@capnetworks.com>
  * Copyright (C) 2013		Juanjo Menent <jmenent@2byte.es>
+ * Copyright (C) 2014       Marcos García <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,6 +23,8 @@
 
 <?php
 
+global $user;
+
 $langs = $GLOBALS['langs'];
 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
 
@@ -47,17 +50,23 @@
 <tr <?php echo $GLOBALS['bc'][$var]; ?> ><td>
 	<a href="<?php echo DOL_URL_ROOT.'/commande/fiche.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowOrder"),"order").' '.$object->ref; ?></a></td>
 	<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
-	<td align="right"><?php echo price($object->total_ht); ?></td>
+	<td align="right"><?php
+		if ($user->rights->commande->lire) {
+			$total = $total + $object->total_ht;
+			echo price($object->total_ht);
+		} ?></td>
 	<td align="right"><?php echo $object->getLibStatut(3); ?></td>
 </tr>
 <?php
-$total = $total + $object->total_ht;
 }
 
 ?>
 <tr class="liste_total">
 	<td align="left" colspan="2"><?php echo $langs->trans('TotalHT'); ?></td>
-	<td align="right"><?php echo price($total); ?></td>
+	<td align="right"><?php
+		if ($user->rights->commande->lire) {
+			echo price($total);
+		} ?></td>
 	<td>&nbsp;</td>
 </tr>
 </table>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/bank/account.php dolibarr-3.5.5+dfsg1/htdocs/compta/bank/account.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/bank/account.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/bank/account.php	2014-09-23 09:18:24.000000000 +0200
@@ -5,7 +5,7 @@
  * Copyright (C) 2004      Christophe Combelles <ccomb@free.fr>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2010-2011 Juanjo Menent        <jmenent@@2byte.es>
- * Copyright (C) 2012      Marcos García         <marcosgdf@gmail.com>
+ * Copyright (C) 2012-2014 Marcos García         <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -253,17 +253,22 @@
 	//Total pages
 	$totalPages = ceil($total_lines/$viewline);
 
-	if ($page > 0)
-	{
-		$limitsql = ($totalPages - $page) * $viewline;
-		if ($limitsql < $viewline) $limitsql = $viewline;
-		$nbline = $limitsql;
-	}
-	else
-	{
+	if ($totalPages == 0) {
 		$page = 0;
-		$limitsql = $nbline;
+	} else {
+
+		if ($page > 0) {
+			$limitsql = ($totalPages - $page) * $viewline;
+			if ($limitsql < $viewline) {
+				$limitsql = $viewline;
+			}
+			$nbline = $limitsql;
+		} else {
+			$page = 0;
+			$limitsql = $nbline;
+		}
 	}
+
 	//print $limitsql.'-'.$page.'-'.$viewline;
 
 	// Onglets
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/bank/bankid_fr.php dolibarr-3.5.5+dfsg1/htdocs/compta/bank/bankid_fr.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/bank/bankid_fr.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/bank/bankid_fr.php	2014-09-23 09:18:24.000000000 +0200
@@ -34,7 +34,7 @@
 $langs->load("bills");
 
 $action=GETPOST('action');
-$id=GETPOST('id');
+$id=GETPOST('id','int');
 
 // Security check
 if (isset($_GET["id"]) || isset($_GET["ref"]))
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/facture/class/facture.class.php dolibarr-3.5.5+dfsg1/htdocs/compta/facture/class/facture.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/facture/class/facture.class.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/facture/class/facture.class.php	2014-09-26 13:24:15.000000000 +0200
@@ -8,7 +8,7 @@
  * Copyright (C) 2006      Andre Cianfarani      <acianfa@free.fr>
  * Copyright (C) 2007      Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
  * Copyright (C) 2010-2013 Juanjo Menent         <jmenent@2byte.es>
- * Copyright (C) 2012      Christophe Battarel   <christophe.battarel@altairis.fr>
+ * Copyright (C) 2012-2014 Christophe Battarel   <christophe.battarel@altairis.fr>
  * Copyright (C) 2012      Marcos García         <marcosgdf@gmail.com>
  * Copyright (C) 2013      Cedric Gross          <c.gross@kreiz-it.fr>
  * Copyright (C) 2013      Florian Henry		  	<florian.henry@open-concept.pro>
@@ -367,7 +367,8 @@
 							$fk_parent_line,
 							$this->lines[$i]->fk_fournprice,
 							$this->lines[$i]->pa_ht,
-							$this->lines[$i]->label
+							$this->lines[$i]->label,
+							$this->lines[$i]->array_options
 						);
 						if ($result < 0)
 						{
@@ -569,6 +570,10 @@
 
 		$this->db->begin();
 
+		// get extrafields so they will be clone
+		foreach($this->lines as $line)
+			$line->fetch_optionals($line->rowid);
+
 		// Load source object
 		$objFrom = dol_clone($this);
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/facture/impayees.php dolibarr-3.5.5+dfsg1/htdocs/compta/facture/impayees.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/facture/impayees.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/facture/impayees.php	2014-09-23 09:18:24.000000000 +0200
@@ -37,6 +37,7 @@
 $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int'));
 $action = GETPOST('action','alpha');
 $option = GETPOST('option');
+$builddoc_generatebutton=GETPOST('builddoc_generatebutton');
 
 // Security check
 if ($user->societe_id) $socid=$user->societe_id;
@@ -50,7 +51,7 @@
  * Action
  */
 
-if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_search'))
+if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_search') && !empty($builddoc_generatebutton))
 {
 	if (is_array($_POST['toGenerate']))
 	{
@@ -174,6 +175,7 @@
 $now=dol_now();
 
 $search_ref = GETPOST("search_ref");
+$search_refcustomer=GETPOST('search_refcustomer');
 $search_societe = GETPOST("search_societe");
 $search_montant_ht = GETPOST("search_montant_ht");
 $search_montant_ttc = GETPOST("search_montant_ttc");
@@ -192,7 +194,7 @@
 $limit = $conf->liste_limit;
 
 $sql = "SELECT s.nom, s.rowid as socid";
-$sql.= ", f.rowid as facid, f.facnumber, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp";
+$sql.= ", f.rowid as facid, f.facnumber, f.ref_client, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp";
 $sql.= ", f.datef as df, f.date_lim_reglement as datelimite";
 $sql.= ", f.paye as paye, f.fk_statut, f.type";
 $sql.= ", sum(pf.amount) as am";
@@ -218,6 +220,7 @@
 	}
 }
 if ($search_ref)         $sql .= " AND f.facnumber LIKE '%".$db->escape($search_ref)."%'";
+if ($search_refcustomer) $sql .= " AND f.ref_client LIKE '%".$db->escape($search_refcustomer)."%'";
 if ($search_societe)     $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
 if ($search_montant_ht)  $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
 if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
@@ -246,6 +249,7 @@
 	$param.=(! empty($socid)?"&amp;socid=".$socid:"");
 	$param.=(! empty($option)?"&amp;option=".$option:"");
 	if ($search_ref)         $param.='&amp;search_ref='.urlencode($search_ref);
+    	if ($search_refcustomer) $param.='&amp;search_ref='.urlencode($search_refcustomer);
 	if ($search_societe)     $param.='&amp;search_societe='.urlencode($search_societe);
 	if ($search_montant_ht)  $param.='&amp;search_montant_ht='.urlencode($search_montant_ht);
 	if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc);
@@ -274,6 +278,7 @@
 	print '<table class="liste" width="100%">';
 	print '<tr class="liste_titre">';
 	print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","",$param,"",$sortfield,$sortorder);
+    	print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
@@ -291,6 +296,9 @@
 	// Ref
 	print '<td class="liste_titre">';
 	print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'"></td>';
+        print '<td class="liste_titre">';
+        print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
+        print '</td>';
 	print '<td class="liste_titre">&nbsp;</td>';
 	print '<td class="liste_titre">&nbsp;</td>';
 	print '<td class="liste_titre" align="left"><input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
@@ -356,6 +364,11 @@
 
 			print "</td>\n";
 
+	                // Customer ref
+	                print '<td class="nowrap">';
+	                print $objp->ref_client;
+	                print '</td>';
+
 			print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($objp->df),'day').'</td>'."\n";
 			print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($objp->datelimite),'day').'</td>'."\n";
 
@@ -402,7 +415,7 @@
 		}
 
 		print '<tr class="liste_total">';
-		print '<td colspan="4" align="left">'.$langs->trans("Total").'</td>';
+		print '<td colspan="5" align="left">'.$langs->trans("Total").'</td>';
 		print '<td align="right"><b>'.price($total_ht).'</b></td>';
 		print '<td align="right"><b>'.price($total_tva).'</b></td>';
 		print '<td align="right"><b>'.price($total_ttc).'</b></td>';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php dolibarr-3.5.5+dfsg1/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,6 +1,7 @@
 <?php
 /* Copyright (C) 2010-2011	Regis Houssin <regis.houssin@capnetworks.com>
  * Copyright (C) 2013		Juanjo Menent <jmenent@2byte.es>
+ * Copyright (C) 2014       Marcos García <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,6 +23,8 @@
 
 <?php
 
+global $user;
+
 $langs = $GLOBALS['langs'];
 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
 
@@ -47,16 +50,22 @@
 <tr <?php echo $GLOBALS['bc'][$var]; ?> ><td>
 	<a href="<?php echo DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id ?>"><?php echo img_object($langs->trans("ShowBill"),"bill").' '.$object->ref; ?></a></td>
 	<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
-	<td align="right"><?php echo price($object->total_ht); ?></td>
+	<td align="right"><?php
+		if ($user->rights->facture->lire) {
+			$total = $total + $object->total_ht;
+			echo price($object->total_ht);
+		} ?></td>
 	<td align="right"><?php echo $object->getLibStatut(3); ?></td>
 </tr>
 <?php
-$total = $total + $object->total_ht;
 }
 ?>
 <tr class="liste_total">
 	<td align="left" colspan="2"><?php echo $langs->trans("TotalHT"); ?></td>
-	<td align="right"><?php echo price($total); ?></td>
+	<td align="right"><?php
+		if ($user->rights->facture->lire) {
+			echo price($total);
+		} ?></td>
 	<td>&nbsp;</td>
 </tr>
 </table>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/facture.php dolibarr-3.5.5+dfsg1/htdocs/compta/facture.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/facture.php	2014-06-21 15:34:16.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/facture.php	2014-10-03 19:04:41.000000000 +0200
@@ -282,7 +282,15 @@
 {
 	$object->fetch($id);
 	$old_date_lim_reglement=$object->date_lim_reglement;
-	$object->date=dol_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']);
+	$date=dol_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']);
+	if (empty($date)) 
+	{
+	    setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
+	    header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
+	    exit;
+	     
+	}
+    $object->date=$date;
 	$new_date_lim_reglement=$object->calculate_date_lim_reglement();
 	if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement=$new_date_lim_reglement;
 	if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement=$object->date;
@@ -1254,8 +1262,6 @@
 					$pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
 					$price_min = $prod->multiprices_min[$object->client->price_level];
 					$price_base_type = $prod->multiprices_base_type[$object->client->price_level];
-					$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
-					$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
 				}
 				else
 				{
@@ -2006,15 +2012,7 @@
 
 llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
 
-print '
-<script type="text/javascript" language="javascript">
-jQuery(document).ready(function() {
-	jQuery("#linktoorder").click(function() {
-		jQuery("#commande").toggle();
-	});
-});
-</script>
-';
+
 
 
 /*********************************************************************
@@ -2352,7 +2350,7 @@
 
 	// Payment mode
 	print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
-	$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
+	$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id, 'mode_reglement_id', 'CRDT');
 	print '</td></tr>';
 
 	// Project
@@ -3356,11 +3354,11 @@
 	print '</td><td colspan="3">';
 	if ($action == 'editmode')
 	{
-		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
+		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
 	}
 	else
 	{
-		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none');
+		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT');
 	}
 	print '</td></tr>';
 
@@ -3812,16 +3810,26 @@
 		// Linked object block
 		$somethingshown=$object->showLinkedObjectBlock();
 
-		if (empty($somethingshown) && $object->statut > 0)
+		if (empty($somethingshown) && ! empty($conf->commande->enabled)) 
 		{
-			print '<br><a href="#" id="linktoorder">'.$langs->trans('LinkedOrder').'</a>';
+			print '<br><a href="#" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
+
+			print '
+				<script type="text/javascript" language="javascript">
+				jQuery(document).ready(function() {
+					jQuery("#linktoorder").click(function() {
+						jQuery("#commande").toggle();
+					});
+				});
+				</script>
+				';
 
 			print '<div id="commande" style="display:none">';
 
 			$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
-			$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-			$sql.= ", ".MAIN_DB_PREFIX."commande as c";
-			$sql.= ' WHERE c.fk_soc = '.$soc->id.'';
+			$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
+			$sql .= ", " . MAIN_DB_PREFIX . "commande as c";
+			$sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $soc->id . '';
 
 			$resqlorderlist = $db->query($sql);
 			if ($resqlorderlist)
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/prelevement/class/bonprelevement.class.php dolibarr-3.5.5+dfsg1/htdocs/compta/prelevement/class/bonprelevement.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/prelevement/class/bonprelevement.class.php	2014-04-12 00:26:28.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/prelevement/class/bonprelevement.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -907,7 +907,7 @@
                 $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
                 $sql.= " ref, entity, datec";
                 $sql.= ") VALUES (";
-                $sql.= "'".$ref."'";
+                $sql.= "'".$this->db->escape($ref)."'";
                 $sql.= ", ".$conf->entity;
                 $sql.= ", '".$this->db->idate($now)."'";
                 $sql.= ")";
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/prelevement/liste.php dolibarr-3.5.5+dfsg1/htdocs/compta/prelevement/liste.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/prelevement/liste.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/prelevement/liste.php	2014-09-23 09:18:24.000000000 +0200
@@ -78,19 +78,19 @@
 if ($socid) $sql.= " AND s.rowid = ".$socid;
 if ($search_line)
 {
-    $sql.= " AND pl.rowid = '".$search_line."'";
+    $sql.= " AND pl.rowid = '".$db->escape($search_line)."'";
 }
 if ($search_bon)
 {
-    $sql.= " AND p.ref LIKE '%".$search_bon."%'";
+    $sql.= " AND p.ref LIKE '%".$db->escape($search_bon)."%'";
 }
 if ($search_code)
 {
-    $sql.= " AND s.code_client LIKE '%".$search_code."%'";
+    $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
 }
 if ($search_societe)
 {
-    $sql .= " AND s.nom LIKE '%".$search_societe."%'";
+    $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
 }
 $sql.=$db->order($sortfield,$sortorder);
 $sql.=$db->plimit($conf->liste_limit+1, $offset);
@@ -104,7 +104,7 @@
     $urladd = "&amp;statut=".$statut;
     $urladd .= "&amp;search_bon=".$search_bon;
 
-    print_barre_liste($langs->trans("WithdrawalsLines"), $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
+    print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
 
     print"\n<!-- debut table -->\n";
     print '<table class="liste" width="100%">';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/prelevement/rejets.php dolibarr-3.5.5+dfsg1/htdocs/compta/prelevement/rejets.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/prelevement/rejets.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/prelevement/rejets.php	2014-09-23 09:18:24.000000000 +0200
@@ -76,7 +76,8 @@
 $sql.= " AND pl.fk_soc = s.rowid";
 $sql.= " AND p.entity = ".$conf->entity;
 if ($socid) $sql.= " AND s.rowid = ".$socid;
-$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+$sql.= " ".$db->order($sortfield, $sortorder);
+$sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
 
 $result = $db->query($sql);
 if ($result)
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/compta/recap-compta.php dolibarr-3.5.5+dfsg1/htdocs/compta/recap-compta.php
--- dolibarr-3.5.4+dfsg2/htdocs/compta/recap-compta.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/compta/recap-compta.php	2014-09-23 09:18:24.000000000 +0200
@@ -30,7 +30,7 @@
 if (! empty($conf->facture->enabled)) $langs->load("bills");
 
 // Security check
-$socid = $_GET["socid"];
+$socid = GETPOST("socid",'int');
 if ($user->societe_id > 0)
 {
   $action = '';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/contact/info.php dolibarr-3.5.5+dfsg1/htdocs/contact/info.php
--- dolibarr-3.5.4+dfsg2/htdocs/contact/info.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/contact/info.php	2014-09-23 09:18:24.000000000 +0200
@@ -31,22 +31,22 @@
 $langs->load("companies");
 
 // Security check
-$contactid = isset($_GET["id"])?$_GET["id"]:'';
+$contactid = GETPOST("id",'int');
 if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
 
 
 
 /*
-* 	View
-*/
+ * 	View
+ */
 
 llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
 
 
 $contact = new Contact($db);
-$contact->fetch($_GET["id"], $user);
-$contact->info($_GET["id"]);
+$contact->fetch($contactid, $user);
+$contact->info($contactid);
 
 
 $head = contact_prepare_head($contact);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/contact/list.php dolibarr-3.5.5+dfsg1/htdocs/contact/list.php
--- dolibarr-3.5.4+dfsg2/htdocs/contact/list.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/contact/list.php	2014-09-23 09:18:24.000000000 +0200
@@ -172,11 +172,11 @@
 }
 if (strlen($search_phoneper))
 {
-    $sql .= " AND p.phone LIKE '%".$db->escape($search_phoneper)."%'";
+    $sql .= " AND p.phone_perso LIKE '%".$db->escape($search_phoneper)."%'";
 }
 if (strlen($search_phonepro))
 {
-    $sql .= " AND p.phone_perso LIKE '%".$db->escape($search_phonepro)."%'";
+    $sql .= " AND p.phone LIKE '%".$db->escape($search_phonepro)."%'";
 }
 if (strlen($search_phonemob))
 {
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/contrat/class/contrat.class.php dolibarr-3.5.5+dfsg1/htdocs/contrat/class/contrat.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/contrat/class/contrat.class.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/contrat/class/contrat.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -410,7 +410,7 @@
 		$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
 		if ($ref)
 		{
-			$sql.= " WHERE ref='".$ref."'";
+			$sql.= " WHERE ref='".$this->db->escape($ref)."'";
 			$sql.= " AND entity IN (".getEntity('contract').")";
 		}
 		else $sql.= " WHERE rowid=".$id;
@@ -811,6 +811,7 @@
 	function delete($user)
 	{
 		global $conf, $langs;
+		require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
 
 		$error=0;
 
@@ -1941,7 +1942,7 @@
 		$sql.= " t.commentaire";
 		$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t";
 		if ($id)  $sql.= " WHERE t.rowid = ".$id;
-		if ($ref) $sql.= " WHERE t.rowid = '".$ref."'";
+		if ($ref) $sql.= " WHERE t.rowid = '".$this->db->escape($ref)."'";
 
 		dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
 		$resql=$this->db->query($sql);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/contrat/info.php dolibarr-3.5.5+dfsg1/htdocs/contrat/info.php
--- dolibarr-3.5.4+dfsg2/htdocs/contrat/info.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/contrat/info.php	2014-09-23 09:18:24.000000000 +0200
@@ -29,7 +29,7 @@
 $langs->load("contracts");
 
 // Security check
-$contratid = isset($_GET["id"])?$_GET["id"]:'';
+$contratid = GETPOST("id",'int');
 if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'contrat',$contratid,'');
 
@@ -41,8 +41,8 @@
 llxHeader();
 
 $contrat = new Contrat($db);
-$contrat->fetch($_GET["id"]);
-$contrat->info($_GET["id"]);
+$contrat->fetch($contratid);
+$contrat->info($contratid);
 
 $head = contract_prepare_head($contrat);
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/class/commonobject.class.php dolibarr-3.5.5+dfsg1/htdocs/core/class/commonobject.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/class/commonobject.class.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/class/commonobject.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -1053,7 +1053,6 @@
         }
     }
 
-
     /**
      *  Save a new position (field rang) for details lines.
      *  You can choose to set position for lines with already a position or lines without any position defined.
@@ -2002,7 +2001,7 @@
         $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
         $sql.= " WHERE entity IN (".getEntity($this->element, 1).")";
         if (! empty($id))  $sql.= " AND rowid = ".$id;
-        if (! empty($ref)) $sql.= " AND ref = '".$ref."'";
+        if (! empty($ref)) $sql.= " AND ref = '".$this->db->escape($ref)."'";
 
         $resql = $this->db->query($sql);
         if ($resql)
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/class/html.form.class.php dolibarr-3.5.5+dfsg1/htdocs/core/class/html.form.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/class/html.form.class.php	2014-06-23 10:14:54.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/class/html.form.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -2275,8 +2275,8 @@
         dol_syslog(get_class($this)."::select_type_paiements ".$selected.", ".$htmlname.", ".$filtertype.", ".$format,LOG_DEBUG);
 
         $filterarray=array();
-        if ($filtertype == 'CRDT')  	$filterarray=array(0,2);
-        elseif ($filtertype == 'DBIT') 	$filterarray=array(1,2);
+        if ($filtertype == 'CRDT')  	$filterarray=array(0,2,3);
+        elseif ($filtertype == 'DBIT') 	$filterarray=array(1,2,3);
         elseif ($filtertype != '' && $filtertype != '-1') $filterarray=explode(',',$filtertype);
 
         $this->load_cache_types_paiements();
@@ -2755,7 +2755,7 @@
      *    Show a form to select a project
      *
      *    @param	int		$page        Page
-     *    @param	int		$socid       Id third party
+     *    @param	int		$socid       Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
      *    @param    int		$selected    Id pre-selected project
      *    @param    string	$htmlname    Name of select field
      *    @return	void
@@ -3000,12 +3000,13 @@
     /**
      *    Affiche formulaire de selection des modes de reglement
      *
-     *    @param	string	$page        Page
-     *    @param    int		$selected    Id mode pre-selectionne
-     *    @param    string	$htmlname    Name of select html field
+     *    @param	string	$page        	Page
+     *    @param    int		$selected    	Id mode pre-selectionne
+     *    @param    string	$htmlname    	Name of select html field
+     *    @param  	string	$filtertype		To filter on field type in llx_c_paiement (array('code'=>xx,'label'=>zz))
      *    @return	void
      */
-    function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id')
+    function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='')
     {
         global $langs;
         if ($htmlname != "none")
@@ -3015,7 +3016,7 @@
             print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
             print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
             print '<tr><td>';
-            $this->select_types_paiements($selected,$htmlname);
+            $this->select_types_paiements($selected,$htmlname,$filtertype);
             print '</td>';
             print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
             print '</tr></table></form>';
@@ -3713,7 +3714,7 @@
         }
         elseif ($typehour=='text')
         {
-        	print '<input type="text" size="3" name="'.$prefix.'hour" class="flat" value="'.((int) $hourSelected).'">';
+        	print '<input type="text" size="3" name="'.$prefix.'hour"'.($disabled?' disabled="disabled"':'').' class="flat" value="'.((int) $hourSelected).'">';
         }
         print $langs->trans('Hours'). "&nbsp;";
         print '<select class="flat" name="'.$prefix.'min"'.($disabled?' disabled="disabled"':'').'>';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/class/html.formfile.class.php dolibarr-3.5.5+dfsg1/htdocs/core/class/html.formfile.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/class/html.formfile.class.php	2014-07-14 23:10:05.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/class/html.formfile.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,10 +1,10 @@
 <?php
-/* Copyright (c) 2008-2013 Laurent Destailleur	<eldy@users.sourceforge.net>
- * Copyright (C) 2010-2012 Regis Houssin		<regis.houssin@capnetworks.com>
- * Copyright (c) 2010      Juanjo Menent		<jmenent@2byte.es>
- * Copyright (c) 2013      Charles-Fr BENKE		<charles.fr@benke.fr>
- * Copyright (C) 2013      Cédric Salvador      <csalvador@gpcsolutions.fr>
- * Copyright (c) 2014       Marcos García       <marcosgdf@gmail.com>
+/* Copyright (C) 2008-2013	Laurent Destailleur	<eldy@users.sourceforge.net>
+ * Copyright (C) 2010-2014	Regis Houssin		<regis.houssin@capnetworks.com>
+ * Copyright (C) 2010		Juanjo Menent		<jmenent@2byte.es>
+ * Copyright (C) 2013		Charles-Fr BENKE	<charles.fr@benke.fr>
+ * Copyright (C) 2013		Cédric Salvador		<csalvador@gpcsolutions.fr>
+ * Copyright (C) 2014		Marcos García		<marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -268,7 +268,7 @@
         if (! empty($iconPDF)) {
         	return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
         }
-        $printer = ($user->rights->printipp->read && $conf->printipp->enabled)?true:false;
+        $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false;
         $hookmanager->initHooks(array('formfile'));
         $forname='builddoc';
         $out='';
@@ -499,7 +499,7 @@
             // Button
             $addcolumforpicto=($delallowed || $printer || $morepicto);
             $out.= '<th align="center" colspan="'.($addcolumforpicto?'2':'1').'" class="formdocbutton liste_titre">';
-            $genbutton = '<input class="button" id="'.$forname.'_generatebutton"';
+            $genbutton = '<input class="button" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
             $genbutton.= ' type="submit" value="'.$buttonlabel.'"';
             if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled="disabled"';
             $genbutton.= '>';
@@ -509,15 +509,15 @@
                	$genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated"));
             }
             if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton='';
-            if (empty($modellist) && ! $showempty) $genbutton='';
+            if (empty($modellist) && ! $showempty && $modulepart != 'unpaid') $genbutton='';
             $out.= $genbutton;
             $out.= '</th>';
 
-            if($hookmanager->hooks['formfile'])
+            if (!empty($hookmanager->hooks['formfile']))
             {
                 foreach($hookmanager->hooks['formfile'] as $module)
                 {
-                    if(method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>';
+                    if (method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>';
                 }
             }
             $out.= '</tr>';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/js/dst.js dolibarr-3.5.5+dfsg1/htdocs/core/js/dst.js
--- dolibarr-3.5.4+dfsg2/htdocs/core/js/dst.js	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/js/dst.js	2014-09-23 09:18:24.000000000 +0200
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2012	Laurent Destailleur	<eldy@users.sourceforge.net>
+// Copyright (C) 2011-2014	Laurent Destailleur	<eldy@users.sourceforge.net>
 // Copyright (C) 2011-2012	Regis Houssin		<regis.houssin@capnetworks.com>
 //
 // This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,8 @@
 
 //
 // \file       htdocs/core/js/dst.js
-// \brief      File that include javascript functions for detect user tz, dst_observed, dst_first, dst_second
+// \brief      File that include javascript functions for detect user tz, tz_string, dst_observed, dst_first, dst_second,
+//             screenwidth and screenheight
 //
 
 $(document).ready(function () {
@@ -39,22 +40,22 @@
 	    dst = "1"; // daylight savings time is observed
 	}
 	var now=new Date();
-	var tz=now.toTimeString().match(/\(.*\)/);
+	var tz=now.toTimeString().match(/\(.*\)/);	// now.toTimeString may return "12:39:59 GMT+0200 (CEST)"
 	//alert('date=' + now + ' string=' + now.toTimeString());
 	var dst_first=DisplayDstSwitchDates('first');
 	var dst_second=DisplayDstSwitchDates('second');
 	//alert(dst);
-	$('#tz').val(std_time_offset);   				  // returns TZ
-	// tz is null with IE
+	$('#tz').val(std_time_offset);   				  					// returns TZ
+	// tz is null with IE 
 	if (tz != null) {
 		$('#tz_string').val(tz[0].replace('(','').replace(')',''));		// returns TZ string
 	}
-	$('#dst_observed').val(dst);   				  // returns if DST is observed on summer
-	$('#dst_first').val(dst_first);   				  // returns DST first switch in year
-	$('#dst_second').val(dst_second);   			  // returns DST second switch in year
+	$('#dst_observed').val(dst);   				  						// returns if DST is observed on summer
+	$('#dst_first').val(dst_first);   									// returns DST first switch in year
+	$('#dst_second').val(dst_second);   								// returns DST second switch in year
 	// Detect and save screen resolution
-	$('#screenwidth').val($(window).width());   // returns width of browser viewport
-	$('#screenheight').val($(window).height());   // returns width of browser viewport
+	$('#screenwidth').val($(window).width());   	// returns width of browser viewport
+	$('#screenheight').val($(window).height());   	// returns width of browser viewport
 });
 
 function DisplayDstSwitchDates(firstsecond)
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/js/lib_head.js dolibarr-3.5.5+dfsg1/htdocs/core/js/lib_head.js
--- dolibarr-3.5.4+dfsg2/htdocs/core/js/lib_head.js	2014-06-20 13:19:43.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/js/lib_head.js	2014-09-23 09:18:24.000000000 +0200
@@ -1,5 +1,5 @@
 // Copyright (C) 2005-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
-// Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
+// Copyright (C) 2005-2014 Regis Houssin        <regis.houssin@capnetworks.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
@@ -631,7 +631,7 @@
 /*
  * TODO Used by admin page only ? 
  */
-function setConstant(url, code, input, entity) {
+function setConstant(url, code, input, entity, strict) {
 	$.get( url, {
 		action: "set",
 		name: code,
@@ -642,7 +642,7 @@
 		$("#del_" + code).show();
 		$.each(input, function(type, data) {
 			// Enable another element
-			if (type == "disabled") {
+			if (type == "disabled" && strict != 1) {
 				$.each(data, function(key, value) {
 					var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
 					$(newvalue).removeAttr("disabled");
@@ -654,7 +654,10 @@
 			} else if (type == "enabled") {
 				$.each(data, function(key, value) {
 					var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
-					$(newvalue).attr("disabled", true);
+					if (strict == 1)
+						$(newvalue).removeAttr("disabled");
+					else
+						$(newvalue).attr("disabled", true);
 					if ($(newvalue).hasClass("butAction") == true) {
 						$(newvalue).removeClass("butAction");
 						$(newvalue).addClass("butActionRefused");
@@ -686,7 +689,7 @@
 /*
  * TODO Used by admin page only ? 
  */
-function delConstant(url, code, input, entity) {
+function delConstant(url, code, input, entity, strict) {
 	$.get( url, {
 		action: "del",
 		name: code,
@@ -706,7 +709,7 @@
 						$(newvalue).addClass("butActionRefused");
 					}
 				});
-			} else if (type == "enabled") {
+			} else if (type == "enabled" && strict != 1) {
 				$.each(data, function(key, value) {
 					var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
 					$(newvalue).removeAttr("disabled");
@@ -740,7 +743,7 @@
 /*
  * TODO Used by admin page only ? 
  */
-function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) {
+function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) {
 	var boxConfirm = box;
 	$("#confirm_" + code)
 			.attr("title", boxConfirm.title)
@@ -756,9 +759,9 @@
 						text : yesButton,
 						click : function() {
 							if (action == "set") {
-								setConstant(url, code, input, entity);
+								setConstant(url, code, input, entity, strict);
 							} else if (action == "del") {
-								delConstant(url, code, input, entity);
+								delConstant(url, code, input, entity, strict);
 							}
 							// Close dialog
 							$(this).dialog("close");
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/lib/ajax.lib.php dolibarr-3.5.5+dfsg1/htdocs/core/lib/ajax.lib.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/lib/ajax.lib.php	2014-06-20 13:19:43.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/lib/ajax.lib.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2007-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2007-2012 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copyright (C) 2007-2014 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2012      Christophe Battarel  <christophe.battarel@altairis.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -380,9 +380,10 @@
  * 	@param	array	$input			Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
  * 	@param	int		$entity			Entity to set
  *  @param	int		$revertonoff	Revert on/off
+ *  @param	bool	$strict			Use only "disabled" with delConstant and "enabled" with setConstant
  * 	@return	void
  */
-function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
+function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0)
 {
 	global $conf, $langs;
 
@@ -395,6 +396,7 @@
 			var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
 			var code = \''.$code.'\';
 			var entity = \''.$entity.'\';
+			var strict = \''.$strict.'\';
 			var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'";
 			var noButton = "'.dol_escape_js($langs->transnoentities("No")).'";
 
@@ -403,9 +405,9 @@
 				if (input.alert && input.alert.set) {
 					if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
 					if (input.alert.set.noButton)  noButton = input.alert.set.noButton;
-					confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
+					confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict);
 				} else {
-					setConstant(url, code, input, entity);
+					setConstant(url, code, input, entity, strict);
 				}
 			});
 
@@ -414,9 +416,9 @@
 				if (input.alert && input.alert.del) {
 					if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
 					if (input.alert.del.noButton)  noButton = input.alert.del.noButton;
-					confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton);
+					confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict);
 				} else {
-					delConstant(url, code, input, entity);
+					delConstant(url, code, input, entity, strict);
 				}
 			});
 		});
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/lib/functions2.lib.php dolibarr-3.5.5+dfsg1/htdocs/core/lib/functions2.lib.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/lib/functions2.lib.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/lib/functions2.lib.php	2014-09-23 09:18:24.000000000 +0200
@@ -1325,7 +1325,7 @@
                     if (! $tmpdir) { unset($listofdir[$key]); continue; }
                     if (is_dir($tmpdir))
                     {
-                        $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0,true); // Disable hook for the moment
+                        $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0);
                         if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
                     }
                 }
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/lib/functions.lib.php dolibarr-3.5.5+dfsg1/htdocs/core/lib/functions.lib.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/lib/functions.lib.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/lib/functions.lib.php	2014-09-23 09:18:24.000000000 +0200
@@ -871,7 +871,7 @@
 	if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$time,$reg)
 	|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i',$time,$reg))
 	{
-		// This part of code should not be used.
+		// This part of code should not be used. TODO Remove this.
 		dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
 		// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
 		$syear	= (! empty($reg[1]) ? $reg[1] : '');
@@ -889,7 +889,7 @@
 		// Date is a timestamps
 		if ($time < 100000000000)	// Protection against bad date values
 		{
-			$ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt);
+			$ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt);	// TODO Remove this
 		}
 		else $ret='Bad value '.$time.' for date';
 	}
@@ -897,7 +897,7 @@
 	if (preg_match('/__b__/i',$format))
 	{
 		// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
-		$month=adodb_strftime('%m',$time+$offsettz+$offsetdst);
+		$month=adodb_strftime('%m',$time+$offsettz+$offsetdst);					// TODO Remove this
 		if ($encodetooutput)
 		{
 			$monthtext=$outputlangs->transnoentities('Month'.$month);
@@ -916,7 +916,7 @@
 	}
 	if (preg_match('/__a__/i',$format))
 	{
-		$w=adodb_strftime('%w',$time+$offsettz+$offsetdst);
+		$w=adodb_strftime('%w',$time+$offsettz+$offsetdst);						// TODO Remove this
 		$dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w);
 		$ret=str_replace('__A__',$dayweek,$ret);
 		$ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret);
@@ -1029,8 +1029,16 @@
 		}
 		else if ($gm === 'user')
 		{
-			$default_timezone=(empty($_SESSION["dol_tz_string"])?'UTC':$_SESSION["dol_tz_string"]);
-			$localtz = new DateTimeZone($default_timezone);
+			// We use dol_tz_string first because it contains dst.
+			$default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]);
+			try {
+				$localtz = new DateTimeZone($default_timezone);
+			}
+			catch(Exception $e)
+			{
+				dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING);
+				$default_timezone=@date_default_timezone_get();
+			}
 		}
 		else $localtz = new DateTimeZone('UTC');
 		$dt = new DateTime(null,$localtz);
@@ -4234,6 +4242,7 @@
 	global $langs, $user, $conf;
 	global $leftmenu;
 	global $rights;
+	global $object;
 
 	//print $s."<br>\n";
 	if ($returnvalue) return @eval('return '.$s.';');
@@ -4533,4 +4542,4 @@
     return " AND " . ($end > 1? '(' : '') . $res;
 }
 
-?>
\ Pas de fin de ligne à la fin du fichier
+?>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/lib/pdf.lib.php dolibarr-3.5.5+dfsg1/htdocs/core/lib/pdf.lib.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/lib/pdf.lib.php	2014-06-20 12:51:44.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/lib/pdf.lib.php	2014-09-23 09:18:24.000000000 +0200
@@ -427,7 +427,7 @@
 	global $conf;
 
 	// Add a background image on document
-	if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF))
+	if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF))		// Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image
 	{
         $pdf->SetAutoPageBreak(0,0);	// Disable auto pagebreak before adding image
 		$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height);
@@ -795,7 +795,7 @@
 	if ($line)	// Free text
 	{
 		$pdf->SetXY($dims['lm'],-$posy);
-		$pdf->MultiCell($width, 3, $line, 0, $align, 0);
+		$pdf->MultiCell(0, 3, $line, 0, $align, 0);
 		$posy-=$freetextheight;
 	}
 
@@ -835,7 +835,7 @@
 	}
 
 	// Show page nb only on iso languages (so default Helvetica font)
-	if (pdf_getPDFFont($outputlangs) == 'Helvetica')
+	if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica')
 	{
 		$pdf->SetXY(-20,-$posy);
 		//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/lib/project.lib.php dolibarr-3.5.5+dfsg1/htdocs/core/lib/project.lib.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/lib/project.lib.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/lib/project.lib.php	2014-09-23 09:18:24.000000000 +0200
@@ -228,7 +228,14 @@
 
 	$numlines=count($lines);
 
-	$total=0;
+	// We declare counter as global because we want to edit them into recursive call
+	global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned;
+	if ($level == 0)
+	{
+		$total_projectlinesa_spent=0;
+		$total_projectlinesa_planned=0;
+		$total_projectlinesa_spent_if_planned=0;
+	}
 
 	for ($i = 0 ; $i < $numlines ; $i++)
 	{
@@ -293,8 +300,8 @@
 
 				if ($showproject)
 				{
+					// Project ref
 					print "<td>";
-					//var_dump($taskrole);
 					if ($showlineingray) print '<i>';
 					$projectstatic->id=$lines[$i]->fk_project;
 					$projectstatic->ref=$lines[$i]->projectref;
@@ -390,7 +397,9 @@
 				$level++;
 				if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
 				$level--;
-				$total += $lines[$i]->duration;
+				$total_projectlinesa_spent += $lines[$i]->duration;
+				$total_projectlinesa_planned += $lines[$i]->planned_workload;
+				if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
 			}
 		}
 		else
@@ -399,7 +408,7 @@
 		}
 	}
 
-	if ($total>0 && $level==0)
+	if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0)
 	{
 		print '<tr class="liste_total">';
 		print '<td class="liste_total">'.$langs->trans("Total").'</td>';
@@ -407,10 +416,16 @@
 		print '<td></td>';
 		print '<td></td>';
 		print '<td></td>';
+		print '<td align="center" class="nowrap liste_total">';
+		print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
+		print '</td>';
 		print '<td></td>';
-		print '<td></td>';
-		print '<td align="right" class="nowrap liste_total">'.convertSecondToTime($total, 'allhourmin').'</td>';
-		print '<td></td>';
+		print '<td align="right" class="nowrap liste_total">';
+		print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
+		print '</td>';
+		print '<td align="right" class="nowrap liste_total">';
+		if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent_if_planned / $total_projectlinesa_planned,2).' %';
+		print '</td>';
 		if ($addordertick) print '<td class="hideonsmartphone"></td>';
 		print '</tr>';
 	}
@@ -422,16 +437,17 @@
 /**
  * Output a task line
  *
- * @param	string	   	&$inc			?
- * @param   string		$parent			?
- * @param   Object		$lines			?
- * @param   int			&$level			?
- * @param   string		&$projectsrole	?
- * @param   string		&$tasksrole		?
- * @param   int			$mytask			0 or 1 to enable only if task is a task i am affected to
+ * @param	string	   	&$inc					?
+ * @param   string		$parent					?
+ * @param   Object		$lines					?
+ * @param   int			&$level					?
+ * @param   string		&$projectsrole			?
+ * @param   string		&$tasksrole				?
+ * @param	string		$mine					Show only task lines I am assigned to
+ * @param   int			$restricteditformytask	0=No restriction, 1=Enable add time only if task is a task i am affected to
  * @return  $inc
  */
-function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0)
+function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
 {
 	global $user, $bc, $langs;
 	global $form, $projectstatic, $taskstatic;
@@ -454,99 +470,104 @@
 				$lastprojectid=$lines[$i]->fk_project;
 			}
 
-			print "<tr ".$bc[$var].">\n";
-
-			// Project
-			print "<td>";
-			$projectstatic->id=$lines[$i]->fk_project;
-			$projectstatic->ref=$lines[$i]->projectref;
-			$projectstatic->public=$lines[$i]->public;
-			$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
-			print $projectstatic->getNomUrl(1);
-			print "</td>";
-
-			// Ref
-			print '<td>';
-			$taskstatic->id=$lines[$i]->id;
-			$taskstatic->ref=$lines[$i]->id;
-			print $taskstatic->getNomUrl(1);
-			print '</td>';
-
-			// Label task
-			print "<td>";
-			for ($k = 0 ; $k < $level ; $k++)
-			{
-				print "&nbsp;&nbsp;&nbsp;";
-			}
-			$taskstatic->id=$lines[$i]->id;
-			$taskstatic->ref=$lines[$i]->label;
-			print $taskstatic->getNomUrl(0);
-			print "</td>\n";
-
-			// Date start
-			print '<td align="center">';
-			print dol_print_date($lines[$i]->date_start,'day');
-			print '</td>';
-
-			// Date end
-			print '<td align="center">';
-			print dol_print_date($lines[$i]->date_end,'day');
-			print '</td>';
-
-			// Planned Workload
-			print '<td align="right">';
-			if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
-			else print '--:--';
-			print '</td>';
-
-			// Progress declared %
-			print '<td align="right">';
-			print $lines[$i]->progress.' %';
-			print '</td>';
-
-			// Time spent
-			print '<td align="right">';
-			if ($lines[$i]->duration)
+			// If we want all or we have a role on task, we show it
+			if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
 			{
-				print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
-				print convertSecondToTime($lines[$i]->duration,'allhourmin');
-				print '</a>';
-			}
-			else print '--:--';
-			print "</td>\n";
+				print "<tr ".$bc[$var].">\n";
 
-			$disabledproject=1;$disabledtask=1;
-			//print "x".$lines[$i]->fk_project;
-			//var_dump($lines[$i]);
-			//var_dump($projectsrole[$lines[$i]->fk_project]);
-			// If at least one role for project
-			if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
-			{
-				$disabledproject=0;
-				$disabledtask=0;
-			}
-			// If mytask and no role on task
-			if ($mytask && empty($tasksrole[$lines[$i]->id]))
-			{
-				$disabledtask=1;
-			}
+				// Project
+				print "<td>";
+				$projectstatic->id=$lines[$i]->fk_project;
+				$projectstatic->ref=$lines[$i]->projectref;
+				$projectstatic->public=$lines[$i]->public;
+				$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
+				print $projectstatic->getNomUrl(1);
+				print "</td>";
+
+				// Ref
+				print '<td>';
+				$taskstatic->id=$lines[$i]->id;
+				$taskstatic->ref=$lines[$i]->id;
+				print $taskstatic->getNomUrl(1);
+				print '</td>';
+
+				// Label task
+				print "<td>";
+				for ($k = 0 ; $k < $level ; $k++)
+				{
+					print "&nbsp;&nbsp;&nbsp;";
+				}
+				$taskstatic->id=$lines[$i]->id;
+				$taskstatic->ref=$lines[$i]->label;
+				print $taskstatic->getNomUrl(0);
+				print "</td>\n";
+
+				// Date start
+				print '<td align="center">';
+				print dol_print_date($lines[$i]->date_start,'dayhour');
+				print '</td>';
+
+				// Date end
+				print '<td align="center">';
+				print dol_print_date($lines[$i]->date_end,'dayhour');
+				print '</td>';
+
+				// Planned Workload
+				print '<td align="right">';
+				if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
+				else print '--:--';
+				print '</td>';
+
+				// Progress declared %
+				print '<td align="right">';
+				print $lines[$i]->progress.' %';
+				print '</td>';
+
+				// Time spent
+				print '<td align="right">';
+				if ($lines[$i]->duration)
+				{
+					print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
+					print convertSecondToTime($lines[$i]->duration,'allhourmin');
+					print '</a>';
+				}
+				else print '--:--';
+				print "</td>\n";
+
+				$disabledproject=1;$disabledtask=1;
+				//print "x".$lines[$i]->fk_project;
+				//var_dump($lines[$i]);
+				//var_dump($projectsrole[$lines[$i]->fk_project]);
+				// If at least one role for project
+				if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
+				{
+					$disabledproject=0;
+					$disabledtask=0;
+				}
+				// If $restricteditformytask is on and I have no role on task, i disable edit
+				if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
+				{
+					$disabledtask=1;
+				}
 
-			print '<td class="nowrap">';
-			$s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask);
-			$s.='&nbsp;&nbsp;&nbsp;';
-			$s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text');
-			$s.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">';
-			print $s;
-			print '</td>';
-			print '<td align="right">';
-			if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
-			else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
-			print '</td>';
+				print '<td class="nowrap">';
+				$s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask);
+				$s.='&nbsp;&nbsp;&nbsp;';
+				$s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text');
+				$s.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">';
+				print $s;
+				print '</td>';
+				print '<td align="right">';
+				if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
+				else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
+				print '</td>';
+
+				print "</tr>\n";
+			}
 
-			print "</tr>\n";
 			$inc++;
 			$level++;
-			if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mytask);
+			if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
 			$level--;
 		}
 		else
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/menus/standard/eldy.lib.php dolibarr-3.5.5+dfsg1/htdocs/core/menus/standard/eldy.lib.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/menus/standard/eldy.lib.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/menus/standard/eldy.lib.php	2014-09-23 09:18:24.000000000 +0200
@@ -1176,7 +1176,7 @@
 		$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu);
 
 		// We update newmenu for special dynamic menus
-		if ($user->rights->banque->lire && $mainmenu == 'bank')	// Entry for each bank account
+		if (!empty($user->rights->banque->lire) && $mainmenu == 'bank')	// Entry for each bank account
 		{
 			$sql = "SELECT rowid, label, courant, rappro, courant";
 			$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
@@ -1206,7 +1206,7 @@
 			else dol_print_error($db);
 			$db->free($resql);
 		}
-		if ($conf->ftp->enabled && $mainmenu == 'ftp')	// Entry for FTP
+		if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp')	// Entry for FTP
 		{
 			$MAXFTP=20;
 			$i=1;
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/modules/product/mod_codeproduct_leopard.php dolibarr-3.5.5+dfsg1/htdocs/core/modules/product/mod_codeproduct_leopard.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/modules/product/mod_codeproduct_leopard.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/modules/product/mod_codeproduct_leopard.php	2014-09-23 09:18:24.000000000 +0200
@@ -68,6 +68,7 @@
 	 */
 	function info($langs)
 	{
+		$langs->load("companies");
 		return $langs->trans("LeopardNumRefModelDesc");
 	}
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/modules/societe/mod_codeclient_leopard.php dolibarr-3.5.5+dfsg1/htdocs/core/modules/societe/mod_codeclient_leopard.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/modules/societe/mod_codeclient_leopard.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/modules/societe/mod_codeclient_leopard.php	2014-09-23 09:18:24.000000000 +0200
@@ -67,6 +67,7 @@
 	 */
 	function info($langs)
 	{
+		$langs->load("companies");
 		return $langs->trans("LeopardNumRefModelDesc");
 	}
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/tpl/document_actions_pre_headers.tpl.php dolibarr-3.5.5+dfsg1/htdocs/core/tpl/document_actions_pre_headers.tpl.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/tpl/document_actions_pre_headers.tpl.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/tpl/document_actions_pre_headers.tpl.php	2014-09-23 09:18:24.000000000 +0200
@@ -74,7 +74,7 @@
                 setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors');
             }
         }
-        header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.($withproject?'&withproject=1':''));
+        header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.(!empty($withproject)?'&withproject=1':''));
         exit;
     }
 }
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php dolibarr-3.5.5+dfsg1/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -131,7 +131,7 @@
 			$object->actiontypecode='AC_OTH_AUTO';
             if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom);
             $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom);
-            if ($object->prefix) $object->actionmsg.=" (".$object->prefix.")";
+            if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")";
             //$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client);
             //$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur);
             $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
@@ -380,7 +380,7 @@
         	$langs->load("other");
         	$langs->load("sendings");
         	$langs->load("agenda");
-        
+
         	$object->actiontypecode='AC_OTH_AUTO';
         	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",$object->ref);
         	if (empty($object->actionmsg))
@@ -388,7 +388,7 @@
         		$object->actionmsg=$langs->transnoentities("ShippingValidated",$object->ref);
         		$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
         	}
-        
+
         	// Parameters $object->sendtoid defined by caller
         	//$object->sendtoid=0;
         	$ok=1;
@@ -641,8 +641,8 @@
 			$actioncomm->contact     = $contactforaction;
 			$actioncomm->societe     = $societeforaction;
 			$actioncomm->author      = $user;   // User saving action
-			//$actioncomm->usertodo  = $user;	// User affected to action
-			$actioncomm->userdone    = $user;	// User doing action
+			$actioncomm->usertodo    = $user;	// User action is assigned to (owner of action)
+			$actioncomm->userdone    = $user;	// User doing action (deprecated, not used anymore)
 
 			$actioncomm->fk_element  = $object->id;
 			$actioncomm->elementtype = $object->element;
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/expedition/index.php dolibarr-3.5.5+dfsg1/htdocs/expedition/index.php
--- dolibarr-3.5.4+dfsg2/htdocs/expedition/index.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/expedition/index.php	2014-09-23 09:18:24.000000000 +0200
@@ -67,7 +67,7 @@
 $sql.= ", s.nom, s.rowid as socid";
 $sql.= ", c.ref as commande_ref, c.rowid as commande_id";
 $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
 if (!$user->rights->societe->client->voir && !$socid)
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/expedition/tpl/linkedobjectblock.tpl.php dolibarr-3.5.5+dfsg1/htdocs/expedition/tpl/linkedobjectblock.tpl.php
--- dolibarr-3.5.4+dfsg2/htdocs/expedition/tpl/linkedobjectblock.tpl.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/expedition/tpl/linkedobjectblock.tpl.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,5 +1,6 @@
 <?php
 /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
+ * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +22,8 @@
 
 <?php
 
+global $user;
+
 $langs = $GLOBALS['langs'];
 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
 
@@ -47,17 +50,23 @@
 	<a href="<?php echo DOL_URL_ROOT.'/expedition/fiche.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowShipping"),"sending").' '.$object->ref; ?></a></td>
 	<td align="center"><?php echo dol_print_date($object->date_creation,'day'); ?></td>
 	<td align="center"><?php echo dol_print_date($object->date_delivery,'day'); ?></td>
-	<td align="right"><?php echo price($object->total_ht); ?></td>
+	<td align="right"><?php
+		if ($user->rights->expedition->lire) {
+			$total = $total + $object->total_ht;
+			echo price($object->total_ht);
+		} ?></td>
 	<td align="right"><?php echo $object->getLibStatut(3); ?></td>
 </tr>
 <?php
-$total = $total + $object->total_ht;
 }
 
 ?>
 <tr class="liste_total">
 	<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
-	<td align="right"><?php echo price($total); ?></td>
+	<td align="right"><?php
+		if ($user->rights->expedition->lire) {
+			echo price($total);
+		} ?></td>
 	<td>&nbsp;</td>
 </tr>
 </table>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fichinter/class/fichinter.class.php dolibarr-3.5.5+dfsg1/htdocs/fichinter/class/fichinter.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/fichinter/class/fichinter.class.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fichinter/class/fichinter.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -235,7 +235,7 @@
 		$this->db->begin();
 
 		$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
-		$sql.= ", description  = '".$this->db->escape($this->description)."'";
+		$sql.= "description  = '".$this->db->escape($this->description)."'";
 		$sql.= ", duree = ".$this->duree;
 		$sql.= ", fk_projet = ".$this->fk_project;
 		$sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/filefunc.inc.php dolibarr-3.5.5+dfsg1/htdocs/filefunc.inc.php
--- dolibarr-3.5.4+dfsg2/htdocs/filefunc.inc.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/filefunc.inc.php	2014-09-23 09:18:24.000000000 +0200
@@ -29,7 +29,7 @@
  *  \brief      File that include conf.php file and commons lib like functions.lib.php
  */
 
-if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.4');
+if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.5');
 if (! defined('EURO')) define('EURO',chr(128));
 
 // Define syslog constants
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fourn/class/fournisseur.commande.class.php dolibarr-3.5.5+dfsg1/htdocs/fourn/class/fournisseur.commande.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/fourn/class/fournisseur.commande.class.php	2014-06-28 15:02:41.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fourn/class/fournisseur.commande.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -132,7 +132,7 @@
         $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (c.fk_mode_reglement = p.id)";
         $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
         $sql.= " WHERE c.entity = ".$conf->entity;
-        if ($ref) $sql.= " AND c.ref='".$ref."'";
+        if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
         else $sql.= " AND c.rowid=".$id;
 
         dol_syslog(get_class($this)."::fetch sql=".$sql,LOG_DEBUG);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fourn/class/paiementfourn.class.php dolibarr-3.5.5+dfsg1/htdocs/fourn/class/paiementfourn.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/fourn/class/paiementfourn.class.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fourn/class/paiementfourn.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -4,6 +4,7 @@
  * Copyright (C) 2005      Marc Barilley / Ocebo  <marc@ocebo.com>
  * Copyright (C) 2005-2009 Regis Houssin          <regis.houssin@capnetworks.com>
  * Copyright (C) 2010-2011 Juanjo Menent          <jmenent@2byte.es>
+ * Copyright (C) 2014      Marcos García          <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -56,6 +57,18 @@
 	// fk_paiement dans llx_paiement_facture est le rowid du paiement
 
 	/**
+	 * Label of payment type
+	 * @var string
+	 */
+	public $type_libelle;
+
+	/**
+	 * Code of Payment type
+	 * @var string
+	 */
+	public $type_code;
+
+	/**
 	 *	Constructor
 	 *
 	 *  @param		DoliDB		$db      Database handler
@@ -74,7 +87,7 @@
 	function fetch($id)
 	{
 		$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
-		$sql.= ' c.libelle as paiement_type,';
+		$sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
 		$sql.= ' p.num_paiement, p.note, b.fk_account';
 		$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p';
 		$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
@@ -95,6 +108,7 @@
 				$this->bank_line      = $obj->fk_bank;
 				$this->montant        = $obj->amount;
 				$this->note           = $obj->note;
+				$this->type_code      = $obj->paiement_code;
 				$this->type_libelle   = $obj->paiement_type;
 				$this->statut         = $obj->statut;
 				$error = 1;
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php dolibarr-3.5.5+dfsg1/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
--- dolibarr-3.5.4+dfsg2/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,5 +1,6 @@
 <?php
 /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
+ * Copyright (C) 2014      Marcos García <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +22,8 @@
 
 <?php
 
+global $user;
+
 $langs = $GLOBALS['langs'];
 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
 
@@ -44,17 +47,23 @@
 <tr <?php echo $bc[$var]; ?> ><td>
 	<a href="<?php echo DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowOrder"),"order").' '.$object->ref; ?></a></td>
 	<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
-	<td align="right"><?php echo price($object->total_ht); ?></td>
+	<td align="right"><?php
+		if ($user->rights->fournisseur->commande->lire) {
+			$total = $total + $object->total_ht;
+			echo price($object->total_ht);
+		} ?></td>
 	<td align="right"><?php echo $object->getLibStatut(3); ?></td>
 </tr>
 <?php
-$total = $total + $object->total_ht;
 }
 
 ?>
 <tr class="liste_total">
 	<td align="left" colspan="2"><?php echo $langs->trans('TotalHT'); ?></td>
-	<td align="right"><?php echo price($total); ?></td>
+	<td align="right"><?php
+		if ($user->rights->fournisseur->commande->lire) {
+			echo price($total);
+		} ?></td>
 	<td>&nbsp;</td>
 </tr>
 </table>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fourn/facture/fiche.php dolibarr-3.5.5+dfsg1/htdocs/fourn/facture/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/fourn/facture/fiche.php	2014-06-28 01:54:20.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fourn/facture/fiche.php	2014-09-23 09:18:24.000000000 +0200
@@ -1279,26 +1279,16 @@
 
 	// Payment term
 	print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
-	$form->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
+	$form->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id, 'cond_reglement_id');
 	print '</td></tr>';
 
 	// Payment mode
 	print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
-	$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
+	$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id, 'mode_reglement_id', 'DBIT');
 	print '</td></tr>';
 
-	// Project
-	if (! empty($conf->projet->enabled))
-	{
-		$formproject=new FormProjets($db);
-
-		$langs->load('projects');
-		print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
-		$formproject->select_projects(-1, $projectid, 'projectid');
-		print '</td></tr>';
-	}
-
-    print '<tr><td>'.$langs->trans('NotePublic').'</td>';
+	// Public note
+	print '<tr><td>'.$langs->trans('NotePublic').'</td>';
     print '<td>';
     $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
     print $doleditor->Create(1);
@@ -1742,11 +1732,11 @@
 		print '</td><td colspan="2">';
 		if ($action == 'editmode')
 		{
-			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT');
 		}
 		else
 		{
-			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', 'DBIT');
 		}
 		print '</td></tr>';
 
@@ -1822,11 +1812,11 @@
             print '</td><td colspan="3">';
             if ($action == 'classify')
             {
-                $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id,$object->socid,$object->fk_project,'projectid');
+                $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:'-1', $object->fk_project, 'projectid');
             }
             else
             {
-                $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id,$object->socid,$object->fk_project,'none');
+                $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none');
             }
             print '</td>';
             print '</tr>';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fourn/facture/paiement.php dolibarr-3.5.5+dfsg1/htdocs/fourn/facture/paiement.php
--- dolibarr-3.5.4+dfsg2/htdocs/fourn/facture/paiement.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fourn/facture/paiement.php	2014-09-23 09:18:24.000000000 +0200
@@ -399,7 +399,7 @@
     {
         $sql .= ' AND p.rowid='.$db->escape($search_ref);
     }
-    if (! empty($search_account))
+    if (! empty($search_account) && $search_account > 0)
     {
         $sql .= ' AND b.fk_account='.$db->escape($search_account);
     }
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php dolibarr-3.5.5+dfsg1/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
--- dolibarr-3.5.4+dfsg2/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,5 +1,6 @@
 <?php
 /* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
+ * Copyright (C) 2014      Marcos García <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,6 +22,8 @@
 
 <?php
 
+global $user;
+
 $langs = $GLOBALS['langs'];
 $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
 
@@ -45,16 +48,22 @@
 <tr <?php echo $bc[$var]; ?> ><td>
 	<a href="<?php echo DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$object->id ?>"><?php echo img_object($langs->trans("ShowBill"),"bill").' '.$object->ref; ?></a></td>
 	<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
-	<td align="right"><?php echo price($object->total_ht); ?></td>
+	<td align="right"><?php
+		if ($user->rights->fournisseur->facture->lire) {
+			$total = $total + $object->total_ht;
+			echo price($object->total_ht);
+		} ?></td>
 	<td align="right"><?php echo $object->getLibStatut(3); ?></td>
 </tr>
 <?php
-$total = $total + $object->total_ht;
 }
 ?>
 <tr class="liste_total">
 	<td align="left" colspan="2"><?php echo $langs->trans("TotalHT"); ?></td>
-	<td align="right"><?php echo price($total); ?></td>
+	<td align="right"><?php
+		if ($user->rights->fournisseur->facture->lire) {
+			echo price($total);
+		} ?></td>
 	<td>&nbsp;</td>
 </tr>
 </table>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/fourn/paiement/fiche.php dolibarr-3.5.5+dfsg1/htdocs/fourn/paiement/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/fourn/paiement/fiche.php	2014-06-14 13:28:35.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/fourn/paiement/fiche.php	2014-09-23 09:18:24.000000000 +0200
@@ -2,6 +2,7 @@
 /* Copyright (C) 2005      Rodolphe Quiedeville  <rodolphe@quiedeville.org>
  * Copyright (C) 2005      Marc Barilley / Ocebo <marc@ocebo.com>
  * Copyright (C) 2006-2010 Laurent Destailleur   <eldy@users.sourceforge.net>
+ * Copyright (C) 2014      Marcos García         <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -187,7 +188,8 @@
     print '</td></tr>';
 
 	// Payment mode
-	print '<tr><td valign="top" colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$object->type_libelle.'</td></tr>';
+	$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
+	print '<tr><td valign="top" colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype.'</td></tr>';
 
 	// Payment numero
     print '<tr><td valign="top" colspan="2">'.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/holiday/class/holiday.class.php dolibarr-3.5.5+dfsg1/htdocs/holiday/class/holiday.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/holiday/class/holiday.class.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/holiday/class/holiday.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -77,7 +77,7 @@
 
 
     /**
-     * updateSold
+     * updateSold. Update sold and check table of users for holidays is complete. If not complete.
      *
      * @return	int			Return 1
      */
@@ -886,7 +886,7 @@
             $month = date('m',$now);
             $lastUpdate = $this->getConfCP('lastUpdate');
             $monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
-			//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;
+			//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;exit;
 
             // Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
             if ($month != $monthLastUpdate)
@@ -983,25 +983,31 @@
      */
     function createCPusers($single=false,$userid='')
     {
-        // Si c'est l'ensemble des utilisateurs à ajoutés
-        if(!$single)
+        // Si c'est l'ensemble des utilisateurs à ajouter
+        if (! $single)
         {
         	dol_syslog(get_class($this).'::createCPusers');
-            foreach($this->fetchUsers(false,true) as $users) {
+        	$arrayofusers = $this->fetchUsers(false,true);
+
+            foreach($arrayofusers as $users)
+            {
                 $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_users";
                 $sql.= " (fk_user, nb_holiday)";
                 $sql.= " VALUES ('".$users['rowid']."','0')";
 
-                $this->db->query($sql);
+                $resql=$this->db->query($sql);
+                if (! $resql) dol_print_error($this->db);
             }
-        } else {
+        }
+        else
+		{
             $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_users";
             $sql.= " (fk_user, nb_holiday)";
             $sql.= " VALUES ('".$userid."','0')";
 
-            $this->db->query($sql);
+            $resql=$this->db->query($sql);
+            if (! $resql) dol_print_error($this->db);
         }
-
     }
 
     /**
@@ -1048,7 +1054,7 @@
      *    uniquement pour vérifier si il existe de nouveau utilisateur
      *
      *    @param      boolean	$liste	    si vrai retourne une liste, si faux retourne un array
-     *    @param      boolean   $type		si vrai retourne pour Dolibarr si faux retourne pour CP
+     *    @param      boolean   $type		si vrai retourne pour Dolibarr, si faux retourne pour CP
      *    @return     string      			retourne un tableau de tout les utilisateurs actifs
      */
     function fetchUsers($liste=true,$type=true)
@@ -1263,50 +1269,56 @@
     function verifNbUsers($userDolibarrWithoutCP,$userCP) {
 
     	if (empty($userCP)) $userCP=0;
-    	dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarr.' userCP='.$userCP);
+    	dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarrWithoutCP.' userCP='.$userCP);
 
         // On vérifie les users Dolibarr sans CP
         if ($userDolibarrWithoutCP > 0)
         {
-            $this->updateConfCP('nbUser',$userDolibarr);
+        	$this->db->begin();
+
+            $this->updateConfCP('nbUser',$userDolibarrWithoutCP);
 
             $listUsersCP = $this->fetchUsers(true,false);
 
             // On séléctionne les utilisateurs qui ne sont pas déjà dans le module
             $sql = "SELECT u.rowid, u.lastname, u.firstname";
             $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
-            $sql.= " WHERE u.rowid NOT IN(".$listUsersCP.")";
-
-            $result = $this->db->query($sql);
-
-            // Si pas d'erreur SQL
-            if($result) {
+            if ($listUsersCP != '') $sql.= " WHERE u.rowid NOT IN(".$listUsersCP.")";
 
+            $resql = $this->db->query($sql);
+            if ($resql)
+            {
                 $i = 0;
                 $num = $this->db->num_rows($resql);
 
-                while($i < $num) {
-
+                while($i < $num)
+                {
                     $obj = $this->db->fetch_object($resql);
+					$uid = $obj->rowid;
 
                     // On ajoute l'utilisateur
-                    $this->createCPusers(true,$obj->rowid);
+					//print "Add user rowid = ".$uid." into database holiday";
+
+                    $result = $this->createCPusers(true,$uid);
 
                     $i++;
                 }
 
-
+				$this->db->commit();
             } else {
                 // Erreur SQL
                 $this->error="Error ".$this->db->lasterror();
                 dol_syslog(get_class($this)."::verifNbUsers ".$this->error, LOG_ERR);
+                $this->db->rollback();
                 return -1;
             }
 
         } else {
-            // Si il y a moins d'utilisateur Dolibarr que dans le module CP
+        	$this->db->begin();
+
+        	// Si il y a moins d'utilisateur Dolibarr que dans le module CP
 
-            $this->updateConfCP('nbUser',$userDolibarr);
+            $this->updateConfCP('nbUser',$userDolibarrWithoutCP);
 
             $listUsersDolibarr = $this->fetchUsers(true,true);
 
@@ -1333,11 +1345,12 @@
                     $i++;
                 }
 
-
+				$this->db->commit();
             } else {
                 // Erreur SQL
                 $this->error="Error ".$this->db->lasterror();
                 dol_syslog(get_class($this)."::verifNbUsers ".$this->error, LOG_ERR);
+                $this->db->rollback();
                 return -1;
             }
         }
@@ -1674,12 +1687,12 @@
 
         // Filtrage de séléction
         if(!empty($filter)) {
-            $sql.= $filter;
+            $sql.= " ".$filter;
         }
 
         // Ordre d'affichage
         if(!empty($order)) {
-            $sql.= $order;
+            $sql.= " ".$order;
         }
 
         dol_syslog(get_class($this)."::fetchLog sql=".$sql, LOG_DEBUG);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/holiday/define_holiday.php dolibarr-3.5.5+dfsg1/htdocs/holiday/define_holiday.php
--- dolibarr-3.5.4+dfsg2/htdocs/holiday/define_holiday.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/holiday/define_holiday.php	2014-09-23 09:18:24.000000000 +0200
@@ -43,14 +43,17 @@
  */
 
 $form = new Form($db);
+$userstatic=new User($db);
+$holiday = new Holiday($db);
+
 
 llxHeader(array(),$langs->trans('CPTitreMenu'));
 
 print_fiche_titre($langs->trans('MenuConfCP'));
 
-$holiday = new Holiday($db);
+$holiday->updateSold();	// Create users into table holiday if they don't exists. TODO Remove if we use field into table user.
+
 $listUsers = $holiday->fetchUsers(false,false);
-$userstatic=new User($db);
 
 // Si il y a une action de mise à jour
 if ($action == 'update' && isset($_POST['update_cp']))
@@ -71,7 +74,7 @@
     $comment = ((isset($_POST['note_holiday'][$userID]) && !empty($_POST['note_holiday'][$userID])) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
 
     // We add the modification to the log
-    $holiday->addLogCP($user->id,$userID, $langs->trans('ManualUpdate').$comment,$userValue);
+    $holiday->addLogCP($user->id,$userID, $langs->transnoentitiesnoconv('ManualUpdate').$comment,$userValue);
 
     // Update of the days of the employee
     $holiday->updateSoldeCP($userID,$userValue);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/holiday/fiche.php dolibarr-3.5.5+dfsg1/htdocs/holiday/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/holiday/fiche.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/holiday/fiche.php	2014-09-23 09:18:24.000000000 +0200
@@ -237,9 +237,9 @@
     if($user->rights->holiday->delete)
     {
     	$error=0;
-    	
+
     	$db->begin();
-    	
+
         $cp = new Holiday($db);
         $cp->fetch($id);
 
@@ -251,12 +251,12 @@
             {
                 $result=$cp->delete($id);
             }
-            else 
+            else
             {
                 $error = $langs->trans('ErrorCantDeleteCP');
             }
         }
-        
+
        	if (! $error)
         {
           	$db->commit();
@@ -265,7 +265,7 @@
         }
         else
         {
-        	$db->rollback();	
+        	$db->rollback();
         }
     }
 }
@@ -384,7 +384,7 @@
         $verif = $cp->update($user->id);
 
         // Si pas d'erreur SQL on redirige vers la fiche de la demande
-        if ($verif > 0) 
+        if ($verif > 0)
         {
             // Calculcate number of days consummed
             $nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1);
@@ -470,7 +470,7 @@
             $verif = $cp->update($user->id);
 
             // Si pas d'erreur SQL on redirige vers la fiche de la demande
-            if ($verif > 0) 
+            if ($verif > 0)
             {
                 // To
                 $destinataire = new User($db);
@@ -541,7 +541,7 @@
     if (($cp->statut == 2 || $cp->statut == 3) && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user))
     {
     	$db->begin();
-    	
+
     	$oldstatus = $cp->statut;
         $cp->date_cancel = dol_now();
         $cp->fk_user_cancel = $user->id;
@@ -568,16 +568,16 @@
         		$error = $langs->trans('ErrorCantDeleteCP');
         	}
         }
-        
+
         if (! $error)
         {
-        	$db->commit();	
+        	$db->commit();
         }
         else
         {
         	$db->rollback();
         }
-        
+
         // Si pas d'erreur SQL on redirige vers la fiche de la demande
         if (! $error && $result > 0)
         {
@@ -874,7 +874,7 @@
             if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous)
             {
 
-                if ($action == 'delete') 
+                if ($action == 'delete')
                 {
                     if($user->rights->holiday->delete)
                     {
@@ -943,8 +943,8 @@
                     print $langs->trans($listhalfday[$starthalfday]);
                     print '</td>';
                     print '</tr>';
-                } 
-                else 
+                }
+                else
                 {
                     print '<tr>';
                     print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
@@ -965,8 +965,8 @@
                     print $langs->trans($listhalfday[$endhalfday]);
                     print '</td>';
                     print '</tr>';
-                } 
-                else 
+                }
+                else
                 {
                     print '<tr>';
                     print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/holiday/index.php dolibarr-3.5.5+dfsg1/htdocs/holiday/index.php
--- dolibarr-3.5.4+dfsg2/htdocs/holiday/index.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/holiday/index.php	2014-09-23 09:18:24.000000000 +0200
@@ -51,7 +51,7 @@
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 
-$id = GETPOST('id');
+$id = GETPOST('id','int');
 
 $search_ref      = GETPOST('search_ref');
 $month_create    = GETPOST('month_create');
@@ -249,7 +249,7 @@
 }
 else {
 	print '</div>';
-} 
+}
 
 print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
 print '<table class="noborder" width="100%;">';
@@ -299,7 +299,7 @@
     $form->select_users($search_valideur,"search_valideur",1,"",0,$valideurarray,'');
     print '</td>';
 }
-else 
+else
 {
     print '<td class="liste_titre">&nbsp;</td>';
 }
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/holiday/view_log.php dolibarr-3.5.5+dfsg1/htdocs/holiday/view_log.php
--- dolibarr-3.5.4+dfsg2/htdocs/holiday/view_log.php	2014-04-08 23:03:59.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/holiday/view_log.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2007-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
+/* Copyright (C) 2007-2014 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2011      Dimitri Mouillard    <dmouillard@teclib.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -37,7 +37,7 @@
 
 /*
  * View
-*/
+ */
 
 $langs->load('users');
 
@@ -45,7 +45,7 @@
 
 
 $cp = new Holiday($db);
-//Recent changes are more important than old changes
+// Recent changes are more important than old changes
 $log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC','');
 
 print_fiche_titre($langs->trans('LogCP'));
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js dolibarr-3.5.5+dfsg1/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js
--- dolibarr-3.5.4+dfsg2/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js	1970-01-01 01:00:00.000000000 +0100
+++ dolibarr-3.5.5+dfsg1/htdocs/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.js	2014-09-23 09:18:24.000000000 +0200
@@ -0,0 +1,400 @@
+/**
+ * TableDnD plug-in for JQuery, allows you to drag and drop table rows
+ * You can set up various options to control how the system will work
+ * Copyright (c) Denis Howlett <denish@isocra.com>
+ * Licensed like jQuery, see http://docs.jquery.com/License.
+ *
+ * Configuration options:
+ * 
+ * onDragStyle
+ *     This is the style that is assigned to the row during drag. There are limitations to the styles that can be
+ *     associated with a row (such as you can't assign a border--well you can, but it won't be
+ *     displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as
+ *     a map (as used in the jQuery css(...) function).
+ * onDropStyle
+ *     This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations
+ *     to what you can do. Also this replaces the original style, so again consider using onDragClass which
+ *     is simply added and then removed on drop.
+ * onDragClass
+ *     This class is added for the duration of the drag and then removed when the row is dropped. It is more
+ *     flexible than using onDragStyle since it can be inherited by the row cells and other content. The default
+ *     is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your
+ *     stylesheet.
+ * onDrop
+ *     Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table
+ *     and the row that was dropped. You can work out the new order of the rows by using
+ *     table.rows.
+ * onDragStart
+ *     Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
+ *     table and the row which the user has started to drag.
+ * onAllowDrop
+ *     Pass a function that will be called as a row is over another row. If the function returns true, allow 
+ *     dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
+ *     the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
+ * scrollAmount
+ *     This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the
+ *     window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2,
+ *     FF3 beta
+ * dragHandle
+ *     This is the name of a class that you assign to one or more cells in each row that is draggable. If you
+ *     specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
+ *     will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
+ *     the whole row is draggable.
+ * 
+ * Other ways to control behaviour:
+ *
+ * Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
+ * that you don't want to be draggable.
+ *
+ * Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form
+ * <tableID>[]=<rowID1>&<tableID>[]=<rowID2> so that you can send this back to the server. The table must have
+ * an ID as must all the rows.
+ *
+ * Other methods:
+ *
+ * $("...").tableDnDUpdate() 
+ * Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
+ * This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
+ * The table maintains the original configuration (so you don't have to specify it again).
+ *
+ * $("...").tableDnDSerialize()
+ * Will serialize and return the serialized string as above, but for each of the matching tables--so it can be
+ * called from anywhere and isn't dependent on the currentTable being set up correctly before calling
+ *
+ * Known problems:
+ * - Auto-scoll has some problems with IE7  (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
+ * 
+ * Version 0.2: 2008-02-20 First public version
+ * Version 0.3: 2008-02-07 Added onDragStart option
+ *                         Made the scroll amount configurable (default is 5 as before)
+ * Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes
+ *                         Added onAllowDrop to control dropping
+ *                         Fixed a bug which meant that you couldn't set the scroll amount in both directions
+ *                         Added serialize method
+ * Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row
+ *                         draggable
+ *                         Improved the serialize method to use a default (and settable) regular expression.
+ *                         Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table
+ * Version 0.6: 2011-12-02 Added support for touch devices
+ */
+// Determine if this is a touch device
+var hasTouch = 'ontouchstart' in document.documentElement,
+	startEvent = hasTouch ? 'touchstart' : 'mousedown',
+	moveEvent = hasTouch ? 'touchmove' : 'mousemove',
+	endEvent = hasTouch ? 'touchend' : 'mouseup';
+
+jQuery.tableDnD = {
+    /** Keep hold of the current table being dragged */
+    currentTable : null,
+    /** Keep hold of the current drag object if any */
+    dragObject: null,
+    /** The current mouse offset */
+    mouseOffset: null,
+    /** Remember the old value of Y so that we don't do too much processing */
+    oldY: 0,
+
+
+    /** Actually build the structure */
+    build: function(options) {
+        // Set up the defaults if any
+
+        this.each(function() {
+            // This is bound to each matching table, set up the defaults and override with user options
+            this.tableDnDConfig = jQuery.extend({
+                onDragStyle: null,
+                onDropStyle: null,
+				// Add in the default class for whileDragging
+				onDragClass: "tDnD_whileDrag",
+                onDrop: null,
+                onDragStart: null,
+                scrollAmount: 5,
+
+                serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs
+				serializeParamName: null, // If you want to specify another parameter name instead of the table ID
+                dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable
+            }, options || {});
+            // Now make the rows draggable
+            jQuery.tableDnD.makeDraggable(this);
+        });
+
+        // Don't break the chain
+        return this;
+    },
+
+    /** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
+    makeDraggable: function(table) {
+		
+        var config = table.tableDnDConfig;
+		if (config.dragHandle) {
+			// We only need to add the event to the specified cells
+			var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
+			cells.each(function() {
+				// The cell is bound to "this"
+                jQuery(this).bind(startEvent, function(ev) {
+					jQuery.tableDnD.initialiseDrag(this.parentNode, table, this, ev, config);
+                    return false;
+                });
+			})
+		} else {
+			// For backwards compatibility, we add the event to the whole row
+	        var rows = jQuery("tr", table); // get all the rows as a wrapped set
+	        rows.each(function() {
+				// Iterate through each row, the row is bound to "this"
+				var row = jQuery(this);
+				if (! row.hasClass("nodrag")) {
+	                row.bind(startEvent, function(ev) {
+	                    if (ev.target.tagName == "TD") {
+							jQuery.tableDnD.initialiseDrag(this, table, this, ev, config);
+	                        return false;
+	                    }
+	                }).css("cursor", "move"); // Store the tableDnD object
+				}
+			});
+		}
+	},
+	
+	initialiseDrag: function(dragObject, table, target, evnt, config) {
+        jQuery.tableDnD.dragObject = dragObject;
+        jQuery.tableDnD.currentTable = table;
+        jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(target, evnt);
+        jQuery.tableDnD.originalOrder = jQuery.tableDnD.serialize();
+        // Now we need to capture the mouse up and mouse move event
+        // We can use bind so that we don't interfere with other event handlers
+        jQuery(document)
+            .bind(moveEvent, jQuery.tableDnD.mousemove)
+            .bind(endEvent, jQuery.tableDnD.mouseup);
+        if (config.onDragStart) {
+            // Call the onDragStart method if there is one
+            config.onDragStart(table, target);
+        }
+	},
+
+	updateTables: function() {
+		this.each(function() {
+			// this is now bound to each matching table
+			if (this.tableDnDConfig) {
+				jQuery.tableDnD.makeDraggable(this);
+			}
+		})
+	},
+
+    /** Get the mouse coordinates from the event (allowing for browser differences) */
+    mouseCoords: function(ev){
+        if(ev.pageX || ev.pageY){
+            return {x:ev.pageX, y:ev.pageY};
+        }
+        return {
+            x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
+            y:ev.clientY + document.body.scrollTop  - document.body.clientTop
+        };
+    },
+
+    /** Given a target element and a mouse event, get the mouse offset from that element.
+        To do this we need the element's position and the mouse position */
+    getMouseOffset: function(target, ev) {
+        ev = ev || window.event;
+
+        var docPos    = this.getPosition(target);
+        var mousePos  = this.mouseCoords(ev);
+        return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
+    },
+
+    /** Get the position of an element by going up the DOM tree and adding up all the offsets */
+    getPosition: function(e){
+        var left = 0;
+        var top  = 0;
+        /** Safari fix -- thanks to Luis Chato for this! */
+        if (e.offsetHeight == 0) {
+            /** Safari 2 doesn't correctly grab the offsetTop of a table row
+            this is detailed here:
+            http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
+            the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
+            note that firefox will return a text node as a first child, so designing a more thorough
+            solution may need to take that into account, for now this seems to work in firefox, safari, ie */
+            e = e.firstChild; // a table cell
+        }
+
+        while (e.offsetParent){
+            left += e.offsetLeft;
+            top  += e.offsetTop;
+            e     = e.offsetParent;
+        }
+
+        left += e.offsetLeft;
+        top  += e.offsetTop;
+
+        return {x:left, y:top};
+    },
+
+    mousemove: function(ev) {
+        if (jQuery.tableDnD.dragObject == null) {
+            return;
+        }
+		if (ev.type == 'touchmove') {
+			// prevent touch device screen scrolling
+			event.preventDefault(); 
+		}
+
+        var dragObj = jQuery(jQuery.tableDnD.dragObject);
+        var config = jQuery.tableDnD.currentTable.tableDnDConfig;
+        var mousePos = jQuery.tableDnD.mouseCoords(ev);
+        var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
+        //auto scroll the window
+	    var yOffset = window.pageYOffset;
+	 	if (document.all) {
+	        // Windows version
+	        //yOffset=document.body.scrollTop;
+	        if (typeof document.compatMode != 'undefined' &&
+	             document.compatMode != 'BackCompat') {
+	           yOffset = document.documentElement.scrollTop;
+	        }
+	        else if (typeof document.body != 'undefined') {
+	           yOffset=document.body.scrollTop;
+	        }
+
+	    }
+		    
+		if (mousePos.y-yOffset < config.scrollAmount) {
+	    	window.scrollBy(0, -config.scrollAmount);
+	    } else {
+            var windowHeight = window.innerHeight ? window.innerHeight
+                    : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
+            if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
+                window.scrollBy(0, config.scrollAmount);
+            }
+        }
+
+
+        if (y != jQuery.tableDnD.oldY) {
+            // work out if we're going up or down...
+            var movingDown = y > jQuery.tableDnD.oldY;
+            // update the old value
+            jQuery.tableDnD.oldY = y;
+            // update the style to show we're dragging
+			if (config.onDragClass) {
+				dragObj.addClass(config.onDragClass);
+			} else {
+	            dragObj.css(config.onDragStyle);
+			}
+            // If we're over a row then move the dragged row to there so that the user sees the
+            // effect dynamically
+            var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
+            if (currentRow) {
+                // TODO worry about what happens when there are multiple TBODIES
+                if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
+                    jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
+                } else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
+                    jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
+                }
+            }
+        }
+
+        return false;
+    },
+
+    /** We're only worried about the y position really, because we can only move rows up and down */
+    findDropTargetRow: function(draggedRow, y) {
+        var rows = jQuery.tableDnD.currentTable.rows;
+        for (var i=0; i<rows.length; i++) {
+            var row = rows[i];
+            var rowY    = this.getPosition(row).y;
+            var rowHeight = parseInt(row.offsetHeight)/2;
+            if (row.offsetHeight == 0) {
+                rowY = this.getPosition(row.firstChild).y;
+                rowHeight = parseInt(row.firstChild.offsetHeight)/2;
+            }
+            // Because we always have to insert before, we need to offset the height a bit
+            if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) {
+                // that's the row we're over
+				// If it's the same as the current row, ignore it
+				if (row == draggedRow) {return null;}
+                var config = jQuery.tableDnD.currentTable.tableDnDConfig;
+                if (config.onAllowDrop) {
+                    if (config.onAllowDrop(draggedRow, row)) {
+                        return row;
+                    } else {
+                        return null;
+                    }
+                } else {
+					// If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
+                    var nodrop = jQuery(row).hasClass("nodrop");
+                    if (! nodrop) {
+                        return row;
+                    } else {
+                        return null;
+                    }
+                }
+                return row;
+            }
+        }
+        return null;
+    },
+
+    mouseup: function(e) {
+        if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
+	        // Unbind the event handlers
+	        jQuery(document)
+	            .unbind(moveEvent, jQuery.tableDnD.mousemove)
+	            .unbind(endEvent, jQuery.tableDnD.mouseup);
+            var droppedRow = jQuery.tableDnD.dragObject;
+            var config = jQuery.tableDnD.currentTable.tableDnDConfig;
+            // If we have a dragObject, then we need to release it,
+            // The row will already have been moved to the right place so we just reset stuff
+			if (config.onDragClass) {
+	            jQuery(droppedRow).removeClass(config.onDragClass);
+			} else {
+	            jQuery(droppedRow).css(config.onDropStyle);
+			}
+            jQuery.tableDnD.dragObject   = null;
+            var newOrder = jQuery.tableDnD.serialize();
+            if (config.onDrop && (jQuery.tableDnD.originalOrder != newOrder)) {
+                // Call the onDrop method if there is one
+                config.onDrop(jQuery.tableDnD.currentTable, droppedRow);
+            }
+            jQuery.tableDnD.currentTable = null; // let go of the table too
+        }
+    },
+
+    serialize: function() {
+        if (jQuery.tableDnD.currentTable) {
+            return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable);
+        } else {
+            return "Error: No Table id set, you need to set an id on your table and every row";
+        }
+    },
+
+	serializeTable: function(table) {
+        var result = "";
+        var tableId = table.id;
+        var rows = table.rows;
+        for (var i=0; i<rows.length; i++) {
+            if (result.length > 0) result += "&";
+            var rowId = rows[i].id;
+            if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
+                rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
+            }
+
+            result += tableId + '[]=' + rowId;
+        }
+        return result;
+	},
+
+	serializeTables: function() {
+        var result = "";
+        this.each(function() {
+			// this is now bound to each matching table
+			result += jQuery.tableDnD.serializeTable(this);
+		});
+        return result;
+    }
+
+};
+
+
+jQuery.fn.extend(
+	{
+		tableDnD : jQuery.tableDnD.build,
+		tableDnDUpdate : jQuery.tableDnD.updateTables,
+		tableDnDSerialize: jQuery.tableDnD.serializeTables
+	}
+);
\ Pas de fin de ligne à la fin du fichier
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/langs/en_US/admin.lang dolibarr-3.5.5+dfsg1/htdocs/langs/en_US/admin.lang
--- dolibarr-3.5.4+dfsg2/htdocs/langs/en_US/admin.lang	2014-07-04 10:56:33.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/langs/en_US/admin.lang	2014-09-23 09:18:24.000000000 +0200
@@ -1416,8 +1416,8 @@
 ##### Tax #####
 TaxSetup=Taxes, social contributions and dividends module setup
 OptionVatMode=VAT due 
-OptionVATDefault=Standard
-OptionVATDebitOption=Option services on Debit
+OptionVATDefault=Cash basis
+OptionVATDebitOption=Accrual basis
 OptionVatDefaultDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on payments for services
 OptionVatDebitOptionDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on invoice (debit) for services
 SummaryOfVatExigibilityUsedByDefault=Time of VAT exigibility by default according to choosed option: 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/langs/en_US/errors.lang dolibarr-3.5.5+dfsg1/htdocs/langs/en_US/errors.lang
--- dolibarr-3.5.4+dfsg2/htdocs/langs/en_US/errors.lang	2014-04-26 17:22:41.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/langs/en_US/errors.lang	2014-09-23 09:18:24.000000000 +0200
@@ -146,3 +146,5 @@
 WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box.
 WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card).
 WarningNotRelevant=Irrelevant operation for this dataset
+WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters
+
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/main.inc.php dolibarr-3.5.5+dfsg1/htdocs/main.inc.php
--- dolibarr-3.5.4+dfsg2/htdocs/main.inc.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/main.inc.php	2014-09-23 09:18:24.000000000 +0200
@@ -446,6 +446,9 @@
                 $dol_authmode=$conf->authmode;	// This properties is defined only when logged, to say what mode was successfully used
                 $dol_tz=$_POST["tz"];
                 $dol_tz_string=$_POST["tz_string"];
+                $dol_tz_string=preg_replace('/\s*\(.+\)$/','',$dol_tz_string);
+                $dol_tz_string=preg_replace('/,/','/',$dol_tz_string);
+                $dol_tz_string=preg_replace('/\s/','_',$dol_tz_string);
                 $dol_dst=0;
                 if (isset($_POST["dst_first"]) && isset($_POST["dst_second"]))
                 {
@@ -1880,4 +1883,4 @@
     }
 }
 
-?>
\ Pas de fin de ligne à la fin du fichier
+?>
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/margin/productMargins.php dolibarr-3.5.5+dfsg1/htdocs/margin/productMargins.php
--- dolibarr-3.5.4+dfsg2/htdocs/margin/productMargins.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/margin/productMargins.php	2014-09-23 09:18:24.000000000 +0200
@@ -260,13 +260,15 @@
 				print dol_print_date($db->jdate($objp->datef),'day')."</td>";
 			}
 			else {
+				print '<td>';
 				$product_static->type=$objp->fk_product_type;
-				$product_static->id=$objp->fk_product;
+				$product_static->id=$objp->rowid;
 				$product_static->ref=$objp->ref;
 				$product_static->libelle=$objp->label;
 				$text=$product_static->getNomUrl(1);
-				$text.= ' - '.$objp->label;
-				print "<td>".$product_static->getNomUrl(1)."</td>\n";
+				print $text.= ' - '.$objp->label;
+				print "</td>\n";
+				//print "<td>".$product_static->getNomUrl(1)."</td>\n";
 			}
 			print "<td align=\"right\">".price($pv, null, null, null, null, $rounding)."</td>\n";
 			print "<td align=\"right\">".price($pa, null, null, null, null, $rounding)."</td>\n";
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/opensurvey/list.php dolibarr-3.5.5+dfsg1/htdocs/opensurvey/list.php
--- dolibarr-3.5.4+dfsg2/htdocs/opensurvey/list.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/opensurvey/list.php	2014-09-23 09:18:24.000000000 +0200
@@ -26,7 +26,7 @@
 require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
 
 $action=GETPOST('action');
-$id=GETPOST('id');
+$id=GETPOST('id','alpha');
 $numsondage=substr($id, 0, 16);
 
 if (! $sortorder) $sortorder="ASC";
@@ -47,9 +47,9 @@
 	$db->begin();
 
 	$object=new Opensurveysondage($db);
-	
+
 	$result=$object->delete($user,'',$numsondageadmin);
-	
+
 	$db->commit();
 }
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/product/class/product.class.php dolibarr-3.5.5+dfsg1/htdocs/product/class/product.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/product/class/product.class.php	2014-06-21 15:42:55.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/product/class/product.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -6,7 +6,7 @@
  * Copyright (C) 2007-2011 Jean Heimburger      <jean@tiaris.info>
  * Copyright (C) 2010-2011 Juanjo Menent        <jmenent@2byte.es>
  * Copyright (C) 2013	   Cedric GROSS	        <c.gross@kreiz-it.fr>
- * Copyright (C) 2013      Marcos García        <marcosgdf@gmail.com>
+ * Copyright (C) 2013-2014 Marcos García        <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -594,6 +594,7 @@
 	function delete($id=0)
 	{
 		global $conf,$user,$langs;
+		require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
 
 		$error=0;
 
@@ -795,6 +796,59 @@
 		return 1;
 	}
 
+	/**
+	 * Sets an accountancy code for a product.
+	 * Also calls PRODUCT_MODIFY trigger when modified
+	 *
+	 * @param string $type It can be 'buy' or 'sell'
+	 * @param string $value Accountancy code
+	 * @return int <0 KO >0 OK
+	 */
+	public function setAccountancyCode($type, $value)
+	{
+		$this->db->begin();
+
+		if ($type == 'buy') {
+			$field = 'accountancy_code_buy';
+		} elseif ($type == 'sell') {
+			$field = 'accountancy_code_sell';
+		} else {
+			return -1;
+		}
+
+		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ";
+		$sql.= "$field = '".$this->db->escape($value)."'";
+		$sql.= " WHERE rowid = ".$this->id;
+
+		dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG);
+		$resql = $this->db->query($sql);
+
+		if ($resql) {
+			global $user, $langs, $conf;
+
+			// Call triggers
+			include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
+			$interface=new Interfaces($this->db);
+			$result=$interface->run_triggers('PRODUCT_MODIFY',$this,$user,$langs,$conf);
+			if ($result < 0) {
+				$this->errors=$interface->errors;
+				$this->db->rollback();
+				return -1;
+			}
+			// End call triggers
+
+			$this->$field = $value;
+
+			$this->db->commit();
+			return 1;
+		}
+		else
+		{
+			$this->error=$this->db->lasterror();
+			$this->db->rollback();
+			return -1;
+		}
+	}
 
 	/**
 	 *	Load array this->multilangs
@@ -1152,6 +1206,7 @@
 		$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
 		$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
 		$sql.= " datec, tms, import_key, entity, desiredstock";
+		$sql.= " ,ref_ext";
 		$sql.= " FROM ".MAIN_DB_PREFIX."product";
 		if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id);
 		else
@@ -1223,6 +1278,7 @@
 				$this->date_modification		= $obj->tms;
 				$this->import_key				= $obj->import_key;
 				$this->entity					= $obj->entity;
+				$this->ref_ext					= $obj->ref_ext;
 
 				$this->db->free($resql);
 
@@ -2847,15 +2903,15 @@
     							// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
     							if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
     							{
-    								$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=addthumb&amp;file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'&nbsp;&nbsp;</a>';
+    								$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=addthumb&amp;file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'&nbsp;&nbsp;</a>';
     							}
     							if ($user->rights->produit->creer || $user->rights->service->creer)
     							{
     								// Link to resize
-    			               		$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$_GET["id"].'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
+    			               		$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
 
     			               		// Link to delete
-    								$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
+    								$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
     								$return.= img_delete().'</a>';
     							}
     						}
@@ -2875,10 +2931,10 @@
     							if ($user->rights->produit->creer || $user->rights->service->creer)
     							{
     								// Link to resize
-    			               		$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$_GET["id"].'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
+    			               		$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&amp;file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> &nbsp; ';
 
     			               		// Link to delete
-    			               		$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
+    			               		$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
     								$return.= img_delete().'</a>';
     							}
     						}
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/product/fiche.php dolibarr-3.5.5+dfsg1/htdocs/product/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/product/fiche.php	2014-04-24 01:26:52.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/product/fiche.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,12 +1,12 @@
 <?php
 /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2014 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005      Eric Seigne          <eric.seigne@ryxeo.com>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2006      Andre Cianfarani     <acianfa@free.fr>
  * Copyright (C) 2006      Auguria SARL         <info@auguria.org>
  * Copyright (C) 2010-2011 Juanjo Menent        <jmenent@2byte.es>
- * Copyright (C) 2013      Marcos García        <marcosgdf@gmail.com>
+ * Copyright (C) 2013-2014 Marcos García        <marcosgdf@gmail.com>
  * Copyright (C) 2013      Cédric Salvador      <csalvador@gpcsolutions.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -122,20 +122,18 @@
     	exit;
     }
 
-    if ($action == 'setaccountancy_code_buy')
-    {
-        $result = $object->setValueFrom('accountancy_code_buy', GETPOST('accountancy_code_buy'));
+    if ($action == 'setaccountancy_code_buy') {
+
+	    $result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy'));
         if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
-        else $object->accountancy_code_buy=GETPOST('accountancy_code_buy');
         $action="";
     }
 
     if ($action == 'setaccountancy_code_sell')
     {
-        $result = $object->setValueFrom('accountancy_code_sell', GETPOST('accountancy_code_sell'));
-        if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
-        else $object->accountancy_code_sell=GETPOST('accountancy_code_sell');
-        $action="";
+	    $result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell'));
+	    if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
+	    $action="";
     }
 
     // Add a product or service
@@ -389,7 +387,7 @@
 
         if ($result > 0)
         {
-            header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref));
+            header('Location: '.DOL_URL_ROOT.'/product/liste.php?type='.$object->type.'&delprod='.urlencode($object->ref));
             exit;
         }
         else
@@ -870,7 +868,7 @@
 
             $type = $langs->trans('Product');
             if ($object->isservice()) $type = $langs->trans('Service');
-            print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, "");
+            print_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
 
             // Main official, simple, and not duplicated code
             print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n";
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/product/index.php dolibarr-3.5.5+dfsg1/htdocs/product/index.php
--- dolibarr-3.5.4+dfsg2/htdocs/product/index.php	2014-04-09 01:38:54.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/product/index.php	2014-09-23 09:18:24.000000000 +0200
@@ -27,7 +27,7 @@
 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
 
-$type=isset($_GET["type"])?$_GET["type"]:(isset($_POST["type"])?$_POST["type"]:'');
+$type=GETPOST("type",'int');
 if ($type =='' && !$user->rights->produit->lire) $type='1';	// Force global page on service page only
 if ($type =='' && !$user->rights->service->lire) $type='0';	// Force global page on product page only
 
@@ -261,7 +261,7 @@
 
 
 // TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter"
-// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover": 
+// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover":
 // "commitment engagment" method and "cash accounting" method
 if ($conf->global->MAIN_FEATURES_LEVEL)
 {
@@ -283,8 +283,8 @@
 function activitytrim($product_type)
 {
 	global $conf,$langs,$db;
-	
-	// We display the last 3 years 
+
+	// We display the last 3 years
 	$yearofbegindate=date('Y',dol_time_plus_duree(time(), -3, "y"));
 
 	// breakdown by quarter
@@ -311,7 +311,7 @@
 		$trim4=0;
 		$lgn = 0;
 		$num = $db->num_rows($result);
-		
+
 		if ($num > 0 )
 		{
 			print '<br>';
@@ -353,7 +353,7 @@
 				$trim3=0;
 				$trim4=0;
 			}
-			
+
 			if ($objp->mois == "01" || $objp->mois == "02" || $objp->mois == "03")
 				$trim1 += $objp->Mnttot;
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/product/stats/contrat.php dolibarr-3.5.5+dfsg1/htdocs/product/stats/contrat.php
--- dolibarr-3.5.4+dfsg2/htdocs/product/stats/contrat.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/product/stats/contrat.php	2014-09-23 09:18:24.000000000 +0200
@@ -70,7 +70,7 @@
 {
 	$product = new Product($db);
 	$result = $product->fetch($id, $ref);
-	
+
 	$parameters=array('id'=>$id);
 	$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action);    // Note that $action and $object may have been modified by some hooks
 	$error=$hookmanager->error; $errors=$hookmanager->errors;
@@ -83,7 +83,7 @@
 		$titre=$langs->trans("CardProduct".$product->type);
 		$picto=($product->type==1?'service':'product');
 		dol_fiche_head($head, 'referers', $titre, 0, $picto);
-		
+
 		$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action);    // Note that $action and $object may have been modified by hook
 
 		print '<table class="border" width="100%">';
@@ -135,7 +135,7 @@
 		if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
 		if ($socid) $sql.= " AND s.rowid = ".$socid;
 		$sql.= " GROUP BY c.rowid, c.date_contrat, c.statut, s.nom, s.rowid, s.code_client";
-		$sql.= " ORDER BY $sortfield $sortorder";
+		$sql.= $db->order($sortfield, $sortorder);
 		$sql.= $db->plimit($conf->liste_limit +1, $offset);
 
 		$result = $db->query($sql);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/product/stock/liste.php dolibarr-3.5.5+dfsg1/htdocs/product/stock/liste.php
--- dolibarr-3.5.4+dfsg2/htdocs/product/stock/liste.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/product/stock/liste.php	2014-09-23 09:18:24.000000000 +0200
@@ -31,12 +31,12 @@
 // Security check
 $result=restrictedArea($user,'stock');
 
-$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
-$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"];
-$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
+$sref=GETPOST("sref");;
+$snom=GETPOST("snom");
+$sall=GETPOST("sall");
 
-$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
-$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
+$sortfield = GETPOST("sortfield");
+$sortorder = GETPOST("sortorder");
 if (! $sortfield) $sortfield="e.label";
 if (! $sortorder) $sortorder="ASC";
 $page = $_GET["page"];
@@ -50,13 +50,13 @@
 $sql.= " WHERE e.entity = ".$conf->entity;
 if ($sref)
 {
-    $sql.= " AND e.label like '%".$sref."%'";
+    $sql.= " AND e.label like '%".$db->escape($sref)."%'";
 }
 if ($sall)
 {
-    $sql.= " AND (e.description like '%".$sall."%' OR e.lieu like '%".$sall."%' OR e.address like '%".$sall."%' OR e.town like '%".$sall."%')";
+    $sql.= " AND (e.description like '%".$db->escape($sall)."%' OR e.lieu like '%".$db->escape($sall)."%' OR e.address like '%".$db->escape($sall)."%' OR e.town like '%".$db->escape($sall)."%')";
 }
-$sql.= " ORDER BY $sortfield $sortorder";
+$sql.= $db->order($sortfield,$sortorder);
 $sql.= $db->plimit($limit+1, $offset);
 
 $result = $db->query($sql);
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/product/stock/massstockmove.php dolibarr-3.5.5+dfsg1/htdocs/product/stock/massstockmove.php
--- dolibarr-3.5.4+dfsg2/htdocs/product/stock/massstockmove.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/product/stock/massstockmove.php	2014-09-23 09:18:24.000000000 +0200
@@ -44,9 +44,9 @@
 //checks if a product has been ordered
 
 $action = GETPOST('action','alpha');
-$id_product = GETPOST('productid', 'productid');
-$id_sw = GETPOST('id_sw', 'id_sw');
-$id_tw = GETPOST('id_tw', 'id_tw');
+$id_product = GETPOST('productid', 'int');
+$id_sw = GETPOST('id_sw', 'int');
+$id_tw = GETPOST('id_tw', 'int');
 $qty = GETPOST('qty');
 $idline = GETPOST('idline');
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/product/stock/replenishorders.php dolibarr-3.5.5+dfsg1/htdocs/product/stock/replenishorders.php
--- dolibarr-3.5.4+dfsg2/htdocs/product/stock/replenishorders.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/product/stock/replenishorders.php	2014-09-23 09:18:24.000000000 +0200
@@ -72,13 +72,8 @@
 $sortorder = GETPOST('sortorder', 'alpha');
 $sortfield = GETPOST('sortfield', 'alpha');
 
-if (!$sortorder) {
-    $sortorder = 'DESC';
-}
-
-if (!$sortfield) {
-    $sortfield = 'cf.date_creation';
-}
+if (!$sortorder) $sortorder = 'DESC';
+if (!$sortfield) $sortfield = 'cf.date_creation';
 
 $offset = $conf->liste_limit * $page ;
 
@@ -146,7 +141,7 @@
 }
 $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
 $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
-$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder  . ' ';
+$sql .= $db->order($sortfield, $sortorder);
 $sql .= $db->plimit($conf->liste_limit+1, $offset);
 $resql = $db->query($sql);
 if ($resql)
@@ -317,7 +312,7 @@
          '</form>';
 
     $db->free($resql);
-    
+
     dol_fiche_end();
 }
 else
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/activity/list.php dolibarr-3.5.5+dfsg1/htdocs/projet/activity/list.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/activity/list.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/activity/list.php	2014-09-23 09:18:24.000000000 +0200
@@ -114,8 +114,6 @@
 if ($mine) $title=$langs->trans("MyTimeSpent");
 
 
-llxHeader("",$title,"");
-
 //$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);  // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
 
@@ -133,6 +131,9 @@
 //var_dump($taskrole);
 
 
+
+llxHeader("",$title,"");
+
 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
 
 
@@ -156,8 +157,18 @@
 print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
 print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
 print "</tr>\n";
-projectLinesb($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine);
 
+// By default, we can edit only tasks we are assigned to
+$restricteditformytask=(empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS)?1:0);	 
+
+if (count($tasksarray) > 0)
+{
+	projectLinesb($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
+}
+else
+{
+	print '<tr><td colspan="10">'.$langs->trans("NoTasks").'</td></tr>';
+}
 print "</table>";
 print '</form>';
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/class/project.class.php dolibarr-3.5.5+dfsg1/htdocs/projet/class/project.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/class/project.class.php	2014-06-21 15:44:30.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/class/project.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -204,9 +204,9 @@
             $sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null");
             $sql.= ", fk_statut = " . $this->statut;
             $sql.= ", public = " . ($this->public ? 1 : 0);
-            $sql.= ", datec=" . ($this->date_c != '' ? $this->db->idate($this->date_c) : 'null');
-            $sql.= ", dateo=" . ($this->date_start != '' ? $this->db->idate($this->date_start) : 'null');
-            $sql.= ", datee=" . ($this->date_end != '' ? $this->db->idate($this->date_end) : 'null');
+            $sql.= ", datec=" . ($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null');
+            $sql.= ", dateo=" . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
+            $sql.= ", datee=" . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
             $sql.= " WHERE rowid = " . $this->id;
 
             dol_syslog(get_class($this)."::Update sql=" . $sql, LOG_DEBUG);
@@ -263,6 +263,7 @@
             else
             {
                 $this->error = $this->db->lasterror();
+                $this->errors[] = $this->error;
                 dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR);
                 $result = -2;
             }
@@ -296,7 +297,7 @@
         }
         else if (! empty($ref))
         {
-        	$sql.= " WHERE ref='".$ref."'";
+        	$sql.= " WHERE ref='".$this->db->escape($ref)."'";
         	$sql.= " AND entity IN (".getEntity('project').")";
         }
 
@@ -513,10 +514,9 @@
         $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields";
         $sql.= " WHERE fk_object=" . $this->id;
 
-
         dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
         $resql = $this->db->query($sql);
-        if (!$resql)
+        if (! $resql)
         {
         	$this->errors[] = $this->db->lasterror();
         	$error++;
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/class/task.class.php dolibarr-3.5.5+dfsg1/htdocs/projet/class/task.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/class/task.class.php	2014-07-08 01:15:37.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/class/task.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -207,7 +207,7 @@
         $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t";
         $sql.= " WHERE ";
         if (!empty($ref)) {
-        	$sql.="t.ref = '".$ref."'";
+        	$sql.="t.ref = '".$this->db->escape($ref)."'";
         }else {
         	$sql.="t.rowid = ".$id;
         }
@@ -354,6 +354,7 @@
     {
 
         global $conf, $langs;
+        require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
 
         $error=0;
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/contact.php dolibarr-3.5.5+dfsg1/htdocs/projet/contact.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/contact.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/contact.php	2014-09-23 09:18:24.000000000 +0200
@@ -93,7 +93,7 @@
 {
 	if ($object->fetch($id))
 	{
-	    $result=$object->swapContactStatus(GETPOST('ligne'));
+	    $result=$object->swapContactStatus(GETPOST('ligne','int'));
 	}
 	else
 	{
@@ -105,7 +105,7 @@
 if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->projet->creer)
 {
 	$object->fetch($id);
-	$result = $object->delete_contact($_GET["lineid"]);
+	$result = $object->delete_contact(GETPOST("lineid"));
 
 	if ($result >= 0)
 	{
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/element.php dolibarr-3.5.5+dfsg1/htdocs/projet/element.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/element.php	2014-07-14 23:10:40.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/element.php	2014-09-23 09:18:24.000000000 +0200
@@ -209,13 +209,13 @@
 	$classname=$value['class'];
 	$tablename=$value['table'];
 	$qualified=$value['test'];
-	
+
 	if ($qualified)
 	{
 		print '<br>';
 
 		print_titre($langs->trans($title));
-		
+
 		$selectList=$formproject->select_element($tablename,$project->societe->id);
 
 		if (!$selectList || ($selectList<0)) {
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/index.php dolibarr-3.5.5+dfsg1/htdocs/projet/index.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/index.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/index.php	2014-09-23 09:18:24.000000000 +0200
@@ -164,9 +164,10 @@
 
 	if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
 	{
-/*		print '<tr '.$bc[0].'>';
+/*		$langs->load("errors");
+  		print '<tr '.$bc[0].'>';
 		print '<td colspan="9">';
-		print $langs->trans("TooManyDataPleaseUseMoreFilters");
+		print $langs->trans("WarningTooManyDataPleaseUseMoreFilters");
 		print '</td></tr>';*/
 	}
 	else
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/tasks/index.php dolibarr-3.5.5+dfsg1/htdocs/projet/tasks/index.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/tasks/index.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/tasks/index.php	2014-09-23 09:18:24.000000000 +0200
@@ -41,9 +41,9 @@
 if ($user->societe_id > 0) $socid = $user->societe_id;
 if (!$user->rights->projet->lire) accessforbidden();
 
-$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
-$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
-$page = isset($_GET["page"])? $_GET["page"]:$_POST["page"];
+$sortfield = GETPOST("sortfield");
+$sortorder = GETPOST("sortorder");
+$page = GETPOST("page");
 $page = is_numeric($page) ? $page : 0;
 $page = $page == -1 ? 0 : $page;
 
@@ -121,9 +121,10 @@
 
 if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
 {
+	$langs->load("errors");
 	print '<tr '.$bc[0].'>';
 	print '<td colspan="9">';
-	print $langs->trans("TooManyDataPleaseUseMoreFilters");
+	print $langs->trans("WarningTooManyDataPleaseUseMoreFilters");
 	print '</td></tr>';
 }
 else
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/projet/tasks/time.php dolibarr-3.5.5+dfsg1/htdocs/projet/tasks/time.php
--- dolibarr-3.5.4+dfsg2/htdocs/projet/tasks/time.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/projet/tasks/time.php	2014-09-23 09:18:24.000000000 +0200
@@ -65,7 +65,8 @@
 	}
 	if (empty($_POST["userid"]))
 	{
-		setEventMessage($langs->trans('ErrorUserNotAffectedToTask'),'errors');
+		$langs->load("errors");
+		setEventMessage($langs->trans('ErrorUserNotAssignedToTask'),'errors');
 		$error++;
 	}
 
@@ -327,9 +328,13 @@
 
 			// Contributor
 			print '<td class="nowrap">';
-			$contactoftask=$object->getListContactId('internal');
+			$restrictaddtimetocontactoftask=0;
+			if (empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS))
+			{
+				$restrictaddtimetocontactoftask=$object->getListContactId('internal');
+			}
 			print img_object('','user');
-			print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$contactoftask);
+			print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$restrictaddtimetocontactoftask);	// Note: If user is not allowed it will be disabled into combo list and userid not posted
 			print '</td>';
 
 			// Note
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/societe/soc.php dolibarr-3.5.5+dfsg1/htdocs/societe/soc.php
--- dolibarr-3.5.4+dfsg2/htdocs/societe/soc.php	2014-06-20 13:21:03.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/societe/soc.php	2014-09-23 09:18:24.000000000 +0200
@@ -159,14 +159,7 @@
 
         $object->forme_juridique_code  = GETPOST('forme_juridique_code');
         $object->effectif_id           = GETPOST('effectif_id');
-        if (GETPOST("private") == 1)
-        {
-            $object->typent_id         = dol_getIdFromCode($db,'TE_PRIVATE','c_typent');
-        }
-        else
-        {
-            $object->typent_id         = GETPOST('typent_id');
-        }
+        $object->typent_id         = GETPOST('typent_id');
 
         $object->client                = GETPOST('client');
         $object->fournisseur           = GETPOST('fournisseur');
@@ -1423,7 +1416,7 @@
             print '<tr class="hideonsmartphone">';
             print '<td>'.$langs->trans("Logo").'</td>';
             print '<td colspan="3">';
-            if ($object->logo) print $form->showphoto('societe',$object,50);
+            if ($object->logo) print $form->showphoto('societe',$object);
             $caneditfield=1;
             if ($caneditfield)
             {
@@ -1497,7 +1490,7 @@
         print '</tr>';
 
         // Logo+barcode
-        $rowspan=4;
+        $rowspan=6;
         if (! empty($conf->global->SOCIETE_USEPREFIX)) $rowspan++;
         if (! empty($object->client)) $rowspan++;
         if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) $rowspan++;
@@ -1507,9 +1500,9 @@
         if ($showlogo || $showbarcode)
         {
             $htmllogobar.='<td rowspan="'.$rowspan.'" style="text-align: center;" width="25%">';
-            if ($showlogo)   $htmllogobar.=$form->showphoto('societe',$object,50);
+            if ($showlogo)   $htmllogobar.=$form->showphoto('societe',$object);
             if ($showlogo && $showbarcode) $htmllogobar.='<br><br>';
-            if ($showbarcode) $htmllogobar.=$form->showbarcode($object,50);
+            if ($showbarcode) $htmllogobar.=$form->showbarcode($object);
             $htmllogobar.='</td>';
         }
 
@@ -1588,12 +1581,12 @@
         if (empty($conf->global->SOCIETE_DISABLE_STATE)) print '<tr><td>'.$langs->trans('State').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">'.$object->state.'</td>';
 
         // EMail
-        print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">';
+        print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
         print dol_print_email($object->email,0,$object->id,'AC_EMAIL');
         print '</td></tr>';
 
         // Web
-        print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
+        print '<tr><td>'.$langs->trans('Web').'</td><td colspan="'.(2+(($showlogo || $showbarcode)?0:1)).'">';
         print dol_print_url($object->url);
         print '</td></tr>';
 
@@ -1937,7 +1930,6 @@
 	        if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
 	        {
 				print '<div class="fichecenter"><div class="fichethirdleft">';
-	        	//print '<table width="100%"><tr><td valign="top" width="50%">';
 	            print '<a name="builddoc"></a>'; // ancre
 
 	            /*
Les fichiers binaires /tmp/V0Ha1W6BJb/dolibarr-3.5.4+dfsg2/htdocs/theme/amarok/img/object_address.png et /tmp/SCO867InuQ/dolibarr-3.5.5+dfsg1/htdocs/theme/amarok/img/object_address.png sont différents
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/theme/amarok/style.css.php dolibarr-3.5.5+dfsg1/htdocs/theme/amarok/style.css.php
--- dolibarr-3.5.4+dfsg2/htdocs/theme/amarok/style.css.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/theme/amarok/style.css.php	2014-09-23 09:18:24.000000000 +0200
@@ -471,6 +471,7 @@
 form#login img#img_logo {
 	width:190px;
 	max-width:190px;
+	max-height:100px;
 	height:auto;
 	border-radius:6px;
 	padding:6px;
@@ -589,6 +590,10 @@
 	height: 16px;
 }
 
+#securitycode {
+	min-width: 60px;
+}
+
 img.login, img.printer, img.entity {
 	/* padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */
 	margin:2px 0px 0px 0px;
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/theme/auguria/style.css.php dolibarr-3.5.5+dfsg1/htdocs/theme/auguria/style.css.php
--- dolibarr-3.5.4+dfsg2/htdocs/theme/auguria/style.css.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/theme/auguria/style.css.php	2014-09-23 09:18:24.000000000 +0200
@@ -545,11 +545,15 @@
 	background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
 	background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
 }
+#securitycode {
+	min-width: 60px;
+}
 #img_securitycode {
 	border: 1px solid #DDDDDD;
 }
 #img_logo {
 	max-width: 200px;
+	max-height: 100px;
 }
 
 div.login_block {
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/theme/bureau2crea/style.css.php dolibarr-3.5.5+dfsg1/htdocs/theme/bureau2crea/style.css.php
--- dolibarr-3.5.4+dfsg2/htdocs/theme/bureau2crea/style.css.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/theme/bureau2crea/style.css.php	2014-09-23 09:18:24.000000000 +0200
@@ -578,11 +578,15 @@
 	background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
 	background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
 }
+#securitycode {
+	min-width: 60px;
+}
 #img_securitycode {
 	border: 1px solid #DDDDDD;
 }
 #img_logo {
 	max-width: 200px;
+	max-height: 100px;
 }
 
 div.login_block {
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/theme/cameleo/style.css.php dolibarr-3.5.5+dfsg1/htdocs/theme/cameleo/style.css.php
--- dolibarr-3.5.4+dfsg2/htdocs/theme/cameleo/style.css.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/theme/cameleo/style.css.php	2014-09-23 09:18:24.000000000 +0200
@@ -649,11 +649,15 @@
 	background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
 	background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
 }
+#securitycode {
+	min-width: 60px;
+}
 #img_securitycode {
 	border: 1px solid #DDDDDD;
 }
 #img_logo {
 	max-width: 200px;
+	max-height: 100px;
 }
 
 div.login_block {
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/theme/eldy/graph-color.php dolibarr-3.5.5+dfsg1/htdocs/theme/eldy/graph-color.php
--- dolibarr-3.5.4+dfsg2/htdocs/theme/eldy/graph-color.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/theme/eldy/graph-color.php	2014-09-23 09:18:24.000000000 +0200
@@ -28,7 +28,7 @@
 
 global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
 $theme_bordercolor = array(235,235,224);
-$theme_datacolor = array(array(190,190,220), array(200,160,180), array(125,135,150), array(170,140,190), array(190,190,170));
+$theme_datacolor = array(array(190,190,220), array(200,160,180), array(125,135,150), array(170,140,190), array(190,190,170), array(190,170,190), array(170,190,190), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));
 $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4'));
 $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC'));
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/theme/eldy/style.css.php dolibarr-3.5.5+dfsg1/htdocs/theme/eldy/style.css.php
--- dolibarr-3.5.4+dfsg2/htdocs/theme/eldy/style.css.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/theme/eldy/style.css.php	2014-09-23 09:18:24.000000000 +0200
@@ -681,7 +681,7 @@
 }
 
 div.mainmenu.companies {
-	background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png',1) ?>);
+	background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png',1) ?>);
 }
 
 div.mainmenu.commercial {
@@ -862,11 +862,15 @@
 table.login_table tr td table.none tr td {
 	padding: 2px;
 }
+#securitycode {
+	min-width: 60px;
+}
 #img_securitycode {
 	border: 1px solid #DDDDDD;
 }
 #img_logo {
 	max-width: 200px;
+	max-height: 100px;
 }
 
 div.login_block {
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/user/class/user.class.php dolibarr-3.5.5+dfsg1/htdocs/user/class/user.class.php
--- dolibarr-3.5.4+dfsg2/htdocs/user/class/user.class.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/user/class/user.class.php	2014-09-23 09:18:24.000000000 +0200
@@ -2192,8 +2192,8 @@
 		// Load array[child]=parent
 		$sql = "SELECT fk_user as id_parent, rowid as id_son";
 		$sql.= " FROM ".MAIN_DB_PREFIX."user";
-		$sql.= " WHERE fk_user != 0";
-		$sql.= " AND entity = ".$conf->entity;
+		$sql.= " WHERE fk_user <> 0";
+		$sql.= " AND entity IN (".getEntity('user',1).")";
 
 		dol_syslog(get_class($this)."::load_parentof sql=".$sql);
 		$resql = $this->db->query($sql);
@@ -2222,10 +2222,10 @@
 	 *				fullname = nom avec chemin complet du user
 	 *				fullpath = chemin complet compose des id
 	 *
-	 *  @param      int		$markafterid      Removed all users including the leaf $markafterid in user tree.
-	 *	@return		array		      		  Array of users. this->users and this->parentof are set.
+	 *  @param      int		$deleteafterid      Removed all users including the leaf $deleteafterid (and all its child) in user tree.
+	 *	@return		array		      		  	Array of users. this->users and this->parentof are set.
 	 */
-	function get_full_tree($markafterid=0)
+	function get_full_tree($deleteafterid=0)
 	{
 		global $conf,$user;
 
@@ -2233,7 +2233,7 @@
 
 		// Init this->parentof that is array(id_son=>id_parent, ...)
 		$this->load_parentof();
-
+		
 		// Init $this->users array
 		$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut, u.entity";	// Distinct reduce pb with old tables with duplicates
 		$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
@@ -2276,14 +2276,14 @@
 			$this->build_path_from_id_user($key,0);	// Process a branch from the root user key (this user has no parent)
 		}
 
-		// Exclude leaf including $markafterid from tree
-		if ($markafterid)
+		// Exclude leaf including $deleteafterid from tree
+		if ($deleteafterid)
 		{
-			//print "Look to discard user ".$markafterid."\n";
-			$keyfilter1='^'.$markafterid.'$';
-			$keyfilter2='_'.$markafterid.'$';
-			$keyfilter3='^'.$markafterid.'_';
-			$keyfilter4='_'.$markafterid.'_';
+			//print "Look to discard user ".$deleteafterid."\n";
+			$keyfilter1='^'.$deleteafterid.'$';
+			$keyfilter2='_'.$deleteafterid.'$';
+			$keyfilter3='^'.$deleteafterid.'_';
+			$keyfilter4='_'.$deleteafterid.'_';
 			foreach($this->users as $key => $val)
 			{
 				if (preg_match('/'.$keyfilter1.'/',$val['fullpath']) || preg_match('/'.$keyfilter2.'/',$val['fullpath'])
@@ -2322,13 +2322,13 @@
 
 		// Define fullpath and fullname
 		$this->users[$id_user]['fullpath'] = '_'.$id_user;
-		$this->users[$id_user]['fullname'] = $this->users[$id_user]['label'];
+		$this->users[$id_user]['fullname'] = $this->users[$id_user]['lastname'];
 		$i=0; $cursor_user=$id_user;
 
 		while ((empty($protection) || $i < $protection) && ! empty($this->parentof[$cursor_user]))
 		{
 			$this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath'];
-			$this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['label'].' >> '.$this->users[$id_user]['fullname'];
+			$this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname'];
 			$i++; $cursor_user=$this->parentof[$cursor_user];
 		}
 
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/user/fiche.php dolibarr-3.5.5+dfsg1/htdocs/user/fiche.php
--- dolibarr-3.5.4+dfsg2/htdocs/user/fiche.php	2014-06-14 13:22:26.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/user/fiche.php	2014-09-23 09:18:24.000000000 +0200
@@ -1879,19 +1879,23 @@
             print "</tr>\n";
 
 			// Accountancy code
-            print "<tr>";
-            print '<td valign="top">'.$langs->trans("AccountancyCode").'</td>';
-            print '<td>';
-            if ($caneditfield)
+            if (! empty($conf->global->USER_ENABLE_ACCOUNTANCY_CODE))	// For the moment field is not used so must not appeared.
             {
-                print '<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.'">';
+	            print "<tr>";
+	            print '<td valign="top">'.$langs->trans("AccountancyCode").'</td>';
+	            print '<td>';
+	            if ($caneditfield)
+	            {
+	                print '<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.'">';
+	            }
+	            else
+	            {
+	                print '<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.'">';
+	                print $object->accountancy_code;
+	            }
+	            print '</td>';
+	            print "</tr>";
             }
-            else
-            {
-                print '<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.'">';
-                print $object->accountancy_code;
-            }
-            print '</td>';
 
             // Status
             print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
diff -Nru dolibarr-3.5.4+dfsg2/htdocs/user/param_ihm.php dolibarr-3.5.5+dfsg1/htdocs/user/param_ihm.php
--- dolibarr-3.5.4+dfsg2/htdocs/user/param_ihm.php	2014-04-08 23:04:00.000000000 +0200
+++ dolibarr-3.5.5+dfsg1/htdocs/user/param_ihm.php	2014-09-23 09:18:24.000000000 +0200
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2005-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
+/* Copyright (C) 2005-2014 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2010-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2013	   Florian Henry        <florian.henry@open-concept.pro.com>
  *
@@ -87,8 +87,6 @@
         if ($_POST["check_MAIN_LANG_DEFAULT"]=="on") $tabparam["MAIN_LANG_DEFAULT"]=$_POST["main_lang_default"];
         else $tabparam["MAIN_LANG_DEFAULT"]='';
 
-        $tabparam["MAIN_MENU_STANDARD"]=$_POST["MAIN_MENU_STANDARD"];
-
         if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["MAIN_SIZE_LISTE_LIMIT"]=$_POST["main_size_liste_limit"];
         else $tabparam["MAIN_SIZE_LISTE_LIMIT"]='';
 
@@ -101,8 +99,6 @@
 
         $result=dol_set_user_param($db, $conf, $fuser, $tabparam);
 
-        $_SESSION["mainmenu"]="";   // Le gestionnaire de menu a pu changer
-
         header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
         exit;
     }
