Merge pull request #14828 from TobiasSekan/NewAllowReopenIntervention

NEW Allow to reopen interventions (green button)
This commit is contained in:
Laurent Destailleur 2020-09-27 17:07:45 +02:00 committed by GitHub
commit 52d1f57276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -555,6 +555,20 @@ if (empty($reshook))
}
}
// Reopen
elseif ($action == 'confirm_reopen' && $user->rights->ficheinter->creer)
{
$result = $object->setStatut(Fichinter::STATUS_VALIDATED);
if ($result > 0)
{
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
}
else {
$mesg = $object->error;
}
}
/*
* Mise a jour d'une ligne d'intervention
*/
@ -1099,6 +1113,12 @@ if ($action == 'create')
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify', '', 0, 1);
}
// Confirm back to open
if ($action == 'reopen')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Reopen'), $langs->trans('ConfirmReopenIntervention', $object->ref), 'confirm_reopen', '', 0, 1);
}
// Confirm deletion of line
if ($action == 'ask_deleteline')
{
@ -1596,6 +1616,15 @@ if ($action == 'create')
print '</a></div>';
}
// Reopen
if ($object->statut > Fichinter::STATUS_CLOSED)
{
if ($user->rights->ficheinter->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans('Reopen').'</a></div>';
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('Reopen').'</a></div>';
}
// Send
if (empty($user->socid)) {
if ($object->statut > Fichinter::STATUS_DRAFT)

View File

@ -64,3 +64,5 @@ InterLineDuration=Line duration intervention
InterLineDesc=Line description intervention
RepeatableIntervention=Template of intervention
ToCreateAPredefinedIntervention=To create a predefined or recurring intervention, create a common intervention and convert it into intervention template
Reopen=Reopen
ConfirmReopenIntervention=Are you sure you want to open back the intervention <b>%s</b>?