Fix for credit transfer module

This commit is contained in:
Laurent Destailleur 2020-06-22 22:54:33 +02:00
parent a8c91069b2
commit 566c1aaf84
8 changed files with 182 additions and 64 deletions

View File

@ -29,11 +29,14 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (!$user->rights->facture->lire) accessforbidden(); if (!$user->rights->facture->lire) accessforbidden();
@ -44,14 +47,18 @@ $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); //
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$type = GETPOST('type', 'aZ09'); $type = GETPOST('type', 'aZ09');
$mode = GETPOST('mode', 'aZ09');
$fieldid = (!empty($ref) ? 'ref' : 'rowid'); $fieldid = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) $socid = $user->socid; if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
$object = new Facture($db); if ($mode == 'bank-transfer') {
$object = new FactureFournisseur($db);
} else {
$object = new Facture($db);
}
// Load object // Load object
if ($id > 0 || !empty($ref)) if ($id > 0 || !empty($ref))
@ -124,13 +131,20 @@ if (empty($reshook))
* View * View
*/ */
$form = new Form($db);
$now = dol_now(); $now = dol_now();
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders'); if ($mode == 'bank-transfer') {
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer');
$helpurl = "";
} else {
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
}
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);
$form = new Form($db);
/* *************************************************************************** */ /* *************************************************************************** */
/* */ /* */
@ -156,18 +170,33 @@ if ($object->id > 0)
if ($object->paye) $resteapayer = 0; if ($object->paye) $resteapayer = 0;
$resteapayeraffiche = $resteapayer; $resteapayeraffiche = $resteapayer;
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if ($mode == 'bank-transfer') {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else { $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; } else {
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')";
} $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')";
}
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount); $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount, 0, 1);
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote); $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote, 0, 1);
$absolute_discount = price2num($absolute_discount, 'MT'); $absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT');
} else {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
}
$absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
}
$author = new User($db); $author = new User($db);
if ($object->user_author) if ($object->user_author)
@ -175,20 +204,37 @@ if ($object->id > 0)
$author->fetch($object->user_author); $author->fetch($object->user_author);
} }
$head = facture_prepare_head($object); if ($mode == 'bank-transfer') {
$head = facturefourn_prepare_head($object);
} else {
$head = facture_prepare_head($object);
}
dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'), -1, 'bill'); dol_fiche_head($head, 'standingorders', $title, -1, 'bill');
// Invoice content // Invoice content
if ($mode == 'bank-transfer') {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
} else {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
}
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Ref customer // Ref customer
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); if ($mode == 'bank-transfer') {
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
} else {
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
}
// Thirdparty // Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
if ($mode == 'bank-transfer') {
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
} else {
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
}
// Project // Project
if (!empty($conf->projet->enabled)) if (!empty($conf->projet->enabled))
{ {
@ -239,15 +285,26 @@ if ($object->id > 0)
// Type // Type
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">';
print $object->getLibType(); print $object->getLibType();
if ($object->type == Facture::TYPE_REPLACEMENT) if ($object->module_source) {
print ' <span class="opacitymediumbycolor">('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')</span>';
}
if ($object->type == $object::TYPE_REPLACEMENT)
{ {
$facreplaced = new Facture($db); if ($mode == 'bank-transfer') {
$facreplaced = new FactureFournisseur($db);
} else {
$facreplaced = new Facture($db);
}
$facreplaced->fetch($object->fk_facture_source); $facreplaced->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')'; print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')';
} }
if ($object->type == Facture::TYPE_CREDIT_NOTE) if ($object->type == $object::TYPE_CREDIT_NOTE)
{ {
$facusing = new Facture($db); if ($mode == 'bank-transfer') {
$facusing = new FactureFournisseur($db);
} else {
$facusing = new Facture($db);
}
$facusing->fetch($object->fk_facture_source); $facusing->fetch($object->fk_facture_source);
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
} }
@ -261,7 +318,11 @@ if ($object->id > 0)
{ {
if ($i == 0) print ' '; if ($i == 0) print ' ';
else print ','; else print ',';
$facavoir = new Facture($db); if ($mode == 'bank-transfer') {
$facavoir = new FactureFournisseur($db);
} else {
$facavoir = new Facture($db);
}
$facavoir->fetch($id); $facavoir->fetch($id);
print $facavoir->getNomUrl(1); print $facavoir->getNomUrl(1);
} }
@ -280,24 +341,39 @@ if ($object->id > 0)
// Discounts // Discounts
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
$thirdparty = $object->thirdparty; if ($mode == 'bank-transfer') {
$discount_type = 0; //$societe = new Fournisseur($db);
//$result = $societe->fetch($object->socid);
$thirdparty = $object->thirdparty;
$discount_type = 1;
} else {
$thirdparty = $object->thirdparty;
$discount_type = 0;
}
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id); $backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
$cannotApplyDiscount = 1; $cannotApplyDiscount = 1;
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
print '</td></tr>'; print '</td></tr>';
// Label
if ($mode == 'bank-transfer') {
print '<tr>';
print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, 0).'</td>';
print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, 0).'</td>';
print '</tr>';
}
// Date invoice // Date invoice
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>'; print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateInvoice'); print $langs->trans('DateInvoice');
print '</td>'; print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE) if ($object->type != $object::TYPE_CREDIT_NOTE)
{ {
if ($action == 'editinvoicedate') if ($action == 'editinvoicedate')
{ {
@ -305,12 +381,12 @@ if ($object->id > 0)
} }
else else
{ {
print dol_print_date($object->date, 'daytext'); print dol_print_date($object->date, 'day');
} }
} }
else else
{ {
print dol_print_date($object->date, 'daytext'); print dol_print_date($object->date, 'day');
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -320,10 +396,10 @@ if ($object->id > 0)
print '<table class="nobordernopadding centpercent"><tr><td>'; print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentConditionsShort'); print $langs->trans('PaymentConditionsShort');
print '</td>'; print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE) if ($object->type != $object::TYPE_CREDIT_NOTE)
{ {
if ($action == 'editconditions') if ($action == 'editconditions')
{ {
@ -345,18 +421,23 @@ if ($object->id > 0)
print '<table class="nobordernopadding centpercent"><tr><td>'; print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateMaxPayment'); print $langs->trans('DateMaxPayment');
print '</td>'; print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>'; if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($object->type != Facture::TYPE_CREDIT_NOTE) if ($object->type != $object::TYPE_CREDIT_NOTE)
{ {
$duedate = $object->date_lim_reglement;
if ($mode == 'bank-transfer') {
$duedate = $object->date_echeance;
}
if ($action == 'editpaymentterm') if ($action == 'editpaymentterm')
{ {
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm'); $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm');
} }
else else
{ {
print dol_print_date($object->date_lim_reglement, 'daytext'); print dol_print_date($duedate, 'day');
if ($object->hasDelay()) { if ($object->hasDelay()) {
print img_warning($langs->trans('Late')); print img_warning($langs->trans('Late'));
} }
@ -559,8 +640,13 @@ if ($object->id > 0)
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
$buttonlabel = $langs->trans("MakeWithdrawRequest");
if ($mode == 'bank-transfer') {
$buttonlabel = $langs->trans("MakeBankTransferOrder");
}
// Add a transfer request // Add a transfer request
if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0) if ($object->statut > $object::STATUS_DRAFT && $object->paye == 0 && $num == 0)
{ {
if ($resteapayer > 0) if ($resteapayer > 0)
{ {
@ -572,36 +658,39 @@ if ($object->id > 0)
print '<input type="hidden" name="token" value="'.newToken().'" />'; print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="id" value="'.$object->id.'" />'; print '<input type="hidden" name="id" value="'.$object->id.'" />';
print '<input type="hidden" name="action" value="new" />'; print '<input type="hidden" name="action" value="new" />';
print '<label for="withdraw_request_amount">'.$langs->trans('WithdrawRequestAmount').' </label>'; print '<label for="withdraw_request_amount">'.$langs->trans('BankTransferAmount').' </label>';
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />'; print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />'; print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
print '</form>'; print '</form>';
} }
else else
{ {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$buttonlabel.'</a>';
} }
} }
else else
{ {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$buttonlabel.'</a>';
} }
} }
else else
{ {
if ($num == 0) if ($num == 0)
{ {
if ($object->statut > Facture::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$langs->trans("MakeWithdrawRequest").'</a>'; if ($object->statut > $object::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$buttonlabel.'</a>';
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$langs->trans("MakeWithdrawRequest").'</a>'; else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("Draft")).'">'.$buttonlabel.'</a>';
} }
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$langs->trans("MakeWithdrawRequest").'</a>'; else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("RequestAlreadyDone")).'">'.$buttonlabel.'</a>';
} }
print "</div><br>\n"; print "</div><br>\n";
print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments").'</div><br>'; if ($mode == 'bank-transfer') {
print '<div class="opacitymedium">'.$langs->trans("DoCreditTransferBeforePayments").'</div><br>';
} else {
print '<div class="opacitymedium">'.$langs->trans("DoStandingOrdersBeforePayments").'</div><br>';
}
/* /*
* Withdrawals * Withdrawals
@ -614,7 +703,11 @@ if ($object->id > 0)
print '<td class="left">'.$langs->trans("DateRequest").'</td>'; print '<td class="left">'.$langs->trans("DateRequest").'</td>';
print '<td class="center">'.$langs->trans("User").'</td>'; print '<td class="center">'.$langs->trans("User").'</td>';
print '<td class="center">'.$langs->trans("Amount").'</td>'; print '<td class="center">'.$langs->trans("Amount").'</td>';
print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>'; if ($mode == 'bank-transfer') {
print '<td class="center">'.$langs->trans("BankTransferReceipt").'</td>';
} else {
print '<td class="center">'.$langs->trans("WithdrawalReceipt").'</td>';
}
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td class="center">'.$langs->trans("DateProcess").'</td>'; print '<td class="center">'.$langs->trans("DateProcess").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';

View File

@ -53,6 +53,28 @@ function facturefourn_prepare_head($object)
$h++; $h++;
} }
//if ($fac->mode_reglement_code == 'PRE')
if (!empty($conf->paymentbybanktransfer->enabled))
{
$nbStandingOrders = 0;
$sql = "SELECT COUNT(pfd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE pfd.fk_facture_fourn = ".$object->id;
$sql .= " AND pfd.ext_payment_id IS NULL";
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj) $nbStandingOrders = $obj->nb;
}
else dol_print_error($db);
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&mode=bank-transfer';
$head[$h][1] = $langs->trans('BankTransfer');
if ($nbStandingOrders > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbStandingOrders.'</span>';
$head[$h][2] = 'standingorders';
$h++;
}
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -55,7 +55,6 @@ function facture_prepare_head($object)
$h++; $h++;
} }
//if ($fac->mode_reglement_code == 'PRE')
if (!empty($conf->prelevement->enabled)) if (!empty($conf->prelevement->enabled))
{ {
$nbStandingOrders = 0; $nbStandingOrders = 0;

View File

@ -2559,14 +2559,6 @@ else
// Date // Date
print '<tr><td>'.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker'); print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker');
print '</td>';
// Due date
print '<tr><td>'.$form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker');
if ($action != 'editdate_lim_reglement' && $object->hasDelay()) {
print img_warning($langs->trans('Late'));
}
print '</td>'; print '</td>';
// Default terms of the settlement // Default terms of the settlement
@ -2591,6 +2583,14 @@ else
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
// Due date
print '<tr><td>'.$form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker');
if ($action != 'editdate_lim_reglement' && $object->hasDelay()) {
print img_warning($langs->trans('Late'));
}
print '</td>';
// Mode of payment // Mode of payment
$langs->load('bills'); $langs->load('bills');
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';

View File

@ -193,7 +193,7 @@ if ($id > 0 || !empty($ref))
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfield">';
// Type // Type
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="4">'; print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="4">';

View File

@ -17,7 +17,8 @@
-- along with this program. If not, see <https://www.gnu.org/licenses/>. -- along with this program. If not, see <https://www.gnu.org/licenses/>.
-- --
-- --
-- Actions commerciales -- Table of events and actions (past and to do).
-- This is also the table to track events on other Dolibarr objects.
-- ======================================================================== -- ========================================================================
create table llx_actioncomm create table llx_actioncomm
@ -40,7 +41,7 @@ create table llx_actioncomm
fk_soc integer, fk_soc integer,
fk_contact integer, fk_contact integer,
fk_parent integer NOT NULL default 0, fk_parent integer NOT NULL default 0,
fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into another table) fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into table 'actioncomm_resources')
fk_user_done integer, -- user id of user that has made action (deprecated) fk_user_done integer, -- user id of user that has made action (deprecated)
transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources. transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources.

View File

@ -105,8 +105,8 @@ SupplierInvoicePayment=Vendor payment
SubscriptionPayment=Subscription payment SubscriptionPayment=Subscription payment
WithdrawalPayment=Debit payment order WithdrawalPayment=Debit payment order
SocialContributionPayment=Social/fiscal tax payment SocialContributionPayment=Social/fiscal tax payment
BankTransfer=Bank transfer BankTransfer=Credit transfer
BankTransfers=Bank transfers BankTransfers=Credit transfers
MenuBankInternalTransfer=Internal transfer MenuBankInternalTransfer=Internal transfer
TransferDesc=Transfer from one account to another, Dolibarr will write two records (a debit in source account and a credit in target account). The same amount (except sign), label and date will be used for this transaction) TransferDesc=Transfer from one account to another, Dolibarr will write two records (a debit in source account and a credit in target account). The same amount (except sign), label and date will be used for this transaction)
TransferFrom=From TransferFrom=From

View File

@ -40,6 +40,7 @@ CreditTransferStatistics=Credit transfer statistics
Rejects=Rejects Rejects=Rejects
LastWithdrawalReceipt=Latest %s direct debit receipts LastWithdrawalReceipt=Latest %s direct debit receipts
MakeWithdrawRequest=Make a direct debit payment request MakeWithdrawRequest=Make a direct debit payment request
MakeBankTransferOrder=Make a credit transfer request
WithdrawRequestsDone=%s direct debit payment requests recorded WithdrawRequestsDone=%s direct debit payment requests recorded
ThirdPartyBankCode=Third-party bank code ThirdPartyBankCode=Third-party bank code
NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode <strong>%s</strong>. NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode <strong>%s</strong>.
@ -93,6 +94,7 @@ WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your cou
ShowWithdraw=Show Direct Debit Order ShowWithdraw=Show Direct Debit Order
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management. IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management.
DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Credit transfer orders to manage the credit transfer payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
WithdrawalFile=Withdrawal file WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent" SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null
@ -103,6 +105,7 @@ RUMLong=Unique Mandate Reference
RUMWillBeGenerated=If empty, a UMR (Unique Mandate Reference) will be generated once the bank account information is saved. RUMWillBeGenerated=If empty, a UMR (Unique Mandate Reference) will be generated once the bank account information is saved.
WithdrawMode=Direct debit mode (FRST or RECUR) WithdrawMode=Direct debit mode (FRST or RECUR)
WithdrawRequestAmount=Amount of Direct debit request: WithdrawRequestAmount=Amount of Direct debit request:
BankTransferAmount=Amount of Credit Transfer request:
WithdrawRequestErrorNilAmount=Unable to create direct debit request for empty amount. WithdrawRequestErrorNilAmount=Unable to create direct debit request for empty amount.
SepaMandate=SEPA Direct Debit Mandate SepaMandate=SEPA Direct Debit Mandate
SepaMandateShort=SEPA Mandate SepaMandateShort=SEPA Mandate