New : Option INVOICE_CAN_REMOVE_DRAFT_ONLY to delete draft invoices with precedence over INVOICE_CAN_ALWAYS_BE_REMOVED
This commit is contained in:
parent
95bd249ec6
commit
17b8de2cdd
@ -585,24 +585,22 @@ if ($resql)
|
|||||||
'presend'=>$langs->trans("SendByMail"),
|
'presend'=>$langs->trans("SendByMail"),
|
||||||
'builddoc'=>$langs->trans("PDFMerge"),
|
'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
if ($conf->prelevement->enabled)
|
if ($conf->prelevement->enabled) {
|
||||||
{
|
$langs->load("withdrawals");
|
||||||
$langs->load("withdrawals");
|
$arrayofmassactions['withdrawrequest'] = $langs->trans("MakeWithdrawRequest");
|
||||||
$arrayofmassactions['withdrawrequest']=$langs->trans("MakeWithdrawRequest");
|
}
|
||||||
}
|
if ($user->rights->facture->supprimer) {
|
||||||
if ($user->rights->facture->supprimer)
|
//if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) || empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
|
||||||
{
|
if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
|
||||||
//if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) || empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
|
$arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft");
|
||||||
if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
|
|
||||||
{
|
}
|
||||||
// mass deletion never possible on invoices on such situation
|
elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) {
|
||||||
}
|
// mass deletion never possible on invoices on such situation
|
||||||
else
|
$arrayofmassactions['predelete'] = $langs->trans("Delete");
|
||||||
{
|
}
|
||||||
$arrayofmassactions['predelete']=$langs->trans("Delete");
|
}
|
||||||
}
|
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||||
}
|
|
||||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
$newcardbutton='';
|
$newcardbutton='';
|
||||||
|
|||||||
@ -1079,26 +1079,16 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
|
|||||||
$result=$objecttmp->fetch($toselectid);
|
$result=$objecttmp->fetch($toselectid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Refuse deletion for some status ?
|
if ($objectclass != 'Facture' || empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY) || (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY) && $objecttmp->statut == Facture::STATUS_DRAFT) ) {
|
||||||
/*
|
if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||||
if ($objectclass == 'Facture' && $objecttmp->status == Facture::STATUS_DRAFT)
|
else $result = $objecttmp->delete($user);
|
||||||
{
|
|
||||||
$langs->load("errors");
|
|
||||||
$nbignored++;
|
|
||||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'</div><br>';
|
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
if ($result <= 0) {
|
||||||
else $result = $objecttmp->delete($user);
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
if ($result <= 0)
|
break;
|
||||||
{
|
} else $nbok++;
|
||||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
}
|
||||||
$error++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else $nbok++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,11 @@
|
|||||||
// $trackid='ord'.$object->id;
|
// $trackid='ord'.$object->id;
|
||||||
|
|
||||||
|
|
||||||
|
if ($massaction == 'predeletedraft')
|
||||||
|
{
|
||||||
|
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDraftDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if ($massaction == 'predelete')
|
if ($massaction == 'predelete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
|
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
|
||||||
|
|||||||
@ -942,3 +942,5 @@ Remote=Remote
|
|||||||
LocalAndRemote=Local and Remote
|
LocalAndRemote=Local and Remote
|
||||||
KeyboardShortcut=Keyboard shortcut
|
KeyboardShortcut=Keyboard shortcut
|
||||||
AssignedTo=Assigned to
|
AssignedTo=Assigned to
|
||||||
|
Deletedraft=Delete draft
|
||||||
|
ConfirmMassDraftDeletion=Draft Bulk delete confirmation
|
||||||
|
|||||||
@ -941,3 +941,5 @@ Remote=Distant
|
|||||||
LocalAndRemote=Local et distant
|
LocalAndRemote=Local et distant
|
||||||
KeyboardShortcut=Raccourci clavier
|
KeyboardShortcut=Raccourci clavier
|
||||||
AssignedTo=Assigné à
|
AssignedTo=Assigné à
|
||||||
|
Deletedraft=Supprimer brouillon
|
||||||
|
ConfirmMassDraftDeletion=Confirmation de suppression brouillons en masse
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user