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