diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 6b8a3fbc267..fd500b34775 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -312,7 +312,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++; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 76099ff7d66..bdae16901c1 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -180,7 +180,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++; } diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index b09b56ffbcf..4568004b33b 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -158,7 +158,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++; } diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 91d32736cbc..2b3ffc95c41 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -105,7 +105,7 @@ if ($action == 'update' && $user->rights->categorie->creer) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); } if (!$error && empty($object->error)) { - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) { $error++; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 54cfea64743..752868acb87 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -585,7 +585,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++; } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index c6b852be444..989ab236a1c 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -156,7 +156,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 (!$error) { $id = $object->create($user); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 5110e08e2fc..c8ff3135aa7 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -420,7 +420,7 @@ if (empty($reshook)) { $object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty // 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/contact/list.php b/htdocs/contact/list.php index 695d4ead3cc..fd61f16dd0c 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -101,9 +101,12 @@ $search_roles = GETPOST("search_roles", 'array'); $search_level = GETPOST("search_level", "array"); $search_stcomm = GETPOST('search_stcomm', 'int'); -if ($search_status == '') { +if ($search_status === '') { $search_status = 1; // always display active customer first } +if ($search_no_email === '') { + $search_no_email = -1; +} $optioncss = GETPOST('optioncss', 'alpha'); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index fc28abe6aa6..6b627e51ab6 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2069,7 +2069,8 @@ class ExtraFields if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) { continue; } - if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key)) { + if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') { + //when unticking boolean field, it's not set in POST continue; } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 9579497411f..bcd3da0dfb5 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -161,7 +161,7 @@ if ($action == 'update') { $object->modepaymentid = (int) 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++; } diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 5ea58da6deb..d1bd49629c6 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -183,7 +183,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++; } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 50d6235dc7d..89bdb013a32 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -270,7 +270,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 b31ba6f0e7b..bec61ec0f48 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -107,7 +107,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $object->progress = price2num(GETPOST('progress', 'alphanohtml')); // 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/resource/card.php b/htdocs/resource/card.php index 1b4c71b158b..c258348a7a4 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -139,7 +139,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 68218ab16bd..23437a7564c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -462,7 +462,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++; } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 56af96740d4..2ce8c6136db 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -210,7 +210,7 @@ if (empty($reshook)) { $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml'))); // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) { $error++; }