diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index cda1d54b38b..74958b35333 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -71,8 +71,6 @@ $offsetunit = GETPOST('offsetunittype_duration', 'aZ09'); $remindertype = GETPOST('selectremindertype', 'aZ09'); $modelmail = GETPOST('actioncommsendmodel_mail', 'int'); -//var_dump($_POST); exit; - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); @@ -111,8 +109,6 @@ if ($id > 0 && $action != 'add') { // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -//var_dump($_POST); - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('actioncard', 'globalcard')); @@ -144,7 +140,7 @@ if (empty($reshook) && (GETPOST('removedassigned') || GETPOST('removedassigned') { if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]); } - //var_dump($_POST['removedassigned']);exit; + $_SESSION['assignedtouser'] = json_encode($tmpassigneduserids); $donotclearsession = 1; if ($action == 'add') $action = 'create'; @@ -1076,18 +1072,21 @@ if ($action == 'create') $listofuserid = array(); $listofcontactid = array(); $listofotherid = array(); + if (empty($donotclearsession)) { $assignedtouser = GETPOST("assignedtouser") ?GETPOST("assignedtouser") : (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id); if ($assignedtouser) $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>$object->transparency); // Owner first - $listofuserid[$user->id]['transparency'] = GETPOSTISSET('transparency') ?GETPOST('transparency', 'alpha') : 1; // 1 by default at first init + //$listofuserid[$user->id] = array('id'=>$user->id, 'mandatory'=>0, 'transparency'=>(GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 1)); // 1 by default at first init + $listofuserid[$assignedtouser]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 1); // 1 by default at first init $_SESSION['assignedtouser'] = json_encode($listofuserid); } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); } - $listofuserid[$user->id]['transparency'] = GETPOSTISSET('transparency') ?GETPOST('transparency', 'alpha') : 0; // 0 by default when refreshing + $firstelem = reset($listofuserid); + if (isset($listofuserid[$firstelem['id']])) $listofuserid[$firstelem['id']]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 0); // 0 by default when refreshing } print '