From 880a27f827483b80af304d6470d5f2050d5df529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 4 Jun 2013 18:40:46 +0200 Subject: [PATCH 01/22] Fixed field name --- htdocs/societe/societe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php index 4e4374fc69a..89187914c04 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/societe.php @@ -98,7 +98,7 @@ if ($mode == 'search') if ($search_categ) $sql.= " AND s.rowid = cs.fk_societe"; // Join for the needed table to filter by categ if (! $user->rights->societe->lire || ! $user->rights->fournisseur->lire) { - if (! $user->rights->fournisseur->lire) $sql.=" AND s.fourn != 1"; + if (! $user->rights->fournisseur->lire) $sql.=" AND s.fournisseur != 1"; } // Insert sale filter if ($search_sale) From a4841dacda59fec0e7a04d719dfc72648c84276f Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 5 Jun 2013 15:09:13 +0200 Subject: [PATCH 02/22] Fix: Warning missing argument 2 into withdrawals --- htdocs/compta/prelevement/rejets.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 6cd04c95162..bebc56abbeb 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2005-2012 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -57,7 +57,7 @@ if ($sortorder == "") $sortorder="DESC"; if ($sortfield == "") $sortfield="p.datec"; $rej = new RejetPrelevement($db, $user); -$ligne = new LignePrelevement($db); +$ligne = new LignePrelevement($db, $user); /* * Liste des factures From 693f4f3b8bfa99fef1f89c01fe06e51e17bd5d3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Jun 2013 21:25:10 +0200 Subject: [PATCH 03/22] Fix: Pb of offset in numbering. Add also phpunit test to detect and test fix. Conflicts: test/phpunit/NumberingModulesTest.php --- htdocs/core/lib/functions2.lib.php | 11 +++++++---- test/phpunit/NumberingModulesTest.php | 12 ++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index ab41e5aaec7..66b64035c4d 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -607,7 +607,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $maskraz=$yearoffsettype; // For backward compatibility else if ($yearoffsettype === '0' || (! empty($yearoffsettype) && ! is_numeric($yearoffsettype) && $conf->global->SOCIETE_FISCAL_MONTH_START > 1)) $maskraz = $conf->global->SOCIETE_FISCAL_MONTH_START; - //print "maskraz=".$maskraz; + //print "maskraz=".$maskraz; // -1=no reset if ($maskraz > 0) // A reset is required { @@ -699,8 +699,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $sqlwhere.='(SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") = '".$yearcomp."')"; } } - //print "sqlwhere=".$sqlwhere."
\n"; - //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset." yearcomp=".$yearcomp."
\n"; + //print "sqlwhere=".$sqlwhere." yearcomp=".$yearcomp."
\n"; // sqlwhere and yearcomp defined only if we ask a reset + //print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n"; // Define $sqlstring $posnumstart=strpos($maskwithnocode,$maskcounter); // Pos of counter in final string (from 0 to ...) @@ -739,7 +739,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $counter = $obj->val; } else dol_print_error($db); + + // Check if we must force counter to maskoffset if (empty($counter) || preg_match('/[^0-9]/i',$counter)) $counter=$maskoffset; + else if ($counter < $maskoffset && empty($conf->global->MAIN_NUMBERING_OFFSET_ONLY_FOR_FIRST)) $counter=$maskoffset; if ($mode == 'last') // We found value for counter = last counter value. Now need to get corresponding ref of invoice. { @@ -824,7 +827,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m } else dol_print_error($db); if (empty($maskrefclient_counter) || preg_match('/[^0-9]/i',$maskrefclient_counter)) $maskrefclient_counter=$maskrefclient_maskoffset; - $maskrefclient_counter++; + $maskrefclient_counter++; } // Build numFinal diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index 82bb96dc0be..5e93e32fe22 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -147,7 +147,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; $this->assertEquals(1, $result); // Can be deleted - + $localobject2=new Facture($this->savdb); $localobject2->initAsSpecimen(); $localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice (there is no reset into mask) @@ -166,7 +166,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; $this->assertEquals(0, $result); // Case 1 can not be deleted (case 2 is more recent) - + // Now we try with a reset $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}'; $conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000@1}'; @@ -194,7 +194,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; $this->assertEquals(1, $result); // Can be deleted - + $localobject2=new Facture($this->savdb); $localobject2->initAsSpecimen(); $localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1921); // we use following year for second invoice (and there is a reset required) @@ -210,7 +210,11 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase $result=$localobject->is_erasable(); print __METHOD__." is_erasable=".$result."\n"; $this->assertEquals(1, $result); // Case 1 can be deleted (because there was a reset for case 2) - + + // Try an offset when an invoice already exists + $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000+9990}'; + $conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}{mm}-{0000+9990}'; + $result=$numbering->getNextValue($mysoc, $localobject2); // Now we try with a different fiscal month (forced by mask) $conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}{mm}-{0000@6}'; From c78d5aa4a78a829849b7ec9dec1f3cf34c913d38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Jun 2013 14:52:25 +0200 Subject: [PATCH 04/22] Fix: Bad param 'zone' into printCommon --- htdocs/main.inc.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f22110f57d7..86419f2bdaf 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1149,7 +1149,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0)) { // We must force not using ajax because cache of jquery does not load js of other pages. - // This also increase seriously speed onto mobile device where complex js code is very slow and memory very low. + // This also increase seriously speed onto mobile device where complex js code is very slow and memory very low. if (empty($conf->dol_use_jmobile) || $conf->dol_use_jmobile != 2) { print '