瀏覽代碼

Fix scrutinizer errors

Laurent Destailleur 4 年之前
父節點
當前提交
e7775d2f79

+ 8 - 6
htdocs/accountancy/journal/bankjournal.php

@@ -437,13 +437,15 @@ if ($result) {
 					// Get thirdparty
 					$tmppayment->fetch($links[$key]['url_id']);
 					$arrayofamounts = $tmppayment->getAmountsArray();
-					foreach ($arrayofamounts as $invoiceid => $amount)
-					{
-						$tmpinvoice->fetch($invoiceid);
-						$tmpinvoice->fetch_thirdparty();
-						if ($tmpinvoice->thirdparty->code_compta)
+					if (is_array($arrayofamounts)) {
+						foreach ($arrayofamounts as $invoiceid => $amount)
 						{
-							$tabtp[$obj->rowid][$tmpinvoice->thirdparty->code_compta] += $amount;
+							$tmpinvoice->fetch($invoiceid);
+							$tmpinvoice->fetch_thirdparty();
+							if ($tmpinvoice->thirdparty->code_compta)
+							{
+								$tabtp[$obj->rowid][$tmpinvoice->thirdparty->code_compta] += $amount;
+							}
 						}
 					}
 				}

+ 1 - 1
htdocs/adherents/type.php

@@ -719,7 +719,7 @@ if ($rowid > 0) {
 
 		print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
 
-		print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
+		print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
 
 		print '<tr><td>'.$langs->trans("Status").'</td><td>';
 		print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status);

+ 18 - 15
htdocs/adherents/type_translation.php

@@ -37,6 +37,7 @@ $langs->loadLangs(array('members', 'languages'));
 $id = GETPOST('rowid', 'int');
 $action = GETPOST('action', 'aZ09');
 $cancel = GETPOST('cancel', 'alpha');
+$ref = GETPOST('ref', 'alphanohtml');
 
 // Security check
 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
@@ -67,15 +68,17 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
 	$object->fetch($id);
 	$current_lang = $langs->getDefaultLang();
 
+	$forcelangprod = GETPOST("forcelangprod", 'aZ09');
+
 	// update of object
-	if ($_POST["forcelangprod"] == $current_lang) {
-		$object->label			= $_POST["libelle"];
-		$object->description = dol_htmlcleanlastbr($_POST["desc"]);
-		$object->other			= dol_htmlcleanlastbr($_POST["other"]);
+	if ($forcelangprod == $current_lang) {
+		$object->label		 = GETPOST("libelle", 'alphanohtml');
+		$object->description = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
+		$object->other		 = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
 	} else {
-		$object->multilangs[$_POST["forcelangprod"]]["label"]		= $_POST["libelle"];
-		$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
-		$object->multilangs[$_POST["forcelangprod"]]["other"]		= dol_htmlcleanlastbr($_POST["other"]);
+		$object->multilangs[$forcelangprod]["label"] = GETPOST("libelle", 'alphanohtml');
+		$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
+		$object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
 	}
 
 	// backup into database
@@ -95,13 +98,13 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
 
 	foreach ($object->multilangs as $key => $value) { // saving new values in the object
 		if ($key == $current_lang) {
-			$object->label			= $_POST["libelle-".$key];
-			$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
-			$object->other			= dol_htmlcleanlastbr($_POST["other-".$key]);
+			$object->label			= GETPOST("libelle-".$key, 'alphanohtml');
+			$object->description = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml'));
+			$object->other			= dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml'));
 		} else {
-			$object->multilangs[$key]["label"]			= $_POST["libelle-".$key];
-			$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
-			$object->multilangs[$key]["other"]			= dol_htmlcleanlastbr($_POST["other-".$key]);
+			$object->multilangs[$key]["label"]			= GETPOST("libelle-".$key, 'alphanohtml');
+			$object->multilangs[$key]["description"] = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml'));
+			$object->multilangs[$key]["other"]			= dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml'));
 		}
 	}
 
@@ -205,7 +208,7 @@ if ($action == 'edit') {
 
 			print '<div class="underbanner clearboth"></div>';
 			print '<table class="border centpercent">';
-			print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
+			print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" class="minwidth300" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
 			print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
 			$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
 			$doleditor->Create();
@@ -264,7 +267,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
 	print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>';
 	print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1);
 	print '</td></tr>';
-	print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
+	print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" class="minwidth300" value="'.dol_escape_htmltag(GETPOST("libelle", 'alphanohtml')).'"></td></tr>';
 	print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
 	$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
 	$doleditor->Create();

+ 1 - 0
htdocs/categories/class/api_categories.class.php

@@ -769,6 +769,7 @@ class Categories extends DolibarrApi
 
 		$objects = $result;
 		$cleaned_objects = array();
+		$objects_api = null;
 		if ($type == 'member') {
 			$objects_api = new Members();
 		} elseif ($type == 'customer' || $type == 'supplier') {

+ 2 - 3
htdocs/categories/class/categorie.class.php

@@ -1891,13 +1891,12 @@ class Categorie extends CommonObject
 			return "";
 		}
 
+		$searchCategorySqlList = array();
 		foreach ($searchList as $searchCategory) {
 			if (intval($searchCategory) == -2) {
 				$searchCategorySqlList[] = " cp.fk_categorie IS NULL";
 			} elseif (intval($searchCategory) > 0) {
-				$searchCategorySqlList[] = " ".$rowIdName
-										." IN (SELECT fk_".$type." FROM ".MAIN_DB_PREFIX."categorie_".$type
-										." WHERE fk_categorie = ".$searchCategory.")";
+				$searchCategorySqlList[] = " ".$rowIdName." IN (SELECT fk_".$type." FROM ".MAIN_DB_PREFIX."categorie_".$type." WHERE fk_categorie = ".((int) $searchCategory).")";
 			}
 		}