Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
21f0264683
@ -4951,14 +4951,14 @@ if ($action == 'create') {
|
|||||||
// List of payments already done
|
// List of payments already done
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder paymenttable" width="100%">';
|
print '<table class="noborder paymenttable centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
|
print '<td class="liste_titre">'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans('Date').'</td>';
|
print '<td class="liste_titre">'.$langs->trans('Date').'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans('Type').'</td>';
|
print '<td class="liste_titre">'.$langs->trans('Type').'</td>';
|
||||||
if (!empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
print '<td class="liste_titre right">'.$langs->trans('BankAccount').'</td>';
|
print '<td class="liste_titre">'.$langs->trans('BankAccount').'</td>';
|
||||||
}
|
}
|
||||||
print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>';
|
print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>';
|
||||||
print '<td class="liste_titre" width="18"> </td>';
|
print '<td class="liste_titre" width="18"> </td>';
|
||||||
|
|||||||
@ -178,6 +178,7 @@ $diroutputmassaction = $conf->facture->dir_output.'/temp/massgeneration/'.$user-
|
|||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
@ -376,22 +377,32 @@ 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' && $user->rights->facture->paiement) {
|
if ($action == 'makepayment_confirm' && !empty($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($arrayofselected)) {
|
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'));
|
||||||
|
if (empty($paiementdate)) {
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
$action = 'makepayment';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
foreach ($arrayofselected as $toselectid) {
|
foreach ($arrayofselected as $toselectid) {
|
||||||
$errorpayment = 0;
|
$errorpayment = 0;
|
||||||
$facture = new Facture($db);
|
$facture = new Facture($db);
|
||||||
$result = $facture->fetch($toselectid);
|
$result = $facture->fetch($toselectid);
|
||||||
|
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($facture->error, 'errors');
|
setEventMessage($facture->error, 'errors');
|
||||||
$errorpayment++;
|
$errorpayment++;
|
||||||
} else {
|
} else {
|
||||||
if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == 1 && $facture->paye == 0) {
|
if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == Facture::STATUS_VALIDATED && $facture->paye == 0) {
|
||||||
$paiementAmount = $facture->getSommePaiement();
|
$paiementAmount = $facture->getSommePaiement();
|
||||||
$totalcreditnotes = $facture->getSumCreditNotesUsed();
|
$totalcreditnotes = $facture->getSumCreditNotesUsed();
|
||||||
$totaldeposits = $facture->getSumDepositsUsed();
|
$totaldeposits = $facture->getSumDepositsUsed();
|
||||||
@ -400,7 +411,7 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
|
|||||||
if ($remaintopay != 0) {
|
if ($remaintopay != 0) {
|
||||||
$resultBank = $facture->setBankAccount($bankid);
|
$resultBank = $facture->setBankAccount($bankid);
|
||||||
if ($resultBank < 0) {
|
if ($resultBank < 0) {
|
||||||
setEventMessage($facture->error, 'errors');
|
setEventMessages($facture->error, null, 'errors');
|
||||||
$errorpayment++;
|
$errorpayment++;
|
||||||
} else {
|
} else {
|
||||||
$paiement = new Paiement($db);
|
$paiement = new Paiement($db);
|
||||||
@ -410,12 +421,14 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
|
|||||||
$paiement->paiementid = $paiementid;
|
$paiement->paiementid = $paiementid;
|
||||||
$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');
|
$langs->load("errors");
|
||||||
|
setEventMessages($facture->ref.' '.$langs->trans($paiement->error), $paiement->errors, 'errors');
|
||||||
$errorpayment++;
|
$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');
|
$langs->load("errors");
|
||||||
|
setEventMessages($facture->ref.' '.$langs->trans($paiement->error), $paiement->errors, 'errors');
|
||||||
$errorpayment++;
|
$errorpayment++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -425,12 +438,17 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
|
|||||||
$errorpayment++;
|
$errorpayment++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
|
setEventMessage($langs->trans('BulkPaymentNotPossibleForInvoice', $facture->ref), 'warnings');
|
||||||
$errorpayment++;
|
$errorpayment++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($errorpayment)) {
|
if (empty($errorpayment)) {
|
||||||
setEventMessage($langs->trans('PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
|
setEventMessage($langs->trans('PaymentRegisteredAndInvoiceSetToPaid', $facture->ref));
|
||||||
|
$db->commit();
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1039,8 +1057,9 @@ if ($resql) {
|
|||||||
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||||
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||||
);
|
);
|
||||||
if ($user->rights->facture->paiement) {
|
|
||||||
$arrayofmassactions['makepayment'] = $langs->trans("RegisterPaymentAndClasiffiedPayed");
|
if (!empty($user->rights->facture->paiement)) {
|
||||||
|
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
|
||||||
}
|
}
|
||||||
if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
|
if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
|
||||||
$langs->load("withdrawals");
|
$langs->load("withdrawals");
|
||||||
@ -1097,12 +1116,12 @@ if ($resql) {
|
|||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// 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"), 'datenow' => 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' => '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("BankAccount"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)),
|
array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("BankAccount"), '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')).'">'),
|
||||||
);
|
);
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('RegisterPaymentAndClasiffiedPayed'), $langs->trans('RegisterPaymentAndClasiffiedPayed', $object->ref), 'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('MakePaymentAndClassifyPayed'), $langs->trans('EnterPaymentReceivedFromCustomer'), 'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -100,6 +100,8 @@ UPDATE llx_facture_fourn SET multicurrency_total_ht = -multicurrency_total_ht WH
|
|||||||
UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
|
UPDATE llx_facture_fourn SET multicurrency_total_tva = -multicurrency_total_tva WHERE ((multicurrency_total_tva < 0 and total_tva > 0) OR (multicurrency_total_tva > 0 and total_tva < 0));
|
||||||
UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
|
UPDATE llx_facture_fourn SET multicurrency_total_ttc = -multicurrency_total_ttc WHERE ((multicurrency_total_ttc < 0 and total_ttc > 0) OR (multicurrency_total_ttc > 0 and total_ttc < 0));
|
||||||
|
|
||||||
|
ALTER TABLE llx_propaldet ADD COLUMN import_key varchar(14);
|
||||||
|
|
||||||
|
|
||||||
-- v15
|
-- v15
|
||||||
|
|
||||||
|
|||||||
@ -607,3 +607,5 @@ SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s
|
|||||||
NoPaymentAvailable=No payment available for %s
|
NoPaymentAvailable=No payment available for %s
|
||||||
PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to paid
|
PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to paid
|
||||||
SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices
|
SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices
|
||||||
|
MakePaymentAndClassifyPayed=Record payment
|
||||||
|
BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status)
|
||||||
Loading…
Reference in New Issue
Block a user