浏览代码

Fix phpcs

Laurent Destailleur 1 年之前
父节点
当前提交
31ab27f631

+ 2 - 1
.php-cs-fixer.dist.php

@@ -3,6 +3,7 @@
 $finder = (new PhpCsFixer\Finder())
 	->in(__DIR__)
 	->exclude([
+		'custom',
 		'documents',
 		'htdocs/custom',
 		'htdocs/includes',
@@ -15,7 +16,7 @@ $finder = (new PhpCsFixer\Finder())
 return (new PhpCsFixer\Config())
 	->setRules([
 		// Apply PSR-12 as per https://wiki.dolibarr.org/index.php?title=Langages_et_normes#PHP:~:text=utiliser%20est%20le-,PSR%2D12,-(https%3A//www
-		// '@PSR12' => true,  // Disabled for now to limit number of changes
+		'@PSR12' => true,  // Disabled for now to limit number of changes
 
 		// Minimum version Dolibarr v18.0.0
 		// Compatibility with min 7.1 is announced with Dolibarr18.0 but

+ 3 - 3
scripts/bank/export-bank-receipts.php

@@ -177,7 +177,7 @@ if (!isset($num)) {
 }
 $sql .= " AND b.fk_account = ba.rowid";
 $sql .= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
-															 // print $sql;
+// print $sql;
 
 $resql = $db->query($sql);
 if ($resql) {
@@ -365,7 +365,7 @@ if ($resql) {
 		$debit = $credit = '';
 		if ($objp->amount < 0) {
 			$totald = $totald + abs($objp->amount);
-			$debit = price2num($objp->amount * - 1);
+			$debit = price2num($objp->amount * -1);
 		} else {
 			$totalc = $totalc + abs($objp->amount);
 			$credit = price2num($objp->amount);
@@ -411,7 +411,7 @@ if ($resql) {
 	}
 } else {
 	dol_print_error($db);
-	$ret = - 1;
+	$ret = -1;
 }
 
 $db->close();

+ 2 - 2
scripts/contracts/email_expire_services_to_customers.php

@@ -181,7 +181,7 @@ if ($resql) {
 			$outputlangs->loadLangs(array("main", "contracts", "bills", "products"));
 
 			if (dol_strlen($newemail)) {
-				$message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$outputlangs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency)."), ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n";
+				$message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$outputlangs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency)."), ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n";
 				dol_syslog("email_expire_services_to_customers.php: ".$newemail." ".$message);
 				$foundtoprocess++;
 			}
@@ -266,7 +266,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget,
 	$sendto = $oldemail;
 	$from = $conf->global->MAIN_MAIL_EMAIL_FROM;
 	$errorsto = $conf->global->MAIN_MAIL_ERRORS_TO;
-	$msgishtml = - 1;
+	$msgishtml = -1;
 
 	print "- Send email to '".$oldtarget."' (".$oldemail."), total: ".$total."\n";
 	dol_syslog("email_expire_services_to_customers.php: send mail to ".$oldemail);

+ 3 - 3
scripts/contracts/email_expire_services_to_representatives.php

@@ -136,7 +136,7 @@ if ($resql) {
 			$outputlangs->loadLangs(array("main", "contracts", "bills", "products"));
 
 			if (dol_strlen($obj->email)) {
-				$message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency).") ".$obj->name.", ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n";
+				$message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency).") ".$obj->name.", ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n";
 				dol_syslog("email_expire_services_to_representatives.php: ".$obj->email);
 				$foundtoprocess++;
 			}
@@ -215,7 +215,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget,
 	$sendto = $oldemail;
 	$from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM;
 	$errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO;
-	$msgishtml = - 1;
+	$msgishtml = -1;
 
 	print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n";
 	dol_syslog("email_expire_services_to_representatives.php: send mail to ".$oldemail);
@@ -236,7 +236,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget,
 		$allmessage .= $newlangs->transnoentities("NoteListOfYourExpiredServices").($usehtml ? "<br>\n" : "\n").($usehtml ? "<br>\n" : "\n");
 	}
 	$allmessage .= $message.($usehtml ? "<br>\n" : "\n");
-	$allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, - 1, $conf->currency).($usehtml ? "<br>\n" : "\n");
+	$allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, -1, $conf->currency).($usehtml ? "<br>\n" : "\n");
 	if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER')) {
 		$allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER;
 		if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER)) {

+ 1 - 1
scripts/emailings/mailing-send.php

@@ -137,7 +137,7 @@ if ($resql) {
 			$replyto = $emailing->email_replyto;
 			$errorsto = $emailing->email_errorsto;
 			// Le message est-il en html
-			$msgishtml = - 1; // Unknown by default
+			$msgishtml = -1; // Unknown by default
 			if (preg_match('/[\s\t]*<html>/i', $message)) {
 				$msgishtml = 1;
 			}

+ 3 - 3
scripts/invoices/email_unpaid_invoices_to_customers.php

@@ -184,7 +184,7 @@ if ($resql) {
 			$outputlangs->loadLangs(array("main", "bills"));
 
 			if (dol_strlen($newemail)) {
-				$message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency)."\n";
+				$message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency)."\n";
 				dol_syslog("email_unpaid_invoices_to_customers.php: ".$newemail." ".$message);
 				$foundtoprocess++;
 			}
@@ -258,7 +258,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
 	$sendto = $oldemail;
 	$from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM;
 	$errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO;
-	$msgishtml = - 1;
+	$msgishtml = -1;
 
 	print "- Send email to '".$oldtarget."' (".$oldemail."), total: ".$total."\n";
 	dol_syslog("email_unpaid_invoices_to_customers.php: send mail to ".$oldemail);
@@ -280,7 +280,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
 		$allmessage .= "Note: This list contains only unpaid invoices.".($usehtml ? "<br>\n" : "\n");
 	}
 	$allmessage .= $message.($usehtml ? "<br>\n" : "\n");
-	$allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, - 1, $conf->currency).($usehtml ? "<br>\n" : "\n");
+	$allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, -1, $conf->currency).($usehtml ? "<br>\n" : "\n");
 	if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER')) {
 		$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER;
 		if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) {

+ 3 - 3
scripts/invoices/email_unpaid_invoices_to_representatives.php

@@ -146,7 +146,7 @@ if ($resql) {
 			$outputlangs->loadLangs(array("main", "bills"));
 
 			if (dol_strlen($obj->email)) {
-				$message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency)." : ".$obj->name."\n";
+				$message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency)." : ".$obj->name."\n";
 				dol_syslog("email_unpaid_invoices_to_representatives.php: ".$obj->email);
 				$foundtoprocess++;
 			}
@@ -214,7 +214,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
 	$sendto = $oldemail;
 	$from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM;
 	$errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO;
-	$msgishtml = - 1;
+	$msgishtml = -1;
 
 	print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n";
 	dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to ".$oldemail);
@@ -235,7 +235,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget)
 		$allmessage .= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml ? "<br>\n" : "\n");
 	}
 	$allmessage .= $message.($usehtml ? "<br>\n" : "\n");
-	$allmessage .= $langs->trans("Total")." = ".price($total, 0, $newlangs, 0, 0, - 1, $conf->currency).($usehtml ? "<br>\n" : "\n");
+	$allmessage .= $langs->trans("Total")." = ".price($total, 0, $newlangs, 0, 0, -1, $conf->currency).($usehtml ? "<br>\n" : "\n");
 	if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER')) {
 		$allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER;
 		if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) {

+ 2 - 2
scripts/members/sync_members_ldap2dolibarr.php

@@ -225,7 +225,7 @@ if ($result >= 0) {
 			$member->public = 1;
 			$member->birth = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_BIRTHDATE')]);
 
-			$member->statut = - 1;
+			$member->statut = -1;
 			if (isset($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')])) {
 				$member->datec = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE')]);
 				$member->datevalid = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE')]);
@@ -263,7 +263,7 @@ if ($result >= 0) {
 				$datelast = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE')]);
 				$pricelast = price2num($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT')]);
 			} elseif ($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) {
-				$datelast = dol_time_plus_duree(dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION')]), - 1, 'y') + 60 * 60 * 24;
+				$datelast = dol_time_plus_duree(dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION')]), -1, 'y') + 60 * 60 * 24;
 				$pricelast = price2num($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT')]);
 
 				// Cas special ou date derniere <= date premiere

+ 1 - 1
scripts/user/sync_groups_ldap2dolibarr.php

@@ -181,7 +181,7 @@ if ($result >= 0) {
 					continue;
 				}
 				if (empty($userList[$userdn])) { // Récupération de l'utilisateur
-												 // Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement
+					// Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement
 					if (getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS') === 'memberUid') {
 						$userKey = array($userdn);
 					} else { // Pour les autres schémas, les membres sont listés sous forme de DN complets

+ 3 - 1
scripts/website/migrate-news-joomla2dolibarr.php

@@ -126,7 +126,9 @@ if ($blogpostfooter === false) {
 
 $db->begin();
 
-$i = 0; $nbimported = 0; $nbalreadyexists = 0;
+$i = 0;
+$nbimported = 0;
+$nbalreadyexists = 0;
 while ($obj = $dbjoomla->fetch_object($resql)) {
 	if ($obj) {
 		$i++;