diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 93c548cef62..0987b3efcf4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -326,7 +326,7 @@ if (empty($reshook)) $object->public = GETPOST("public", 'alpha'); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; // Check if we need to also synchronize user information diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index d8890836bb7..d404080b2c0 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -175,7 +175,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) $object->vote = (boolean) trim($vote); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; $ret = $object->update($user); diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 8df5ffe8c40..b58bb74853c 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -154,7 +154,7 @@ if ($action == 'update' && $user->rights->asset->write) $object->note = trim($comment); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; $ret = $object->update($user); diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index cd8a718279e..10af9ff2b25 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -102,7 +102,7 @@ if ($action == 'update' && $user->rights->categorie->creer) } if (!$error && empty($object->error)) { - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if (!$error && $object->update($user) > 0) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index fcb33bd544a..b1314a8e702 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -529,7 +529,7 @@ if (empty($reshook) && $action == 'update') } // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if (!$error) { diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 1403ecc66b8..ebc8a479213 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -246,7 +246,7 @@ if ($action == 'update') if (!$error) { // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); } if (!$error) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 3e3e1894a75..0ca5b184f88 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -421,7 +421,7 @@ if (empty($reshook)) $object->roles = GETPOST("roles", 'array'); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if (!$error) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f37d2e1932c..4d20499b5ba 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2055,7 +2055,8 @@ class ExtraFields foreach ($extralabels as $key => $value) { if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) continue; - if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && ! GETPOSTISSET('options_'.$key)) continue; + //when unticking boolean field, it's not set in POST + if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && ! GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') continue; $key_type = $this->attributes[$object->table_element]['type'][$key]; if ($key_type == 'separate') continue; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 01e8acf4896..0084a4a33c8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4784,7 +4784,7 @@ function price2num($amount, $rounding = '', $option = 0) $nbofdectoround = ''; if ($rounding == 'MU') $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT; elseif ($rounding == 'MT') $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT; - elseif ($rounding == 'MS') $nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK; + elseif ($rounding == 'MS') $nbofdectoround = !isset($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK; elseif ($rounding == 'CR') $nbofdectoround = 8; elseif (is_numeric($rounding)) $nbofdectoround = $rounding; //print "RR".$amount.' - '.$nbofdectoround.'
'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 281e45baf51..7749a1176b2 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1937,7 +1937,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) { $prev_progress = 0; - if (method_exists($object, 'get_prev_progress')) + if (method_exists($object->lines[$i], 'get_prev_progress')) { $prev_progress = $object->lines[$i]->get_prev_progress($object->id); } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 3d2e873b5b3..9c7c0a0bcc5 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -118,7 +118,7 @@ if ($action == 'update') $object->modepaymentid = GETPOST('modepayment', 'int'); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if ($object->update($user) > 0) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 0444157704b..b71bea7bd34 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -84,7 +84,12 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid"; $sql .= " WHERE cp.rowid > 0"; $sql .= " AND cp.statut = 3"; // Approved -$sql .= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')"; +$sql .= " AND ("; +$sql .= " (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')"; +$sql .= " OR"; +// For work leave over several months +$sql .= " (date_format(cp.date_debut, '%Y-%m') < '".$db->escape($year_month)."' AND date_format(cp.date_fin, '%Y-%m') > '".$db->escape($year_month)."') "; +$sql .= " )"; $sql .= " ORDER BY u.lastname, cp.date_debut"; $resql = $db->query($sql); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 1f53d3491fa..1fa34d2f03f 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -182,7 +182,7 @@ if (empty($reshook)) $object->fax = GETPOST("fax"); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if (!$error) { diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index ab350dc0919..3ec0141bedb 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -276,7 +276,7 @@ if (empty($reshook)) $object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha') == 'on' ? 1 : 0); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index d912286b3c8..228c17328f2 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -102,7 +102,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->projet->creer) $object->progress = $_POST['progress']; // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if (!$error) diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index b403c0516f9..2204d9c05bf 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -155,7 +155,7 @@ if (empty($reshook)) $object->country_id = $country_id; // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) { $error++; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 9b747d9c713..28fcda3871d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -440,7 +440,7 @@ if (empty($reshook)) { } // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) { $error++; } @@ -1259,7 +1259,7 @@ if ($action == 'create' || $action == 'adduserldap') // Signature print ''.$langs->trans("Signature").''; - print ''; + print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%'); print $doleditor->Create(1); diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index d70827d357f..8db1e90c72d 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -219,7 +219,7 @@ if (empty($reshook)) { $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none'))); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0;