Index: /changelog
===================================================================
--- /changelog	(revision 7947)
+++ /changelog	(revision 7948)
@@ -483,2 +483,3 @@
 - Bugfix: PHP8 KompatibilitÃ€t Cron/PDF Barcode
 - Bugfix: Option "Bestellungen fÃŒr 0 EUR direkt abschlieÃen" bezieht sich jetzt auf den zu zahlenden Betrag und nicht auf den Bestellwert (Bei Wertgutscheinen) 
+- Bugfix: Korrektur alter Preis bei Kundengruppenrabatt
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 7947)
+++ /model/wpsg_product.class.php	(revision 7948)
@@ -341,9 +341,7 @@
 		 * Gibt den Alten Preis fÃŒr das Frontend zurÃŒck
 		 */
-		public function getOldPrice($taxView = false)
-		{
+		public function getOldPrice($taxView = false) {
 		    
-		    if ($taxView === false)
-		    {
+		    if ($taxView === false) {
 		        
 		        if (is_admin()) $taxView = $this->shop->getBackendTaxview();
@@ -355,14 +353,18 @@
 		    
 		    // Rabatt ÃŒberschreibt die Produkteinstellung
-		    if ($this->shop->hasMod('wpsg_mod_discount') && wpsg_isSizedInt($this->shop->get_option('wpsg_mod_discount_show')) && isset($this->loadedData['preis_prediscount']))
-		    {
+		    if ($this->shop->hasMod('wpsg_mod_discount') && wpsg_isSizedInt($this->shop->get_option('wpsg_mod_discount_show')) && isset($this->loadedData['preis_prediscount'])) {
 		        
 		        // Rabatt
 		        $oldprice = $this->loadedData['preis_prediscount'];
 		        
+		        if ($oldprice > 0) return $oldprice;
+		        else return false;
+		        
+		    } else {
+		    
+		        if ($oldprice > 0) return $this->calculateTaxViewPrice($oldprice, $taxView);
+		        else return false;
+
 		    }
-		    
-		    if ($oldprice > 0) return $this->calculateTaxViewPrice($oldprice, $taxView);
-		    else return false;
 		    
 		}
Index: /mods/wpsg_mod_discount.class.php
===================================================================
--- /mods/wpsg_mod_discount.class.php	(revision 7947)
+++ /mods/wpsg_mod_discount.class.php	(revision 7948)
@@ -60,6 +60,5 @@
 		} // public function settings_edit()
 
-		public function settings_save()
-		{
+		public function settings_save() {
 
 		    $this->shop->update_option('wpsg_mod_discount_productdiscount', $_REQUEST['wpsg_mod_discount_productdiscount'], false, false, WPSG_SANITIZE_CHECKBOX);
@@ -68,6 +67,8 @@
 			$this->shop->update_option("wpsg_mod_discount_universal_to", wpsg_xss($_REQUEST['wpsg_mod_discount_universal_to']));
 			$this->shop->update_option("wpsg_mod_discount_universal_value", wpsg_ff($_REQUEST['wpsg_mod_discount_universal_value']), false, false, WPSG_SANITIZE_FLOAT);
+			
 			if ($this->shop->hasMod('wpsg_mod_productgroups')) $this->shop->update_option('wpsg_mod_discount_productgroupdiscount', $_REQUEST['wpsg_mod_discount_productgroupdiscount'], false, false, WPSG_SANITIZE_CHECKBOX);
 			if ($this->shop->hasMod('wpsg_mod_customergroup')) $this->shop->update_option('wpsg_mod_discount_customergroup', $_REQUEST['wpsg_mod_discount_customergroup'], false, false, WPSG_SANITIZE_CHECKBOX);
+			
 			$this->shop->update_option('wpsg_mod_discount_show', $_REQUEST['wpsg_mod_discount_show'], false, false, WPSG_SANITIZE_CHECKBOX);
 			$this->shop->update_option('wpsg_mod_discount_hierarchie', implode(',', $_REQUEST['wpsg_mod_discount_hierarchie']));
@@ -145,5 +146,5 @@
 			$this->shop->update_option('wpsg_mod_discount_showBasket', $_REQUEST['wpsg_mod_discount_showBasket'], false, false, WPSG_SANITIZE_CHECKBOX);
 			$this->shop->update_option('wpsg_mod_discount_voucher', $_REQUEST['wpsg_mod_discount_voucher'], false, false, WPSG_SANITIZE_CHECKBOX);		
-			$this->shop->update_option('wpsg_mod_discount_productindex', $_REQUEST['wpsg_mod_discount_productindex'], false, false, WPSG_SANITIZE_CHECKBOX);
+			$this->shop->update_option('wpsg_mod_discount_productindex', $_REQUEST['wpsg_mod_discount_productindex'], false, false, WPSG_SANITIZE_CHECKBOX, ['allowEmpty' => true]);
 			
 		} // public function settings_save()
@@ -985,6 +986,5 @@
 			if ($discount_max_price && !isset($product_data['max_preis_prediscount'])) $product_data['max_preis_prediscount'] = $product_data['max_preis'];
 
-			if ($this->shop->getBackendTaxview() == WPSG_BRUTTO)
-			{
+			if ($this->shop->getBackendTaxview() == WPSG_BRUTTO) {
 
 				$preis_discount_calc = &$product_data['preis_brutto'];
@@ -992,7 +992,5 @@
 				$calc = WPSG_NETTO;
 
-			}
-			else
-			{
+			} else {
 
 				$preis_discount_calc = &$product_data['preis_netto'];
@@ -1002,14 +1000,11 @@
 			}
 
-			if (strpos($discount_value, '%') !== false)
-			{
+			if (strpos($discount_value, '%') !== false) {
 
 				$preis_discount_calc = $preis_discount_calc - ($preis_discount_calc * wpsg_tf($discount_value) / 100);
-				if ($discount_min_price) $discount_min_price = $discount_min_price - ($discount_min_price * $discount_value / 100);
-				if ($discount_max_price) $discount_max_price = $discount_max_price - ($discount_max_price * $discount_value / 100);
-
-			}
-			else
-			{
+				if ($discount_min_price) $discount_min_price = $discount_min_price - ($discount_min_price * wpsg_tf($discount_value) / 100);
+				if ($discount_max_price) $discount_max_price = $discount_max_price - ($discount_max_price * wpsg_tf($discount_value) / 100);
+
+			} else {
 
 				$preis_discount_calc = $preis_discount_calc = $preis_discount_calc - $discount_value;
@@ -1025,12 +1020,9 @@
 
 			// Preis fÃŒr Anzeige wieder setzen
-			if ($this->shop->getFrontendTaxview() == WPSG_BRUTTO)
-			{
+			if ($this->shop->getFrontendTaxview() == WPSG_BRUTTO) {
 
 				$product_data['preis'] = &$product_data['preis_brutto'];
 
-			}
-			else
-			{
+			} else {
 
 				$product_data['preis'] = &$product_data['preis_netto'];
@@ -1119,27 +1111,29 @@
 		 * Gibt true zurÃŒck, sofern das Produkt einen aktiven Rabatt aus der Kundengruppe hat
 		 */
-		public function hasCustomergroupRabatt()
-		{
-
-			if ($this->shop->hasMod('wpsg_mod_customergroup') && $this->shop->get_option('wpsg_mod_discount_customergroup') === '1')
-			{
+		public function hasCustomergroupRabatt() {
+
+			if ($this->shop->hasMod('wpsg_mod_customergroup') && $this->shop->get_option('wpsg_mod_discount_customergroup') === '1') {
 
 				$act_customer_group = $this->shop->callMod('wpsg_mod_kundenverwaltung', 'getCustomerGroup');
 
-				if (wpsg_isSizedInt($act_customer_group))
-				{
-
-					$oCustomerGroup = wpsg_customergroup::getInstance($act_customer_group);
-
-					if ($oCustomerGroup !== false && wpsg_isSizedString($oCustomerGroup->discount))
-					{
-
-						return true;
-
-					}
-
-				}
-
-			}
+				if (wpsg_isSizedInt($act_customer_group)) {
+
+					try {
+					
+						$oCustomerGroup = wpsg_customergroup::getInstance($act_customer_group);
+
+						if (($oCustomerGroup->__get('discount')??'') !== '') {
+
+							return true;
+
+						}
+
+					} catch (\Exception $e) { }
+
+				}
+
+			}
+			
+			return false;
 
 		} // public function hasCustomergroupRabatt()
@@ -1148,6 +1142,5 @@
 		 * Gibt den Rabatt aus der Kundengruppe zurÃŒck
 		 */
-		public function getCustomergroupRabatt()
-		{
+		public function getCustomergroupRabatt() {
 
 			if (!$this->hasCustomergroupRabatt()) return 0;
@@ -1155,13 +1148,11 @@
 			$act_customer_group = $this->shop->callMod('wpsg_mod_kundenverwaltung', 'getCustomerGroup');
 
-			if (wpsg_isSizedInt($act_customer_group))
-			{
+			if (wpsg_isSizedInt($act_customer_group)) {
 
 				$oCustomerGroup = wpsg_customergroup::getInstance($act_customer_group);
 
-				if ($oCustomerGroup !== false && wpsg_isSizedString($oCustomerGroup->discount))
-				{
-
-					return $oCustomerGroup->discount;
+				if (($oCustomerGroup->__get('discount')??'') !== '') {
+
+					return $oCustomerGroup->__get('discount');
 
 				}
Index: /views/mods/mod_kundenverwaltung/edit.phtml
===================================================================
--- /views/mods/mod_kundenverwaltung/edit.phtml	(revision 7947)
+++ /views/mods/mod_kundenverwaltung/edit.phtml	(revision 7948)
@@ -76,5 +76,5 @@
                         	<?php echo wpsg_drawForm_Input('strasse', __('StraÃe', 'wpsg'), @$this->view['data']['strasse']); ?>
 										
-							<?php if ($this->view['pflicht']['wpsg_showNr'] === '1') { ?>	
+							<?php if (($this->view['pflicht']['wpsg_showNr']??'') === '1') { ?>	
 								<?php echo wpsg_drawForm_Input('nr', __('Hausnummer', 'wpsg'), @$this->view['data']['nr']); ?>
 							<?php } ?>
