From c018858e91b6cf28ac0e027602d030cdd5829445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 23 May 2015 20:43:01 +0200 Subject: [PATCH 1/4] Deprecation of the mysql driver Fix #2886 --- htdocs/core/db/mysql.class.php | 2 ++ htdocs/install/fileconf.php | 5 +++-- htdocs/langs/en_US/install.lang | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 30a7780afdf..bca6d0798b8 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php'; /** * Class to manage Dolibarr database access for a MySQL database using the mysql extension + * + * @deprecated Use DoliDBMysqli */ class DoliDBMysql extends DoliDB { diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 97a52ff6c34..04f8a3caf4c 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -328,8 +328,9 @@ if (! empty($force_install_message)) $option.='>'; $option.=$type.'   '; if ($note) $option.=' '.$note; - // Experimental - if ($type=='mssql') $option.=' '.$langs->trans("Experimental"); + // Deprecated and experimental + if ($type=='mysql') $option.=' ' . $langs->trans("Deprecated"); + elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental"); elseif ($type=='sqlite') $option.=' '.$langs->trans("Experimental"); elseif ($type=='sqlite3') $option.=' '.$langs->trans("Experimental"); // No available diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 7de123d5ea3..0c61ce35e2e 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -64,6 +64,7 @@ DatabaseSuperUserAccess=Database server - Superuser access CheckToCreateDatabase=Check box if database does not exist and must be created.
In this case, you must fill the login/password for superuser account at the bottom of this page. CheckToCreateUser=Check box if database owner does not exist and must be created.
In this case, you must choose its login and password and also fill the login/password for the superuser account at the bottom of this page. If this box is unchecked, owner database and its passwords must exists. Experimental=(experimental) +Deprecated=(deprecated) DatabaseRootLoginDescription=Login of the user allowed to create new databases or new users, mandatory if your database or its owner does not already exists. KeepEmptyIfNoPassword=Leave empty if user has no password (avoid this) SaveConfigurationFile=Save values @@ -211,4 +212,4 @@ MigrationCategorieAssociation=Migration of categories MigrationEvents=Migration of events to add event owner into assignement table ShowNotAvailableOptions=Show not available options -HideNotAvailableOptions=Hide not available options \ No newline at end of file +HideNotAvailableOptions=Hide not available options From becc240b92fc04b39db0f1a8f5b30c7857c0f727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Sat, 23 May 2015 23:32:12 +0200 Subject: [PATCH 2/4] Include Categories class whenever Categorie::TYPE is used --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/adherents/list.php | 1 + htdocs/comm/prospect/list.php | 1 + htdocs/compta/stats/cabyprodserv.php | 1 + htdocs/compta/stats/casoc.php | 1 + htdocs/contact/list.php | 1 + htdocs/core/lib/company.lib.php | 1 + htdocs/core/lib/contact.lib.php | 1 + htdocs/core/lib/member.lib.php | 1 + htdocs/core/lib/product.lib.php | 1 + htdocs/fourn/list.php | 1 + htdocs/product/composition/card.php | 1 + 12 files changed, 12 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 99d73dd9cf6..40029d45f84 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; /** diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 1e128da7fa7..05035fa1f9f 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -209,6 +209,7 @@ if ($resql) $moreforfilter=''; if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1); $moreforfilter.='       '; diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 15cb4c32d5c..e807b3fcbc4 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -299,6 +299,7 @@ if ($resql) $moreforfilter=''; if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1); $moreforfilter.='       '; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 0ce8c8b0915..4b92ce7eebc 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $langs->load("products"); $langs->load("categories"); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 32a4f8555cc..7b9cfdd7913 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $langs->load("companies"); $langs->load("categories"); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 3d67d63c138..72eee453c9f 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -275,6 +275,7 @@ if ($result) if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1); $moreforfilter.='       '; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c1c9d9e2311..4eb33852836 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -84,6 +84,7 @@ function societe_prepare_head(Societe $object) //show categorie tab if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $type = Categorie::TYPE_CUSTOMER; if ($object->fournisseur) $type = Categorie::TYPE_SUPPLIER; $head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?socid='.$object->id."&type=".$type; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 26b0b0c0e5f..3a50b79edd7 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -89,6 +89,7 @@ function contact_prepare_head(Contact $object) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $type = Categorie::TYPE_CONTACT; $head[$tab][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type; $head[$tab][1] = $langs->trans('Categories'); diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index e3bc5c236bc..0dbdcf64a86 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -71,6 +71,7 @@ function member_prepare_head(Adherent $object) // Show category tab if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $type = Categorie::TYPE_MEMBER; $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type; $head[$h][1] = $langs->trans('Categories'); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index f8c3ed12cf6..e6a84657d87 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -61,6 +61,7 @@ function product_prepare_head($object) /* No more required. Replaced with new multiselect component if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $type = Categorie::TYPE_PRODUCT; $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type; $head[$h][1] = $langs->trans('Categories'); diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index 62985db80b2..8f77ea73115 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -168,6 +168,7 @@ if ($resql) $moreforfilter=''; if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ,'search_categ',1); $moreforfilter.='       '; diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 112d6d2d44b..6809e3d3a52 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -473,6 +473,7 @@ if ($id > 0 || ! empty($ref)) print ''; if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; print ''.$langs->trans("CategoryFilter").'   '; print ''.$form->select_all_categories(Categorie::TYPE_PRODUCT, $parent).''; } From d1c7c9489e017adc33ae07d96b3c2c5421598fae Mon Sep 17 00:00:00 2001 From: Steve Braun Date: Mon, 25 May 2015 14:56:37 +0200 Subject: [PATCH 3/4] fixes #2847 --- htdocs/core/lib/functions2.lib.php | 46 ++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 1a1fd706e0a..e06577cf8f5 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -637,10 +637,21 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m //$date=dol_mktime(12, 0, 0, 1, 1, 1900); //$date=dol_stringtotime('20130101'); + $hasglobalcounter=false; // Extract value for mask counter, mask raz and mask offset - if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; - $masktri=$reg[1].(! empty($reg[2])?$reg[2]:'').(! empty($reg[3])?$reg[3]:''); - $maskcounter=$reg[1]; + if (preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) + { + $masktri=$reg[1].(! empty($reg[2])?$reg[2]:'').(! empty($reg[3])?$reg[3]:''); + $maskcounter=$reg[1]; + $hasglobalcounter=true; + } + else + { + // setting some defaults so the rest of the code won't fail if there is a third party counter + $masktri='00000'; + $maskcounter='00000'; + } + $maskraz=-1; $maskoffset=0; $resetEveryMonth=false; @@ -659,6 +670,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; } else $maskrefclient=''; + + // fail if there is neither a global nor a third party counter + if (! $hasglobalcounter && ($maskrefclient_maskcounter == '')) + { + return 'ErrorBadMask'; + } // Extract value for third party type if (preg_match('/\{(t+)\}/i',$mask,$regType)) @@ -993,10 +1010,21 @@ function check_value($mask,$value) { $result=0; + $hasglobalcounter=false; // Extract value for mask counter, mask raz and mask offset - if (! preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; - $masktri=$reg[1].(isset($reg[2])?$reg[2]:'').(isset($reg[3])?$reg[3]:''); - $maskcounter=$reg[1]; + if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg)) + { + $masktri=$reg[1].(isset($reg[2])?$reg[2]:'').(isset($reg[3])?$reg[3]:''); + $maskcounter=$reg[1]; + $hasglobalcounter=true; + } + else + { + // setting some defaults so the rest of the code won't fail if there is a third party counter + $masktri='00000'; + $maskcounter='00000'; + } + $maskraz=-1; $maskoffset=0; if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; @@ -1015,6 +1043,12 @@ function check_value($mask,$value) } else $maskrefclient=''; + // fail if there is neither a global nor a third party counter + if (! $hasglobalcounter && ($maskrefclient_maskcounter == '')) + { + return 'ErrorBadMask'; + } + $maskwithonlyymcode=$mask; $maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$maskcounter,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode); From a30d4d4be6b9bc8a2462b71c0752e2cc5a69f831 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 25 May 2015 18:14:49 +0200 Subject: [PATCH 4/4] Tabs collector better identification Tabs collector goes wrong with 2 tabs in the same page (like projet and task), so we use picto name to identify the 2 tabscollect We need to substract the @ if the tabs is from a module... eg : factory@factory --- htdocs/core/lib/functions.lib.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 63ab76dcb2f..8b6dfa38657 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -789,14 +789,15 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if ($displaytab > $limittoshow) { - $out.='
'; + $tabsname=str_replace ("@", "", $picto); + $out.='
'; $out.=''.$langs->trans("More").'...'; - $out.='
'.$outmore.'
'; + $out.='
'.$outmore.'
'; $out.="
\n"; $out.=""; }