From afbee44993e6c5c6ae80f7e46f5eba72bd523fab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= <rdoursenaud@gpcsolutions.fr>
Date: Mon, 5 Oct 2015 20:51:17 +0200
Subject: [PATCH] Fix #3667 checkbox extrafields on edit
For actions and members.
---
htdocs/adherents/type.php | 11 ++++++++++-
htdocs/comm/action/card.php | 11 ++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 14bbcb8e854..1819925e723 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -678,7 +678,16 @@ if ($rowid > 0)
print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
{
- $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($adht->array_options['options_'.$key])?$adht->array_options['options_'.$key]:''));
+ if (isset($_POST["options_" . $key])) {
+ if (is_array($_POST["options_" . $key])) {
+ // $_POST["options"] is an array but following code expects a comma separated string
+ $value = implode(",", $_POST["options_" . $key]);
+ } else {
+ $value = $_POST["options_" . $key];
+ }
+ } else {
+ $value = $adht->array_options["options_" . $key];
+ }
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 2e35b8004f0..c011717c0cc 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1202,7 +1202,16 @@ if ($id > 0)
print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
{
- $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
+ if (isset($_POST["options_" . $key])) {
+ if (is_array($_POST["options_" . $key])) {
+ // $_POST["options"] is an array but following code expects a comma separated string
+ $value = implode(",", $_POST["options_" . $key]);
+ } else {
+ $value = $_POST["options_" . $key];
+ }
+ } else {
+ $value = $object->array_options["options_" . $key];
+ }
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
--
GitLab