Fix: Test sur user assigned not filled
Can use empty line into select boolean form.
This commit is contained in:
parent
a4a01de8a1
commit
b6b6cced30
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user