diff --git a/ChangeLog b/ChangeLog index 8f8467ddc715741841cd8f49f5501c509e54800b..f239a0eba3143bef56ed9574bbd1e16fa395b186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ $Id$ ***** ChangeLog for 3.1 compared to 3.0 ***** 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: Can edit note of payment. - New: Login is not mandatory in member module. diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 51794f67f2210d45c4be6c0210b8a370716babee..22ec7827cad7e366b95f04fcd09d421e56ceb831 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -185,6 +185,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ // Subscription informations $datecotisation=0; $datesubend=0; + $paymentdate=0; if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"]) { $datecotisation=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); @@ -200,6 +201,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $cotisation=$_POST["cotisation"]; // Amount of subscription $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) { $error++; @@ -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'); } - - // 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'; + if (($option == 'bankviainvoice' || $option == 'bankdirect') && ! $paymentdate) + { + $error++; + $errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")); + $action='addsubscription'; + } // Check if a payment is mandatory or not if (! $error && $adht->cotisation) // Type adherent soumis a cotisation @@ -271,7 +279,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $acct=new Account($db); $result=$acct->fetch($accountid); - $dateop=dol_now(); + $dateop=$paymentdate; $insertid=$acct->addline($dateop, $operation, $label, $cotisation, $num_chq, '', $user, $emetteur_nom, $emetteur_banque); if ($insertid > 0) @@ -353,7 +361,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ // Validate invoice $result=$invoice->validate($user); - // Add payment on invoice + // Add payment onto invoice if ($option == 'bankviainvoice' && $accountid) { require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); @@ -363,7 +371,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ // Creation de la ligne paiement $amounts[$invoice->id] = price2num($cotisation); $paiement = new Paiement($db); - $paiement->datepaye = $datecotisation; + $paiement->datepaye = $paymentdate; $paiement->amounts = $amounts; $paiement->paiementid = dol_getIdFromCode($db,$operation,'c_paiement'); $paiement->num_paiement = $num_chq; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 23ded6670c0e7fcc14179e7ea2937619f5d6e784..1ccab42a71871dc3402ec3981a1c443fbc6a4a4c 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -211,6 +211,7 @@ DateProcess=Process date DatePlanShort=Date planed DateRealShort=Date real. DateBuild=Report build date +DatePayment=Date of payment DurationYear=year DurationMonth=month DurationWeek=week diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 81a0ac85096bd21dcf33d5a343d8d3780c5f0616..c2bdb10f601dec7eb47e0346021c0c0dfabc9b17 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -210,6 +210,7 @@ DateProcess=Date traitement DatePlanShort=Date planif. DateRealShort=Date réal. DateBuild=Date génération du rapport +DatePayment=Date paiement DurationYear=an DurationMonth=mois DurationWeek=semaine