diff --git a/COPYRIGHT b/COPYRIGHT
index b9560cdaa45..a6ce437a9c3 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -37,6 +37,7 @@ TCPDF 6.2.25 LGPL-3+ Yes
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:
+Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
@@ -54,7 +55,6 @@ jQuery Timepicker 1.1.0 GPL and MIT License Yes
jsGanttImproved 1.7.5.4 BSD License Yes JS library (to build Gantt reports)
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
-Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
Image libraries:
Octicons 8.1 MIT Yes
diff --git a/build/exe/doliwamp/README b/build/exe/doliwamp/README
deleted file mode 100644
index 9d4c68daf3d..00000000000
--- a/build/exe/doliwamp/README
+++ /dev/null
@@ -1,8 +0,0 @@
-README (English)
-##################################################
-DOLIWAMP Package tools
-##################################################
-
-This directory contains files used by makepack-dolibarr.pl
-script to build the all-in-on .EXE package DoliWamp, ready
-to be distributed (for Windows).
\ No newline at end of file
diff --git a/build/exe/doliwamp/README.md b/build/exe/doliwamp/README.md
index 8e6f4744438..87d3371f9bb 100644
--- a/build/exe/doliwamp/README.md
+++ b/build/exe/doliwamp/README.md
@@ -3,5 +3,8 @@
DoliWamp is a special all in one package installer for Windows (Dolibarr+Mysql+Apache+PHP).
It's a dedicated Dolibarr version for Windows newbies with no technical knowledge. This package will install or upgrade Dolibarr but also all prerequisites like the web server, and the database in one auto-install process.
+This directory contains files used by *makepack-dolibarr.pl* script to build the all-in-on .EXE package DoliWamp, ready
+to be distributed (for Windows).
+
If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file).
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 0e7047b84de..a209d6c41bb 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -215,19 +215,7 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) {
$sql .= natural_search("fd.tva_tx", price2num($search_vat), 1);
}
-if ($search_month > 0)
-{
- if ($search_year > 0 && empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'";
- elseif ($search_year > 0 && ! empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
- else
- $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
-}
-elseif ($search_year > 0)
-{
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'";
-}
+$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index b738933c89c..65fd0886c79 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -251,19 +251,7 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", $search_vat, 1);
}
-if ($search_month > 0)
-{
- if ($search_year > 0 && empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'";
- elseif ($search_year > 0 && ! empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
- else
- $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
-}
-elseif ($search_year > 0)
-{
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'";
-}
+$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index d15ef52ad39..9002c95e672 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -186,19 +186,7 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) {
$sql .= natural_search("erd.tva_tx", price2num($search_vat), 1);
}
-if ($search_month > 0)
-{
- if ($search_year > 0 && empty($search_day))
- $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'";
- elseif ($search_year > 0 && ! empty($search_day))
- $sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
- else
- $sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
-}
-elseif ($search_year > 0)
-{
- $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'";
-}
+$sql.=dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year);
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
$sql .= $db->order($sortfield, $sortorder);
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index 60b24638775..f29f93d6322 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -215,20 +215,8 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) {
$sql .= natural_search("erd.tva_tx", $search_vat, 1);
}
-if ($search_month > 0)
-{
- if ($search_year > 0 && empty($search_day))
- $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'";
- elseif ($search_year > 0 && ! empty($search_day))
- $sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
- else
- $sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
-}
-elseif ($search_year > 0)
-{
- $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'";
-}
-$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
+$sql.=dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year);
+$sql.= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
$sql .= $db->order($sortfield, $sortorder);
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index c4aa1316876..c60f9bf0ff2 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -210,19 +210,7 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
}
-if ($search_month > 0)
-{
- if ($search_year > 0 && empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'";
- elseif ($search_year > 0 && ! empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
- else
- $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
-}
-elseif ($search_year > 0)
-{
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'";
-}
+$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 9ce49b23e6a..6a2327578b0 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -252,19 +252,7 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
}
-if ($search_month > 0)
-{
- if ($search_year > 0 && empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'";
- elseif ($search_year > 0 && ! empty($search_day))
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
- else
- $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
-}
-elseif ($search_year > 0)
-{
- $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'";
-}
+$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 840b4d143cd..6b451f2a629 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -1038,8 +1038,8 @@ else
}
}
- // Birthday
- print "
| ".$langs->trans("Birthday")." | \n";
+ // Birth Date
+ print " |
| ".$langs->trans("DateToBirth")." | \n";
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print " |
\n";
@@ -1290,8 +1290,8 @@ else
}
}
- // Birthday
- print "| ".$langs->trans("Birthday")." | \n";
+ // Birth Date
+ print " |
| ".$langs->trans("DateToBirth")." | \n";
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print " |
\n";
@@ -1732,8 +1732,8 @@ else
print '';
- // Birthday
- print '| '.$langs->trans("Birthday").' | '.dol_print_date($object->birth, 'day').' |
';
+ // Birth Date
+ print '| '.$langs->trans("DateToBirth").' | '.dol_print_date($object->birth, 'day').' |
';
// Public
print '| '.$langs->trans("Public").' | '.yn($object->public).' |
';
diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php
index dc02e48cbab..335b43bd041 100644
--- a/htdocs/adherents/cartes/carte.php
+++ b/htdocs/adherents/cartes/carte.php
@@ -48,7 +48,7 @@ $object=new Adherent($db);
$extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('adherent');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
/*
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index f78059c2969..e85b5143257 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -88,7 +88,8 @@ $hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('adherent');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php
index 026ac9b20bf..48d1ffde363 100644
--- a/htdocs/adherents/subscription/list.php
+++ b/htdocs/adherents/subscription/list.php
@@ -68,7 +68,8 @@ $hookmanager->initHooks(array('subscriptionlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('subscription');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 849d787c220..352a4dc6130 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -73,7 +73,7 @@ $object = new AdherentType($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
+$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index 4b3da666aa0..b6ba2b8742b 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -55,8 +55,10 @@ $object = new EmailCollector($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->emailcollector->dir_output . '/temp/massgeneration/' . $user->id;
$hookmanager->initHooks(array('emailcollectorcard')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('emailcollector');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index a55f6ee962e..8d7f535f1e5 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -66,8 +66,10 @@ $object = new EmailCollector($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->emailcollector->dir_output . '/temp/massgeneration/' . $user->id;
$hookmanager->initHooks(array('emailcollectorlist')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('emailcollector');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST)
diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php
index 7abf8247a71..dd026dd8230 100644
--- a/htdocs/admin/mails_senderprofile_list.php
+++ b/htdocs/admin/mails_senderprofile_list.php
@@ -59,8 +59,10 @@ $object=new EmailSenderProfile($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->admin->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('emailsenderprofilelist')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('emailsenderprofile');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST)
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index 5bf3767ece1..805110806c8 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -43,8 +43,10 @@ $object=new Asset($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->asset->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('assetcard')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('asset');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php
index 1de1030dec9..abe3be7cdd5 100644
--- a/htdocs/asset/document.php
+++ b/htdocs/asset/document.php
@@ -60,8 +60,9 @@ $object=new Asset($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->assets->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('assetdocument')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('asset');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php
index 26fcb76795f..13fa77b6160 100644
--- a/htdocs/asset/list.php
+++ b/htdocs/asset/list.php
@@ -60,8 +60,10 @@ $object=new Asset($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->asset->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('assetlist')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('asset');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST)
diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php
index cfcb5fe70bc..51dcc8615a2 100644
--- a/htdocs/asset/note.php
+++ b/htdocs/asset/note.php
@@ -41,8 +41,9 @@ $object=new Asset($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->asset->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('asset');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php
index 303d05b298b..1357d397709 100644
--- a/htdocs/asset/type.php
+++ b/htdocs/asset/type.php
@@ -65,7 +65,7 @@ $object = new AssetType($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extralabels=$extrafields->fetch_name_optionals_label('asset_type');
+$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php
index 3cc042941b2..ae937353c2b 100644
--- a/htdocs/bom/bom_document.php
+++ b/htdocs/bom/bom_document.php
@@ -63,7 +63,7 @@ $extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('bom');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php
index bbb51211137..8b7b296b929 100644
--- a/htdocs/bom/bom_list.php
+++ b/htdocs/bom/bom_list.php
@@ -60,8 +60,10 @@ $object = new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('bom'); // Load $extrafields->attributes['bom']
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); // Load $extrafields->attributes['bom']
+
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST)
diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php
index 75232a74d42..dd6791c4102 100644
--- a/htdocs/bom/bom_note.php
+++ b/htdocs/bom/bom_note.php
@@ -42,8 +42,9 @@ $object=new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->hooks_modules contains array
+
// Fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('bom');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->societe_id > 0) access_forbidden();
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 7ad86b59ae8..e6f98b0c473 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -245,7 +245,7 @@ class BOM extends CommonObject
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0)
{
- $extrafields->fetch_name_optionals_label($this->element);
+ $extrafields->fetch_name_optionals_label($object->table_element);
foreach($object->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 2ef4c74f765..f944cb75548 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -80,8 +80,10 @@ $object = new ActionComm($db);
$hookmanager->initHooks(array('agendalist'));
$extrafields = new ExtraFields($db);
+
// fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('actioncomm');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// If not choice done on calendar owner, we filter on user.
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index 88dfcef7d7f..e8d1d8c7599 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -716,10 +716,10 @@ $htmlother = new FormOther($db);
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing';
llxHeader('', $langs->trans("Mailing"), $help_url, '', 0, 0,
array(
- '/includes/ace/ace.js',
- '/includes/ace/ext-statusbar.js',
- '/includes/ace/ext-language_tools.js',
- //'/includes/ace/ext-chromevox.js'
+ '/includes/ace/src/ace.js',
+ '/includes/ace/src/ext-statusbar.js',
+ '/includes/ace/src/ext-language_tools.js',
+ //'/includes/ace/src/ext-chromevox.js'
), array());
if ($action == 'create')
diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php
index da74efaaf98..0986050a146 100644
--- a/htdocs/comm/mailing/list.php
+++ b/htdocs/comm/mailing/list.php
@@ -53,7 +53,8 @@ $hookmanager->initHooks(array('mailinglist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('mailing');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 768ea188174..609cfc49d43 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -129,7 +129,8 @@ $hookmanager->initHooks(array('propallist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
-$extralabels = $extrafields->fetch_name_optionals_label('propal');
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
+
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 02ea14142fc..efaf3d5d1de 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1266,7 +1266,7 @@ class Commande extends CommonOrder
$object->fetch_optionals($object->id);
$e = new ExtraFields($this->db);
- $element_extrafields = $e->fetch_name_optionals_label($this->element);
+ $element_extrafields = $e->fetch_name_optionals_label($this->table_element);
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index bb072291cb8..b88cf6bfa0a 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -40,6 +40,7 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
// Load translation files required by the page
@@ -246,32 +247,8 @@ if ($search_status != '' && $search_status >= -1)
if ($search_status == 1) $sql.= ' AND frequency != 0 AND suspended = 0';
if ($search_status == -1) $sql.= ' AND suspended = 1';
}
-if ($search_month > 0)
-{
- if ($search_year > 0 && empty($search_day))
- $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year, $search_month, false))."' AND '".$db->idate(dol_get_last_day($search_year, $search_month, false))."'";
- elseif ($search_year > 0 && ! empty($search_day))
- $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
- else
- $sql.= " AND date_format(f.date_last_gen, '%m') = '".$db->escape($search_month)."'";
-}
-elseif ($search_year > 0)
-{
- $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year, 12, false))."'";
-}
-if ($search_month_date_when > 0)
-{
- if ($search_year_date_when > 0 && empty($search_day_date_when))
- $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when, $search_month_date_when, false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when, $search_month_date_when, false))."'";
- elseif ($search_year_date_when > 0 && ! empty($search_day_date_when))
- $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_date_when, $search_day_date_when, $search_year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_date_when, $search_day_date_when, $search_year_date_when))."'";
- else
- $sql.= " AND date_format(f.date_when, '%m') = '".$db->escape($search_month_date_when)."'";
-}
-elseif ($search_year_date_when > 0)
-{
- $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when, 1, false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when, 12, false))."'";
-}
+$sql.=dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
+$sql.=dolSqlDateFilter('f.date_last_gen', $search_day_date_when, $search_month_date_when, $search_year_date_when);
$sql.= $db->order($sortfield, $sortorder);
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index 64ae1dea1f2..b43ed9dfe1c 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -96,19 +96,8 @@ $sql.= " AND bc.entity = ".$conf->entity;
if ($search_ref) $sql.=natural_search("bc.ref", $search_ref);
if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account;
if ($search_amount) $sql.=natural_search("bc.amount", price2num($search_amount));
-if ($month > 0)
-{
- if ($year > 0 && empty($day))
- $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'";
- elseif ($year > 0 && ! empty($day))
- $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
- else
- $sql.= " AND date_format(bc.date_bordereau, '%m') = '".$month."'";
-}
-elseif ($year > 0)
-{
- $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
-}
+$sql.= dolSqlDateFilter('bc.date_bordereau', 0, $month, $year);
+
$sql.= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php
index d735edd5840..1214b0b0871 100644
--- a/htdocs/compta/tva/list.php
+++ b/htdocs/compta/tva/list.php
@@ -108,17 +108,7 @@ if ($search_ref) $sql.= natural_search("t.rowid", $search_ref);
if ($search_label) $sql.= natural_search("t.label", $search_label);
if ($search_amount) $sql.= natural_search("t.amount", price2num(trim($search_amount)), 1);
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
-if ($month > 0)
-{
- if ($year > 0)
- $sql.= " AND t.datev BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'";
- else
- $sql.= " AND date_format(t.datev, '%m') = '$month'";
-}
-elseif ($year > 0)
-{
- $sql.= " AND t.datev BETWEEN '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
-}
+$sql.= dolSqlDateFilter('t.datev', 0, $month, $year);
if ($filtre) {
$filtre=str_replace(":", "=", $filtre);
$sql .= " AND ".$filtre;
diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php
index 9cde6e2df4e..67972aabfd4 100644
--- a/htdocs/contact/consumption.php
+++ b/htdocs/contact/consumption.php
@@ -300,19 +300,7 @@ if (!empty($sql_select))
$sql.= " FROM "/*.MAIN_DB_PREFIX."societe as s, "*/.$tables_from;
// if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
$sql.= $where;
- if ($month > 0) {
- if ($year > 0) {
- $start = dol_mktime(0, 0, 0, $month, 1, $year);
- $end = dol_time_plus_duree($start, 1, 'm') - 1;
- $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
- } else {
- $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d', $month)."'";
- }
- } elseif ($year > 0) {
- $start = dol_mktime(0, 0, 0, 1, 1, $year);
- $end = dol_time_plus_duree($start, 1, 'y') - 1;
- $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
- }
+ $sql.= dolSqlDateFilter($dateprint, 0, $month, $year);
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
if ($sprod_fulldescr)
{
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 2bb6ece49e6..67047adea9a 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2482,7 +2482,7 @@ class Contrat extends CommonObject
// Clean extrafields
if (is_array($clonedObj->array_options) && count($clonedObj->array_options) > 0)
{
- $extrafields->fetch_name_optionals_label($this->element);
+ $extrafields->fetch_name_optionals_label($this->table_element);
foreach($clonedObj->array_options as $key => $option)
{
$shortkey = preg_replace('/options_/', '', $key);
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 9709eed637d..5fea2cee66f 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -241,19 +241,7 @@ $sql.= ' AND c.entity IN ('.getEntity('contract').')';
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
if ($socid) $sql.= " AND s.rowid = ".$db->escape($socid);
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-if ($month > 0)
-{
- if ($year > 0 && empty($day))
- $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'";
- elseif ($year > 0 && ! empty($day))
- $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
- else
- $sql.= " AND date_format(c.date_contrat, '%m') = '".$month."'";
-}
-elseif ($year > 0)
-{
- $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
-}
+$sql.= dolSqlDateFilter('c.date_contrat', $day, $month, $year);
if ($search_name) $sql .= natural_search('s.nom', $search_name);
if ($search_email) $sql .= natural_search('s.email', $search_email);
if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php
index 8204543540e..bedd9c08819 100644
--- a/htdocs/core/boxes/box_birthdays.php
+++ b/htdocs/core/boxes/box_birthdays.php
@@ -34,7 +34,7 @@ class box_birthdays extends ModeleBoxes
{
public $boxcode="birthdays";
public $boximg="object_user";
- public $boxlabel="BoxBirthdays";
+ public $boxlabel="BoxTitleUserBirthdaysOfMonth";
public $depends = array("user");
/**
@@ -76,18 +76,20 @@ class box_birthdays extends ModeleBoxes
$this->max=$max;
- include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+ include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$userstatic=new User($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleUserBirthdaysOfMonth"));
if ($user->rights->user->user->lire)
{
- $sql = "SELECT u.rowid, u.firstname, u.lastname";
- $sql.= ", u.birth";
+ $tmparray=dol_getdate(dol_now(), true);
+
+ $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.entity IN (".getEntity('user').")";
- $sql.= " AND MONTH(u.birth) = ".date('m');
+ $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], $tmparray['year']);
$sql.= " ORDER BY u.birth ASC";
$sql.= $this->db->plimit($max, 0);
@@ -127,7 +129,7 @@ class box_birthdays extends ModeleBoxes
$line++;
}
- if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedUsers"));
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"','text'=>$langs->trans("None"));
$this->db->free($result);
}
diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php
index 45f64adce42..4b3805b8908 100644
--- a/htdocs/core/boxes/box_birthdays_members.php
+++ b/htdocs/core/boxes/box_birthdays_members.php
@@ -34,7 +34,7 @@ class box_birthdays_members extends ModeleBoxes
{
public $boxcode="birthdays_members";
public $boximg="object_user";
- public $boxlabel="BoxBirthdaysMembers";
+ public $boxlabel="BoxTitleMemberNextBirthdays";
public $depends = array("adherent");
/**
@@ -76,20 +76,22 @@ class box_birthdays_members extends ModeleBoxes
$this->max=$max;
- include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+ include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$memberstatic=new Adherent($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleMemberNextBirthdays"));
if ($user->rights->adherent->lire)
{
- $sql = "SELECT u.rowid, u.firstname, u.lastname";
- $sql.= ", u.birth";
+ $tmparray=dol_getdate(dol_now(), true);
+
+ $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as u";
$sql.= " WHERE u.entity IN (".getEntity('adherent').")";
$sql.= " AND u.statut = 1";
- $sql.= " AND date_format(u.birth, '%m-%d') >= date_format(curdate(), '%m-%d')";
- $sql.= " ORDER BY date_format(u.birth, '%m-%d') ASC";
+ $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], $tmparray['year']);
+ $sql.= " ORDER BY u.birth ASC";
$sql.= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
@@ -128,7 +130,7 @@ class box_birthdays_members extends ModeleBoxes
$line++;
}
- if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedUsers"));
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"','text'=>$langs->trans("None"));
$this->db->free($result);
}
diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php
index eb1dd7a7e8c..b549ea1c75d 100644
--- a/htdocs/core/class/doleditor.class.php
+++ b/htdocs/core/class/doleditor.class.php
@@ -265,7 +265,7 @@ class DolEditor
if ($titlecontent)
{
$out.= '';
$out.= '
+
+
+