Index: /changelog
===================================================================
--- /changelog	(revision 7644)
+++ /changelog	(revision 7645)
@@ -324,3 +324,4 @@
 - Bugfix: Produktoption "Bewertungspunkte" lÃ€sst sich mit Wert "Aus Kommentarbewertung" speichern
 - Bugfix: Auswahl der Zahl- und Versandarten im Produkt funktioniert zuverlÃ€ssig (PayPal Plus + Zahlvariante) / Task #708
+- Bugfix: Speichern von Rabatt % Werten in Kundengruppen/Produktgruppen und Produkten korrigiert
 - Technisch: Ausgabe Overview wird zwischengespeichert, um Performance zu erhÃ¶hen
Index: /mods/wpsg_mod_discount.class.php
===================================================================
--- /mods/wpsg_mod_discount.class.php	(revision 7644)
+++ /mods/wpsg_mod_discount.class.php	(revision 7645)
@@ -365,47 +365,78 @@
 		} // public function wpsg_mod_productgroups_addedit_sidebar(&$productgroupdata)
 
-		public function wpsg_mod_productgroups_save($productgroup_id)
-		{
-
-			$rabatt = "";
-
-			/**
-			 * Ich speichere die Rabatteinstellungen in einem Feld innerhalb der Produktgruppe das Trennzeichen ist "_"
-			 */
-			$dis_aktiv = wpsg_sinput(WPSG_SANITIZE_CHECKBOX, $_REQUEST['wpsg_mod_discount']['discount_aktiv']);
-			$dis_from = wpsg_sinput(WPSG_SANITIZE_TEXTFIELD, $_REQUEST['wpsg_mod_discount']['discount_from']);
-			$dis_to = wpsg_sinput(WPSG_SANITIZE_TEXTFIELD, $_REQUEST['wpsg_mod_discount']['discount_to']);
-			$dis_val = wpsg_tf(wpsg_sinput("key", $_REQUEST['wpsg_mod_discount']['discount_value'], WPSG_SANITIZE_FLOAT));
-
-			$rabatt_str = $dis_aktiv.'_'.$dis_from.'_'.$dis_to.'_'.wpsg_tf($dis_val, true);
-
-			$this->db->UpdateQuery(WPSG_TBL_PRODUCTS_GROUP, array(
-				'rabatt' => wpsg_q($rabatt_str)
-			), "`id` = '".wpsg_q($productgroup_id)."'");
-
-		} // public function wpsg_mod_productgroups_save($productgroup_id)
-
-		public function produkt_save(&$produkt_id)
-		{
-
-			$rabatt = "";
-
+		public function wpsg_mod_productgroups_save($productgroup_id) {
+			
+			$strDiscount = "";
+			
 			/**
 			 * Ich speichere die Rabatteinstellungen in einem Feld innerhalb des Produktes das Trennzeichen ist "_"
 			 */
-			if (isset($_REQUEST['wpsg_mod_discount']))
-			{
-
-				$dis_active = wpsg_sinput("key", $_REQUEST['wpsg_mod_discount']['discount_aktiv']);
-				$dis_from = wpsg_sinput("text_field", $_REQUEST['wpsg_mod_discount']['discount_from']);
-				$dis_to = wpsg_sinput("text_field", $_REQUEST['wpsg_mod_discount']['discount_to']);
-				$dis_value = wpsg_tf(wpsg_sinput("key", $_REQUEST['wpsg_mod_discount']['discount_value'], WPSG_SANITIZE_FLOAT));
-
-				$rabatt_str = $dis_active."_".$dis_from."_".$dis_to."_".wpsg_tf($dis_value, true);
+			if (isset($_REQUEST['wpsg_mod_discount'])) {
+				
+				try {
+					
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_aktiv'], WPSG_SANITIZE_CHECKBOX)) throw new \Exception(_('Aktion aktiv'));
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_from'], WPSG_SANITIZE_DATE, ['allowEmpty' => true])) throw new \Exception(_('Start (TT.MM.JJJJ)'));
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_to'], WPSG_SANITIZE_DATE, ['allowEmpty' => true])) throw new \Exception(_('Ende (TT.MM.JJJJ)'));
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_value'], WPSG_SANITIZE_FLOAT, ['allowEmpty' => true])) throw new \Exception(_('Rabatt'));
+					
+					$dis_active = $_REQUEST['wpsg_mod_discount']['discount_aktiv'];
+					$dis_from = $_REQUEST['wpsg_mod_discount']['discount_from'];
+					$dis_to = $_REQUEST['wpsg_mod_discount']['discount_to'];
+					$dis_value = wpsg_tf($_REQUEST['wpsg_mod_discount']['discount_value'], true);
+					
+					$strDiscount = $dis_active."_".$dis_from."_".$dis_to."_".$dis_value;
+					
+				} catch (\Exception $e) {
+					
+					$this->shop->addBackendError(wpsg_translate(__('Eingaben in Feld "#1#" ÃŒberprÃŒfen.', $e->getMessage())));
+					
+					return;
+					
+				} 
+				
+			}
+			 
+			$this->db->UpdateQuery(WPSG_TBL_PRODUCTS_GROUP, array(
+				'rabatt' => wpsg_q($strDiscount)
+			), "`id` = '".wpsg_q($productgroup_id)."'");
+
+		} // public function wpsg_mod_productgroups_save($productgroup_id)
+
+		public function produkt_save(&$produkt_id) {
+			
+			$strDiscount = "";
+
+			/**
+			 * Ich speichere die Rabatteinstellungen in einem Feld innerhalb des Produktes das Trennzeichen ist "_"
+			 */
+			if (isset($_REQUEST['wpsg_mod_discount'])) {
+
+				try {
+				
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_aktiv'], WPSG_SANITIZE_CHECKBOX)) throw new \Exception(_('Aktion aktiv'));
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_from'], WPSG_SANITIZE_DATE, ['allowEmpty' => true])) throw new \Exception(_('Start (TT.MM.JJJJ)'));
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_to'], WPSG_SANITIZE_DATE, ['allowEmpty' => true])) throw new \Exception(_('Ende (TT.MM.JJJJ)'));
+					if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount_value'], WPSG_SANITIZE_FLOAT, ['allowEmpty' => true])) throw new \Exception(_('Rabatt'));
+				
+				} catch (\Exception $e) {
+					
+					$this->shop->addBackendError(wpsg_translate(__('Eingaben in Feld "#1#" ÃŒberprÃŒfen.', $e->getMessage())));
+					
+					return;
+					
+				}
+					
+				$dis_active = $_REQUEST['wpsg_mod_discount']['discount_aktiv'];
+				$dis_from = $_REQUEST['wpsg_mod_discount']['discount_from'];
+				$dis_to = $_REQUEST['wpsg_mod_discount']['discount_to'];
+				$dis_value = wpsg_tf($_REQUEST['wpsg_mod_discount']['discount_value'], true);
+				
+				$strDiscount = $dis_active."_".$dis_from."_".$dis_to."_".$dis_value;
 
 			}
 
 			$this->db->UpdateQuery(WPSG_TBL_PRODUCTS, array(
-				'rabatt' => wpsg_q(wpsg_getStr($rabatt_str))
+				'rabatt' => wpsg_q($strDiscount)
 			), "`id` = '".wpsg_q($produkt_id)."'");
 
@@ -421,10 +452,15 @@
 		} // public function customergroup_edit(&$customergroup_id)
 
-		public function customergroup_save(&$customergroup_id)
-		{
-
-			$this->db->UpdateQuery(WPSG_TBL_KG, array(
-			    'discount' => wpsg_q(wpsg_tf(wpsg_sinput("key", $_REQUEST['wpsg_mod_discount']['discount'], WPSG_SANITIZE_FLOAT)))
-			), " `id` = '".wpsg_q($customergroup_id)."' ");
+		public function customergroup_save(&$customergroup_id) {
+			
+			$db_udpate = [];
+			
+			if (!wpsg_checkInput($_REQUEST['wpsg_mod_discount']['discount'], WPSG_SANITIZE_FLOAT)) {
+				
+				$this->shop->addBackendMessage(__('Bitte die Eingaben im Feld "Rabatt" prÃŒfen.', 'wpsg'));
+				
+			} else $db_udpate['discount'] = wpsg_q($_REQUEST['wpsg_mod_discount']['discount']);
+						
+			$this->db->UpdateQuery(WPSG_TBL_KG, $db_udpate, " `id` = '".wpsg_q($customergroup_id)."' ");
 
 		} // public function customergroup_save(&$customergroup_id)
@@ -1350,3 +1386,2 @@
 	} // class wpsg_mod_discount
 
-?>
Index: /mods/wpsg_mod_productgroups.class.php
===================================================================
--- /mods/wpsg_mod_productgroups.class.php	(revision 7644)
+++ /mods/wpsg_mod_productgroups.class.php	(revision 7645)
@@ -860,3 +860,2 @@
 	} // class wpsg_mod_productgroups extends wpsg_mod_basic
 
-?>
