From ef5d394b84543757bf3afa76438d5d8127e3c64b Mon Sep 17 00:00:00 2001 From: tomours Date: Thu, 6 Aug 2015 14:00:50 +0200 Subject: [PATCH 1/2] FIX #3349 Allow checking a VAT number with spaces One of the first things I did, while starting to try Dolibarr, was to fill info about my company. I filled my VAT number : "FR 13 794..." and saw the "check" button. Oh, that's nice ! Click. Didn't work :( In fact, it didn't work because the webservice Dolibarr uses to check VAT numbers doesn't understand spaces. By doing this we could enter good looking VAT numbers (with spaces) and still check them. --- htdocs/societe/checkvat/checkVatPopup.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 9252a479403..13d669789e7 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -49,8 +49,10 @@ if (! $_REQUEST["vatNumber"]) } else { + $_REQUEST["vatNumber"] = preg_replace('/\^\w/', '', $_REQUEST["vatNumber"]); $countryCode=substr($_REQUEST["vatNumber"],0,2); $vatNumber=substr($_REQUEST["vatNumber"],2); + print ''.$langs->trans("Country").': '.$countryCode.'
'; print ''.$langs->trans("VATIntraShort").': '.$vatNumber.'
'; print '
'; From 9267fe367eecdff0385f6cfd102468579601b33d Mon Sep 17 00:00:00 2001 From: tomours Date: Mon, 10 Aug 2015 14:06:11 +0200 Subject: [PATCH 2/2] FIX #3372 - Printing issue with Postgres and dates (SQL format) After connecting to the database, we force datestyle to "ISO, YMD", so dates returned by the db will have a format compatible with Dolibarr functions. This will fix dates printing issues in mostly all pages, with a postgres db configured with "SQL, DMY" as default. --- htdocs/core/db/pgsql.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 41bd45bebff..048ef2d450d 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -410,6 +410,7 @@ class DoliDBPgsql extends DoliDB $this->database_name = $name; pg_set_error_verbosity($this->db, PGSQL_ERRORS_VERBOSE); // Set verbosity to max } + pg_query($this->db, "set datestyle = 'ISO, YMD';"); return $this->db; }