Skip to content

Commit

Permalink
Fix: Add hidden option so we can restore old behaviour (duration is
Browse files Browse the repository at this point in the history
free) for people that can't work with new one.
  • Loading branch information
eldy committed Jun 21, 2014
1 parent 5c0813e commit dce0c38
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
17 changes: 11 additions & 6 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -3733,13 +3733,14 @@ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_nam
/**
* 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;

Expand Down Expand Up @@ -3770,7 +3771,11 @@ function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select')
{
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)
{
Expand Down
20 changes: 9 additions & 11 deletions htdocs/fichinter/fiche.php
Expand Up @@ -1332,9 +1332,7 @@
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';
Expand Down Expand Up @@ -1419,7 +1417,7 @@
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].'>';
Expand Down Expand Up @@ -1452,9 +1450,7 @@

$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%">';
Expand Down Expand Up @@ -1483,14 +1479,16 @@
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>';
Expand All @@ -1513,8 +1511,8 @@


/*
* Barre d'actions
*/
* Actions buttons
*/
print '<div class="tabsAction">';

if ($user->societe_id == 0)
Expand Down

0 comments on commit dce0c38

Please sign in to comment.