From f605f0dc778e731ad9a79bc5dc0abe80c91741cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Oct 2016 02:35:20 +0200 Subject: [PATCH 1/8] Prepare 4.0.2 --- ChangeLog | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6442635ac44..85e3b313ccc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,30 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** ChangeLog for 4.0.2 compared to 4.0.1 ***** +FIX: #5340 +FIX: #5779 +FIX: #5849 +FIX: #5866 +FIX: #5907 +FIX: Addline if $txlocaltax1 is empty +FIX: Avoid error 500 if phpexcel is disabled +FIX: Avoid errors on debian +FIX: Can edit the customer ref even if order is not draft. +FIX: Documents not moved in new directory if we change reference of the task. +FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is child of an already linked to object +FIX: Extra fields of task not copied on project cloning +FIX: Hidden option PRODUCT_MAX_VISIBLE_PHOTO +FIX: Link on supplier invoice in widget was not clickable +FIX: margin tab on customer card must filter on current entity invoices +FIX: missing column into SQL on thirdparty list +FIX: Nber of attached files were not reported in event report of email sent +FIX: only show projects of related third if external user +FIX: Search provider by price +FIX: Solve backup when using mysqldump that return warning +FIX: Sql error in widget of product for stock alerts +FIX: updateligne if $txlocaltax1 is null + ***** ChangeLog for 4.0.1 compared to 4.0.0 ***** FIX: #2853 FIX: #2991 From de5210626552c9d231b00b0a1c0924739af24737 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Oct 2016 14:11:08 +0100 Subject: [PATCH 2/8] Fix: do not publish files 'none' to Sourceforge --- build/makepack-dolibarr.pl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 41ae64834e4..970c507ae28 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -159,6 +159,7 @@ $REL1 = $newbuild; $REL1 =~ s/-.*$//gi; if ($RPMSUBVERSION eq 'auto') { $RPMSUBVERSION = $newbuild; $RPMSUBVERSION =~ s/^.*-//gi; } $FILENAMETGZ2="$PROJECT-$MAJOR.$MINOR.$REL1"; $FILENAMERPM=$FILENAMETGZ2."-".$RPMSUBVERSION.".".$ARCH.".rpm"; +$FILENAMERPMSRC=$FILENAMETGZ2."-".$RPMSUBVERSION.".src.rpm"; # For Deb $newbuild = $BUILD; $newbuild =~ s/(dev|alpha)/1/gi; # dev @@ -733,8 +734,8 @@ if ($nboftargetok) { 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 ".$FILENAMERPMSRC."...\n"; + unlink("$NEWDESTI/".$FILENAMERPMSRC); print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; @@ -1142,8 +1143,9 @@ if ($nboftargetok) { %filestoscansf=( "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', + "$DESTI/package_rpm_generic/$FILENAMERPMSRC"=>'none', # none means it won't be published on SF "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', - "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', + "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' @@ -1151,6 +1153,7 @@ if ($nboftargetok) { %filestoscanstableasso=( "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', + "$DESTI/package_rpm_generic/$FILENAMERPMSRC"=>'package_rpm_generic', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows', @@ -1212,9 +1215,10 @@ if ($nboftargetok) { my $filesize = -s $file; if (! $filesize) { next; } - print "\n"; - - if ($target eq 'SF' && $filestoscan{$file} ne 'none') { + if ($target eq 'SF') { + if ($filestoscan{$file} eq 'none') { + next; + } $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; } elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) { @@ -1231,6 +1235,8 @@ if ($nboftargetok) { $filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/; $destFolder="$NEWPUBLISH/$dirnameonly"; } + + print "\n"; print "Publish file ".$file." to ".$destFolder."\n"; # mkdir From f3a35c004550e68ba66828a2cd6463a24215ed5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Oct 2016 14:14:10 +0100 Subject: [PATCH 3/8] Fix: do not publish files 'none' to Sourceforge --- build/makepack-dolibarr.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 970c507ae28..fb3b39feca3 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -1141,7 +1141,7 @@ if ($nboftargetok) { print "\nList of files to publish (BUILD=$BUILD)\n"; %filestoscansf=( - "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', + "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'none', # none means it won't be published on SF "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_rpm_generic/$FILENAMERPMSRC"=>'none', # none means it won't be published on SF "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', From 3ff8a49e4f93e5f3da4291c0da900a38c405376c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Oct 2016 14:50:17 +0100 Subject: [PATCH 4/8] Fix english --- build/rpm/dolibarr_fedora.spec | 2 +- build/rpm/dolibarr_generic.spec | 2 +- build/rpm/dolibarr_mandriva.spec | 2 +- build/rpm/dolibarr_opensuse.spec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 4ad1441104d..e65e6bc3b7d 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -34,7 +34,7 @@ AutoReqProv: no %description -An easy to use CRM & ERP open source/free software for small +An easy to use CRM & ERP open source/free software package for small and medium companies, foundations or freelances. It includes different features for Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) but also for different other activities. diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index f20b2047225..655ef87f925 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -75,7 +75,7 @@ AutoReqProv: no %description -An easy to use CRM & ERP open source/free software for small +An easy to use CRM & ERP open source/free software package for small and medium companies, foundations or freelances. It includes different features for Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) but also for different other activities. diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index ca836bc47d6..55fb7183734 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -33,7 +33,7 @@ AutoReqProv: no %description -An easy to use CRM & ERP open source/free software for small +An easy to use CRM & ERP open source/free software package for small and medium companies, foundations or freelances. It includes different features for Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) but also for different other activities. diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index fcff3363213..f7e29927ebb 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -36,7 +36,7 @@ AutoReqProv: no %description -An easy to use CRM & ERP open source/free software for small +An easy to use CRM & ERP open source/free software package for small and medium companies, foundations or freelances. It includes different features for Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) but also for different other activities. From b4303470f8d5e29e68757e40f3666933c3ee75cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Oct 2016 15:42:43 +0100 Subject: [PATCH 5/8] Fix do not update instance status if method used to update other element --- htdocs/core/class/commonobject.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0a0b85dab7a..83bbdda4a41 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2754,7 +2754,11 @@ abstract class CommonObject if (! $error) { $this->db->commit(); - $this->statut = $status; + if (empty($elementId)) // If the element we update was $this (so $elementId is null) + { + $this->statut = $status; + $this->status = $status; + } return 1; } else From 090f13afa4df0af03014d3b1cd250504e3af840c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Oct 2016 22:10:00 +0100 Subject: [PATCH 6/8] Fix missing id param --- htdocs/comm/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index f1002bd27f5..dd43fc62425 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -87,7 +87,7 @@ $hookmanager->initHooks(array('commcard','globalcard')); * Actions */ -$parameters = array('socid' => $id); +$parameters = array('id' => $id, 'socid' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -454,7 +454,7 @@ if ($id > 0) { $langs->load("members"); $langs->load("users"); - print ''.$langs->trans("LinkedToDolibarrMember").''; + print ''.$langs->trans("LinkedToDolibarrMember").''; print ''; $adh=new Adherent($db); $result=$adh->fetch('','',$object->id); From 3882fa0c3db958b22534efd6d1309fadaf9664a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Oct 2016 10:37:58 +0100 Subject: [PATCH 7/8] Fix dol_buildpath with parameter 3. Add phpunit tests --- htdocs/core/lib/functions.lib.php | 18 ++++++++++++++++-- test/phpunit/FunctionsLibTest.php | 28 +++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ac9d58eee62..ae12bfe4f8b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -368,7 +368,21 @@ function dol_buildpath($path, $type=0) foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) { - if ($key == 'main') continue; + if ($key == 'main') + { + if ($type == 3) + { + global $dolibarr_main_url_root; + + // Define $urlwithroot + $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + $res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).'/'.$path; // Test on start with http is for old conf syntax + } + continue; + } preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i',$path,$regs); // Take part before '?' if (! empty($regs[1])) { @@ -392,7 +406,7 @@ function dol_buildpath($path, $type=0) $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; + $res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax } break; } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 4c76ba47770..ca06655c845 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -119,6 +119,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase } + + /** + * testDolBuildPath + * + * @return boolean + */ + public function testDolBuildPath() + { + /*$tmp=dol_buildpath('/google/oauth2callback.php', 0); + var_dump($tmp); + */ + + /*$tmp=dol_buildpath('/google/oauth2callback.php', 1); + var_dump($tmp); + */ + + $result=dol_buildpath('/google/oauth2callback.php', 2); + print __METHOD__." result=".$result."\n"; + $this->assertStringStartsWith('http', $result); + + $result=dol_buildpath('/google/oauth2callback.php', 3); + print __METHOD__." result=".$result."\n"; + $this->assertStringStartsWith('http', $result); + } + + /** * testGetBrowserInfo * @@ -973,5 +999,5 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase return true; } - + } From ffe4ae5915a56ebbf15677d66834feff74270b82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Oct 2016 21:24:23 +0100 Subject: [PATCH 8/8] Fix php7 compatibility --- htdocs/admin/dict.php | 6 ++++-- htdocs/admin/websites.php | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 5379a3afd83..211b2a1dc71 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1687,12 +1687,14 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print ''; if (! empty($conf->accounting->enabled)) { - $accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); + $fieldname = $fieldlist[$field]; + $accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0); print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } else { - print ''; + $fieldname = $fieldlist[$field]; + print ''; } print ''; } diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index ecc6b6a0166..b0c81ec18af 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -535,7 +535,8 @@ if ($id) { $showfield=1; $align="left"; - $valuetoshow=$obj->$fieldlist[$field]; + $fieldname=$fieldlist[$field]; + $valuetoshow=$obj->$fieldname; // Show value for field if ($showfield) print ''.$valuetoshow.''; @@ -613,14 +614,15 @@ function fieldListWebsites($fieldlist, $obj='', $tabname='', $context='') foreach ($fieldlist as $field => $value) { + $fieldname = $fieldlist[$field]; if ($fieldlist[$field] == 'lang') { print ''; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang'); print ''; } - elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) { - print ''; + elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldname)) { + print ''; } else { @@ -631,7 +633,7 @@ function fieldListWebsites($fieldlist, $obj='', $tabname='', $context='') if ($fieldlist[$field]=='libelle') $size='size="32" '; if ($fieldlist[$field]=='tracking') $size='size="92" '; if ($fieldlist[$field]=='sortorder') $size='size="2" '; - print ''; + print ''; print ''; } }