Work on task #11018 : Add a status "not applicable" on event
This commit is contained in:
parent
76e8107713
commit
5519216f9d
@ -464,6 +464,16 @@ if (GETPOST('action') == 'create')
|
||||
jQuery("#fullday").change(function() {
|
||||
setdatefields();
|
||||
});
|
||||
jQuery("#selectcomplete").change(function() {
|
||||
if (jQuery("#selectcomplete").val() == 100)
|
||||
{
|
||||
if (jQuery("#doneby").val() <= 0) jQuery("#doneby").val(\''.$user->id.'\');
|
||||
}
|
||||
if (jQuery("#selectcomplete").val() == 0)
|
||||
{
|
||||
jQuery("#doneby").val(-1);
|
||||
}
|
||||
});
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
@ -521,8 +531,8 @@ if (GETPOST('action') == 'create')
|
||||
// Status
|
||||
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<td>';
|
||||
$percent=0;
|
||||
if (GETPOST('percentage'))
|
||||
$percent=-1;
|
||||
if (isset($_GET['percentage']) || isset($_POST['percentage']))
|
||||
{
|
||||
$percent=GETPOST('percentage');
|
||||
}
|
||||
@ -531,7 +541,7 @@ if (GETPOST('action') == 'create')
|
||||
if (GETPOST("afaire") == 1) $percent=0;
|
||||
if (GETPOST("afaire") == 2) $percent=100;
|
||||
}
|
||||
print $htmlactions->form_select_status_action('formaction',$percent,1);
|
||||
print $htmlactions->form_select_status_action('formaction',$percent,1,'complete');
|
||||
print '</td></tr>';
|
||||
|
||||
// Location
|
||||
@ -550,7 +560,7 @@ if (GETPOST('action') == 'create')
|
||||
|
||||
// Realised by
|
||||
print '<tr><td nowrap>'.$langs->trans("ActionDoneBy").'</td><td>';
|
||||
$html->select_users(GETPOST("doneby")?GETPOST("doneby"):$actioncomm->userdone,'doneby',1);
|
||||
$html->select_users(GETPOST("doneby")?GETPOST("doneby"):($percent==100?$actioncomm->userdone:0),'doneby',1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -779,14 +779,14 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return select list of users
|
||||
* \param selected Id user preselected
|
||||
* \param htmlname Field name in form
|
||||
* \param show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||
* \param exclude Array list of users id to exclude
|
||||
* \param disabled If select list must be disabled
|
||||
* \param include Array list of users id to include
|
||||
* \param enableonly Array list of users id to be enabled. All other must be disabled
|
||||
* Return select list of users
|
||||
* @param selected Id user preselected
|
||||
* @param htmlname Field name in form
|
||||
* @param show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||
* @param exclude Array list of users id to exclude
|
||||
* @param disabled If select list must be disabled
|
||||
* @param include Array list of users id to include
|
||||
* @param enableonly Array list of users id to be enabled. All other must be disabled
|
||||
*/
|
||||
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='')
|
||||
{
|
||||
@ -794,21 +794,21 @@ class Form
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return select list of users
|
||||
* \param selected User id or user object of user preselected. If -1, we use id of current user.
|
||||
* \param htmlname Field name in form
|
||||
* \param show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||
* \param exclude Array list of users id to exclude
|
||||
* \param disabled If select list must be disabled
|
||||
* \param include Array list of users id to include
|
||||
* \param enableonly Array list of users id to be enabled. All other must be disabled
|
||||
* Return select list of users
|
||||
* @param selected User id or user object of user preselected. If -1, we use id of current user.
|
||||
* @param htmlname Field name in form
|
||||
* @param show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||
* @param exclude Array list of users id to exclude
|
||||
* @param disabled If select list must be disabled
|
||||
* @param include Array list of users id to include
|
||||
* @param enableonly Array list of users id to be enabled. All other must be disabled
|
||||
*/
|
||||
function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='')
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
// If no preselected user defined, we take current user
|
||||
if (empty($selected) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
if ($selected < -1 && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
|
||||
// Permettre l'exclusion d'utilisateurs
|
||||
if (is_array($exclude)) $excludeUsers = implode("','",$exclude);
|
||||
@ -829,7 +829,7 @@ class Form
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$out.= '<select class="flat" name="'.$htmlname.'"'.($disabled?' disabled="true"':'').'>';
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="true"':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.($id==-1?' selected="selected"':'').'> </option>'."\n";
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
@ -47,42 +47,47 @@ class FormActions
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show list of action status
|
||||
* \param formname Name of form where select in included
|
||||
* \param selected Preselected value
|
||||
* \param canedit 1=can edit, 0=read only
|
||||
* Show list of action status
|
||||
* @param formname Name of form where select in included
|
||||
* @param selected Preselected value
|
||||
* @param canedit 1=can edit, 0=read only
|
||||
* @param htmlname Name of html prefix for html fields (selectX and valX)
|
||||
*/
|
||||
function form_select_status_action($formname,$selected,$canedit=1)
|
||||
function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$listofstatus=array('0'=>$langs->trans("ActionRunningNotStarted"),'50'=>$langs->trans("ActionRunningShort"),'100'=>$langs->trans("ActionDoneShort"));
|
||||
$listofstatus=array('-1'=>$langs->trans("ActionNotApplicable"),
|
||||
'0'=>$langs->trans("ActionRunningNotStarted"),
|
||||
'50'=>$langs->trans("ActionRunningShort"),
|
||||
'100'=>$langs->trans("ActionDoneShort"));
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n";
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print 'function select_status(mypercentage) {'."\n";
|
||||
print 'document.'.$formname.'.percentageshown.value=mypercentage;'."\n";
|
||||
print 'document.'.$formname.'.percentageshown.value=(mypercentage>=0?mypercentage:\'\');'."\n";
|
||||
print 'document.'.$formname.'.percentage.value=mypercentage;'."\n";
|
||||
print 'if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
|
||||
print 'if (mypercentage == -1) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
|
||||
print 'else if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
|
||||
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; }'."\n";
|
||||
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n";
|
||||
print '}'."\n";
|
||||
print '</script>'."\n";
|
||||
print '<select '.($canedit?'':'disabled="true" ').'name="status" class="flat" onChange="select_status(document.'.$formname.'.status.value)">';
|
||||
print '<select '.($canedit?'':'disabled="true" ').'name="status" id="select'.$htmlname.'" class="flat" onChange="select_status(document.'.$formname.'.status.value)">';
|
||||
foreach($listofstatus as $key => $val)
|
||||
{
|
||||
print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>'.$val.'</option>';
|
||||
}
|
||||
print '</select>';
|
||||
if ($selected == 0 || $selected == 100) $canedit=0;
|
||||
print ' <input type="text" name="percentageshown" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').' onChange="select_status(document.'.$formname.'.percentageshown.value)">%';
|
||||
print ' <input type="text" id="val'.$htmlname.'" name="percentageshown" class="flat" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit&&($selected>=0)?'':' disabled="true"').' onChange="select_status(document.'.$formname.'.percentageshown.value)">%';
|
||||
print ' <input type="hidden" name="percentage" value="'.$selected.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' <input type="text" name="percentage" class="flat" value="'.$selected.'" size="2"'.($canedit?'':' disabled="true"').'>%';
|
||||
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit?'':' disabled="true"').'>%';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -312,7 +312,8 @@ ActionsDone=Actions done
|
||||
ActionsToDoShort=To do
|
||||
ActionsRunningshort=Started
|
||||
ActionsDoneShort=Done
|
||||
ActionRunningNotStarted=Not started
|
||||
ActionNotApplicable=Not applicable
|
||||
ActionRunningNotStarted=To start
|
||||
ActionRunningShort=Started
|
||||
ActionDoneShort=Finished
|
||||
CompanyFoundation=Company/Foundation
|
||||
|
||||
@ -311,7 +311,8 @@ ActionsToDo=Événements à faire
|
||||
ActionsDone=Événements effectués
|
||||
ActionsToDoShort=À faire
|
||||
ActionsDoneShort=Effectuées
|
||||
ActionRunningNotStarted=Non commencé
|
||||
ActionNotApplicable=Non applicable
|
||||
ActionRunningNotStarted=A commencé
|
||||
ActionRunningShort=En cours
|
||||
ActionDoneShort=Terminé
|
||||
CompanyFoundation=Société ou institution
|
||||
|
||||
Loading…
Reference in New Issue
Block a user