Browse Source

Debug v18

Laurent Destailleur 1 năm trước cách đây
mục cha
commit
544819fb60

+ 11 - 11
scripts/contracts/email_expire_services_to_customers.php

@@ -149,7 +149,7 @@ if ($resql) {
 			if ($startbreak) {
 				// Break onto sales representative (new email or cid)
 				if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) {
-					envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value);
+					sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value);
 					$trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid;
 				} else {
 					if ($oldemail != 'none') {
@@ -203,7 +203,7 @@ if ($resql) {
 		// Si il reste des envois en buffer
 		if ($foundtoprocess) {
 			if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { // Break onto email (new email)
-				envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value);
+				sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, $duration_value);
 				$trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid;
 			} else {
 				if ($oldemail != 'none') {
@@ -230,16 +230,16 @@ if ($resql) {
 /**
  * Send email
  *
- * @param string $mode			Mode (test | confirm)
- * @param string $oldemail		Target email
- * @param string $message		Message to send
- * @param string $total			Total amount of unpayed invoices
- * @param string $userlang		Code lang to use for email output.
- * @param string $oldtarget		Target name
- * @param int $duration_value	duration value
- * @return int 					<0 if KO, >0 if OK
+ * @param string 	$mode				Mode (test | confirm)
+ * @param string 	$oldemail			Target email
+ * @param string 	$message			Message to send
+ * @param string 	$total				Total amount of unpayed invoices
+ * @param string 	$userlang			Code lang to use for email output.
+ * @param string 	$oldtarget			Target name
+ * @param int 		$duration_value		duration value
+ * @return int 							<0 if KO, >0 if OK
  */
-function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget, $duration_value)
+function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $duration_value)
 {
 	global $conf, $langs;
 

+ 12 - 12
scripts/contracts/email_expire_services_to_representatives.php

@@ -109,7 +109,7 @@ if ($resql) {
 			if (($obj->email != $oldemail || $obj->uid != $olduid) || $oldemail == 'none') {
 				// Break onto sales representative (new email or uid)
 				if (dol_strlen($oldemail) && $oldemail != 'none') {
-					envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative, $duration_value);
+					sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative, $duration_value);
 				} else {
 					if ($oldemail != 'none') {
 						print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n";
@@ -157,7 +157,7 @@ if ($resql) {
 		// Si il reste des envois en buffer
 		if ($foundtoprocess) {
 			if (dol_strlen($oldemail) && $oldemail != 'none') { // Break onto email (new email)
-				envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative, $duration_value);
+				sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative, $duration_value);
 			} else {
 				if ($oldemail != 'none') {
 					print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n";
@@ -179,16 +179,16 @@ if ($resql) {
 /**
  * Send email
  *
- * @param string $mode					Mode (test | confirm)
- * @param string $oldemail				Old email
- * @param string $message				Message to send
- * @param string $total					Total amount of unpayed invoices
- * @param string $userlang				Code lang to use for email output.
- * @param string $oldsalerepresentative	Old sale representative
- * @param int $duration_value			Duration value
- * @return int 							<0 if KO, >0 if OK
+ * @param string 	$mode					Mode (test | confirm)
+ * @param string 	$oldemail				Target Email
+ * @param string 	$message				Message to send
+ * @param string 	$total					Total amount of unpayed invoices
+ * @param string 	$userlang				Code lang to use for email output.
+ * @param string 	$oldtarget				Target name of sale representative
+ * @param int 		$duration_value			Duration value
+ * @return int 								<0 if KO, >0 if OK
  */
-function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldsalerepresentative, $duration_value)
+function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $duration_value)
 {
 	global $conf, $langs;
 
@@ -217,7 +217,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldsalerepre
 	$errorsto = empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '' : $conf->global->MAIN_MAIL_ERRORS_TO;
 	$msgishtml = - 1;
 
-	print "- Send email for ".$oldsalerepresentative." (".$oldemail."), total: ".$total."\n";
+	print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n";
 	dol_syslog("email_expire_services_to_representatives.php: send mail to ".$oldemail);
 
 	$usehtml = 0;

+ 6 - 4
scripts/invoices/email_unpaid_invoices_to_representatives.php

@@ -106,10 +106,12 @@ if ($resql) {
 	$oldlang = '';
 	$total = 0;
 	$foundtoprocess = 0;
+
 	print "We found ".$num." couples (unpayed validated invoice - sale representative) qualified\n";
 	dol_syslog("We found ".$num." couples (unpayed validated invoice - sale representative) qualified");
 	$message = '';
 	$oldsalerepresentative = 0;
+
 	if ($num) {
 		while ($i < $num) {
 			$obj = $db->fetch_object($resql);
@@ -188,14 +190,14 @@ if ($resql) {
  * Send email
  *
  * @param string $mode						Mode (test | confirm)
- * @param string $oldemail					Old email
+ * @param string $oldemail					Target email
  * @param string $message					Message to send
  * @param string $total						Total amount of unpayed invoices
  * @param string $userlang					Code lang to use for email output.
- * @param string $oldsalerepresentative		Old sale representative
+ * @param string $oldtarget					Target name of sale representative
  * @return int 								<0 if KO, >0 if OK
  */
-function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldsalerepresentative)
+function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
 {
 	global $conf, $langs;
 
@@ -214,7 +216,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldsalerepre
 	$errorsto = empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '' : $conf->global->MAIN_MAIL_ERRORS_TO;
 	$msgishtml = - 1;
 
-	print "- Send email for ".$oldsalerepresentative." (".$oldemail."), total: ".$total."\n";
+	print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n";
 	dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to ".$oldemail);
 
 	$usehtml = 0;

+ 6 - 6
scripts/invoices/rebuild_merge_pdf.php

@@ -63,7 +63,7 @@ dol_syslog($script_file." launched with arg ".join(',', $argv));
 
 // Check parameters
 if (!isset($argv[1])) {
-	usage();
+	rebuild_merge_pdf_usage();
 	exit(-1);
 }
 
@@ -208,23 +208,23 @@ foreach ($argv as $key => $value) {
 	}
 
 	if (!$found && preg_match('/filter=/i', $value)) {
-		usage();
+		rebuild_merge_pdf_usage();
 		exit(-1);
 	}
 }
 
 // Check if an option and a filter has been provided
 if (empty($option) && count($filter) <= 0) {
-	usage();
+	rebuild_merge_pdf_usage();
 	exit(-1);
 }
 // Check if there is no uncompatible choice
 if (in_array('payments', $filter) && in_array('nopayment', $filter)) {
-	usage();
+	rebuild_merge_pdf_usage();
 	exit(-1);
 }
 if (in_array('bank', $filter) && in_array('nopayment', $filter)) {
-	usage();
+	rebuild_merge_pdf_usage();
 	exit(-1);
 }
 
@@ -251,7 +251,7 @@ exit($error);
  *
  * @return void
  */
-function usage()
+function rebuild_merge_pdf_usage()
 {
 	global $script_file;