diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index a1e6f89f6635a734f2e7b431d2730010c9c3f9c1..96db3133cf9edc1300deffa64e7c4b6a50d369de 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -251,11 +251,11 @@ if ($action == 'add') if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; // Check parameters - if (empty($object->userownerid)) + if (empty($object->userownerid) && empty($_SESSION['assignedtouser'])) { $error++; $donotclearsession=1; $action = 'create'; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors'); } if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) { @@ -423,7 +423,7 @@ if ($action == 'update') { $error++; $donotclearsession=1; $action = 'edit'; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors'); } // Fill array 'array_options' with data from add form diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8e369151fd7030e2f8e19d570d96908b0e17ab75..eb7b3d8af4f4d3c4cb8c31e14b52b73f2d288d90 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4166,18 +4166,18 @@ class Form /** * Return an html string with a select combo box to choose yes or no * - * @param string $htmlname Name of html select field - * @param string $value Pre-selected value - * @param int $option 0 return yes/no, 1 return 1/0 - * @param bool $disabled true or false - * @return mixed See option + * @param string $htmlname Name of html select field + * @param string $value Pre-selected value + * @param int $option 0 return yes/no, 1 return 1/0 + * @param bool $disabled true or false + * @param useempty $useempty 1=Add empty line + * @return mixed See option */ - function selectyesno($htmlname,$value='',$option=0,$disabled=false) + function selectyesno($htmlname,$value='',$option=0,$disabled=false,$useempty='') { global $langs; $yes="yes"; $no="no"; - if ($option) { $yes="1"; @@ -4187,15 +4187,17 @@ class Form $disabled = ($disabled ? ' disabled="disabled"' : ''); $resultyesno = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; + if ($useempty) $resultyesno .= '<option value="-1"'.(($value < 0)?' selected="selected"':'').'></option>'."\n"; if (("$value" == 'yes') || ($value == 1)) { $resultyesno .= '<option value="'.$yes.'" selected="selected">'.$langs->trans("Yes").'</option>'."\n"; $resultyesno .= '<option value="'.$no.'">'.$langs->trans("No").'</option>'."\n"; } else - { + { + $selected=($useempty?'':' selected="selected"'); $resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n"; - $resultyesno .= '<option value="'.$no.'" selected="selected">'.$langs->trans("No").'</option>'."\n"; + $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n"; } $resultyesno .= '</select>'."\n"; return $resultyesno;