diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 0adcb967991..efea4c54b09 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -724,7 +724,7 @@ function getFormeJuridiqueLabel($code) function getCountriesInEEC() { // List of all country codes that are in europe for european vat rules - // List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9 + // List found on https://ec.europa.eu/taxation_customs/territorial-status-eu-countries-and-certain-territories_en global $conf, $db; $country_code_in_EEC = array(); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index cb5c475ed1e..d5610c9153a 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -277,10 +277,14 @@ if (empty($reshook)) { } } - if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) { - $error++; - setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors'); - $action = 'create'; + if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS)) { + $overlappingExpenseReportID = $object->periode_existe($fuser, $object->date_debut, $object->date_fin, true); + + if ($overlappingExpenseReportID > 0) { + $error++; + setEventMessages($langs->trans("ErrorDoubleDeclaration").' '. $langs->trans('ShowTrip').'', null, 'errors'); + $action = 'create'; + } } if (!$error) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 63303554c51..64034c10a3f 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2213,8 +2213,6 @@ class ExpenseReport extends CommonObject $date_d_form = $date_debut; $date_f_form = $date_fin; - $existe = false; - while ($i < $num_rows) { $objp = $this->db->fetch_object($result); @@ -2222,17 +2220,13 @@ class ExpenseReport extends CommonObject $date_f_req = $this->db->jdate($objp->date_fin); // 4 if (!($date_f_form < $date_d_req || $date_d_form > $date_f_req)) { - $existe = true; + return $objp->rowid; } $i++; } - if ($existe) { - return 1; - } else { - return 0; - } + return 0; } else { return 0; } diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 4465756f00a..7217fda7d09 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -279,5 +279,5 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (24 -- Set field eec -UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HR','NL','HU','IE','IM','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI'); +UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HR','NL','HU','IE','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI'); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b7f3f577ce2..f32e09aa580 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -618,11 +618,13 @@ if ($search_ref_supplier) { $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); } // Add $param from extra fields -foreach ($search_array_options as $key => $val) { - $crit = $val; - $tmpkey = preg_replace('/search_options_/', '', $key); - if ($val != '') { - $param .= '&search_options_'.$tmpkey.'='.urlencode($val); +if ($search_array_options) { + foreach ($search_array_options as $key => $val) { + $crit = $val; + $tmpkey = preg_replace('/search_options_/', '', $key); + if ($val != '') { + $param .= '&search_options_' . $tmpkey . '=' . urlencode($val); + } } }