Add Button Cancel

And cancel confirmation
This commit is contained in:
Lenin Rivas 2020-04-23 00:38:08 -05:00 committed by GitHub
parent 169378f276
commit e152567122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Yasser Carreón <yacasia@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -460,7 +461,23 @@ if (empty($reshook))
}
}
}
elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->expedition->supprimer)
{
$also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0);
$result = $object->cancel(0, $also_update_stock);
if ($result > 0)
{
$result = $object->setStatut(-1);
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
{
$also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0);
@ -1689,7 +1706,7 @@ elseif ($id || $ref)
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateSending'), $text, 'confirm_valid', '', 0, 1);
}
// Confirm cancelation
if ($action == 'annuler')
if ($action == 'cancel')
{
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('CancelSending'), $langs->trans("ConfirmCancelSending", $object->ref), 'confirm_cancel', '', 0, 1);
}
@ -2575,6 +2592,16 @@ elseif ($id || $ref)
}
}
// Cancel
if ($object->statut == Expedition::STATUS_VALIDATED)
{
if ($user->rights->expedition->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("Cancel").'</a>';
}
}
// Delete
if ($user->rights->expedition->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';