Skip to content
Snippets Groups Projects
Commit f6b3bbd8 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Can set date of payment for autocreate invoice/payment when creating a foundation subscription.

parent 660e4b40
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,8 @@ $Id$ ...@@ -5,6 +5,8 @@ $Id$
***** ChangeLog for 3.1 compared to 3.0 ***** ***** ChangeLog for 3.1 compared to 3.0 *****
For users: For users:
- New: Can set date of payment for autocreate invoice/payment when
creating a foundation subscription.
- New: task #10969 : Add checkbox to close automatically invoice to "payed" - New: task #10969 : Add checkbox to close automatically invoice to "payed"
- New: Can edit note of payment. - New: Can edit note of payment.
- New: Login is not mandatory in member module. - New: Login is not mandatory in member module.
......
...@@ -185,6 +185,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ ...@@ -185,6 +185,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
// Subscription informations // Subscription informations
$datecotisation=0; $datecotisation=0;
$datesubend=0; $datesubend=0;
$paymentdate=0;
if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"])
{ {
$datecotisation=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datecotisation=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
...@@ -200,6 +201,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ ...@@ -200,6 +201,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$cotisation=$_POST["cotisation"]; // Amount of subscription $cotisation=$_POST["cotisation"]; // Amount of subscription
$label=$_POST["label"]; $label=$_POST["label"];
// Payment informations
$accountid=$_POST["accountid"];
$operation=$_POST["operation"]; // Payment mode
$num_chq=$_POST["num_chq"];
$emetteur_nom=$_POST["chqemetteur"];
$emetteur_banque=$_POST["chqbank"];
$option=$_POST["paymentsave"];
if (empty($option)) $option='none';
// Check parameters
if (! $datecotisation) if (! $datecotisation)
{ {
$error++; $error++;
...@@ -210,15 +221,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ ...@@ -210,15 +221,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
{ {
$datesubend=dol_time_plus_duree(dol_time_plus_duree($datecotisation,$defaultdelay,$defaultdelayunit),-1,'d'); $datesubend=dol_time_plus_duree(dol_time_plus_duree($datecotisation,$defaultdelay,$defaultdelayunit),-1,'d');
} }
if (($option == 'bankviainvoice' || $option == 'bankdirect') && ! $paymentdate)
// Payment informations {
$accountid=$_POST["accountid"]; $error++;
$operation=$_POST["operation"]; // Payment mode $errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
$num_chq=$_POST["num_chq"]; $action='addsubscription';
$emetteur_nom=$_POST["chqemetteur"]; }
$emetteur_banque=$_POST["chqbank"];
$option=$_POST["paymentsave"];
if (empty($option)) $option='none';
// Check if a payment is mandatory or not // Check if a payment is mandatory or not
if (! $error && $adht->cotisation) // Type adherent soumis a cotisation if (! $error && $adht->cotisation) // Type adherent soumis a cotisation
...@@ -271,7 +279,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ ...@@ -271,7 +279,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$acct=new Account($db); $acct=new Account($db);
$result=$acct->fetch($accountid); $result=$acct->fetch($accountid);
$dateop=dol_now(); $dateop=$paymentdate;
$insertid=$acct->addline($dateop, $operation, $label, $cotisation, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); $insertid=$acct->addline($dateop, $operation, $label, $cotisation, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
if ($insertid > 0) if ($insertid > 0)
...@@ -353,7 +361,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ ...@@ -353,7 +361,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
// Validate invoice // Validate invoice
$result=$invoice->validate($user); $result=$invoice->validate($user);
// Add payment on invoice // Add payment onto invoice
if ($option == 'bankviainvoice' && $accountid) if ($option == 'bankviainvoice' && $accountid)
{ {
require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
...@@ -363,7 +371,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ ...@@ -363,7 +371,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
// Creation de la ligne paiement // Creation de la ligne paiement
$amounts[$invoice->id] = price2num($cotisation); $amounts[$invoice->id] = price2num($cotisation);
$paiement = new Paiement($db); $paiement = new Paiement($db);
$paiement->datepaye = $datecotisation; $paiement->datepaye = $paymentdate;
$paiement->amounts = $amounts; $paiement->amounts = $amounts;
$paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement'); $paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement');
$paiement->num_paiement = $num_chq; $paiement->num_paiement = $num_chq;
......
...@@ -211,6 +211,7 @@ DateProcess=Process date ...@@ -211,6 +211,7 @@ DateProcess=Process date
DatePlanShort=Date planed DatePlanShort=Date planed
DateRealShort=Date real. DateRealShort=Date real.
DateBuild=Report build date DateBuild=Report build date
DatePayment=Date of payment
DurationYear=year DurationYear=year
DurationMonth=month DurationMonth=month
DurationWeek=week DurationWeek=week
......
...@@ -210,6 +210,7 @@ DateProcess=Date traitement ...@@ -210,6 +210,7 @@ DateProcess=Date traitement
DatePlanShort=Date planif. DatePlanShort=Date planif.
DateRealShort=Date réal. DateRealShort=Date réal.
DateBuild=Date génération du rapport DateBuild=Date génération du rapport
DatePayment=Date paiement
DurationYear=an DurationYear=an
DurationMonth=mois DurationMonth=mois
DurationWeek=semaine DurationWeek=semaine
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment