NEW : Withdraw request massaction

This commit is contained in:
ATM-Nicolas 2018-08-03 09:57:29 +02:00
parent e8f8508401
commit 342a3ef663

View File

@ -268,7 +268,6 @@ if ($massaction == 'withdrawrequest')
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed();
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
$listofbills[] = $objecttmp;
if($objecttmp->paye || $objecttmp->resteapayer==0){
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("AlreadyPaid"), $objecttmp->errors, 'errors');
@ -300,18 +299,21 @@ if ($massaction == 'withdrawrequest')
if ($numprlv>0){
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'errors');
setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings');
}
if (!empty($objecttmp->mode_reglement_code ) && $objecttmp->mode_reglement_code != 'PRE'){
else if (!empty($objecttmp->mode_reglement_code ) && $objecttmp->mode_reglement_code != 'PRE'){
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors');
}
else {
$listofbills[] = $objecttmp; // $listofbills will only contains invoices with good payment method and no request already done
}
}
}
//Massive withdraw request
if(!empty($listofbills) && empty($error))
//Massive withdraw request for request with no errors
if(!empty($listofbills))
{
$nbwithdrawrequestok=0;
foreach($listofbills as $aBill)