Skip to content

Commit

Permalink
New : can define RUM date on third bank account
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-maxime committed Jul 28, 2019
1 parent 9f7d118 commit be6ad7b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion htdocs/langs/en_US/withdrawals.lang
Expand Up @@ -76,7 +76,8 @@ WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also record payments to invoices and will classify them as "Paid" if remain to pay is null
StatisticsByLineStatus=Statistics by status of lines
RUM=UMR
RUM=Unique Mandate Reference (UMR)
DateRUM=Mandate signature date
RUMLong=Unique Mandate Reference
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)
Expand Down
5 changes: 3 additions & 2 deletions htdocs/societe/class/companybankaccount.class.php
Expand Up @@ -46,7 +46,7 @@ class CompanyBankAccount extends Account
* @var integer
*/
public $datec;

/**
* Date modification record (tms)
*
Expand Down Expand Up @@ -217,7 +217,7 @@ public function fetch($id, $socid = 0, $default = 1, $type = 'ban')
if (empty($id) && empty($socid)) return -1;

$sql = "SELECT rowid, type, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
$sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur";
$sql.= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur, date_rum";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
if ($id) $sql.= " WHERE rowid = ".$id;
if ($socid)
Expand Down Expand Up @@ -255,6 +255,7 @@ public function fetch($id, $socid = 0, $default = 1, $type = 'ban')
$this->datem = $this->db->jdate($obj->datem);
$this->rum = $obj->rum;
$this->frstrecur = $obj->frstrecur;
$this->date_rum = $this->db->jdate($obj->date_rum);
}
$this->db->free($resql);

Expand Down
18 changes: 14 additions & 4 deletions htdocs/societe/paymentmodes.php
Expand Up @@ -157,9 +157,13 @@
$companybankaccount->owner_address = GETPOST('owner_address', 'alpha');
$companybankaccount->frstrecur = GETPOST('frstrecur', 'alpha');
$companybankaccount->rum = GETPOST('rum', 'alpha');
$companybankaccount->date_rum = dol_mktime(0,0,0, GETPOST('date_rummonth'),GETPOST('date_rumday'),GETPOST('date_rumyear'));
if (empty($companybankaccount->rum))
{
$companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id);
}
if (empty($companybankaccount->date_rum))
{
$companybankaccount->date_rum = dol_now();
}

Expand Down Expand Up @@ -268,6 +272,7 @@
$companybankaccount->owner_address = GETPOST('owner_address', 'alpha');
$companybankaccount->frstrecur = GETPOST('frstrecur');
$companybankaccount->rum = GETPOST('rum', 'alpha');
$companybankaccount->date_rum = dol_mktime(0,0,0, GETPOST('date_rummonth'),GETPOST('date_rumday'),GETPOST('date_rumyear'));
$companybankaccount->datec = dol_now();
$companybankaccount->status = 1;

Expand Down Expand Up @@ -1208,6 +1213,7 @@
if (! empty($conf->prelevement->enabled))
{
print_liste_field_titre("RUM");
print_liste_field_titre("DateRUM");
print_liste_field_titre("WithdrawMode");
}
print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center ');
Expand Down Expand Up @@ -1257,8 +1263,6 @@
if (! empty($rib->iban)) {
if (! checkIbanForAccount($rib)) {
print ' '.img_picto($langs->trans("IbanNotValid"), 'warning');
} else {
print ' '.img_picto($langs->trans("IbanValid"), 'info');
}
}
print '</td>';
Expand All @@ -1267,8 +1271,6 @@
if (! empty($rib->bic)) {
if (! checkSwiftForAccount($rib)) {
print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning');
} else {
print ' '.img_picto($langs->trans("SwiftValid"), 'info');
}
}
print '</td>';
Expand All @@ -1279,6 +1281,8 @@
//print '<td>'.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).'</td>';
print '<td>'.$rib->rum.'</td>';

print '<td>'.dol_print_date($rib->date_rum, 'day').'</td>';

// FRSTRECUR
print '<td>'.$rib->frstrecur.'</td>';
}
Expand Down Expand Up @@ -1531,6 +1535,9 @@
print '<tr><td class="titlefield">'.$langs->trans("RUM").'</td>';
print '<td><input class="minwidth300" type="text" name="rum" value="'.dol_escape_htmltag($companybankaccount->rum).'"></td></tr>';

print '<tr><td class="titlefield">'.$langs->trans("DateRUM").'</td>';
print '<td>'.$form->selectDate(GETPOST('date_rum')?GETPOST('date_rum'):$companybankaccount->date_rum, 'date_rum', 0,0,1, 'date_rum').'</td></tr>';

print '<tr><td>'.$langs->trans("WithdrawMode").'</td><td>';
$tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR"));
print $form->selectarray("frstrecur", $tblArraychoice, dol_escape_htmltag(GETPOST('frstrecur', 'alpha')?GETPOST('frstrecur', 'alpha'):$companybankaccount->frstrecur), 0);
Expand Down Expand Up @@ -1675,6 +1682,9 @@
print '<tr><td class="titlefieldcreate">'.$langs->trans("RUM").'</td>';
print '<td colspan="4"><input type="text" class="minwidth300" name="rum" value="'.GETPOST('rum', 'alpha').'"> <div class="opacitymedium">'.$langs->trans("RUMWillBeGenerated").'</div></td></tr>';

print '<tr><td class="titlefieldcreate">'.$langs->trans("DateRUM").'</td>';
print '<td colspan="4">'.$form->selectDate(GETPOST('date_rum'), 'date_rum', 0,0,1, 'date_rum').'</td></tr>';

print '<tr><td>'.$langs->trans("WithdrawMode").'</td><td>';
$tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR"));
print $form->selectarray("frstrecur", $tblArraychoice, (isset($_POST['frstrecur'])?GETPOST('frstrecur'):'FRST'), 0);
Expand Down

0 comments on commit be6ad7b

Please sign in to comment.