Fix: Add hidden option so we can restore old behaviour (duration is

free) for people that can't work with new one.
This commit is contained in:
Laurent Destailleur 2014-06-21 16:06:59 +02:00
parent 5c0813e865
commit dce0c38533
2 changed files with 20 additions and 17 deletions

View File

@ -3733,13 +3733,14 @@ class Form
/**
* Function to show a form to select a duration on a page
*
* @param string $prefix prefix
* @param int $iSecond Default preselected duration (number of seconds)
* @param int $disabled Disable the combo box
* @param string $typehour if 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo
* @param string $prefix Prefix
* @param int $iSecond Default preselected duration (number of seconds)
* @param int $disabled Disable the combo box
* @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo
* @param string $minunderhours If 1, show minutes selection under the hours
* @return void
*/
function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select')
function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0)
{
global $langs;
@ -3770,7 +3771,11 @@ class Form
{
print '<input type="text" size="3" name="'.$prefix.'hour" class="flat" value="'.((int) $hourSelected).'">';
}
print $langs->trans('Hours'). "&nbsp;";
print $langs->trans('Hours');
if ($minunderhours) print '<br>';
else print "&nbsp;";
print '<select class="flat" name="'.$prefix.'min"'.($disabled?' disabled="disabled"':'').'>';
for ($min = 0; $min <= 55; $min=$min+5)
{

View File

@ -1332,9 +1332,7 @@ else if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="action" value="addline">';
}
/*
* Lignes d'intervention
*/
// Intervention lines
$sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,';
$sql.= ' ft.date as date_intervention';
$sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
@ -1419,7 +1417,7 @@ else if ($id > 0 || ! empty($ref))
print '</tr>';
}
// Ligne en mode update
// Line in update mode
if ($object->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && GETPOST('line_id','int') == $objp->rowid)
{
print '<tr '.$bc[$var].'>';
@ -1452,9 +1450,7 @@ else if ($id > 0 || ! empty($ref))
$db->free($resql);
/*
* Add line
*/
// Add new line
if ($object->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline')
{
if (! $num) print '<br><table class="noborder" width="100%">';
@ -1483,14 +1479,16 @@ else if ($id > 0 || ! empty($ref))
print '<td align="center" class="nowrap">';
$now=dol_now();
$timearray=dol_getdate($now);
if (!GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']);
if (! GETPOST('diday','int')) $timewithnohour=dol_mktime(0,0,0,$timearray['mon'],$timearray['mday'],$timearray['year']);
else $timewithnohour=dol_mktime(GETPOST('dihour','int'),GETPOST('dimin','int'), 0,GETPOST('dimonth','int'),GETPOST('diday','int'),GETPOST('diyear','int'));
$form->select_date($timewithnohour,'di',1,1,0,"addinter");
print '</td>';
// Duration
print '<td align="right">';
$form->select_duration('duration',(!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int')));
$selectmode='select';
if (! empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) $selectmode='text';
$form->select_duration('duration', (!GETPOST('durationhour','int') && !GETPOST('durationmin','int'))?3600:(60*60*GETPOST('durationhour','int')+60*GETPOST('durationmin','int')), 0, $selectmode, 1);
print '</td>';
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>';
@ -1513,8 +1511,8 @@ else if ($id > 0 || ! empty($ref))
/*
* Barre d'actions
*/
* Actions buttons
*/
print '<div class="tabsAction">';
if ($user->societe_id == 0)