New: Adds an hide hour button in the "intervention" module

Adds a way to set the visibility of hours/mins of the intervention date field from the administration interface of the "intervention" module
This commit is contained in:
Neil Orley 2017-09-07 15:31:19 +02:00
parent b5c30ea679
commit e43b13968e
5 changed files with 47 additions and 4 deletions

View File

@ -230,6 +230,20 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '',
$conf->entity);
if (!$res > 0) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -607,6 +621,23 @@ print '<input type="submit" class="button" value="' . $langs->trans("Modify") .
print '</td>';
print '</tr>';
print '</form>';
// use date without hour
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
print '<tr class="oddeven">';
print '<td>';
print $langs->trans("UseDateWithoutHourOnFichinter");
print '</td>';
print '<td align="center">';
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"' . ($conf->global->FICHINTER_DATE_WITHOUT_HOUR?' checked':'') . '>';
print '</td>';
print '<td align="right">';
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
print '</td>';
print '</tr>';
print '</form>';

View File

@ -277,7 +277,15 @@ class pdf_soleil extends ModelePDFFicheinter
$curX = $this->posxdesc-1;
// Description of product line
$txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true);
if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR))
{
$txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true);
}
else
{
$txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'day',false,$outputlangs,true);
}
if ($objectligne->duration > 0)
{
$txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration);

View File

@ -1379,7 +1379,7 @@ else if ($id > 0 || ! empty($ref))
print dol_htmlentitiesbr($objp->description);
// Date
print '<td align="center" width="150">'.dol_print_date($db->jdate($objp->date_intervention),'dayhour').'</td>';
print '<td align="center" width="150">'.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)?dol_print_date($db->jdate($objp->date_intervention),'dayhour'):dol_print_date($db->jdate($objp->date_intervention),'day')).'</td>';
// Duration
print '<td align="right" width="150">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?convertSecondToTime($objp->duree):'').'</td>';
@ -1452,7 +1452,8 @@ else if ($id > 0 || ! empty($ref))
// Date d'intervention
print '<td align="center" class="nowrap">';
$form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention");
if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) $form->select_date($db->jdate($objp->date_intervention),'di',0,0,0,"date_intervention");
else $form->select_date($db->jdate($objp->date_intervention),'di',1,1,0,"date_intervention");
print '</td>';
// Duration
@ -1519,7 +1520,8 @@ else if ($id > 0 || ! empty($ref))
$timearray=dol_getdate($now);
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");
if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) $form->select_date($timewithnohour,'di',0,0,0,"addinter");
else $form->select_date($timewithnohour,'di',1,1,0,"addinter");
print '</td>';
// Duration

View File

@ -49,6 +49,7 @@ PrintProductsOnFichinter=Print also lines of type "product" (not only services)
PrintProductsOnFichinterDetails=interventions generated from orders
UseServicesDurationOnFichinter=Use services duration for interventions generated from orders
UseDurationOnFichinter=Hides the duration field for intervention records
UseDateWithoutHourOnFichinter=Hides hours and minutes off the date field for intervention records
InterventionStatistics=Statistics of interventions
NbOfinterventions=Nb of intervention cards
NumberOfInterventionsByMonth=Nb of intervention cards by month (date of validation)

View File

@ -49,6 +49,7 @@ PrintProductsOnFichinter=Imprimer aussi les lignes de type "produit" (pas seulem
PrintProductsOnFichinterDetails=interventions générées à partir des commandes
UseServicesDurationOnFichinter=Utiliser la durée des services dans les interventions créées depuis des commandes
UseDurationOnFichinter=Masquer le champ durée dans les fiches d'intervention
UseDateWithoutHourOnFichinter=Masquer l'heure de la date d'intervention
InterventionStatistics=Statistiques des interventions
NbOfinterventions=Nb de fiches d'intervention
NumberOfInterventionsByMonth=Nb de fiches d'intervention par mois (date de validation)