[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#797906: marked as done (jessie-pu: package dolibarr/3.5.5+dfsg1-2)



Your message dated Sat, 02 Apr 2016 14:20:04 +0100
with message-id <1459603204.2441.216.camel@adam-barratt.org.uk>
and subject line Fix included in stable
has caused the Debian Bug report #797906,
regarding jessie-pu: package dolibarr/3.5.5+dfsg1-2
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
797906: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797906
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

A security error CVE-2015-3935 was reported for Dolibarr ERP CRM package. This bug is fixed into official package 3.5.7 of Dolibarr.
Package 3.5.7 is a maintenance release compared to 3.5.5 and contains only fixes. But not only bugs reported to debian, it includes also other fixes (but they are all related to stability or security).
I think it is a better solution to validate this maintenance release based on the new upstream version of Dolibarr than applying a patch of the only CVE-2015-3935.
Pro are:
- It fixes all debian reported bugs (including security one)
- It fixes also stability bugs
- Patches were already tested because deployed and used by several thousands of users.
- It is easier for package maintener to include this official set of fixes than applying one patch after one patch for each debian report or backported each patch into a dedicated version.
- Debian maintenance version matches with official project maintenance version (better when all fixes are not related to the way the software is packaged)
Cons are: 
- The patch include more than the only one security reported fxes

So I just need to know if it's ok to push such a version 3.5.7 (fixes for 3.5.* branch) instead of only one fix for only the few (the only) reported debian bugs,
since it provides more stability and is or me a more secured process.

I include the debdiff into this email


-- System Information:
Debian Release: jessie/sid
  APT prefers trusty-updates
  APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 'trusty-proposed'), (500, 'trusty'), (100, 'trusty-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-63-generic (SMP w/8 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

*** /tmp/bbb
diff -Nru dolibarr-3.5.5+dfsg1/build/debian/changelog dolibarr-3.5.7+dfsg1/build/debian/changelog
--- dolibarr-3.5.5+dfsg1/build/debian/changelog	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/build/debian/changelog	2015-05-16 15:21:42.000000000 +0200
@@ -1,3 +1,17 @@
+dolibarr (3.5.7-3) unstable; urgency=low
+
+  [ Laurent Destailleur (eldy) ]
+  * New upstream release.
+    
+ -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net>  Tue, 12 May 2015 12:00:00 +0100     
+
+dolibarr (3.5.6-3) unstable; urgency=low
+
+  [ Laurent Destailleur (eldy) ]
+  * New upstream release.
+    
+ -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net>  Tue, 2 Dec 2014 12:00:00 +0100     
+
 dolibarr (3.5.5-3) unstable; urgency=low
 
   [ Laurent Destailleur (eldy) ]
diff -Nru dolibarr-3.5.5+dfsg1/build/makepack-dolibarr.pl dolibarr-3.5.7+dfsg1/build/makepack-dolibarr.pl
--- dolibarr-3.5.5+dfsg1/build/makepack-dolibarr.pl	2014-10-03 19:07:35.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/build/makepack-dolibarr.pl	2015-05-16 16:13:53.000000000 +0200
@@ -2,7 +2,7 @@
 #----------------------------------------------------------------------------
 # \file         build/makepack-dolibarr.pl
 # \brief        Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
-# \author       (c)2004-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
+# \author       (c)2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
 #
 # This is list of constant you can set to have generated packages moved into a specific dir: 
 #DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
@@ -15,12 +15,17 @@
 
 use Cwd;
 
+
+# Change this to defined target for option 98 and 99
 $PROJECT="dolibarr";
-$RPMSUBVERSION="auto";	# auto use value found into BUILD
+$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
+$PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
+
 
 @LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT");   # Possible packages
 %REQUIREMENTPUBLISH=(
-"SF"=>"git ssh rsync"
+"SF"=>"git ssh rsync",
+"ASSO"=>"git ssh rsync"
 );
 %REQUIREMENTTARGET=(                            # Tool requirement for each package
 "TGZ"=>"tar",
@@ -40,6 +45,7 @@
 "makensis.exe"=>"NSIS"
 );
 
+$RPMSUBVERSION="auto";	# auto use value found into BUILD
 if (-d "/usr/src/redhat")   { $RPMDIR="/usr/src/redhat"; } # redhat
 if (-d "/usr/src/packages") { $RPMDIR="/usr/src/packages"; } # opensuse
 if (-d "/usr/src/RPM")      { $RPMDIR="/usr/src/RPM"; } # mandrake
@@ -58,22 +64,21 @@
 
 $SOURCE="$DIR/..";
 $DESTI="$SOURCE/build";
-$PUBLISH="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
 if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
 {
-    print "Error: Missing environment variables.\n";
+	print "Error: Missing environment variables.\n";
 	print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n";
 	print "Example: DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'\n";
 	print "Example: DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'\n";
 	print "$PROG.$Extension aborted.\n";
-    sleep 2;
+	sleep 2;
 	exit 1;
 }
 if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
 {
-    print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n";
+	print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n";
 	print "$PROG.$Extension aborted.\n";
-    sleep 2;
+	sleep 2;
 	exit 1;
 }
 
@@ -83,31 +88,31 @@
 elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
 elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; }
 if (! $OS) {
-    print "Error: Can't detect your OS.\n";
+	print "Error: Can't detect your OS.\n";
 	print "Can't continue.\n";
 	print "$PROG.$Extension aborted.\n";
-    sleep 2;
+	sleep 2;
 	exit 1;
 }
 
 # Define buildroot
 # ----------------
 if ($OS =~ /linux/) {
-    $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
+	$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
 }
 if ($OS =~ /macos/) {
-    $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
+	$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
 }
 if ($OS =~ /windows/) {
-    $TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"c:/temp";
-    $PROGPATH=$ENV{"ProgramFiles"};
+	$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"c:/temp";
+	$PROGPATH=$ENV{"ProgramFiles"};
 }
 if (! $TEMP || ! -d $TEMP) {
-    print "Error: A temporary directory can not be find.\n";
-    print "Check that TEMP or TMP environment variable is set correctly.\n";
+	print "Error: A temporary directory can not be find.\n";
+	print "Check that TEMP or TMP environment variable is set correctly.\n";
 	print "$PROG.$Extension aborted.\n";
-    sleep 2;
-    exit 2;
+	sleep 2;
+	exit 2;
 } 
 $BUILDROOT="$TEMP/buildroot";
 
@@ -116,7 +121,7 @@
 $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\.]+)'\)/ ) { $PROJVERSION = $1; break; }
+	if ( $_ =~ /define\('DOL_VERSION','([\d\.a-z\-]+)'\)/ ) { $PROJVERSION = $1; break; }
 }
 close IN;
 ($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
@@ -167,22 +172,22 @@
 for (0..@ARGV-1) {
 	if ($ARGV[$_] =~ /^-*target=(\w+)/i)   { $target=$1; $batch=1; }
 	if ($ARGV[$_] =~ /^-*desti=(.+)/i)     { $DESTI=$1; }
-    if ($ARGV[$_] =~ /^-*prefix=(.+)/i)    {
-    	$PREFIX=$1; 
-    	$FILENAMESNAPSHOT.="-".$PREFIX; 
-    }
+	if ($ARGV[$_] =~ /^-*prefix=(.+)/i)    {
+		$PREFIX=$1; 
+		$FILENAMESNAPSHOT.="-".$PREFIX; 
+	}
 }
 if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i)   { $DESTI = $ENV{"DESTIBETARC"}; }	# Force output dir if env DESTIBETARC is defined
 if ($ENV{"DESTISTABLE"} && $BUILD =~ /^[0-9]+$/) { $DESTI = $ENV{"DESTISTABLE"}; }	# Force output dir if env DESTISTABLE is defined
-if ($ENV{"PUBLISHBETARC"} && $BUILD =~ /[a-z]/i)   { $PUBLISH = $ENV{"PUBLISHBETARC"}; }	# Force target site for publishing if env PUBLISHBETARC is defined
-if ($ENV{"PUBLISHSTABLE"} && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $ENV{"PUBLISHSTABLE"}; }	# Force target site for publishing if env PUBLISHSTABLE is defined
+if ($ENV{"PUBLISHBETARC"} && $BUILD =~ /[a-z]/i)   { $PUBLISHBETARC = $ENV{"PUBLISHBETARC"}; }	# Force target site for publishing if env PUBLISHBETARC is defined
+if ($ENV{"PUBLISHSTABLE"} && $BUILD =~ /^[0-9]+$/) { $PUBLISHSTABLE = $ENV{"PUBLISHSTABLE"}; }	# Force target site for publishing if env PUBLISHSTABLE is defined
 
 print "Makepack version $VERSION\n";
 print "Building/publishing package name: $PROJECT\n";
 print "Building/publishing package version: $MAJOR.$MINOR.$BUILD\n";
 print "Source directory (SOURCE): $SOURCE\n";
 print "Target directory (DESTI) : $DESTI\n";
-print "Publishing target (PUBLISH): $PUBLISH\n";
+#print "Publishing target (PUBLISH): $PUBLISH\n";
 
 
 # Choose package targets
@@ -190,61 +195,73 @@
 if ($target) {
 	if ($target eq "ALL") { 
 		foreach my $key (@LISTETARGET) {
-	    	if ($key ne 'SNAPSHOT' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
+			if ($key ne 'SNAPSHOT' && $key ne 'SF' && $key ne 'ASSO') { $CHOOSEDTARGET{$key}=1; }
 		}
 	}
-	if ($target ne "ALL" && $target ne "SF") { $CHOOSEDTARGET{uc($target)}=1; }
+	if ($target ne "ALL" && $target ne "SF" && $target ne "ASSO") { $CHOOSEDTARGET{uc($target)}=1; }
 	if ($target eq "SF") { $CHOOSEDPUBLISH{"SF"}=1; }
+	if ($target eq "ASSO") { $CHOOSEDPUBLISH{"ASSO"}=1; }
 }
 else {
-    my $found=0;
-    my $NUM_SCRIPT;
-   	my $cpt=0;
-    while (! $found) {
-    	printf(" %2d - %-12s    (%s)\n",$cpt,"ALL (1..9)","Need ".join(",",values %REQUIREMENTTARGET));
-    	foreach my $target (@LISTETARGET) {
-    		$cpt++;
-    		printf(" %2d - %-12s    (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target});
-    	}
-    	$cpt=99;
-    	printf(" %2d - %-12s    (%s)\n",$cpt,"SF (publish)","Need ".join(",",values %REQUIREMENTPUBLISH));
-    
-    	# Ask which target to build
-    	print "Choose one package number or several separated with space (0 - ".$cpt."): ";
-    	$NUM_SCRIPT=<STDIN>; 
-    	chomp($NUM_SCRIPT);
-    	if ($NUM_SCRIPT !~ /^[0-9\s]+$/)
-    	{
-    		print "This is not a valid package number list.\n";
-    		$found = 0;
-    	}
-    	else
-    	{
-    		$found = 1;
-    	}
-    }
-    print "\n";
-    if ($NUM_SCRIPT eq "99") {
-   		$CHOOSEDPUBLISH{"SF"}=1;
-    }
-    else {
-	    if ($NUM_SCRIPT eq "0") {
-	    	foreach my $key (@LISTETARGET) {
-	    		if ($key ne 'SNAPSHOT' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
-	        }
-	    }
-	    else {
-	   		foreach my $num (split(/\s+/,$NUM_SCRIPT)) {
-	   			$CHOOSEDTARGET{$LISTETARGET[$num-1]}=1;
-	   		}
-	    }
-    }
+	my $found=0;
+	my $NUM_SCRIPT;
+	my $cpt=0;
+	while (! $found) {
+		$cpt=0;
+		printf(" %2d - %-14s  (%s)\n",$cpt,"ALL (1..10)","Need ".join(",",values %REQUIREMENTTARGET));
+		$cpt++;
+		printf(" %2d - %-14s\n",$cpt,"Generate check file");
+		foreach my $target (@LISTETARGET) {
+			$cpt++;
+			printf(" %2d - %-14s  (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target});
+		}
+		$cpt=98;
+		printf(" %2d - %-14s  (%s)\n",$cpt,"ASSO (publish)","Need ".$REQUIREMENTPUBLISH{"ASSO"});
+		$cpt=99;
+		printf(" %2d - %-14s  (%s)\n",$cpt,"SF (publish)","Need ".$REQUIREMENTPUBLISH{"SF"});
+	
+		# Ask which target to build
+		print "Choose one target number or several separated with space (0 - ".$cpt."): ";
+		$NUM_SCRIPT=<STDIN>; 
+		chomp($NUM_SCRIPT);
+		if ($NUM_SCRIPT !~ /^[0-9\s]+$/)
+		{
+			print "This is not a valid package number list.\n";
+			$found = 0;
+		}
+		else
+		{
+			$found = 1;
+		}
+	}
+	print "\n";
+	if ($NUM_SCRIPT eq "98") {
+		$CHOOSEDPUBLISH{"ASSO"}=1;
+	}
+	elsif ($NUM_SCRIPT eq "99") {
+		$CHOOSEDPUBLISH{"SF"}=1;
+	}
+	elsif ($NUM_SCRIPT eq "0") {
+		$CHOOSEDTARGET{"-CHKSUM"}=1;
+		foreach my $key (@LISTETARGET) {
+			if ($key ne 'SNAPSHOT' && $key ne 'ASSO' && $key ne 'SF') { $CHOOSEDTARGET{$key}=1; }
+		}
+	}
+	elsif ($NUM_SCRIPT eq "1") {
+		$CHOOSEDTARGET{"-CHKSUM"}=1
+	}
+	else {
+		foreach my $num (split(/\s+/,$NUM_SCRIPT)) {
+			$CHOOSEDTARGET{$LISTETARGET[$num-2]}=1;
+		}
+	}
 }
 
+
 # Test if requirement is ok
 #--------------------------
 $atleastonerpm=0;
-foreach my $target (keys %CHOOSEDTARGET) {
+foreach my $target (sort keys %CHOOSEDTARGET) {
 	if ($target =~ /RPM/i)
 	{
 		if ($atleastonerpm && ($DESTI eq "$SOURCE/build"))
@@ -254,187 +271,208 @@
 		}
 		$atleastonerpm=1;			
 	} 
-    foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) 
-    {
-        # Test    
-        print "Test requirement for target $target: Search '$req'... ";
-        $newreq=$req; $newparam='';
-        if ($newreq eq 'zip') { $newparam.='-h'; }
-        if ($newreq eq 'xz') { $newparam.='-h'; }
-        $cmd="\"$newreq\" $newparam 2>&1";
-        print "Test command ".$cmd."... ";
-        $ret=`$cmd`;
-        $coderetour=$?; $coderetour2=$coderetour>>8;
-        if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) { 
-            # Not found error, we try in PROGPATH
-            $ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
-            $coderetour=$?; $coderetour2=$coderetour>>8;
-            $REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req";
-        } 
-
-        if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) {
-            # Not found error
-            print "Not found\nCan't build target $target. Requirement '$req' not found in PATH\n";
-            $CHOOSEDTARGET{$target}=-1;
-            last;
-        } else {
-            # Pas erreur ou erreur autre que programme absent
-            print " Found ".$req."\n";
-        }
-    }
+	foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) 
+	{
+		# Test    
+		print "Test requirement for target $target: Search '$req'... ";
+		$newreq=$req; $newparam='';
+		if ($newreq eq 'zip') { $newparam.='-h'; }
+		if ($newreq eq 'xz') { $newparam.='-h'; }
+		$cmd="\"$newreq\" $newparam 2>&1";
+		print "Test command ".$cmd."... ";
+		$ret=`$cmd`;
+		$coderetour=$?; $coderetour2=$coderetour>>8;
+		if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) { 
+			# Not found error, we try in PROGPATH
+			$ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
+			$coderetour=$?; $coderetour2=$coderetour>>8;
+			$REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req";
+		} 
+
+		if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) {
+			# Not found error
+			print "Not found\nCan't build target $target. Requirement '$req' not found in PATH\n";
+			$CHOOSEDTARGET{$target}=-1;
+			last;
+		} else {
+			# Pas erreur ou erreur autre que programme absent
+			print " Found ".$req."\n";
+		}
+	}
 }
 
 print "\n";
 
-# Check if there is at least on target to build
+# Build xml check file
+#-----------------------
+if ($CHOOSEDTARGET{'-CHKSUM'})
+{
+   	print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filecheck_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
+  	$ret=`php $SOURCE/build/generate_filecheck_xml.php release=$MAJOR.$MINOR.$BUILD`;
+  	print $ret."\n";
+}
+
+
+#print join(',',sort keys %CHOOSEDTARGET)."\n";
+
+# Check if there is at least one target to build
 #----------------------------------------------
 $nboftargetok=0;
 $nboftargetneedbuildroot=0;
 $nbofpublishneedtag=0;
-foreach my $target (keys %CHOOSEDTARGET) {
-    if ($CHOOSEDTARGET{$target} < 0) { next; }
-	if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP') 
+foreach my $target (sort keys %CHOOSEDTARGET) {
+	if ($CHOOSEDTARGET{$target} < 0) { next; }
+	if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM') 
 	{
 		$nboftargetneedbuildroot++;
 	}
 	$nboftargetok++;
 }
-foreach my $target (keys %CHOOSEDPUBLISH) {
-    if ($CHOOSEDPUBLISH{$target} < 0) { next; }
-	if ($target eq 'SF')
-	{
-		$nbofpublishneedtag++;
-	}
+foreach my $target (sort keys %CHOOSEDPUBLISH) {
+	if ($CHOOSEDPUBLISH{$target} < 0) { next; }
+	if ($target eq 'ASSO') { $nbofpublishneedtag++; }
+	if ($target eq 'SF') { $nbofpublishneedtag++; }
 	$nboftargetok++;
 }
 
 if ($nboftargetok) {
 
-    # Update CVS if required
-    #-----------------------
-    if ($nbofpublishneedtag)
+	# Update CVS if required
+	#-----------------------
+	if ($nbofpublishneedtag)
 	{
-    	print "Go to directory $SOURCE\n";
-   		$olddir=getcwd();
-   		chdir("$SOURCE");
-    	print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
-    	$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
-    	if ($ret =~ /already exists/)
-    	{
-    		print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
-	    	$QUESTIONOVERWRITETAG=<STDIN>; 
-	    	chomp($QUESTIONOVERWRITETAG);
-	    	if ($QUESTIONOVERWRITETAG =~ /(o|y)/)
-	    	{
-		    	print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
-		    	$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
-	    	}
-    	}
-    	print 'Run git push --tags'."\n";
-    	$ret=`git push --tags`;
-    	chdir("$olddir");
+		print "Go to directory $SOURCE\n";
+		$olddir=getcwd();
+		chdir("$SOURCE");
+		print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
+		$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
+		if ($ret =~ /already exists/)
+		{
+			print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
+			$QUESTIONOVERWRITETAG=<STDIN>; 
+			chomp($QUESTIONOVERWRITETAG);
+			if ($QUESTIONOVERWRITETAG =~ /(o|y)/)
+			{
+				print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
+				$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
+			}
+		}
+		print 'Run git push --tags'."\n";
+		$ret=`git push --tags`;
+		chdir("$olddir");
 	}
 	
-    # Update buildroot if required
-    #-----------------------------
-    if ($nboftargetneedbuildroot)
+	# Update buildroot if required
+	#-----------------------------
+	if ($nboftargetneedbuildroot)
 	{
-	    if (! $copyalreadydone) {
-	    	print "Creation of a buildroot used for all packages\n";
+		if (! $copyalreadydone) {
+			print "Creation of a buildroot used for all packages\n";
+
+			print "Delete directory $BUILDROOT\n";
+			$ret=`rm -fr "$BUILDROOT"`;
+		
+			mkdir "$BUILDROOT";
+			mkdir "$BUILDROOT/$PROJECT";
+			print "Copy $SOURCE into $BUILDROOT/$PROJECT\n";
+			$ret=`cp -pr "$SOURCE" "$BUILDROOT/$PROJECT"`;
 
-	    	print "Delete directory $BUILDROOT\n";
-	    	$ret=`rm -fr "$BUILDROOT"`;
-	    
-	    	mkdir "$BUILDROOT";
-	    	mkdir "$BUILDROOT/$PROJECT";
-	    	print "Copy $SOURCE into $BUILDROOT/$PROJECT\n";
-	    	$ret=`cp -pr "$SOURCE" "$BUILDROOT/$PROJECT"`;
-
-	    	print "Copy $SOURCE/build/debian/apache/.htaccess into $BUILDROOT/$PROJECT/build/debian/apache/.htaccess\n";
-	    	$ret=`cp -pr "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT/build/debian/apache/.htaccess"`;
-	    }
-	    print "Clean $BUILDROOT\n";
-	    $ret=`rm -f  $BUILDROOT/$PROJECT/.buildpath`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/.git`;
-	    $ret=`rm -f  $BUILDROOT/$PROJECT/.gitmodules`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/.gitignore`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/.settings`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`;
-	    $ret=`rm -f  $BUILDROOT/$PROJECT/build.xml`;
-	    $ret=`rm -f  $BUILDROOT/$PROJECT/quickbuild.xml`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/pom.xml`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/README.md`;
-        
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/Doli*-*`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr_*.deb`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.deb`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.xz`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/cache.manifest`;
-	    $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`;
-
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/install/mssql/README`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/install/mysql/README`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`;
-
-        $ret=`rm -fr  $BUILDROOT/$PROJECT/htdocs/install/mssql`;
-
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpunit`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/security`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/spec`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/test`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/uml`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/dev/xdebug`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/dev/dolibarr_changes.txt`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/dev/README`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot2.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot3.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot4.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot5.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot6.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot7.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot8.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot9.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot10.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot11.png`;
-        $ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`;
-
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/document`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
+			#print "Copy $SOURCE/build/debian/apache/.htaccess into $BUILDROOT/$PROJECT/build/debian/apache/.htaccess\n";
+			#$ret=`cp -pr "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT/build/debian/apache/.htaccess"`;
+		}
+		print "Clean $BUILDROOT\n";
+		$ret=`rm -f  $BUILDROOT/$PROJECT/.buildpath`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.cache`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.editorconfig`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.git*`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.settings`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.scrutinizer.yml`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/.tx`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build.xml`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/pom.xml`;
+		
+		$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/Doli*-*`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr_*.deb`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.deb`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.xz`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/cache.manifest`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`;
+
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/install/mssql/README`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/install/mysql/README`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`;
+
+		$ret=`rm -fr  $BUILDROOT/$PROJECT/htdocs/install/mssql`;
+
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpunit`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/security`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/spec`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/test`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/uml`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/vagrant`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/dev/xdebug`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/dev/dolibarr_changes.txt`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/dev/README`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot2.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot3.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot4.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot5.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot6.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot7.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot8.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot9.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot10.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot11.png`;
+		$ret=`rm -f  $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`;
+
+		# Security to avoid to package data files 
+		$ret=`rm -fr $BUILDROOT/$PROJECT/document`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
+		# Removed known external modules to avoir any error when packaging on test env 
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
+	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`;
 	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
 	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
-	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
+	    $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`;
+		$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/htdocs/timesheet*`;
+		# Removed other test files
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
+		$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/eldy/*.new`;
 	    $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`;
@@ -446,430 +484,451 @@
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/adapters`;		# Keep this removal in case we embed libraries
         #$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`;		# _source must be kept into tarball
    	    
+        $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/datatables/extras/TableTools/swf`;	# Source of this flash is not available
 	    $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33`;
-        $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-20100919`;
+        $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
+        $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
 	    $ret=`rm -f  $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
         $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/savant`;
 	}
 
-    # Build package for each target
-    #------------------------------
-    foreach my $target (keys %CHOOSEDTARGET) 
-    {
-        if ($CHOOSEDTARGET{$target} < 0) { next; }
-    
-        print "\nBuild package for target $target\n";
-
-    	if ($target eq 'SNAPSHOT') 
-    	{
-    		$NEWDESTI=$DESTI;
-
-    		print "Remove target $FILENAMESNAPSHOT.tgz...\n";
-    		unlink("$NEWDESTI/$FILENAMESNAPSHOT.tgz");
-
-            #rmdir "$BUILDROOT/$FILENAMESNAPSHOT";
-    		$ret=`rm -fr $BUILDROOT/$FILENAMESNAPSHOT`;
-            print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMESNAPSHOT\n";
-    		$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMESNAPSHOT\"";
-            $ret=`$cmd`;
+	# Build package for each target
+	#------------------------------
+	foreach my $target (sort keys %CHOOSEDTARGET) 
+	{
+		if ($CHOOSEDTARGET{$target} < 0) { next; }
+		if ($target eq '-CHKSUM') { next; }
+		
+		print "\nBuild package for target $target\n";
 
-    		print "Compress $BUILDROOT into $FILENAMESNAPSHOT.tgz...\n";
-   		    $cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.xz --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
+		if ($target eq 'SNAPSHOT') 
+		{
+			$NEWDESTI=$DESTI;
+
+			print "Remove target $FILENAMESNAPSHOT.tgz...\n";
+			unlink("$NEWDESTI/$FILENAMESNAPSHOT.tgz");
+
+			#rmdir "$BUILDROOT/$FILENAMESNAPSHOT";
+			$ret=`rm -fr $BUILDROOT/$FILENAMESNAPSHOT`;
+			print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMESNAPSHOT\n";
+			$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMESNAPSHOT\"";
+			$ret=`$cmd`;
+
+			print "Compress $BUILDROOT into $FILENAMESNAPSHOT.tgz...\n";
+			$cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.xz --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
 			print $cmd."\n";
 			$ret=`$cmd`;
 
-    		# Move to final dir
-       		print "Move $FILENAMESNAPSHOT.tgz to $NEWDESTI/$FILENAMESNAPSHOT.tgz\n";
-       		$ret=`mv "$FILENAMESNAPSHOT.tgz" "$NEWDESTI/$FILENAMESNAPSHOT.tgz"`;
-    		next;
-    	}
+			# Move to final dir
+			print "Move $FILENAMESNAPSHOT.tgz to $NEWDESTI/$FILENAMESNAPSHOT.tgz\n";
+			$ret=`mv "$FILENAMESNAPSHOT.tgz" "$NEWDESTI/$FILENAMESNAPSHOT.tgz"`;
+			next;
+		}
 
-    	if ($target eq 'TGZ') 
-    	{
-    		$NEWDESTI=$DESTI;
-    		mkdir($DESTI.'/standard');
+		if ($target eq 'TGZ') 
+		{
+			$NEWDESTI=$DESTI;
+			mkdir($DESTI.'/standard');
 			if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } 
 
-    		print "Remove target $FILENAMETGZ.tgz...\n";
-    		unlink("$NEWDESTI/$FILENAMETGZ.tgz");
+			print "Remove target $FILENAMETGZ.tgz...\n";
+			unlink("$NEWDESTI/$FILENAMETGZ.tgz");
 
-            #rmdir "$BUILDROOT/$FILENAMETGZ";
-    		$ret=`rm -fr $BUILDROOT/$FILENAMETGZ`;
-            print "Copy $BUILDROOT/$PROJECT/ to $BUILDROOT/$FILENAMETGZ\n";
-    		$cmd="cp -pr \"$BUILDROOT/$PROJECT/\" \"$BUILDROOT/$FILENAMETGZ\"";
-            $ret=`$cmd`;
+			#rmdir "$BUILDROOT/$FILENAMETGZ";
+			$ret=`rm -fr $BUILDROOT/$FILENAMETGZ`;
+			print "Copy $BUILDROOT/$PROJECT/ to $BUILDROOT/$FILENAMETGZ\n";
+			$cmd="cp -pr \"$BUILDROOT/$PROJECT/\" \"$BUILDROOT/$FILENAMETGZ\"";
+			$ret=`$cmd`;
 
-		    $ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`;
+			$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`;
 			$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/htdocs/includes/ckeditor/_source`;	# We can't remove it with exclude file, we need it for some tarball packages
 			
-    		print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n";
-   		    $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" $FILENAMETGZ";
-   		    print "$cmd\n";
-   		    $ret=`$cmd`;
+			print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n";
+			$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" $FILENAMETGZ";
+			print "$cmd\n";
+			$ret=`$cmd`;
 
-    		# Move to final dir
-       		print "Move $BUILDROOT/$FILENAMETGZ.tgz to $NEWDESTI/$FILENAMETGZ.tgz\n";
-       		$ret=`mv "$BUILDROOT/$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
-    		next;
-    	}
+			# Move to final dir
+			print "Move $BUILDROOT/$FILENAMETGZ.tgz to $NEWDESTI/$FILENAMETGZ.tgz\n";
+			$ret=`mv "$BUILDROOT/$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
+			next;
+		}
 
-    	if ($target eq 'XZ') 
-    	{
-    		$NEWDESTI=$DESTI;
-    		mkdir($DESTI.'/standard');
+		if ($target eq 'XZ') 
+		{
+			$NEWDESTI=$DESTI;
+			mkdir($DESTI.'/standard');
 			if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } 
 
-    		print "Remove target $FILENAMEXZ.xz...\n";
-    		unlink("$NEWDESTI/$FILENAMEXZ.xz");
+			print "Remove target $FILENAMEXZ.xz...\n";
+			unlink("$NEWDESTI/$FILENAMEXZ.xz");
 
-            #rmdir "$BUILDROOT/$FILENAMEXZ";
-    		$ret=`rm -fr $BUILDROOT/$FILENAMEXZ`;
-            print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEXZ\n";
-    		$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEXZ\"";
-            $ret=`$cmd`;
+			#rmdir "$BUILDROOT/$FILENAMEXZ";
+			$ret=`rm -fr $BUILDROOT/$FILENAMEXZ`;
+			print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEXZ\n";
+			$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEXZ\"";
+			$ret=`$cmd`;
 
-		    $ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`;
+			$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`;
 			$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/htdocs/includes/ckeditor/_source`;	# We can't remove it with exclude file, we need it for some tarball packages
 			
-    		print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n";
- 
-            print "Go to directory $BUILDROOT\n";
-     		$olddir=getcwd();
-     		chdir("$BUILDROOT");
-    		$cmd= "xz -9 -r $BUILDROOT/$FILENAMEAPS.xz \*";
+			print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n";
+
+			print "Go to directory $BUILDROOT\n";
+			$olddir=getcwd();
+			chdir("$BUILDROOT");
+			$cmd= "xz -9 -r $BUILDROOT/$FILENAMEAPS.xz \*";
 			print $cmd."\n";
 			$ret= `$cmd`;
-            chdir("$olddir");
+			chdir("$olddir");
 
-    		# Move to final dir
-            print "Move $FILENAMEXZ.xz to $NEWDESTI/$FILENAMEXZ.xz\n";
-            $ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`;
-    		next;
-    	}
-    	
-    	if ($target eq 'ZIP') 
-    	{
-    		$NEWDESTI=$DESTI;
-    		mkdir($DESTI.'/standard');
+			# Move to final dir
+			print "Move $FILENAMEXZ.xz to $NEWDESTI/$FILENAMEXZ.xz\n";
+			$ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`;
+			next;
+		}
+		
+		if ($target eq 'ZIP') 
+		{
+			$NEWDESTI=$DESTI;
+			mkdir($DESTI.'/standard');
 			if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } 
 
-    		print "Remove target $FILENAMEZIP.zip...\n";
-    		unlink("$NEWDESTI/$FILENAMEZIP.zip");
+			print "Remove target $FILENAMEZIP.zip...\n";
+			unlink("$NEWDESTI/$FILENAMEZIP.zip");
 
-            #rmdir "$BUILDROOT/$FILENAMEZIP";
-    		$ret=`rm -fr $BUILDROOT/$FILENAMEZIP`;
-            print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEZIP\n";
-    		$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEZIP\"";
-            $ret=`$cmd`;
+			#rmdir "$BUILDROOT/$FILENAMEZIP";
+			$ret=`rm -fr $BUILDROOT/$FILENAMEZIP`;
+			print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEZIP\n";
+			$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEZIP\"";
+			$ret=`$cmd`;
 
-		    $ret=`rm -fr $BUILDROOT/$FILENAMEZIP/build/exe`;
+			$ret=`rm -fr $BUILDROOT/$FILENAMEZIP/build/exe`;
 			$ret=`rm -fr $BUILDROOT/$FILENAMEZIP/htdocs/includes/ckeditor/_source`;	# We can't remove it with exclude file, we need it for some tarball packages
 
-    		print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
- 
-            print "Go to directory $BUILDROOT\n";
-     		$olddir=getcwd();
-     		chdir("$BUILDROOT");
-    		$cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\/*";
+			print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
+
+			print "Go to directory $BUILDROOT\n";
+			$olddir=getcwd();
+			chdir("$BUILDROOT");
+			$cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\/*";
 			print $cmd."\n";
 			$ret= `$cmd`;
-            chdir("$olddir");
-            			
-    		# Move to final dir
-            print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
-            $ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
-    		next;
-    	}
-    
-    	if ($target =~ /RPM/)	                 # Linux only 
-    	{
-    		$NEWDESTI=$DESTI;
-    		$subdir="package_rpm_generic";
-    		if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; }
-    		if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; }
-    		if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; }
-    		mkdir($DESTI.'/'.$subdir);
+			chdir("$olddir");
+						
+			# Move to final dir
+			print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
+			$ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
+			next;
+		}
+	
+		if ($target =~ /RPM/)	                 # Linux only 
+		{
+			$NEWDESTI=$DESTI;
+			$subdir="package_rpm_generic";
+			if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; }
+			if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; }
+			if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; }
+			mkdir($DESTI.'/'.$subdir);
 			if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; } 
 
 			if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; }
 
-            print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
+			print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
 
-            #print "Create directory $RPMDIR\n";
-            #$ret=`mkdir -p "$RPMDIR"`;
+			print "Remove target ".$FILENAMERPM."...\n";
+			unlink("$NEWDESTI/".$FILENAMERPM);
+			print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n";
+			unlink("$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm");
 
-    		print "Remove target ".$FILENAMERPM."...\n";
-    		unlink("$NEWDESTI/".$FILENAMERPM);
-    		print "Remove target ".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm...\n";
-    		unlink("$NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm");
-
-    		print "Create directory $BUILDROOT/$FILENAMETGZ2\n";
-    		$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`;
-            print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n";
-    		$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
-            $ret=`$cmd`;
+			print "Create directory $BUILDROOT/$FILENAMETGZ2\n";
+			$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`;
+			
+			print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n";
+			$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
+			$ret=`$cmd`;
 
-			# Set owners
-            #print "Set owners on files/dir\n";
-		    #$ret=`chown -R root.root $BUILDROOT/$FILENAMETGZ2`;
-
-            print "Set permissions on files/dir\n";
-		    $ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`;
-		    $cmd="find $BUILDROOT/$FILENAMETGZ2 -type f -exec chmod 644 {} \\; ";
-            $ret=`$cmd`;
+			# Removed files we don't need
+			$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/htdocs/includes/ckeditor/_source`;
 
-			# Build tgz
-    		print "Compress $FILENAMETGZ2 into $FILENAMETGZ2.tgz...\n";
-    		$ret=`tar --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" -czvf "$BUILDROOT/$FILENAMETGZ2.tgz" $FILENAMETGZ2`;
+			print "Set permissions on files/dir\n";
+			$ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`;
+			$cmd="find $BUILDROOT/$FILENAMETGZ2 -type f -exec chmod 644 {} \\; ";
+			$ret=`$cmd`;
 
-    		print "Move $BUILDROOT/$FILENAMETGZ2.tgz to $RPMDIR/SOURCES/$FILENAMETGZ2.tgz\n";
-    		$cmd="mv $BUILDROOT/$FILENAMETGZ2.tgz $RPMDIR/SOURCES/$FILENAMETGZ2.tgz";
-            $ret=`$cmd`;
+			# Build tgz
+			print "Compress $FILENAMETGZ2 into $FILENAMETGZ2.tgz...\n";
+			$ret=`tar --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" -czvf "$BUILDROOT/$FILENAMETGZ2.tgz" $FILENAMETGZ2`;
 
-    		$BUILDFIC="${FILENAME}.spec";
-    		$BUILDFICSRC="${FILENAME}_generic.spec";
-    		if ($target =~ /FEDO/i) { $BUILDFICSRC="${FILENAME}_fedora.spec"; }
-    		if ($target =~ /MAND/i) { $BUILDFICSRC="${FILENAME}_mandriva.spec"; }
-    		if ($target =~ /OPEN/i) { $BUILDFICSRC="${FILENAME}_opensuse.spec"; }
-    		
- 			print "Generate file $BUILDROOT/$BUILDFIC from $SOURCE/build/rpm/${BUILDFICSRC}\n";
-            open (SPECFROM,"<$SOURCE/build/rpm/${BUILDFICSRC}") || die "Error";
-            open (SPECTO,">$BUILDROOT/$BUILDFIC") || die "Error";
-            while (<SPECFROM>) {
-                $_ =~ s/__FILENAMETGZ__/$FILENAMETGZ/;
-                $_ =~ s/__VERSION__/$MAJOR.$MINOR.$REL1/;
-                $_ =~ s/__RELEASE__/$RPMSUBVERSION/;
-                print SPECTO $_;
-            }
-            close SPECFROM;
-            close SPECTO;
-    
-    		print "Copy patch file to $RPMDIR/SOURCES\n";
-    		$ret=`cp "$SOURCE/build/rpm/dolibarr-forrpm.patch" "$RPMDIR/SOURCES"`;
-		    $ret=`chmod 644 $RPMDIR/SOURCES/dolibarr-forrpm.patch`;
-
-    		print "Launch RPM build (rpmbuild --clean -ba $BUILDROOT/${BUILDFIC})\n";
-    		#$ret=`rpmbuild -vvvv --clean -ba $BUILDROOT/${BUILDFIC}`;
-    		$ret=`rpmbuild --clean -ba $BUILDROOT/${BUILDFIC}`;
+			print "Move $BUILDROOT/$FILENAMETGZ2.tgz to $RPMDIR/SOURCES/$FILENAMETGZ2.tgz\n";
+			$cmd="mv $BUILDROOT/$FILENAMETGZ2.tgz $RPMDIR/SOURCES/$FILENAMETGZ2.tgz";
+			$ret=`$cmd`;
 
-    		# Move to final dir
-   		    print "Move $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm\n";
-   		    $cmd="mv $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm \"$NEWDESTI/\"";
-    		$ret=`$cmd`;
-   		    print "Move $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm\n";
-   		    $cmd="mv $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm \"$NEWDESTI/\"";
-    		$ret=`$cmd`;
-   		    print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n";
-   		    $cmd="mv \"$RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz\" \"$NEWDESTI/".$FILENAMETGZ2.".tgz\"";
-    		$ret=`$cmd`;
-    		next;
-    	}
+			$BUILDFIC="${FILENAME}.spec";
+			$BUILDFICSRC="${FILENAME}_generic.spec";
+			if ($target =~ /FEDO/i) { $BUILDFICSRC="${FILENAME}_fedora.spec"; }
+			if ($target =~ /MAND/i) { $BUILDFICSRC="${FILENAME}_mandriva.spec"; }
+			if ($target =~ /OPEN/i) { $BUILDFICSRC="${FILENAME}_opensuse.spec"; }
+			
+			use Date::Language;
+			$lang=Date::Language->new('English');
+			$datestring = $lang->time2str("%a %b %e %Y", time);
+    		$changelogstring="* ".$datestring." Laurent Destailleur $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n- Upstream release\n";
+
+			print "Generate file $BUILDROOT/$BUILDFIC from $SOURCE/build/rpm/${BUILDFICSRC}\n";
+			open (SPECFROM,"<$SOURCE/build/rpm/${BUILDFICSRC}") || die "Error";
+			open (SPECTO,">$BUILDROOT/$BUILDFIC") || die "Error";
+			while (<SPECFROM>) {
+				$_ =~ s/__FILENAMETGZ__/$FILENAMETGZ/;
+				$_ =~ s/__VERSION__/$MAJOR.$MINOR.$REL1/;
+				$_ =~ s/__RELEASE__/$RPMSUBVERSION/;
+                $_ =~ s/__CHANGELOGSTRING__/$changelogstring/;
+				print SPECTO $_;
+			}
+			close SPECFROM;
+			close SPECTO;
+	
+			print "Copy patch file to $RPMDIR/SOURCES\n";
+			$ret=`cp "$SOURCE/build/rpm/dolibarr-forrpm.patch" "$RPMDIR/SOURCES"`;
+			$ret=`chmod 644 $RPMDIR/SOURCES/dolibarr-forrpm.patch`;
+
+			print "Launch RPM build (rpmbuild --clean -ba $BUILDROOT/${BUILDFIC})\n";
+			#$ret=`rpmbuild -vvvv --clean -ba $BUILDROOT/${BUILDFIC}`;
+			$ret=`rpmbuild --clean -ba $BUILDROOT/${BUILDFIC}`;
+
+			# Move to final dir
+			print "Move $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm\n";
+			$cmd="mv $RPMDIR/RPMS/".$ARCH."/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.".$ARCH.".rpm \"$NEWDESTI/\"";
+			$ret=`$cmd`;
+			print "Move $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm into $NEWDESTI/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm\n";
+			$cmd="mv $RPMDIR/SRPMS/".$FILENAMETGZ2."-".$RPMSUBVERSION."*.src.rpm \"$NEWDESTI/\"";
+			$ret=`$cmd`;
+			print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n";
+			$cmd="mv \"$RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz\" \"$NEWDESTI/".$FILENAMETGZ2.".tgz\"";
+			$ret=`$cmd`;
+			next;
+		}
 
-    	if ($target eq 'DEB') 
-    	{
-    		$NEWDESTI=$DESTI;
-    		mkdir($DESTI.'/package_debian-ubuntu');
+		if ($target eq 'DEB') 
+		{
+			$NEWDESTI=$DESTI;
+			mkdir($DESTI.'/package_debian-ubuntu');
 			if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; } 
 
-            $olddir=getcwd();
+			$olddir=getcwd();
+
+			print "Remove target ${FILENAMEDEB}_all.deb...\n";
+			unlink("$NEWDESTI/${FILENAMEDEB}_all.deb");
+			print "Remove target ${FILENAMEDEB}.dsc...\n";
+			unlink("$NEWDESTI/${FILENAMEDEB}.dsc");
+			print "Remove target ${FILENAMEDEB}.tar.gz...\n";
+			unlink("$NEWDESTI/${FILENAMEDEB}.tar.gz");
+			print "Remove target ${FILENAMEDEB}.changes...\n";
+			unlink("$NEWDESTI/${FILENAMEDEB}.changes");
+			print "Remove target ${FILENAMEDEB}.debian.tar.gz...\n";
+			unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.gz");
+			print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n";
+			unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz");
 
-    		print "Remove target ${FILENAMEDEB}_all.deb...\n";
-    		unlink("$NEWDESTI/${FILENAMEDEB}_all.deb");
-    		print "Remove target ${FILENAMEDEB}.dsc...\n";
-    		unlink("$NEWDESTI/${FILENAMEDEB}.dsc");
-    		print "Remove target ${FILENAMEDEB}.tar.gz...\n";
-    		unlink("$NEWDESTI/${FILENAMEDEB}.tar.gz");
-    		print "Remove target ${FILENAMEDEB}.changes...\n";
-    		unlink("$NEWDESTI/${FILENAMEDEB}.changes");
-    		print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n";
-    		unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz");
-
-    		$ret=`rm -fr $BUILDROOT/$PROJECT.tmp`;
-    		$ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`;
-    		
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`;
+			
 			print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n";
 			$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\"";
 			$ret=`$cmd`;
 			$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/debian/apache/.htaccess\" \"$BUILDROOT/$PROJECT.tmp/build/debian/apache/.htaccess\"";
 			$ret=`$cmd`;
 
- 			print "Remove other files\n";
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/README-FR`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/README`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/README-FR`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/dmg`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/pad/README`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/tgz/README`;
-            #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/po`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/source`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/changelog`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/compat`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/control*`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/copyright`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.config`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.doc-base`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.install`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postrm`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postinst`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates.futur`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/rules`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`;
-            $ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/watch`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/launchpad`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/live`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/patch`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`;
-            # Rename upstream changelog to match debian rules
+			print "Remove other files\n";
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/README-FR`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/README`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/README-FR`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/dmg`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/pad/README`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/tgz/README`;
+			#$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/po`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/debian/source`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/changelog`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/compat`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/control*`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/copyright`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.config`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.docs`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.install`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postrm`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postinst`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates.futur`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/rules`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/README.Debian`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`;
+			$ret=`rm -f  $BUILDROOT/$PROJECT.tmp/build/debian/watch`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/exe`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/launchpad`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/live`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/patch`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/perl`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/rpm`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/zip`;
+			# Removed duplicate license files
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/LICENSE.md`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/scayt/LICENSE.md`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source/plugins/wsc/LICENSE.md`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/LICENSE.md`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/scayt/LICENSE.md`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/plugins/wsc/LICENSE.md`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/flot/LICENSE.txt`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.34/LICENSE`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/tcpdf/fonts/freefont-20120503/COPYING`;
+			# Removed files we don't need
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/_source`;
+			
+			# Rename upstream changelog to match debian rules
 			$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
 			
-            # Prepare source package (init debian dir)
-            print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
-            $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
-            print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n";
-            # Add files for dpkg-source
-            $ret=`cp -f  "$SOURCE/build/debian/changelog"      "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/compat"         "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/control"        "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/copyright"      "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.desktop"        	"$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.doc-base"        	"$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.install" 	        "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.lintian-overrides"  "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.xpm"  		      	"$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/README.source"  "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/rules"          "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/watch"          "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -fr "$SOURCE/build/debian/patches"        "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -fr "$SOURCE/build/debian/po"             "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -fr "$SOURCE/build/debian/source"         "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -fr "$SOURCE/build/debian/apache"         "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
-            $ret=`cp -f  "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
-            $ret=`cp -fr "$SOURCE/build/debian/lighttpd"       "$BUILDROOT/$PROJECT.tmp/debian/lighttpd"`;
-            # Add files also required to build binary package
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.config"         "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.postinst"       "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.postrm"         "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/dolibarr.templates"      "$BUILDROOT/$PROJECT.tmp/debian"`;
-            $ret=`cp -f  "$SOURCE/build/debian/install.forced.php.install"      "$BUILDROOT/$PROJECT.tmp/debian"`;
-            
+			# Prepare source package (init debian dir)
+			print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
+			$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
+			print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n";
+			# Add files for dpkg-source
+			$ret=`cp -f  "$SOURCE/build/debian/changelog"      "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/compat"         "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/control"        "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/copyright"      "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.desktop"        	"$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.docs"        		"$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.install" 	        "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.lintian-overrides"  "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.xpm"  		      	"$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/rules"          "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/watch"          "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -fr "$SOURCE/build/debian/patches"        "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -fr "$SOURCE/build/debian/po"             "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -fr "$SOURCE/build/debian/source"         "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -fr "$SOURCE/build/debian/apache"         "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
+			$ret=`cp -f  "$SOURCE/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
+			$ret=`cp -fr "$SOURCE/build/debian/lighttpd"       "$BUILDROOT/$PROJECT.tmp/debian/lighttpd"`;
+			# Add files also required to build binary package
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.config"         "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.postinst"       "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.postrm"         "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/dolibarr.templates"      "$BUILDROOT/$PROJECT.tmp/debian"`;
+			$ret=`cp -f  "$SOURCE/build/debian/install.forced.php.install"      "$BUILDROOT/$PROJECT.tmp/debian"`;
+			
 			# Set owners and permissions
-            #print "Set owners on files/dir\n";
-		    #$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`;
+			#print "Set owners on files/dir\n";
+			#$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`;
 
-            print "Set permissions on files/dir\n";
-		    $ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`;
-		    $cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; ";
-            $ret=`$cmd`;
-            $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.php' -type f -exec chmod 755 {} \\; ";
-            $ret=`$cmd`;
-            $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.dpatch' -type f -exec chmod 755 {} \\; ";
-            $ret=`$cmd`;
-            $cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.pl' -type f -exec chmod 755 {} \\; ";
-            $ret=`$cmd`;
-            $cmd="find $BUILDROOT/$PROJECT.tmp/dev -name '*.php' -type f -exec chmod 755 {} \\; ";
-            $ret=`$cmd`;
-            $ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
-            $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
-            $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`;
-            $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`;
-            $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_page.php`;
-            $ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`;
-            $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; ";
-            $ret=`$cmd`;
-            $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; ";
-            $ret=`$cmd`;
-            
-          
-            print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
-            $cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
-            $ret=`$cmd`;
+			print "Set permissions on files/dir\n";
+			$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp`;
+			$cmd="find $BUILDROOT/$PROJECT.tmp -type f -exec chmod 644 {} \\; ";
+			$ret=`$cmd`;
+			$cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.php' -type f -exec chmod 755 {} \\; ";
+			$ret=`$cmd`;
+			$cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.dpatch' -type f -exec chmod 755 {} \\; ";
+			$ret=`$cmd`;
+			$cmd="find $BUILDROOT/$PROJECT.tmp/build -name '*.pl' -type f -exec chmod 755 {} \\; ";
+			$ret=`$cmd`;
+			$cmd="find $BUILDROOT/$PROJECT.tmp/dev -name '*.php' -type f -exec chmod 755 {} \\; ";
+			$ret=`$cmd`;
+			$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
+			$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
+			$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/modMyModule.class.php`;
+			$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_class.class.php`;
+			$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_page.php`;
+			$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`;
+			$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; ";
+			$ret=`$cmd`;
+			$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; ";
+			$ret=`$cmd`;
+			
+		
+			print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
+			$cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
+			$ret=`$cmd`;
 
 
-     		print "Go into directory $BUILDROOT\n";
-            chdir("$BUILDROOT");
+			print "Go into directory $BUILDROOT\n";
+			chdir("$BUILDROOT");
 			
 			# We need a tarball to be able to build "quilt" debian package (not required for native but we need patch so it is not a native)
-    		print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n";
-   		    $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build";
-   		    print $cmd."\n";
-   		    $ret=`$cmd`;
+			print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n";
+			$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build";
+			print $cmd."\n";
+			$ret=`$cmd`;
 
 			# Creation of source package          
-     		print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
-            chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
-            #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
-            $cmd="dpkg-buildpackage -us -uc";
-            print "Launch DEB build ($cmd)\n";
-            $ret=`$cmd 2>&1 3>&1`;
-            print $ret."\n";
+			print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
+			chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
+			#$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
+			$cmd="dpkg-buildpackage -us -uc";
+			print "Launch DEB build ($cmd)\n";
+			$ret=`$cmd 2>&1 3>&1`;
+			print $ret."\n";
 
-            chdir("$olddir");
-    		
-    		print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n";
-    		print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n";
-    		
-    		# Move to final dir
-            print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n";
-            $ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
-            $ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
-            $ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
-            $ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
-        	next;
-        }
-        
-    	if ($target eq 'APS') 
-    	{
+			chdir("$olddir");
+			
+			print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n";
+			print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n";
+			
+			# Move to final dir
+			print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n";
+			$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
+			$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
+			$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
+			$ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`;
+			$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
+			next;
+		}
+		
+		if ($target eq 'APS') 
+		{
 			$NEWDESTI=$DESTI;
-    		mkdir($DESTI.'/package_aps');
+			mkdir($DESTI.'/package_aps');
 			if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; } 
 			
-            $newbuild = $BUILD;
-            $newbuild =~ s/(dev|alpha)/0/gi;                # dev
-            $newbuild =~ s/beta/1/gi;                       # beta
-            $newbuild =~ s/rc./2/gi;                        # rc
-            if ($newbuild !~ /-/) { $newbuild.='-3'; }      # finale
-            # now newbuild is 0-0 or 0-3 for example
-            $REL1 = $newbuild; $REL1 =~ s/-.*$//gi;
-            if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; }
-            print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
-    		
-     		print "Remove target $FILENAMEAPS.zip...\n";
-    		unlink "$NEWDESTI/$FILENAMEAPS.zip";
- 
-            #rmdir "$BUILDROOT/$PROJECT.tmp";
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp`;
-            print "Create directory $BUILDROOT/$PROJECT.tmp\n";
-            $ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp"`;
-            print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n";
-            $cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\"";
-            $ret=`$cmd`;
+			$newbuild = $BUILD;
+			$newbuild =~ s/(dev|alpha)/0/gi;                # dev
+			$newbuild =~ s/beta/1/gi;                       # beta
+			$newbuild =~ s/rc./2/gi;                        # rc
+			if ($newbuild !~ /-/) { $newbuild.='-3'; }      # finale
+			# now newbuild is 0-0 or 0-3 for example
+			$REL1 = $newbuild; $REL1 =~ s/-.*$//gi;
+			if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; }
+			print "Version is $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n";
+			
+			print "Remove target $FILENAMEAPS.zip...\n";
+			unlink "$NEWDESTI/$FILENAMEAPS.zip";
 
-            print "Remove other files\n";
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/deb`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/dmg`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/doap`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/exe`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/live`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/patch`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/rpm`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/zip`;
-            $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/perl`;
+			#rmdir "$BUILDROOT/$PROJECT.tmp";
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp`;
+			print "Create directory $BUILDROOT/$PROJECT.tmp\n";
+			$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp"`;
+			print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n";
+			$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\"";
+			$ret=`$cmd`;
+
+			print "Remove other files\n";
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/deb`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/dmg`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/doap`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/exe`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/live`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/patch`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/rpm`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/zip`;
+			$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/$PROJECT/build/perl`;
 
             $APSVERSION="1.2";
             print "Create APS files $BUILDROOT/$PROJECT.tmp/$PROJECT/APP-META.xml\n";
@@ -889,8 +948,6 @@
             close SPECFROM;
             close SPECTO;
             print "Version set to $MAJOR.$MINOR.$newbuild\n";
-            #$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure\"";
-            #$ret=`$cmd`;
             $cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure.php\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure.php\"";
             $ret=`$cmd`;
             $cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\"";
@@ -918,87 +975,109 @@
             next;
     	}
 
-    	if ($target eq 'EXEDOLIWAMP')
-    	{
-    		$NEWDESTI=$DESTI;
-    		mkdir($DESTI.'/package_windows');
+		if ($target eq 'EXEDOLIWAMP')
+		{
+			$NEWDESTI=$DESTI;
+			mkdir($DESTI.'/package_windows');
 			if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } 
-    		
+
      		print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n";
     		unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
  
+ 			print "Check that in your Wine setup, you create a Z: drive that point to your /tmp directory.\n";
+
  			$SOURCEBACK=$SOURCE;
  			$SOURCEBACK =~ s/\//\\/g;
-    		print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
-    		$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"";
+
+    		print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
+    		$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
+
+    		print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"\n";
+    		$cmd= "ISCC.exe \"Z:$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
 			print "$cmd\n";
 			$ret= `$cmd`;
 			#print "$ret\n";
 
-    		# Move to final dir
+			# Move to final dir
 			print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
     		rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
             print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
             $ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
+            
+            $ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
+            
     		next;
     	}
     }
 
-    # Build package for each target
-    #------------------------------
-    foreach my $target (keys %CHOOSEDPUBLISH) 
-    {
-        if ($CHOOSEDPUBLISH{$target} < 0) { next; }
-    
+	# Publish package for each target
+	#--------------------------------
+	foreach my $target (sort keys %CHOOSEDPUBLISH) 
+	{
+		if ($CHOOSEDPUBLISH{$target} < 0) { next; }
+	
 		print "\nList of files to publish\n";
-    	%filestoscan=(
-    		"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
-    		"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
-    		"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
-    		"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
-    		"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
-    	);
-    	use POSIX qw/strftime/;
-    	foreach my $file (sort keys %filestoscan)
-    	{
-    		$found=0;
-    		my $filesize = -s $file;
-    		my $filedate = (stat $file)[9];
-    		print $file." ".($filesize?"(found)":"(not found)");
-    		print ($filesize?" - ".$filesize:"");
-    		print ($filedate?" - ".strftime("%Y-%m-%d %H:%M:%S",localtime($filedate)):"");
-    		print "\n";
-    	}
+		%filestoscansf=(
+			"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
+			"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
+			"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
+			"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
+			"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
+		);
+		use POSIX qw/strftime/;
+		foreach my $file (sort keys %filestoscansf)
+		{
+			$found=0;
+			my $filesize = -s $file;
+			my $filedate = (stat $file)[9];
+			print $file." ".($filesize?"(found)":"(not found)");
+			print ($filesize?" - ".$filesize:"");
+			print ($filedate?" - ".strftime("%Y-%m-%d %H:%M:%S",localtime($filedate)):"");
+			print "\n";
+		}
 
-    	if ($target eq 'SF') 
-    	{
-    		print "\n";
-    		
-    		$NEWPUBLISH=$PUBLISH;
-    		print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n";
-
-	    	# Ask which target to build
-	    	$NUM_SCRIPT=<STDIN>; 
-	    	chomp($NUM_SCRIPT);
+		if ($target eq 'SF' || $target eq 'ASSO') 
+		{
+			print "\n";
+			
+			if ($target eq 'SF') { $PUBLISH = $PUBLISHSTABLE; }
+			if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i)   { $PUBLISH = $PUBLISHBETARC.'/lastbuild'; }
+			if ($target eq 'ASSO' && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $PUBLISHBETARC.'/stable'; }
+			
+			$NEWPUBLISH=$PUBLISH;
+			print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n";
+
+			# Ask which target to build
+			$NUM_SCRIPT=<STDIN>; 
+			chomp($NUM_SCRIPT);
 
 			print "Create empty dir /tmp/emptydir. We need it to create target dir using rsync.\n";
-            $ret=`mkdir -p "/tmp/emptydir/"`;
-            
-	    	foreach my $file (sort keys %filestoscan)
-	    	{
-	    		$found=0;
-	    		my $filesize = -s $file;
-	    		if (! $filesize) { next; }
+			$ret=`mkdir -p "/tmp/emptydir/"`;
+			
+			%filestoscan=%filestoscansf;
+			
+			foreach my $file (sort keys %filestoscan)
+			{
+				$found=0;
+				my $filesize = -s $file;
+				if (! $filesize) { next; }
 
 				print "\n";
-	    		print "Publish file ".$file." to ".$filestoscan{$file}."\n";
 	    		
-	    		$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
+	    		if ($target eq 'SF') { 
+	    			$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
+		    		print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."\n";
+	    		}
+	    		else
+	    		{
+	    			$destFolder="$NEWPUBLISH";
+		    		print "Publish file ".$file." to $NEWPUBLISH\n";
+	    		}
 
 				# mkdir	   
 				#my $ssh = Net::SSH::Perl->new("frs.sourceforge.net");
 				#$ssh->login("$user","$pass"); 		
-	    		#use String::ShellQuote qw( shell_quote );
+				#use String::ShellQuote qw( shell_quote );
 				#$ssh->cmd('mkdir '.shell_quote($destFolder).' && exit');
 
 				#use Net::SFTP::Foreign;
@@ -1008,6 +1087,7 @@
 				#$command="ssh eldy,dolibarr\@frs.sourceforge.net mkdir -p \"$destFolder\"";
 				#print "$command\n";	
 				#my $ret=`$command 2>&1`;
+
 				$command="rsync -s -e 'ssh' --recursive /tmp/emptydir/ \"".$destFolder."\"";
 				print "$command\n";	
 				my $ret=`$command 2>&1`;
@@ -1016,25 +1096,24 @@
 				print "$command\n";	
 				my $ret=`$command 2>&1`;
 				print "$ret\n";
-	    		
-	    	}
-
-    	}
-    }    
+			}
+		}
+	}    
 }
 
 print "\n----- Summary -----\n";
-foreach my $target (keys %CHOOSEDTARGET) {
-    if ($CHOOSEDTARGET{$target} < 0) {
-        print "Package $target not built (bad requirement).\n";
-    } else {
-        print "Package $target built successfully in $DESTI\n";
-    }
+foreach my $target (sort keys %CHOOSEDTARGET) {
+	if ($target eq '-CHKSUM') { print "Checksum was generated"; next; }
+	if ($CHOOSEDTARGET{$target} < 0) {
+		print "Package $target not built (bad requirement).\n";
+	} else {
+		print "Package $target built successfully in $DESTI\n";
+	}
 }
 
 if (! $batch) {
-    print "\nPress key to finish...";
-    my $WAITKEY=<STDIN>;
+	print "\nPress key to finish...";
+	my $WAITKEY=<STDIN>;
 }
 
 0;
diff -Nru dolibarr-3.5.5+dfsg1/build/makepack-howto.txt dolibarr-3.5.7+dfsg1/build/makepack-howto.txt
--- dolibarr-3.5.5+dfsg1/build/makepack-howto.txt	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/build/makepack-howto.txt	2015-05-16 16:08:43.000000000 +0200
@@ -12,8 +12,6 @@
 - Update version number with x.y.z-w in htdocs/filefunc.inc.php
 - 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     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).
@@ -35,7 +33,6 @@
 - Update version number with x.y.z in htdocs/filefunc.inc.php
 - Update version number with x.y.z in build/debian/changelog
 - Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss
-- Update version number with x.y.z in build/rpm/*.spec
 - Commit all changes.
 - Add a Tag (x.y.z)
 
diff -Nru dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_fedora.spec dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_fedora.spec
--- dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_fedora.spec	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_fedora.spec	2015-05-16 15:35:42.000000000 +0200
@@ -331,20 +331,4 @@
 
 # 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
-
-* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
-- Upstream release
-
-* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
-- Upstream release
-
-* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
-- Upstream release
-
-* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
-- Initial version (#723326)
+__CHANGELOGSTRING__
\ Pas de fin de ligne à la fin du fichier
diff -Nru dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_generic.spec dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_generic.spec
--- dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_generic.spec	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_generic.spec	2015-05-16 15:35:51.000000000 +0200
@@ -567,20 +567,4 @@
 
 # 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
-
-* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
-- Upstream release
-
-* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
-- Upstream release
-
-* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
-- Upstream release
-
-* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
-- Initial version (#723326)
+__CHANGELOGSTRING__
diff -Nru dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_mandriva.spec dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_mandriva.spec
--- dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_mandriva.spec	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_mandriva.spec	2015-05-16 15:35:58.000000000 +0200
@@ -336,20 +336,4 @@
 
 # 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
-
-* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
-- Upstream release
-
-* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
-- Upstream release
-
-* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
-- Upstream release
-
-* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
-- Initial version (#723326)
+__CHANGELOGSTRING__
\ Pas de fin de ligne à la fin du fichier
diff -Nru dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_opensuse.spec dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_opensuse.spec
--- dolibarr-3.5.5+dfsg1/build/rpm/dolibarr_opensuse.spec	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/build/rpm/dolibarr_opensuse.spec	2015-05-16 15:36:04.000000000 +0200
@@ -347,20 +347,4 @@
 
 # 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
-
-* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3
-- Upstream release
-
-* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3
-- Upstream release
-
-* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3
-- Upstream release
-
-* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3
-- Initial version (#723326)
+__CHANGELOGSTRING__
diff -Nru dolibarr-3.5.5+dfsg1/ChangeLog dolibarr-3.5.7+dfsg1/ChangeLog
--- dolibarr-3.5.5+dfsg1/ChangeLog	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/ChangeLog	2015-05-16 15:27:18.000000000 +0200
@@ -2,6 +2,33 @@
 English Dolibarr ChangeLog
 --------------------------------------------------------------
 
+***** ChangeLog for 3.5.7 compared to 3.5.6 *****
+Fix: Paypal link were broken dur to SSL v3 closed.
+Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
+Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
+Fix: [ bug #1757 ] Sorting breaks product/service statistics
+Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date
+Fix: [ bug #1792 ] Users are not allowed to see margins module index page when no product view permission is enabled
+Fix: [ bug #1846 ] Browser IE11 not detected
+Fix: [ bug #1906 ] Deplacement does not allow translated decimal format
+Fix: [ bug #1905 ] Custom deplacement types do not get translated in deplacement card
+Fix: [ bug #2583 ] Unable to create a bank transfer with localized numbers
+Fix: [ bug #2577 ] Incorrect invoice status in "Linked objects" page of a project
+Fix: [ bug #2576 ] Unable to edit a dictionary entry that has # in its ref
+Fix: [ bug #2758 ] Product::update sets product note to "null" when $prod->note is null
+Fix: [ bug #2757 ] Deleting product category photo gives "Forbidden access" error
+
+***** ChangeLog for 3.5.6 compared to 3.5.5 *****
+Fix: Avoid missing class error for fetch_thirdparty method #1973
+Fix: Can't update phone_pro from web service
+Fix: Some security holes.
+Fix: copy extrafields when creating order from proposal.
+Fix: report on action was not filtering by environment.
+Fix: Avoid missing class error.
+Fix: Add function dolEscapeXML.
+Fix: Bad days and month reported by function.
+Fix: Bad margin calculation.
+
 ***** 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.
diff -Nru dolibarr-3.5.5+dfsg1/debian/changelog dolibarr-3.5.7+dfsg1/debian/changelog
--- dolibarr-3.5.5+dfsg1/debian/changelog	2015-05-05 10:21:16.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/debian/changelog	2015-08-18 18:06:53.000000000 +0200
@@ -1,3 +1,12 @@
+dolibarr (3.5.7+dfsg1-1) UNRELEASED; urgency=medium
+
+  * New upstream release with 3.5.7
+  * Fixed Does not honor dropdown menu for Cc: when sending 
+    invoices/quotations (Closes: #786479)
+  * Fixed CVE-2015-3935: dolibarr HTML injection (Closes: #787762)
+
+ -- Laurent Destailleur (eldy) <eldy@users.sourceforge.net>  Tue, 18 Aug 2015 17:54:56 +0200
+
 dolibarr (3.5.5+dfsg1-2) unstable; urgency=medium
 
   * Use final package name for jflot instead of transitionnal (Closes: #783061)
diff -Nru dolibarr-3.5.5+dfsg1/.gitattributes dolibarr-3.5.7+dfsg1/.gitattributes
--- dolibarr-3.5.5+dfsg1/.gitattributes	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/.gitattributes	1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-# Set default behaviour, in case users don't have core.autocrlf set.
-# More info: https://help.github.com/articles/dealing-with-line-endings
-* text=auto
-
-
-# Explicitly declare text files we want to always be normalized and converted 
-# to native line endings on checkout.
-*.php text eol=lf
-*.pl text eol=lf
-*.sql text eol=lf
-*.htm text eol=lf
-*.html text eol=lf
-*.js text eol=lf
-*.css text eol=lf
-*.lang text eol=lf
-*.txt text eol=lf
-*.md text eol=lf
-
-# Denote all files that are truly binary and should not be modified.
-*.bmp binary
-*.ico binary
-*.png binary
-*.jpg binary
-*.odt binary
-*.odf binary
-*.frm binary
-*.MYD binary
-*.MYI binary
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/admin/dict.php dolibarr-3.5.7+dfsg1/htdocs/admin/dict.php
--- dolibarr-3.5.5+dfsg1/htdocs/admin/dict.php	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/admin/dict.php	2015-05-11 23:37:43.000000000 +0200
@@ -6,7 +6,7 @@
  * Copyright (C) 2010-2013 Juanjo Menent        <jmenent@2byte.es>
  * Copyright (C) 2011      Philippe Grand       <philippe.grand@atoo-net.com>
  * Copyright (C) 2011      Remy Younes          <ryounes@gmail.com>
- * Copyright (C) 2012-2013 Marcos García        <marcosgdf@gmail.com>
+ * Copyright (C) 2012-2015 Marcos García        <marcosgdf@gmail.com>
  * Copyright (C) 2012      Christophe Battarel	<christophe.battarel@ltairis.fr>
  * Copyright (C) 2011-2012 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  *
@@ -1104,7 +1104,7 @@
 
                     if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0;
 
-                    $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;';
+                    $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?urlencode($obj->code):'').'&amp;id='.$id.'&amp;';
 
                     // Active
                     print '<td align="center" class="nowrap">';
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/categories/photos.php dolibarr-3.5.7+dfsg1/htdocs/categories/photos.php
--- dolibarr-3.5.5+dfsg1/htdocs/categories/photos.php	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/categories/photos.php	2015-05-16 15:27:18.000000000 +0200
@@ -264,11 +264,11 @@
 			// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
 			if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
 			{
-				print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->entity.'&amp;action=addthumb&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'&nbsp;&nbsp;</a>';
+				print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addthumb&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'&nbsp;&nbsp;</a>';
 			}
 			if ($user->rights->categorie->creer)
 			{
-				print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->entity.'&amp;action=delete&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">';
+				print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">';
 				print img_delete().'</a>';
 			}
 			if ($nbbyrow) print '</td>';
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/comm/action/index.php dolibarr-3.5.7+dfsg1/htdocs/comm/action/index.php
--- dolibarr-3.5.5+dfsg1/htdocs/comm/action/index.php	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/comm/action/index.php	2015-04-13 09:15:59.000000000 +0200
@@ -184,18 +184,19 @@
     $prev_month = $prev['prev_month'];
     $prev_day   = $prev['prev_day'];
     $first_day  = $prev['first_day'];
-
+    $first_month= $prev['first_month'];
+    $first_year = $prev['first_year'];
     $week = $prev['week'];
 
     $day = (int) $day;
-    $next = dol_get_next_week($day, $week, $month, $year);
+    $next = dol_get_next_week($first_day, $week, $first_month, $first_year);
     $next_year  = $next['year'];
     $next_month = $next['month'];
     $next_day   = $next['day'];
 
     // Define firstdaytoshow and lastdaytoshow
-    $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year);
-    $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year);
+    $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
+	$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
 
     $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
 
@@ -870,39 +871,27 @@
     }
     echo " </tr>\n";
 
-    // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month)
-    //var_dump($eventarray);
-    //print $tmpday;
-
     echo " <tr>\n";
 
     for($iter_day = 0; $iter_day < 7; $iter_day++)
     {
-        if(($tmpday <= $max_day_in_month))
-        {
-            // Show days of the current week
-            $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
-
-            $style='cal_current_month';
-        	if ($iter_day == 6) $style.=' cal_other_month_right';
-            $today=0;
-            $todayarray=dol_getdate($now,'fast');
-            if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
-            if ($today) $style='cal_today';
-
-            echo '  <td class="'.$style.' nowrap" width="14%" valign="top">';
-            show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
-            echo "  </td>\n";
-        }
-        else
-        {
-            $style='cal_current_month';
-        	if ($iter_day == 6) $style.=' cal_other_month_right';
-            echo '  <td class="'.$style.' nowrap" width="14%" valign="top">';
-            show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
-            echo "</td>\n";
-        }
-        $tmpday++;
+        // Show days of the current week
+		$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
+		$tmparray = dol_getdate($curtime,'fast');
+		$tmpday = $tmparray['mday'];
+		$tmpmonth = $tmparray['mon'];
+		$tmpyear = $tmparray['year'];
+
+        $style='cal_current_month';
+        if ($iter_day == 6) $style.=' cal_other_month_right';
+        $today=0;
+        $todayarray=dol_getdate($now,'fast');
+        if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
+        if ($today) $style='cal_today';
+
+        echo '  <td class="'.$style.'" width="14%" valign="top">';
+        show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300);
+        echo "  </td>\n";
     }
     echo " </tr>\n";
 
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/comm/propal/list.php dolibarr-3.5.7+dfsg1/htdocs/comm/propal/list.php
--- dolibarr-3.5.5+dfsg1/htdocs/comm/propal/list.php	2014-09-23 09:18:23.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/comm/propal/list.php	2015-04-13 09:15:59.000000000 +0200
@@ -141,7 +141,9 @@
 $limit = $conf->liste_limit;
 
 
-$sql = 'SELECT s.rowid, s.nom, s.town, s.client, s.code_client,';
+if (! $sall) $sql = 'SELECT';
+else $sql = 'SELECT DISTINCT';
+$sql.= ' s.rowid, s.nom, s.town, s.client, s.code_client,';
 $sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
 if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
 $sql.= ' u.login';
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/commande/class/commande.class.php dolibarr-3.5.7+dfsg1/htdocs/commande/class/commande.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/commande/class/commande.class.php	2014-09-26 13:24:15.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/commande/class/commande.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -972,7 +972,12 @@
 				$line->marge_tx			= $marginInfos[1];
 				$line->marque_tx		= $marginInfos[2];
 
-                $this->lines[$i] = $line;
+                // get extrafields from original line
+				$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
+				foreach($object->lines[$i]->array_options as $options_key => $value)
+					$line->array_options[$options_key] = $value;
+
+				$this->lines[$i] = $line;
             }
 
             $this->socid                = $object->socid;
@@ -991,6 +996,11 @@
             $this->origin				= $object->element;
             $this->origin_id			= $object->id;
 
+            // get extrafields from original line
+			$object->fetch_optionals($object->id);
+			foreach($object->array_options as $options_key => $value)
+				$this->array_options[$options_key] = $value;
+
             // Possibility to add external linked objects with hooks
             $this->linked_objects[$this->origin] = $this->origin_id;
             if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/compta/bank/virement.php dolibarr-3.5.7+dfsg1/htdocs/compta/bank/virement.php
--- dolibarr-3.5.5+dfsg1/htdocs/compta/bank/virement.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/compta/bank/virement.php	2015-05-11 23:37:43.000000000 +0200
@@ -3,6 +3,7 @@
  * Copyright (C) 2004-2008 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copytight (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copytight (C) 2012	   Juanjo Menent        <jmenent@2byte.es>
+ * Copyright (C) 2015      Marcos García        <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,7 +49,7 @@
 	$mesg='';
 	$dateo = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
 	$label = GETPOST('label','alpha');
-	$amount= GETPOST('amount','int');
+	$amount= GETPOST('amount');
 
 	if (! $label)
 	{
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/compta/deplacement/fiche.php dolibarr-3.5.7+dfsg1/htdocs/compta/deplacement/fiche.php
--- dolibarr-3.5.5+dfsg1/htdocs/compta/deplacement/fiche.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/compta/deplacement/fiche.php	2015-04-14 14:25:09.000000000 +0200
@@ -4,6 +4,7 @@
  * Copyright (C) 2005-2012	Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2012		Juanjo Menent        <jmenent@2byte.es>
  * Copyright (C) 2013       Florian Henry		  	<florian.henry@open-concept.pro>
+ * Copyright (C) 2015       Marcos García        <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -123,8 +124,14 @@
     {
         $error=0;
 
+	    $km = GETPOST('km');
+
+	    if ($km) {
+		    $km = price2num($km);
+	    }
+
         $object->date			= dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
-        $object->km				= GETPOST('km','int');
+        $object->km				= $km;
         $object->type			= GETPOST('type','alpha');
         $object->socid			= GETPOST('socid','int');
         $object->fk_user		= GETPOST('fk_user','int');
@@ -182,8 +189,14 @@
     {
         $result = $object->fetch($id);
 
+	    $km = GETPOST('km');
+
+	    if ($km) {
+		    $km = price2num($km);
+	    }
+
         $object->date			= dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
-        $object->km				= GETPOST('km','int');
+        $object->km				= $km;
         $object->type			= GETPOST('type','alpha');
         $object->socid			= GETPOST('socid','int');
         $object->fk_user		= GETPOST('fk_user','int');
@@ -225,12 +238,6 @@
     $result=$object->setValueFrom('dated',$dated,'','','date');
     if ($result < 0) dol_print_error($db, $object->error);
 }
-else if ($action == 'setkm' && $user->rights->deplacement->creer)
-{
-    $object->fetch($id);
-    $result=$object->setValueFrom('km',GETPOST('km','int'));
-    if ($result < 0) dol_print_error($db, $object->error);
-}
 else if ($action == 'setnote_public' && $user->rights->deplacement->creer)
 {
     $object->fetch($id);
@@ -385,7 +392,7 @@
 
             // Km
             print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
-            print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
+            print '<input name="km" class="flat" size="10" value="'.price($object->km).'">';
             print '</td></tr>';
 
             // Where
@@ -453,10 +460,12 @@
             print '</td></tr>';
 
             // Type
+	        $form->load_cache_types_fees();
+
             print '<tr><td>';
             print $form->editfieldkey("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
             print '</td><td>';
-            print $form->editfieldval("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
+            print $form->editfieldval("Type",'type', $form->cache_types_fees[$object->type],$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
             print '</td></tr>';
 
             // Who
@@ -477,7 +486,7 @@
             print '<tr><td valign="top">';
             print $form->editfieldkey("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
             print '</td><td>';
-            print $form->editfieldval("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
+            print $form->editfieldval("FeesKilometersOrAmout",'km',price($object->km),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
             print "</td></tr>";
 
             // Where
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/compta/facture/class/facture.class.php dolibarr-3.5.7+dfsg1/htdocs/compta/facture/class/facture.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/compta/facture/class/facture.class.php	2014-09-26 13:24:15.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/compta/facture/class/facture.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -701,6 +701,11 @@
 			$marginInfos			= getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
 			$line->pa_ht			= $marginInfos[0];
 
+            // get extrafields from original line
+			$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
+			foreach($object->lines[$i]->array_options as $options_key => $value)
+				$line->array_options[$options_key] = $value;
+
 			$this->lines[$i] = $line;
 		}
 
@@ -720,6 +725,11 @@
 		$this->origin				= $object->element;
 		$this->origin_id			= $object->id;
 
+        // get extrafields from original line
+		$object->fetch_optionals($object->id);
+		foreach($object->array_options as $options_key => $value)
+			$this->array_options[$options_key] = $value;
+
 		// Possibility to add external linked objects with hooks
 		$this->linked_objects[$this->origin] = $this->origin_id;
 		if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects))
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/boxes/box_activity.php dolibarr-3.5.7+dfsg1/htdocs/core/boxes/box_activity.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/boxes/box_activity.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/boxes/box_activity.php	2015-04-13 09:15:59.000000000 +0200
@@ -114,7 +114,7 @@
 					$billurl="viewstatut=2&paye=1&year=".$objp->annee;
 
 					$this->info_box_contents[$i][2] = array('td' => 'align="right"',
-					'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/liste.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills"
+					'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills"
 					);
 
 					$this->info_box_contents[$i][3] = array('td' => 'align="right"',
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/class/commonobject.class.php dolibarr-3.5.7+dfsg1/htdocs/core/class/commonobject.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/class/commonobject.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/class/commonobject.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -575,6 +575,11 @@
         global $conf;
 
         if (empty($this->socid)) return 0;
+        
+        if (!class_exists('Societe'))
+	    require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+
+	require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 
         $thirdparty = new Societe($this->db);
         $result=$thirdparty->fetch($this->socid);
@@ -2175,10 +2180,10 @@
             			$this->array_options[$key] = price2num($this->array_options[$key]);
             			break;
             		case 'date':
-            			$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
+            			if (is_numeric($this->array_options[$key])) $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
             			break;
             		case 'datetime':
-            			$this->array_options[$key]=$this->db->idate($this->array_options[$key]);
+            			if (is_numeric($this->array_options[$key])) $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
             			break;
                	}
             }
@@ -2192,7 +2197,7 @@
             {
             	$attributeKey = substr($key,8);   // Remove 'options_' prefix
                 // Add field of attribut
-            	if ($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
+            	if (isset($extrafields->attribute_type[$attributeKey]) && $extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate
                 	$sql.=",".$attributeKey;
             }
             $sql .= ") VALUES (".$this->id;
@@ -2200,7 +2205,7 @@
             {
             	$attributeKey = substr($key,8);   // Remove 'options_' prefix
                 // Add field o fattribut
-            	if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
+            	if(isset($extrafields->attribute_type[$attributeKey]) && $extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
             	{
 	                if ($this->array_options[$key] != '')
 	                {
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/class/extrafields.class.php dolibarr-3.5.7+dfsg1/htdocs/core/class/extrafields.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/class/extrafields.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/class/extrafields.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -727,11 +727,11 @@
 					if (strpos($InfoFieldList[4], 'extra')!==false)
 					{
 						$sql.= ' as main, '.MAIN_DB_PREFIX .$InfoFieldList[0].'_extrafields as extra';
-						$sqlwhere.= ' AND extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
+						$sqlwhere.= ' WHERE extra.fk_object=main.'.$InfoFieldList[2]. ' AND '.$InfoFieldList[4];
 					}
 					else
 					{
-						$sqlwhere.= ' AND '.$InfoFieldList[4];
+						$sqlwhere.= ' WHERE '.$InfoFieldList[4];
 					}
 				}
 				if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity;	// Some tables may have field, some other not. For the moment we disable it.
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/class/hookmanager.class.php dolibarr-3.5.7+dfsg1/htdocs/core/class/hookmanager.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/class/hookmanager.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/class/hookmanager.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -131,6 +131,7 @@
         // Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated.
         $hooktype='output';
         if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue';	// pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
+        if ($method =='insertExtraFields') $hooktype='returnvalue';
         if (in_array(
         	$method,
         	array(
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/class/html.formother.class.php dolibarr-3.5.7+dfsg1/htdocs/core/class/html.formother.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/class/html.formother.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/class/html.formother.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -1017,6 +1017,7 @@
         if ($nbboxactivated)
         {
         	$langs->load("boxes");
+			$langs->load("projects");
 
         	$emptybox=new ModeleBoxes($db);
 
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/class/translate.class.php dolibarr-3.5.7+dfsg1/htdocs/core/class/translate.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/class/translate.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/class/translate.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -703,7 +703,7 @@
 	 */
 	function getCurrencyAmount($currency_code, $amount)
 	{
-		$symbol=$this->getCurrencSymbol($currency_code);
+		$symbol=$this->getCurrencySymbol($currency_code);
 
 		if (in_array($currency_code, array('USD'))) return $symbol.$amount;
 		else return $amount.$symbol;
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/db/pgsql.class.php dolibarr-3.5.7+dfsg1/htdocs/core/db/pgsql.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/db/pgsql.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/db/pgsql.class.php	2015-04-13 09:15:59.000000000 +0200
@@ -402,7 +402,7 @@
 		if ((! empty($host) && $host == "socket") && ! defined('NOLOCALSOCKETPGCONNECT'))
 		{
 			$con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'";    // $name may be empty
-			$this->db = pg_connect($con_string);
+			$this->db = @pg_connect($con_string);
 		}
 
 		// if local connection failed or not requested, use TCP/IP
@@ -412,7 +412,7 @@
 			if (! $port) $port = 5432;
 
 			$con_string = "host='".$host."' port='".$port."' dbname='".$name."' user='".$login."' password='".$passwd."'";
-			$this->db = pg_connect($con_string);
+			$this->db = @pg_connect($con_string);
 		}
 
 		// now we test if at least one connect method was a success
@@ -1021,7 +1021,7 @@
 		// Test charset match LC_TYPE (pgsql error otherwise)
 		//print $charset.' '.setlocale(LC_CTYPE,'0'); exit;
 
-		$sql='CREATE DATABASE '.$database.' OWNER '.$owner.' ENCODING \''.$charset.'\'';
+		$sql='CREATE DATABASE "'.$database.'" OWNER "'.$owner.'" ENCODING \''.$charset.'\'';
 		dol_syslog($sql,LOG_DEBUG);
 		$ret=$this->query($sql);
 		return $ret;
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/lib/date.lib.php dolibarr-3.5.7+dfsg1/htdocs/core/lib/date.lib.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/lib/date.lib.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/lib/date.lib.php	2015-04-13 09:15:59.000000000 +0200
@@ -518,8 +518,8 @@
  *	@param		int		$day		Day
  * 	@param		int		$month		Month
  *  @param		int		$year		Year
- * 	@param		int		$gm			False = Return date to compare with server TZ, True to compare with GM date.
- *	@return		array				year,month, week,first_day,prev_year,prev_month,prev_day
+ * 	@param		int		$gm			False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
+ *	@return		array				year,month,week,first_day,prev_year,prev_month,prev_day
  */
 function dol_get_first_day_week($day,$month,$year,$gm=false)
 {
@@ -542,7 +542,7 @@
     $tmpday = date($tmparray[0])-$seconds;
 	$tmpday = date("d",$tmpday);
 
-	//Check first day of week is form this month or not
+	//Check first day of week is in same month than current day or not
 	if ($tmpday>$day)
     {
     	$prev_month = $month-1;
@@ -559,15 +559,17 @@
     	$prev_month = $month;
 		$prev_year  = $year;
     }
+	$tmpmonth = $prev_month;
+	$tmpyear = $prev_year;
 
-    //Get first day of next week
+	//Get first day of next week
 	$tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0);
 	$tmptime-=24*60*60*7;
 	$tmparray=dol_getdate($tmptime,true);
     $prev_day   = $tmparray['mday'];
 
-    //Check first day of week is form this month or not
-	if ($prev_day>$tmpday)
+    //Check prev day of week is in same month than first day or not
+	if ($prev_day > $tmpday)
     {
     	$prev_month = $month-1;
 		$prev_year  = $year;
@@ -579,9 +581,9 @@
     	}
     }
 
-    $week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm));
+    $week = date("W",dol_mktime(0,0,0,$tmpmonth,$tmpday,$tmpyear,$gm));
 
-	return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
+	return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
 }
 
 /**
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/lib/functions.lib.php dolibarr-3.5.7+dfsg1/htdocs/core/lib/functions.lib.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/lib/functions.lib.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/lib/functions.lib.php	2015-04-13 09:15:59.000000000 +0200
@@ -10,6 +10,7 @@
  * Copyright (C) 2010-2011 Juanjo Menent        <jmenent@2byte.es>
  * Copyright (C) 2013      Cédric Salvador      <csalvador@gpcsolutions.fr>
  * Copyright (C) 2013      Alexandre Spangaro   <alexandre.spangaro@gmail.com>
+ * Copyright (C) 2014-2015 Marcos García        <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -146,7 +147,7 @@
 	elseif (preg_match('/epiphany/i',$_SERVER["HTTP_USER_AGENT"]))                       { $name='epiphany';  $version=$reg[2]; }
 	elseif ((empty($phone) || preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) && preg_match('/safari(\/|\s)([\d\.]*)/i',$_SERVER["HTTP_USER_AGENT"], $reg)) { $name='safari'; $version=$reg[2]; }	// Safari is often present in string for mobile but its not.
 	elseif (preg_match('/opera(\/|\s)([\d\.]*)/i',  $_SERVER["HTTP_USER_AGENT"], $reg))  { $name='opera';     $version=$reg[2]; }
-	elseif (preg_match('/msie(\/|\s)([\d\.]*)/i',   $_SERVER["HTTP_USER_AGENT"], $reg))  { $name='ie';        $version=$reg[2]; }    // MS products at end
+	elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i',   $_SERVER["HTTP_USER_AGENT"], $reg))  { $name='ie';        $version= end($reg); }    // MS products at end
 	// Other
 	$firefox=0;
 	if (in_array($name,array('firefox','iceweasel'))) $firefox=1;
@@ -2515,7 +2516,7 @@
 	$return='';
 
 	if ($picto == 'setup') $picto='title.png';
-	if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif';
+	if (($conf->browser->name == 'ie') && $picto=='title.png') $picto='title.gif';
 
 	$return.= "\n";
 	$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
@@ -2553,7 +2554,7 @@
 	global $conf,$langs;
 
 	if ($picto == 'setup') $picto='title.png';
-	if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif';
+	if (($conf->browser->name == 'ie') && $picto=='title.png') $picto='title.gif';
 
 	if (($num > $conf->liste_limit) || ($num == -1))
 	{
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/modules/action/rapport.pdf.php dolibarr-3.5.7+dfsg1/htdocs/core/modules/action/rapport.pdf.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/modules/action/rapport.pdf.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/modules/action/rapport.pdf.php	2015-04-13 09:15:59.000000000 +0200
@@ -182,6 +182,7 @@
 		$sql.= " WHERE c.id=a.fk_action AND a.fk_user_author = u.rowid";
 		$sql.= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($this->year,$this->month,false))."'";
 		$sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'";
+		$sql.= " AND a.entity = ".$conf->entity;
 		$sql.= " ORDER BY a.datep DESC";
 
 		dol_syslog(get_class($this)."::_page sql=".$sql);
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php dolibarr-3.5.7+dfsg1/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php	2015-04-13 09:15:59.000000000 +0200
@@ -255,19 +255,44 @@
 						$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).'</strong>';
 						$desc=dol_htmlentitiesbr($objectligne->desc,1);
 
-						$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0);
-
+						$pdf->startTransaction();
+						$pdf->writeHTMLCell(0, 0, $curX, $curY, $txt.'<br>'.$desc, LR, 1, 0);
+						$pageposafter=$pdf->getPage();
+						if ($pageposafter > $pageposbefore)	// There is a pagebreak
+						{
+							$pdf->rollbackTransaction(true);
+							$pageposafter=$pageposbefore;
+							//print $pageposafter.'-'.$pageposbefore;exit;
+							$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
+							$pdf->writeHTMLCell(0, 0, $curX, $curY, $txt.'<br>'.$desc, LR, 1, 0);
+							$pageposafter=$pdf->getPage();
+							$posyafter=$pdf->GetY();
+							//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
+							if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot)))	// There is no space left for total+free text
+							{
+								if ($i == ($nblines-1))	// No more lines, and no space left to show total, so we create a new page
+								{
+									$pdf->AddPage('','',true);
+									$pdf->setPage($pageposafter+1);
+								}
+							}
+						}
+						else	// No pagebreak
+						{
+							$pdf->commitTransaction();
+						}
+	
 						$nexY = $pdf->GetY();
 						$pageposafter=$pdf->getPage();
 						$pdf->setPage($pageposbefore);
 						$pdf->setTopMargin($this->marge_haute);
 						$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
-
+	
 						// We suppose that a too long description is moved completely on next page
 						if ($pageposafter > $pageposbefore) {
 							$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
 						}
-
+						
 						$pdf->SetFont('','', $default_font_size - 1);   // On repositionne la police par defaut
 
 						// Detect if some page were added automatically and output _tableau for past pages
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/modules/modProjet.class.php dolibarr-3.5.7+dfsg1/htdocs/core/modules/modProjet.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/modules/modProjet.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/modules/modProjet.class.php	2015-05-11 23:37:43.000000000 +0200
@@ -280,11 +280,9 @@
         $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
 		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
         $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
-		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task,";
-		$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
-		$this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid';
-		$this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity;
-
+		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
+		$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
+		$this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity;
 	}
 
 
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/modules/societe/mod_codecompta_aquarium.php dolibarr-3.5.7+dfsg1/htdocs/core/modules/societe/mod_codecompta_aquarium.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/modules/societe/mod_codecompta_aquarium.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/modules/societe/mod_codecompta_aquarium.php	2015-04-13 09:15:59.000000000 +0200
@@ -44,8 +44,8 @@
 	function __construct()
 	{
 	    global $conf;
-		if (empty($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER)) $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
-        if (empty($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER)) $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401';
+		if (! isset($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) || trim($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) == '') $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
+        if (! isset($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) || trim($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) == '') $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401';
 		$this->prefixcustomeraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER;
 	    $this->prefixsupplieraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER;
 	}
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php dolibarr-3.5.7+dfsg1/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php	2015-04-13 09:15:59.000000000 +0200
@@ -125,7 +125,8 @@
 			return 0;
 		}
 
-		$numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc->code_fournisseur,$object->datef);
+	    //Supplier invoices take invoice date instead of creation date for the mask
+		$numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc->code_fournisseur,$object->date);
 
 		return  $numFinal;
 	}
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/core/tpl/objectline_edit.tpl.php dolibarr-3.5.7+dfsg1/htdocs/core/tpl/objectline_edit.tpl.php
--- dolibarr-3.5.5+dfsg1/htdocs/core/tpl/objectline_edit.tpl.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/core/tpl/objectline_edit.tpl.php	2015-04-13 09:15:59.000000000 +0200
@@ -128,7 +128,7 @@
 
 	<?php if (! empty($conf->margin->enabled)) { ?>
 		<td align="right"><?php $coldisplay++; ?>
-			<select id="fournprice" name="fournprice" class="hideobject"></select>
+			<select id="fournprice" name="fournprice"></select>
 			<input type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht,0,'',0); ?>">
 		</td>
 	    <?php if ($user->rights->margins->creer) {
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/cron/card.php dolibarr-3.5.7+dfsg1/htdocs/cron/card.php
--- dolibarr-3.5.5+dfsg1/htdocs/cron/card.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/cron/card.php	2015-04-13 09:15:59.000000000 +0200
@@ -95,9 +95,18 @@
 	}
 	else
 	{
-		if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings');
-		else setEventMessage($langs->trans("JobFinished"),'mesgs');
-		$action='';
+		$res = $object->reprogram_jobs($user->login);
+		if ($res > 0)
+		{
+			if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings');
+			else setEventMessage($langs->trans("JobFinished"),'mesgs');
+			$action='';
+		}
+		else
+		{
+			setEventMessage($object->error,'errors');
+			$action='';
+		}
 	}
 }
 
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/cron/list.php dolibarr-3.5.7+dfsg1/htdocs/cron/list.php
--- dolibarr-3.5.5+dfsg1/htdocs/cron/list.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/cron/list.php	2015-04-13 09:15:59.000000000 +0200
@@ -100,6 +100,21 @@
 	if ($result < 0) {
 		setEventMessage($object->error,'errors');
 	}
+	else 
+	{
+		$res = $object->reprogram_jobs($user->login);
+		if ($res > 0)
+		{
+			if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings');
+			else setEventMessage($langs->trans("JobFinished"),'mesgs');
+			$action='';
+		}
+		else
+		{
+			setEventMessage($object->error,'errors');
+			$action='';
+		}
+	}
 
 	header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-1');		// Make a call to avoid to run twice job when using back
 	exit;
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/expedition/class/expedition.class.php dolibarr-3.5.7+dfsg1/htdocs/expedition/class/expedition.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/expedition/class/expedition.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/expedition/class/expedition.class.php	2015-05-11 23:37:43.000000000 +0200
@@ -164,8 +164,6 @@
 
 		$now=dol_now();
 
-		if (empty($this->model_pdf)) $this->model_pdf=$conf->global->EXPEDITION_ADDON_PDF;
-
 		require_once DOL_DOCUMENT_ROOT .'/product/stock/class/mouvementstock.class.php';
 		$error = 0;
 
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/expedition/fiche.php dolibarr-3.5.7+dfsg1/htdocs/expedition/fiche.php
--- dolibarr-3.5.5+dfsg1/htdocs/expedition/fiche.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/expedition/fiche.php	2015-05-11 23:37:43.000000000 +0200
@@ -113,6 +113,7 @@
 
     $object->socid					= $objectsrc->socid;
     $object->ref_customer			= $objectsrc->ref_client;
+	$object->model_pdf				= GETPOST('model');
     $object->date_delivery			= $date_delivery;	// Date delivery planed
     $object->fk_delivery_address	= $objectsrc->fk_delivery_address;
     $object->shipping_method_id		= GETPOST('shipping_method_id','int');
@@ -662,6 +663,14 @@
             print '<td colspan="3">';
             print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number','alpha').'">';
             print "</td></tr>\n";
+            
+            // Document model
+            print "<tr><td>".$langs->trans("Model")."</td>";
+            print '<td colspan="3">';
+			include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php';
+			$liste = ModelePdfExpedition::liste_modeles($db);
+			print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF);
+            print "</td></tr>\n";
 
             // Other attributes
             $parameters=array('colspan' => ' colspan="3"');
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/filefunc.inc.php dolibarr-3.5.7+dfsg1/htdocs/filefunc.inc.php
--- dolibarr-3.5.5+dfsg1/htdocs/filefunc.inc.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/filefunc.inc.php	2015-05-16 15:21:45.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.5');
+if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.7');
 if (! defined('EURO')) define('EURO',chr(128));
 
 // Define syslog constants
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/langs/fr_FR/bills.lang dolibarr-3.5.7+dfsg1/htdocs/langs/fr_FR/bills.lang
--- dolibarr-3.5.5+dfsg1/htdocs/langs/fr_FR/bills.lang	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/langs/fr_FR/bills.lang	2015-04-13 09:16:00.000000000 +0200
@@ -255,7 +255,7 @@
 Deposit=Acompte
 Deposits=Acomptes
 DiscountFromCreditNote=Remise issue de l'avoir %s
-DiscountFromDeposit=Paiements issue de l'acompte %s
+DiscountFromDeposit=Paiement issu de l'acompte %s
 AbsoluteDiscountUse=Ce type de crédit ne peut s'utiliser que sur une facture non validée
 CreditNoteDepositUse=La facture doit être validée pour pouvoir utiliser ce type de crédit
 NewGlobalDiscount=Nouvelle ligne de déduction
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/margin/agentMargins.php dolibarr-3.5.7+dfsg1/htdocs/margin/agentMargins.php
--- dolibarr-3.5.5+dfsg1/htdocs/margin/agentMargins.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/margin/agentMargins.php	2015-04-13 09:16:00.000000000 +0200
@@ -57,9 +57,9 @@
 $startdate=$enddate='';
 
 if (!empty($_POST['startdatemonth']))
-  $startdate  = dol_mktime(12, 0, 0, $_POST['startdatemonth'],  $_POST['startdateday'],  $_POST['startdateyear']);
+  $startdate  = dol_mktime(0, 0, 0, $_POST['startdatemonth'],  $_POST['startdateday'],  $_POST['startdateyear']);
 if (!empty($_POST['enddatemonth']))
-  $enddate  = dol_mktime(12, 0, 0, $_POST['enddatemonth'],  $_POST['enddateday'],  $_POST['enddateyear']);
+  $enddate  = dol_mktime(23, 59, 59, $_POST['enddatemonth'],  $_POST['enddateday'],  $_POST['enddateyear']);
 
 /*
  * View
@@ -109,8 +109,8 @@
 if ($agentid > 0) $sql.= " s.rowid as socid, s.nom, s.code_client, s.client,";
 $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,";
 $sql.= " sum(d.total_ht) as selling_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht <=0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht <=0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge" ;
+$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
+$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge" ;
 $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
 $sql.= ", ".MAIN_DB_PREFIX."facture as f";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE);
@@ -119,6 +119,7 @@
 $sql.= ", ".MAIN_DB_PREFIX."user as u";
 $sql.= " WHERE f.fk_soc = s.rowid";
 $sql.= " AND sc.fk_soc = f.fk_soc";
+$sql.= " AND (d.product_type = 0 OR d.product_type = 1)";
 if (! empty($conf->global->AGENT_CONTACT_TYPE))
 	$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))";
 else
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/margin/customerMargins.php dolibarr-3.5.7+dfsg1/htdocs/margin/customerMargins.php
--- dolibarr-3.5.5+dfsg1/htdocs/margin/customerMargins.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/margin/customerMargins.php	2015-04-13 09:16:00.000000000 +0200
@@ -164,8 +164,8 @@
 $sql.= " s.rowid as socid, s.nom, s.code_client, s.client,";
 if ($client) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
 $sql.= " sum(d.total_ht) as selling_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht <=0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht <=0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
+$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
+$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
 $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
 $sql.= ", ".MAIN_DB_PREFIX."facture as f";
 $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
@@ -173,6 +173,7 @@
 $sql.= " AND f.fk_statut > 0";
 $sql.= " AND s.entity = ".$conf->entity;
 $sql.= " AND d.fk_facture = f.rowid";
+$sql.= " AND (d.product_type = 0 OR d.product_type = 1)";
 if ($client)
   $sql.= " AND f.fk_soc = ".$socid;
 if (!empty($startdate))
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/margin/index.php dolibarr-3.5.7+dfsg1/htdocs/margin/index.php
--- dolibarr-3.5.5+dfsg1/htdocs/margin/index.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/margin/index.php	2015-04-13 09:16:00.000000000 +0200
@@ -1,5 +1,6 @@
 <?php
 /* Copyright (C) 2012	Christophe Battarel	<christophe.battarel@altairis.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
@@ -21,6 +22,16 @@
  *	\brief      Page d'index du module margin
  */
 
-require 'productMargins.php';
+require '../main.inc.php';
+
+if ($user->rights->produit->lire) {
+	$page = 'productMargins';
+} elseif ($user->rights->societe->lire) {
+	$page = 'customerMargins';
+} else {
+	$page = 'agentMargins';
+}
+
+header('Location: '.dol_buildpath('/margin/'.$page.'.php', 1));
 
 ?>
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/margin/lib/margins.lib.php dolibarr-3.5.7+dfsg1/htdocs/margin/lib/margins.lib.php
--- dolibarr-3.5.5+dfsg1/htdocs/margin/lib/margins.lib.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/margin/lib/margins.lib.php	2015-04-13 09:16:00.000000000 +0200
@@ -1,5 +1,6 @@
 <?php
 /* Copyright (C) 2012	Christophe Battarel	<christophe.battarel@altairis.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
@@ -56,21 +57,25 @@
  */
 function marges_prepare_head()
 {
-	global $langs, $conf;
+	global $langs, $conf, $user;
 	$langs->load("marges@marges");
 
 	$h = 0;
 	$head = array();
 
-	$head[$h][0] = DOL_URL_ROOT."/margin/productMargins.php";
-	$head[$h][1] = $langs->trans("ProductMargins");
-	$head[$h][2] = 'productMargins';
-	$h++;
-
-	$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
-	$head[$h][1] = $langs->trans("CustomerMargins");
-	$head[$h][2] = 'customerMargins';
-	$h++;
+	if ($user->rights->produit->lire) {
+		$head[$h][0] = DOL_URL_ROOT."/margin/productMargins.php";
+		$head[$h][1] = $langs->trans("ProductMargins");
+		$head[$h][2] = 'productMargins';
+		$h++;
+	}
+
+	if ($user->rights->societe->lire) {
+		$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
+		$head[$h][1] = $langs->trans("CustomerMargins");
+		$head[$h][2] = 'customerMargins';
+		$h++;
+	}
 
 	$head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php";
 	$head[$h][1] = $langs->trans("AgentMargins");
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/margin/productMargins.php dolibarr-3.5.7+dfsg1/htdocs/margin/productMargins.php
--- dolibarr-3.5.5+dfsg1/htdocs/margin/productMargins.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/margin/productMargins.php	2015-04-13 09:16:00.000000000 +0200
@@ -167,8 +167,8 @@
 if ($id > 0) $sql.= " d.fk_product,";
 if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
 $sql.= " sum(d.total_ht) as selling_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht <=0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht <=0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
+$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
+$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
 $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
 $sql.= ", ".MAIN_DB_PREFIX."product as p";
 $sql.= ", ".MAIN_DB_PREFIX."facture as f";
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/paypal/lib/paypal.lib.php dolibarr-3.5.7+dfsg1/htdocs/paypal/lib/paypal.lib.php
--- dolibarr-3.5.5+dfsg1/htdocs/paypal/lib/paypal.lib.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/paypal/lib/paypal.lib.php	2015-04-13 09:16:00.000000000 +0200
@@ -683,7 +683,8 @@
      exit;*/
     curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
     curl_setopt($ch, CURLOPT_VERBOSE, 1);
-    curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3
+    //curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3
+	curl_setopt($ch, CURLOPT_SSLVERSION, 1); // Force TLSv1
 
     //turning off the server and peer verification(TrustManager Concept).
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/product/class/product.class.php dolibarr-3.5.7+dfsg1/htdocs/product/class/product.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/product/class/product.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/product/class/product.class.php	2015-05-11 23:37:43.000000000 +0200
@@ -442,7 +442,7 @@
 		$this->ref = dol_string_nospecial(trim($this->ref));
 		$this->libelle = trim($this->libelle);
 		$this->description = trim($this->description);
-		$this->note = (isset($this->note)? trim($this->note):"null");
+		$this->note = (isset($this->note)? trim($this->note):null);
 		$this->weight = price2num($this->weight);
 		$this->weight_units = trim($this->weight_units);
 		$this->length = price2num($this->length);
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/product/popuprop.php dolibarr-3.5.7+dfsg1/htdocs/product/popuprop.php
--- dolibarr-3.5.5+dfsg1/htdocs/product/popuprop.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/product/popuprop.php	2015-04-13 09:16:00.000000000 +0200
@@ -3,6 +3,7 @@
  * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2004      Eric Seigne          <eric.seigne@ryxeo.com>
  * Copyright (C) 2005-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
@@ -71,7 +72,9 @@
 $sql = "SELECT count(*) as c";
 $sql.= " FROM ".MAIN_DB_PREFIX."product";
 $sql.= ' WHERE entity IN ('.getEntity('product', 1).')';
-if (isset($type)) $sql.= " AND fk_product_type = ".$type;
+if ($type !== '') {
+	$sql.= " AND fk_product_type = ".$type;
+}
 
 $result=$db->query($sql);
 if ($result)
@@ -82,11 +85,14 @@
 
 $param = '';
 $title = $langs->trans("ListProductServiceByPopularity");
-if (isset($type))
-{
+if ($type !== '') {
 	$param = '&amp;type='.$type;
-	$title = $langs->trans("ListProductByPopularity");
-	if ($type == 1) $title = $langs->trans("ListServiceByPopularity");
+
+	if ($type == 1) {
+		$title = $langs->trans("ListServiceByPopularity");
+	} else {
+		$title = $langs->trans("ListProductByPopularity");
+	}
 }
 
 print_barre_liste($title, $page, "popuprop.php",$param,"","","",$num);
@@ -106,7 +112,9 @@
 $sql.= ", ".MAIN_DB_PREFIX."product as p";
 $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
 $sql.= " AND p.rowid = pd.fk_product";
-if (isset($type)) $sql.= " AND fk_product_type = ".$type;
+if ($type !== '') {
+	$sql.= " AND fk_product_type = ".$type;
+}
 $sql.= " GROUP BY (p.rowid)";
 $sql.= $db->order($sortfield,$sortorder);
 $sql.= $db->plimit($limit, $offset);
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/projet/class/task.class.php dolibarr-3.5.7+dfsg1/htdocs/projet/class/task.class.php
--- dolibarr-3.5.5+dfsg1/htdocs/projet/class/task.class.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/projet/class/task.class.php	2015-04-13 09:16:00.000000000 +0200
@@ -1007,7 +1007,8 @@
 
 		$error=0;
 
-		$now=dol_now();
+		//Use 00:00 of today if time is use on task.
+		$now=dol_mktime(0,0,0,dol_print_date(dol_now(),'%m'),dol_print_date(dol_now(),'%d'),dol_print_date(dol_now(),'%Y'));
 
 		$datec = $now;
 
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/projet/element.php dolibarr-3.5.7+dfsg1/htdocs/projet/element.php
--- dolibarr-3.5.5+dfsg1/htdocs/projet/element.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/projet/element.php	2015-05-11 23:37:43.000000000 +0200
@@ -3,6 +3,7 @@
  * Copyright (C) 2004-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2010 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2012	   Juanjo Menent        <jmenent@2byte.es>
+ * Copyright (C) 2015      Marcos García        <marcosgdf@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -281,7 +282,14 @@
 				if (empty($value['disableamount'])) print '<td align="right">'.(isset($element->total_ttc)?price($element->total_ttc):'&nbsp;').'</td>';
 
 				// Status
-				print '<td align="right">'.$element->getLibStatut(5).'</td>';
+				print '<td align="right">';
+				if ($element instanceof CommonInvoice) {
+					//This applies for Facture and FactureFournisseur
+					print $element->getLibStatut(5, $element->getSommePaiement());
+				} else {
+					print $element->getLibStatut(5);
+				}
+				print '</td>';
 
 				print '</tr>';
 
diff -Nru dolibarr-3.5.5+dfsg1/htdocs/webservices/server_contact.php dolibarr-3.5.7+dfsg1/htdocs/webservices/server_contact.php
--- dolibarr-3.5.5+dfsg1/htdocs/webservices/server_contact.php	2014-09-23 09:18:24.000000000 +0200
+++ dolibarr-3.5.7+dfsg1/htdocs/webservices/server_contact.php	2015-04-13 09:16:00.000000000 +0200
@@ -655,6 +655,7 @@
 			$object->province_id=$contact['province_id'];
 		
 
+			$object->phone_pro=$contact['phone_pro'];
 			$object->phone_perso=$contact['phone_perso'];
 			$object->phone_mobile=$contact['phone_mobile'];
 			$object->fax=$contact['fax'];
diff -Nru dolibarr-3.5.5+dfsg1/README.md dolibarr-3.5.7+dfsg1/README.md
--- dolibarr-3.5.5+dfsg1/README.md	1970-01-01 01:00:00.000000000 +0100
+++ dolibarr-3.5.7+dfsg1/README.md	2015-04-13 09:15:59.000000000 +0200
@@ -0,0 +1,138 @@
+# DOLIBARR ERP & CRM
+
+Dolibarr ERP & CRM is a modern software to manage your company or foundation activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).It's an opensource software (wrote with PHP language) designed for small and medium companies, foundation and freelances. You can freely install, use and distribute it as a standalone application or as a web application to use it from every internet access and media.
+
+![ScreenShot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x480.png)
+
+
+## LICENSE
+
+Dolibarr is released 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 (GPL-3+).
+
+
+
+## INSTALL
+
+If you have no technical knowledge, and you are looking for an autoinstaller to install Dolibarr ERP/CRM in few clicks, you must download DoliWamp (the all-in-one package of Dolibarr for Windows), DoliDeb (the all-in-one package of Dolibarr for Debian or Ubuntu) or DoliRpm (the all-in-one package of Dolibarr for Fedora, Redhat, Opensuse, Mandriva or Mageia).
+
+You can download this at: [Official website] (http://www.dolibarr.org/downloads/)
+
+If you already have installed a Web server and a Mysql database, you can install the standard version like this:
+
+- Uncompress the downloaded archive.
+
+- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator).
+  
+- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished).
+  
+- From your browser, call the dolibarr "install/" page.
+
+Url depends on choice made on first step:
+
+	http://localhost/dolibarr/htdocs/install/
+or
+
+	http://localhost/dolibarr/install/
+or
+
+	http://yourdolibarrvirtualhost/install/
+   
+- Follow instructions provided by installer...
+
+
+
+## UPGRADE
+
+To upgrade Dolibarr from an old version to this one:
+
+- Overwrite all old files inside old 'dolibarr' directory by files provided into new version package.
+  
+- If you came from version x.y.z to x.y.w (only third number differ), there is no need to run any migrate process.
+  
+- If you came from a beta version or from any version x.y.z to any other where x or y number differs, you must call the Dolibarr "install/" page in your browser (this should be done automatically at first dolibarr access).
+
+This URL should looks like:
+
+	http://localhost/dolibarr/htdocs/install/
+or
+
+	http://localhost/dolibarr/install/
+or
+
+	http://yourdolibarrhost/install/
+
+Then choose the "update" option according to your case.
+Note: Migrate process can be ran safely several times.
+  
+
+
+## WHAT'S NEW
+
+See ChangeLog file found into package.
+
+
+
+## WHAT DOLIBARR CAN DO
+
+### Main modules/features:
+
+- Customers, Prospects or Suppliers directory.
+- Products and services catalog.
+- Bank accounts management.
+- Orders management.
+- Commercial proposals management.
+- Contracts management.
+- Invoices management.
+- Payments management.
+- Standing orders management.
+- Stock management.
+- Shipping management.
+- PDF or ODT generation for invoice, proposals, orders...
+- Agenda with ical,vcal export for third tools integration.
+- EDM (Electronic Document Management).
+- Foundations members management.
+- Employee's holidays management.
+- Mass Emailing.
+- Realize surveys.
+- Point of Sale.
+
+### Other modules:
+
+- Bookmarks management.
+- Donations management.
+- Reporting.
+- Data export/import.
+- Third parties or products categories. 
+- LDAP connectivity.
+- ClickToDial integration.
+- RSS integration.
+- Can be extended with a lot of other external modules available onto DoliStore.com.
+
+### Miscellaneous:
+
+- Multi-user, with several permissions levels for each feature.
+- Very user friendly and easy to use.
+- Highly customizable: Enable only modules you need, user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one).
+- Works with PHP 5.2.1, MySql 4.1 or PostgreSQL 8.1.
+- Compatible with all Cloud solutions that match MySql, PHP or PostgreSQL prerequisites.
+- An easy to understand, maintain and code interfaces with your own system information (PHP with no heavy frameworks, trigger and hook architecture).
+- Support countries specific features:
+   Spanish Tax RE and ISPF.
+   French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM).
+   Canadian double taxes (federal/province) and other countries using cumulative VAT.
+   Tunisian tax stamp.  
+   Compatible with European directives (2006/112/CE ... 2010/45/UE) (http://europa.eu/legislation_summaries/taxation/l31057_en.htm)
+   ...
+
+
+## WHAT DOLIBARR CAN'T DO YET (TODO LIST)
+
+This is features that Dolibarr does not support completely yet:
+
+- No double party accountancy (only bank and treasury management).
+- Dolibarr manage one currency at once (mono-currency).
+- Dolibarr manage one master activity (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas).
+- Tasks on module project can't have dependencies between each other.
+- Dolibarr does not contains Payroll module.
+- Dolibarr does not include any Webmail.
+- Dolibarr can't do coffee (not yet).

--- End Message ---
--- Begin Message ---
Version: 8.4

Hi,

The packages referenced by these bugs were included in today's stable
point release.

Regards,

Adam

--- End Message ---

Reply to: