浏览代码

add new rule

Frédéric FRANCE 5 年之前
父节点
当前提交
d9f42f85d1

+ 2 - 4
dev/initdata/generate-invoice.php

@@ -179,12 +179,10 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
 		if ($result)
 		{
 			print " OK with ref ".$object->ref."\n";;
-		}
-		else {
+		} else {
 			dol_print_error($db, $object->error);
 		}
-	}
-	else {
+	} else {
 		dol_print_error($db, $object->error);
 	}
 }

+ 4 - 8
dev/initdata/generate-order.php

@@ -124,8 +124,7 @@ if ($resql) {
         $row = $db->fetch_row($resql);
         $societesid[$i] = $row[0];
     }
-}
-else { print "err"; }
+} else { print "err"; }
 
 $commandesid = array();
 $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande";
@@ -138,8 +137,7 @@ if ($resql) {
         $row = $db->fetch_row($resql);
         $commandesid[$i] = $row[0];
     }
-}
-else { print "err"; }
+} else { print "err"; }
 
 $prodids = array();
 $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1";
@@ -206,14 +204,12 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
         {
             $db->commit();
             print " OK with ref ".$object->ref."\n";
-        }
-        else {
+        } else {
             print " KO\n";
             $db->rollback();
             dol_print_error($db, $object->error);
         }
-    }
-    else {
+    } else {
         print " KO\n";
         $db->rollback();
         dol_print_error($db, $object->error);

+ 2 - 4
dev/initdata/generate-proposal.php

@@ -210,14 +210,12 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
 		{
 		    $db->commit();
 		    print " OK with ref ".$object->ref."\n";
-		}
-		else {
+		} else {
 		    print " KO\n";
 		    $db->rollback();
 		    dol_print_error($db, $object->error);
 		}
-	}
-	else {
+	} else {
 		dol_print_error($db, $object->error);
 	}
 }

+ 1 - 2
dev/initdata/generate-thirdparty.php

@@ -136,8 +136,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
         }
 
         print "Company ".$s." created nom=".$soc->name."\n";
-    }
-    else {
+    } else {
     	print "Error: ".$soc->error."\n";
     }
 }

+ 4 - 8
dev/initdata/import-products.php

@@ -163,8 +163,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
     {
         print " - Error in create result code = ".$ret." - ".$produit->errorsToString();
         $errorrecord++;
-    }
-	else {
+    } else {
 	    print " - Creation OK with ref ".$produit->ref." - id = ".$ret;
 	}
 
@@ -179,8 +178,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
         {
             print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString();
             $errorrecord++;
-        }
-    	else {
+        } else {
     	    print " - updatePrice OK";
     	}
 	}
@@ -198,8 +196,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
         {
             print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString();
             $errorrecord++;
-        }
-    	else {
+        } else {
     	    print " - setMultiLangs OK";
     	}
 	}
@@ -224,8 +221,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
 {
     print "Rollback any changes.\n";
     $db->rollback();
-}
-else {
+} else {
     print "Commit all changes.\n";
     $db->commit();
 }

+ 5 - 10
dev/initdata/import-thirdparties.php

@@ -181,8 +181,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
         {
             print " - Error in create result code = ".$ret." - ".$object->errorsToString();
             $errorrecord++;
-        }
-    	else {
+        } else {
     	    print " - Creation OK with name ".$object->name." - id = ".$ret;
     	}
     }
@@ -211,8 +210,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
     	{
     	    print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString();
     	    $errorrecord++;
-    	}
-    	else {
+    	} else {
     	    print " - create link sale representative OK";
     	}
 	}
@@ -241,8 +239,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
         {
             print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
             $errorrecord++;
-        }
-    	else {
+        } else {
     	    print " - create contact OK";
     	}
 	}
@@ -274,8 +271,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
         {
             print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
             $errorrecord++;
-        }
-    	else {
+        } else {
     	    print " - create contact OK";
     	}
 	}
@@ -301,8 +297,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
 {
     print "Rollback any changes.\n";
     $db->rollback();
-}
-else {
+} else {
     print "Commit all changes.\n";
     $db->commit();
 }

+ 2 - 4
dev/initdata/import-users.php

@@ -142,8 +142,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
     {
         print " - Error in create result code = ".$ret." - ".$object->errorsToString();
         $errorrecord++;
-    }
-	else {
+    } else {
 	    print " - Creation OK with login ".$object->login." - id = ".$ret;
 	}
 
@@ -167,8 +166,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
 {
     print "Rollback any changes.\n";
     $db->rollback();
-}
-else {
+} else {
     print "Commit all changes.\n";
     $db->commit();
 }

+ 1 - 2
dev/initdata/purge-data.php

@@ -325,8 +325,7 @@ if ($error || $mode != 'confirm')
 {
     print "\nRollback any changes.\n";
     $db->rollback();
-}
-else {
+} else {
     print "Commit all changes.\n";
     $db->commit();
 }

+ 1 - 1
dev/setup/codesniffer/ruleset.xml

@@ -214,7 +214,7 @@
     <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
 
     <!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" /> -->
-    <!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> -->
+    <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
     <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
 
     <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />

+ 14 - 28
htdocs/main.inc.php

@@ -266,8 +266,7 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV
 			{
 				$newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]);
 			}
-		}
-		else {
+		} else {
 			// Check HTTPS environment variable (Apache/mod_ssl only)
 			$newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
 		}
@@ -860,14 +859,12 @@ if (!GETPOST('nojs', 'int'))   // If javascript was not disabled on URL
 	{
 		$conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
 	}
-}
-else $conf->use_javascript_ajax = 0;
+} else $conf->use_javascript_ajax = 0;
 // Set MAIN_OPTIMIZEFORTEXTBROWSER
 if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER))   // If we must enable text browser
 {
 	$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
-}
-elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER))
+} elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER))
 {
 	$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER;
 }
@@ -1134,8 +1131,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0)
 			// default-src http: https: 'unsafe-eval' 'unsafe-inline'; object-src 'none'
 			header("Content-Security-Policy: ".$contentsecuritypolicy);
 		}
-	}
-	elseif (constant('FORCECSP'))
+	} elseif (constant('FORCECSP'))
 	{
 		header("Content-Security-Policy: ".constant('FORCECSP'));
 	}
@@ -1553,10 +1549,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
 			if (preg_match('/\d\.\d/', $appli))
 			{
 				if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
-			}
-			else $appli .= " ".DOL_VERSION;
-		}
-		else $appli .= " ".DOL_VERSION;
+			} else $appli .= " ".DOL_VERSION;
+		} else $appli .= " ".DOL_VERSION;
 
 		if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
 
@@ -1727,8 +1721,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
     {
         $userImage          = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1);
         $userDropDownImage  = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1);
-    }
-    else {
+    } else {
         $nophoto = '/public/theme/common/user_anonymous.png';
         if ($user->gender == 'man') $nophoto = '/public/theme/common/user_man.png';
         if ($user->gender == 'woman') $nophoto = '/public/theme/common/user_woman.png';
@@ -1781,8 +1774,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
     {
         if ($result == 0) {
             $dropdownBody .= $hookmanager->resPrint; // add
-        }
-        else {
+        } else {
             $dropdownBody = $hookmanager->resPrint; // replace
         }
     }
@@ -1808,10 +1800,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
     	if (preg_match('/\d\.\d/', $appli))
     	{
     		if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
-    	}
-    	else $appli .= " ".DOL_VERSION;
-    }
-    else $appli .= " ".DOL_VERSION;
+    	} else $appli .= " ".DOL_VERSION;
+    } else $appli .= " ".DOL_VERSION;
 
     if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
 	    $btnUser = '<!-- div for user link -->
@@ -2202,10 +2192,8 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
 				if (preg_match('/\d\.\d/', $appli))
 				{
 					if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
-				}
-				else $appli .= " ".DOL_VERSION;
-			}
-			else $appli .= " ".DOL_VERSION;
+				} else $appli .= " ".DOL_VERSION;
+			} else $appli .= " ".DOL_VERSION;
 			print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
 			if ($doliurl) print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">';
 			else print '<span class="help">';
@@ -2259,8 +2247,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
 			if (empty($reshook))
 			{
 				$bugbaseurl .= $hookmanager->resPrint;
-			}
-			else $bugbaseurl = $hookmanager->resPrint;
+			} else $bugbaseurl = $hookmanager->resPrint;
 
 			$bugbaseurl .= urlencode("\n");
 			$bugbaseurl .= urlencode("## Report\n");
@@ -2580,8 +2567,7 @@ if (!function_exists("llxFooter"))
 				// No ping done if we are into an alpha version
 				if (strpos('alpha', DOL_VERSION) > 0 && !$forceping) {
 					print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
-				}
-				elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping)	// Cookie is set when we uncheck the checkbox in the installation wizard.
+				} elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping)	// Cookie is set when we uncheck the checkbox in the installation wizard.
 				{
 					// MAIN_LAST_PING_KO_DATE
 					// Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent