Merge pull request #9197 from ATM-Nicolas/new_withdrawrequest_massaction

NEW : Withdraw request massaction can include already on process invoices
This commit is contained in:
Juanjo Menent 2018-08-08 10:58:53 +02:00 committed by GitHub
commit af50d36560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)