done
This commit is contained in:
parent
7c6ac86d32
commit
4d7b09ff2a
@ -363,21 +363,22 @@ if (empty($reshook)) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'makepayment_confirm') {
|
if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
|
||||||
/*require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
if (!empty($invoices_id)) {
|
if (!empty($arrayofselected)) {
|
||||||
$bankid=GETPOST('bankid','int');
|
$bankid=GETPOST('bankid', 'int');
|
||||||
$paiementid=GETPOST('paiementid','int');
|
$paiementid=GETPOST('paiementid', 'int');
|
||||||
$paiementdate=dol_mktime(12,0,0,GETPOST('datepaimentmonth','int'),GETPOST('datepaimentday','int'),GETPOST('datepaimentyear','year'));
|
$paiementdate=dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
|
||||||
foreach ($arrayofselected as $toselectid) {
|
foreach ($arrayofselected as $toselectid) {
|
||||||
|
$errorpayment=0;
|
||||||
$facture = new Facture($db);
|
$facture = new Facture($db);
|
||||||
$result = $facture->fetch($invoice_id);
|
$result = $facture->fetch($toselectid);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($facture->error, 'errors');
|
setEventMessage($facture->error, 'errors');
|
||||||
|
$errorpayment++;
|
||||||
} else {
|
} else {
|
||||||
if (empty($facture->paye)) {
|
if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == 1 && $facture->paye == 0) {
|
||||||
|
|
||||||
$paiementAmount = $facture->getSommePaiement();
|
$paiementAmount = $facture->getSommePaiement();
|
||||||
$totalcreditnotes = $facture->getSumCreditNotesUsed();
|
$totalcreditnotes = $facture->getSumCreditNotesUsed();
|
||||||
$totaldeposits = $facture->getSumDepositsUsed();
|
$totaldeposits = $facture->getSumDepositsUsed();
|
||||||
@ -387,8 +388,9 @@ if ($action == 'makepayment_confirm') {
|
|||||||
$resultBank = $facture->setBankAccount($bankid);
|
$resultBank = $facture->setBankAccount($bankid);
|
||||||
if ($resultBank < 0) {
|
if ($resultBank < 0) {
|
||||||
setEventMessage($facture->error, 'errors');
|
setEventMessage($facture->error, 'errors');
|
||||||
|
$errorpayment++;
|
||||||
} else {
|
} else {
|
||||||
$paiement = new Paiement($this->db);
|
$paiement = new Paiement($db);
|
||||||
$paiement->datepaye = $paiementdate;
|
$paiement->datepaye = $paiementdate;
|
||||||
$paiement->amounts[$facture->id] = $remaintopay; // Array with all payments dispatching with invoice id
|
$paiement->amounts[$facture->id] = $remaintopay; // Array with all payments dispatching with invoice id
|
||||||
$paiement->multicurrency_amounts[$facture->id] = $remaintopay;
|
$paiement->multicurrency_amounts[$facture->id] = $remaintopay;
|
||||||
@ -396,20 +398,29 @@ if ($action == 'makepayment_confirm') {
|
|||||||
$paiement_id = $paiement->create($user, 1, $facture->thirdparty);
|
$paiement_id = $paiement->create($user, 1, $facture->thirdparty);
|
||||||
if ($paiement_id < 0) {
|
if ($paiement_id < 0) {
|
||||||
setEventMessage($facture->ref . ' ' . $paiement->error, 'errors');
|
setEventMessage($facture->ref . ' ' . $paiement->error, 'errors');
|
||||||
|
$errorpayment++;
|
||||||
} else {
|
} else {
|
||||||
$result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', '');
|
$result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', '');
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($facture->ref . ' ' . $paiement->error, $paiement->errors, 'errors');
|
setEventMessages($facture->ref . ' ' . $paiement->error, $paiement->errors, 'errors');
|
||||||
|
$errorpayment++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
|
||||||
|
$errorpayment++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($facture->ref.' Total 0 € Pas de réglement enregistré', 'errors');
|
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
|
||||||
|
$errorpayment++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (empty($errorpayment)) {
|
||||||
|
setEventMessage($langs->trans('RegisterPaymentAndClasiffiedPayedDone', $facture->ref));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
} elseif ($massaction == 'withdrawrequest') {
|
} elseif ($massaction == 'withdrawrequest') {
|
||||||
$langs->load("withdrawals");
|
$langs->load("withdrawals");
|
||||||
|
|
||||||
@ -1048,7 +1059,7 @@ if ($resql) {
|
|||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||||
array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date")),
|
array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date")),
|
||||||
array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 2, 0, 1, 0, 1, '', 1)),
|
array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 0, 0, 1, 0, 1, '', 1)),
|
||||||
array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("Date"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)),
|
array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("Date"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)),
|
||||||
//array('type' => 'other', 'name' => 'invoicesid', 'label' => '', 'value'=>'<input type="hidden" id="invoicesid" name="invoicesid" value="'.implode('#',GETPOST('toselect','array')).'">'),
|
//array('type' => 'other', 'name' => 'invoicesid', 'label' => '', 'value'=>'<input type="hidden" id="invoicesid" name="invoicesid" value="'.implode('#',GETPOST('toselect','array')).'">'),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -590,4 +590,6 @@ SituationTotalRayToRest=Remainder to pay without taxe
|
|||||||
PDFSituationTitle=Situation n° %d
|
PDFSituationTitle=Situation n° %d
|
||||||
SituationTotalProgress=Total progress %d %%
|
SituationTotalProgress=Total progress %d %%
|
||||||
SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s
|
SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s
|
||||||
RegisterPaymentAndClasiffiedPayed=Enter payment and Classify 'Paid'
|
RegisterPaymentAndClasiffiedPayed=Enter payment and classify 'Paid'
|
||||||
|
NoPaymentAvailable=No payment available for %s
|
||||||
|
RegisterPaymentAndClasiffiedPayedDone=Payment registered and classify 'Paid' done for invoice %s
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user