Browse Source

Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 17.0

daraelmin 1 year ago
parent
commit
2ce3ececfb
2 changed files with 8 additions and 6 deletions
  1. 5 3
      htdocs/adherents/subscription.php
  2. 3 3
      htdocs/public/payment/paymentok.php

+ 5 - 3
htdocs/adherents/subscription.php

@@ -80,9 +80,6 @@ $extrafields->fetch_name_optionals_label($object->table_element);
 
 $errmsg = '';
 
-$defaultdelay = 1;
-$defaultdelayunit = 'y';
-
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
 $hookmanager->initHooks(array('subscription'));
 
@@ -212,6 +209,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
 	// Subscription informations
 	$datesubscription = 0;
 	$datesubend = 0;
+	$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
+	$defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y';
 	$paymentdate = ''; // Do not use 0 here, default value is '' that means not filled where 0 means 1970-01-01
 	if (GETPOST("reyear", "int") && GETPOST("remonth", "int") && GETPOST("reday", "int")) {
 		$datesubscription = dol_mktime(0, 0, 0, GETPOST("remonth", "int"), GETPOST("reday", "int"), GETPOST("reyear", "int"));
@@ -470,6 +469,9 @@ if ($rowid > 0) {
 
 	$adht->fetch($object->typeid);
 
+	$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
+	$defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y';
+
 	$head = member_prepare_head($object);
 
 	$rowspan = 10;

+ 3 - 3
htdocs/public/payment/paymentok.php

@@ -398,9 +398,6 @@ if ($ispaymentok) {
 		// Create complementary actions (this include creation of thirdparty)
 		// Send confirmation email
 
-		$defaultdelay = 1;
-		$defaultdelayunit = 'y';
-
 		// Record subscription
 		include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
 		include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
@@ -411,6 +408,9 @@ if ($ispaymentok) {
 		$result1 = $object->fetch((int) $tmptag['MEM']);
 		$result2 = $adht->fetch($object->typeid);
 
+		$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
+		$defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y';
+
 		dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment');
 
 		if ($result1 > 0 && $result2 > 0) {