Index: /controller/wpsg_AdminController.class.php
===================================================================
--- /controller/wpsg_AdminController.class.php	(revision 5921)
+++ /controller/wpsg_AdminController.class.php	(revision 5922)
@@ -1021,4 +1021,201 @@
 		} // private function loadStandardLaenderVz()
  
+		
+		/**
+		 * Wird aufgerufen wenn die Zahlungsart verÃ€ndert wird
+		 */
+		public function paymentDataAction()
+		{
+			$pid = 0;
+			$oid = 0;
+			$pval = 0.0;
+			if (isset($_REQUEST['edit_id'])) $oid = wpsg_q($_REQUEST['edit_id']);
+			if (isset($_REQUEST['p_id'])) $pid = wpsg_q($_REQUEST['p_id']);
+			if (isset($_REQUEST['p_value'])) $pid = wpsg_q($_REQUEST['p_value']);
+			if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'change')
+			{
+				//'wp-admin/admin.php?page=wpsg-Admin&subaction=paymentData&do=change&edit_id=12&p_id=34&p_value=56&noheader=1';
+			
+				//TODO
+				//price_payment (-/_netto/_brutto)
+				//type_payment
+				
+				
+				$val = abs(wpsg_tf($_REQUEST['p_value']));
+				
+				$arTaxKey = explode('_', wpsg_q($_REQUEST['mwst']));
+				$country_id = $arTaxKey[1];
+				$country = wpsg_country::getInstance($country_id);
+				$tax_key = 'c';
+				$noMwSt = false;
+				if (wpsg_q($_REQUEST['noMwSt']) == 1) $noMwSt = true;
+				if ($noMwSt === true) $tax_value = 0; else $tax_value = $country->getTax($tax_key);
+				if (wpsg_q($_REQUEST['price_frontend']) == WPSG_NETTO)
+				{
+					$val = wpsg_calculatePreis($val, WPSG_BRUTTO, $tax_value);
+				}
+				$data = array('price_rabatt' => $val);
+				$sql = "`id` = '".wpsg_q($_REQUEST['edit_id'])."'";
+				
+				
+				
+				//$ogs = array('gs_id' => $gs_id, 'price_gs' => 10.0);
+				//$this->db->UpdateQuery(WPSG_TBL_ORDER, $ogs, "`id` = '".$oid."'");
+			
+			}
+				
+		
+		
+		}	// public function paymentDataAction()
+		
+		/**
+		 * Wird aufgerufen wenn die Gutscheine verwaltet werden sollen
+		 */
+		public function voucherDataAction()
+		{
+			//die('voucher');
+			$t1 = 0;
+			$oid = 0;
+			if (isset($_REQUEST['edit_id'])) $oid = wpsg_q($_REQUEST['edit_id']);
+			
+			if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'add')
+			{
+				if (isset($_REQUEST['edit_id'])) $oid = wpsg_q($_REQUEST['edit_id']);
+				//wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=add&oid=34&noheader=1
+				$dt = new DateTime();
+				$dt1 = $dt->format('Y-m-d H:i:s');
+				$dt = date_modify($dt, '+1 year');
+				$dt2 = $dt->format('Y-m-d H:i:s');
+				$gs = array('value' => '10.00', 'calc_typ' => 'w', 'code' => 'Gutschein', 'o_id' => $oid,
+							'cdate' => $dt1, 'start_date' => $dt1, 'end_date' => $dt2);
+				$gs_id = $this->db->ImportQuery(WPSG_TBL_GUTSCHEIN, $gs);
+				
+				$ogs = array('gs_id' => $gs_id, 'price_gs' => 10.0);
+				$this->db->UpdateQuery(WPSG_TBL_ORDER, $ogs, "`id` = '".$oid."'");
+				$_REQUEST['gs_id'] = $gs_id;
+				
+			}
+			else if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'remove')
+			{
+				// Gutschein lÃ¶schen
+				$this->db->Query("DELETE FROM `".WPSG_TBL_GUTSCHEIN."` WHERE `id` = '".wpsg_q($_REQUEST['gs_id'])."'");
+				$ogs = array('gs_id' => 0, 'price_gs' => 0);
+				$this->db->UpdateQuery(WPSG_TBL_ORDER, $ogs, "`id` = '".$oid."'");
+				$_REQUEST['gs_id'] = 0;
+				
+			}
+			else if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'editname')
+			{
+				//wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editname&oid=34&noheader=1
+				//submitdata: { field: 'code', gs_id: 92 }
+				$data = array(wpsg_q($_REQUEST['field']) => wpsg_q($_REQUEST['value']));
+
+				$this->db->UpdateQuery(WPSG_TBL_GUTSCHEIN, $data, "`id` = '".wpsg_q($_REQUEST['gs_id'])."'");
+			}
+			else if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'editvalue')
+			{
+				//wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editname&oid=34&noheader=1
+				//submitdata: { field: 'code', gs_id: 92 }
+				$val = abs(wpsg_tf($_REQUEST['value']));
+				
+				$arTaxKey = explode('_', wpsg_q($_REQUEST['mwst']));
+				$country_id = $arTaxKey[1];
+				$country = wpsg_country::getInstance($country_id);
+				$tax_key = 'c';
+				$noMwSt = false;
+				if (wpsg_q($_REQUEST['noMwSt']) == 1) $noMwSt = true;
+				if ($noMwSt === true) $tax_value = 0; else $tax_value = $country->getTax($tax_key);
+				if (wpsg_q($_REQUEST['price_frontend']) == WPSG_NETTO)
+				{
+			        //$val = wpsg_calculatePreis($val, WPSG_BRUTTO, $tax_value);
+				}
+				$data = array('price_gs' => $val);
+				$sql = "`id` = '".wpsg_q($_REQUEST['edit_id'])."'";
+				$this->db->UpdateQuery(WPSG_TBL_ORDER, $data, "`id` = '".wpsg_q($_REQUEST['edit_id'])."'");
+					
+			}
+			
+			// Order-Daten sammeln und Tabelle neu generieren
+			$basket = new wpsg_basket();
+			$basket->initFromDB($oid, true);
+			$this->shop->view['basket'] = $basket->toArray(true);
+			
+			$this->shop->view['colspan'] = 3;
+			if ($this->shop->get_option('wpsg_showMwstAlways') == '1' || sizeof($this->shop->view['basket']['mwst']) > 1) $this->shop->view['colspan'] ++;
+				
+			$this->shop->render(WPSG_PATH_VIEW.'/order/view_orderdata.phtml');
+				
+			exit;
+		
+		} // public function voucherDataAction()
+		
+		/**
+		 * Wird aufgerufen wenn die Rabatte verwaltet werden sollen
+		 */
+		public function discountDataAction()
+		{
+			//die('voucher');
+			$t1 = 0;
+			$oid = 0;
+			if (isset($_REQUEST['edit_id'])) $oid = wpsg_q($_REQUEST['edit_id']);
+				
+			if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'add')
+			{	
+				if (isset($_REQUEST['edit_id'])) $oid = wpsg_q($_REQUEST['edit_id']);
+		
+				$ogs = array('price_rabatt' => 10.0);
+				$this->db->UpdateQuery(WPSG_TBL_ORDER, $ogs, "`id` = '".$oid."'");
+		
+			}
+			else if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'remove')
+			{	
+				// Rabatt lÃ¶schen
+				$ogs = array('price_rabatt' => 0);
+				$this->db->UpdateQuery(WPSG_TBL_ORDER, $ogs, "`id` = '".$oid."'");
+		
+			}
+			else if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'editname')
+			{
+				//submitdata: { field: 'code', gs_id: 92 }
+				$data = array(wpsg_q($_REQUEST['field']) => wpsg_q($_REQUEST['value']));
+		
+				//$this->db->UpdateQuery(WPSG_TBL_GUTSCHEIN, $data, "`id` = '".wpsg_q($_REQUEST['gs_id'])."'");
+			}
+			else if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'editvalue')
+			{	
+				$val = abs(wpsg_tf($_REQUEST['value']));
+				
+				$arTaxKey = explode('_', wpsg_q($_REQUEST['mwst']));
+				$country_id = $arTaxKey[1];
+				$country = wpsg_country::getInstance($country_id);
+				$tax_key = 'c';
+				$noMwSt = false;
+				if (wpsg_q($_REQUEST['noMwSt']) == 1) $noMwSt = true;
+				if ($noMwSt === true) $tax_value = 0; else $tax_value = $country->getTax($tax_key);
+				if (wpsg_q($_REQUEST['price_frontend']) == WPSG_NETTO)
+				{
+					//$val = wpsg_calculatePreis($val, WPSG_BRUTTO, $tax_value);
+				}
+				$data = array('price_rabatt' => $val);
+				$sql = "`id` = '".wpsg_q($_REQUEST['edit_id'])."'";
+				$this->db->UpdateQuery(WPSG_TBL_ORDER, $data, "`id` = '".wpsg_q($_REQUEST['edit_id'])."'");
+
+			}
+			
+			// Order-Daten sammeln und Tabelle neu generieren
+			$basket = new wpsg_basket();
+			$basket->initFromDB($oid, true);
+			$this->shop->view['basket'] = $basket->toArray(true);
+				
+			$this->shop->view['colspan'] = 3;
+			if ($this->shop->get_option('wpsg_showMwstAlways') == '1' || sizeof($this->shop->view['basket']['mwst']) > 1) $this->shop->view['colspan'] ++;
+		
+			$this->shop->render(WPSG_PATH_VIEW.'/order/view_orderdata.phtml');
+		
+			exit;
+		
+		} // public function discountDataAction()
+		
+		
 		/**
 		 * Wird aufgerufen wenn die Pflichtfelder verwaltet werden sollen
@@ -1068,5 +1265,6 @@
 						{
 							
-							if ($c['del'] == '1') unset($this->shop->view['pflicht']['custom'][$c_id]);
+							if (wpsg_getInt($c['del']) == '1')
+								unset($this->shop->view['pflicht']['custom'][$c_id]);
 							else
 							{
Index: /controller/wpsg_BasketController.class.php
===================================================================
--- /controller/wpsg_BasketController.class.php	(revision 5921)
+++ /controller/wpsg_BasketController.class.php	(revision 5922)
@@ -598,5 +598,6 @@
 								
 								// ProduktgÃŒltigkeit prÃŒfen
-								if (wpsg_isSizedArray(wpsg_explode(',', $gs_db['products'])))
+								$tarr = wpsg_explode(',', $gs_db['products']);
+								if (wpsg_isSizedArray($tarr))
 								{
 									
@@ -611,5 +612,6 @@
 								
 								// ProduktgruppengÃŒltigkeit prÃŒfen
-								if (wpsg_isSizedArray(wpsg_explode(',', $gs_db['productgroups'])))
+								$tarr = wpsg_explode(',', $gs_db['productgroups']);
+								if (wpsg_isSizedArray($tarr))
 								{
 									
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 5921)
+++ /controller/wpsg_ShopController.class.php	(revision 5922)
@@ -3369,9 +3369,28 @@
 				if ($mw['base_value'] > 0)
 				{
-					
-					$proz = $mw['base_value'] / $arBasket['sum']['preis_brutto'];	
-									
-					$arBasket['mwst'][$mw_id]['base_value'] -= $proz * $value;										
-					$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_BRUTTO, $mw['value']);
+					if ((isset($arBasket['price_frontend'])) && ($arBasket['price_frontend'] == WPSG_BRUTTO))
+					{
+						$proz = $mw['base_value'] / $arBasket['sum']['preis_brutto'];
+						
+						$arBasket['mwst'][$mw_id]['base_value'] -= $proz * $value;
+						$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_BRUTTO, $mw['value']);
+						
+					}
+					else if ((isset($arBasket['price_frontend'])) && ($arBasket['price_frontend'] == WPSG_NETTO))
+					{
+						$proz = $mw['base_value'] / $arBasket['sum']['preis_netto'];
+						
+						$arBasket['mwst'][$mw_id]['base_value'] -= $proz * $value;
+						$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_NETTO, $mw['value']);
+						
+					}
+					else
+					{
+						$proz = $mw['base_value'] / $arBasket['sum']['preis_brutto'];
+						
+						$arBasket['mwst'][$mw_id]['base_value'] -= $proz * $value;
+						$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_BRUTTO, $mw['value']);
+						
+					}
 					 
 				}
@@ -3380,4 +3399,5 @@
 			
 			// Mehrwertsteuer Summe korrigieren
+			$sum_mwst = 0;
 			foreach ($arBasket['mwst'] as $mw_id => $mw)
 			{
@@ -3409,9 +3429,29 @@
 				if ($mw['base_value'] > 0)
 				{
-					
-					$proz = $mw['base_value'] / $arBasket['sum']['preis_brutto'];
-					
-					$arBasket['mwst'][$mw_id]['base_value'] -= wpsg_calculatePreis($proz * $value, WPSG_BRUTTO, $mw['value']);					
-					$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_BRUTTO, $mw['value']);
+					if ((isset($arBasket['price_frontend'])) && ($arBasket['price_frontend'] == WPSG_BRUTTO))
+					{
+						$proz = $mw['base_value'] / $arBasket['sum']['preis_brutto'];
+						
+						$arBasket['mwst'][$mw_id]['base_value'] -= wpsg_calculatePreis($proz * $value, WPSG_BRUTTO, $mw['value']);
+						$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_BRUTTO, $mw['value']);
+						
+					}
+					else if ((isset($arBasket['price_frontend'])) && ($arBasket['price_frontend'] == WPSG_NETTO))
+					{
+						$proz = $mw['base_value'] / $arBasket['sum']['preis_netto'];
+						
+						//$arBasket['mwst'][$mw_id]['base_value'] -= wpsg_calculatePreis($proz * $value, WPSG_NETTO, $mw['value']);
+						$arBasket['mwst'][$mw_id]['base_value'] -= $proz * $value;
+						$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_NETTO, $mw['value']);
+						
+					}
+					else
+					{
+						$proz = $mw['base_value'] / $arBasket['sum']['preis_brutto'];
+						
+						$arBasket['mwst'][$mw_id]['base_value'] -= wpsg_calculatePreis($proz * $value, WPSG_BRUTTO, $mw['value']);
+						$arBasket['mwst'][$mw_id]['sum'] = wpsg_calculateSteuer($arBasket['mwst'][$mw_id]['base_value'], WPSG_BRUTTO, $mw['value']);
+						
+					}
 					  
 				}
@@ -3420,4 +3460,5 @@
 			
 			// Mehrwertsteuer Summe korrigieren
+			$sum_mwst = 0.0;
 			foreach ($arBasket['mwst'] as $mw_id => $mw)
 			{
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 5921)
+++ /lib/functions.inc.php	(revision 5922)
@@ -1021,5 +1021,5 @@
 	 * Gibt die Numerische Entsprechung einer Variable zurÃŒck oder $default
 	 */
-	function wpsg_getInt(&$value, $default = false)
+	function wpsg_getInt(&$value, $default = 0)
 	{
 			
Index: /lib/helper_functions.inc.php
===================================================================
--- /lib/helper_functions.inc.php	(revision 5921)
+++ /lib/helper_functions.inc.php	(revision 5922)
@@ -1135,4 +1135,19 @@
 		
 	} // function wpsg_drawForm_Date($field_name, $field_label, $field_value, $conf = array())
+
+	function wpsg_drawForm_Link($field_name, $field_label, $field_link, $conf = array())
+	{
+	
+		$TC = new wpsg_SystemController();
+	
+		$TC->view['field_name'] = $field_name;
+		$TC->view['field_label'] = $field_label;
+		$TC->view['field_id'] = wpsg_drawForm_getID($field_name);
+		$TC->view['field_link'] = $field_link;
+		$TC->view['field_config'] = $conf;
+	
+		return $TC->render(WPSG_PATH_VIEW.'admin/form/link.phtml', false);
+	
+	} // function wpsg_drawForm_Link($field_name, $field_label, $field_link, $conf = array())
 	
 ?>
Index: /lib/install.php
===================================================================
--- /lib/install.php	(revision 5921)
+++ /lib/install.php	(revision 5922)
@@ -122,4 +122,5 @@
    		price_rabatt DOUBLE(10,4) NOT NULL,
    		price_gs DOUBLE(10,4) NOT NULL,
+	  	price_frontend INT(1) NOT NULL,
    		mwst_payment DOUBLE(10,4) NOT NULL,
    		mwst_shipping DOUBLE(10,4) NOT NULL,
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 5921)
+++ /lib/wpsg_basket.class.php	(revision 5922)
@@ -362,5 +362,7 @@
 				'datum' => strftime($order['cdate'])
 			);
-			 			
+			
+			$this->arOrder = $order;
+			
 			// Produkte
 			$arProdukte = $this->db->fetchAssoc("
@@ -419,5 +421,5 @@
 			if ($order['gs_id'] > 0)
 			{
-				
+
 				$gs = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_GUTSCHEIN."` WHERE `id` = '".wpsg_q($order['gs_id'])."'");
 				
@@ -426,4 +428,13 @@
 				$this->gs_code = $gs['code'];
 				$this->gs_id = $gs['id'];
+				
+			}
+			
+			// Gutschein-Wert aus der Order-Tabelle wegen Bearbeitung
+			//if ($order['price_frontend'] == WPSG_NETTO)
+			if ($backend)
+			{
+				$val = abs($order['price_gs']);
+				$this->gs_value = $val;
 				
 			}
@@ -723,5 +734,5 @@
 							
 				// Produkte letztmalig ÃŒberprÃŒfen			
-				foreach ($arBasket['produkte'] as $p_id => &$p)
+				foreach ($arBasket['produkte'] as $p_id => $p)
 				{
 				
@@ -755,5 +766,6 @@
 					'price_payment_netto' 	=> wpsg_getFloat($arBasket['sum']['preis_payment_netto']),
 					'price_payment_brutto' 	=> wpsg_getFloat($arBasket['sum']['preis_payment_brutto']),
-					'price_rabatt' 		=> wpsg_tf($arBasket['sum']['preis_rabatt']),				
+					'price_rabatt' 		=> wpsg_tf($arBasket['sum']['preis_rabatt']),	
+					'price_frontend'	=> $this->shop->getFrontendTaxview(),
 					'mwst_payment' 		=> wpsg_tf(wpsg_getFloat($arBasket['payment']['preis_payment_brutto']) - wpsg_getFloat($arBasket['payment']['preis_payment_netto'])),
 					'mwst_shipping' 	=> wpsg_tf(wpsg_getFloat($arBasket['shipping']['preis_shipping_brutto']) - wpsg_getFloat($arBasket['shipping']['preis_shipping_netto'])),
@@ -795,4 +807,10 @@
 				$this->shop->callMods('basket_save_order', array(&$data, &$this->arCheckout, &$arBasket, $finish_order));
 				
+				$data['custom_data']['basket']['oOrder'] = Array();
+				//unset($data['custom_data']['basket']['oOrder']['shop']);
+				
+				$sw = wpsg_q(serialize($data['custom_data']));
+				$sl = strlen($sw);
+				//echo "<b>wpsg_q:</B><br />".$sw;
 				$data['custom_data'] = wpsg_q(serialize($data['custom_data']));
 				
@@ -1277,5 +1295,5 @@
 		{
 			
-			if ($this->o_id > 0)
+			if (($this->o_id > 0) && false)
 			{
 				
@@ -1520,7 +1538,23 @@
 				if (!$noMwSt)
 				{
-						
-					wpsg_addSet($arReturn['mwst'][$tax_key_lang]['sum'], $sum_tax_value);
-					wpsg_addSet($arReturn['mwst'][$tax_key_lang]['base_value'], $sum_brutto);
+					
+					if ((isset($this->arOrder['price_frontend'])) && ($this->arOrder['price_frontend'] == WPSG_BRUTTO))
+					{
+						wpsg_addSet($arReturn['mwst'][$tax_key_lang]['sum'], $sum_tax_value);
+						wpsg_addSet($arReturn['mwst'][$tax_key_lang]['base_value'], $sum_brutto);
+						
+					}
+					else if ((isset($this->arOrder['price_frontend'])) && ($this->arOrder['price_frontend'] == WPSG_NETTO))
+					{
+						wpsg_addSet($arReturn['mwst'][$tax_key_lang]['sum'], $sum_tax_value);
+						wpsg_addSet($arReturn['mwst'][$tax_key_lang]['base_value'], $sum_netto);
+						
+					}
+					else
+					{
+						wpsg_addSet($arReturn['mwst'][$tax_key_lang]['sum'], $sum_tax_value);
+						wpsg_addSet($arReturn['mwst'][$tax_key_lang]['base_value'], $sum_brutto);
+						
+					}
 						
 				}
@@ -1542,10 +1576,19 @@
 				
 			}
-												
+						
+			if ($backend)
+			{
+				$arReturn['backend'] = $backend;
+				$arReturn['price_frontend'] = $this->arOrder['price_frontend'];
+				$arReturn['order_rabatt'] = $this->arOrder['price_rabatt'];
+				$arReturn['gs_value'] = $this->arOrder['price_gs'];
+				
+			}
+				
 			// Gutschein einberechnen
 			$this->shop->callMod('wpsg_mod_gutschein', 'basket_toArray_gs', array(&$this, &$arReturn));
 
 			// Staffelrabatt
-			$this->shop->callMod('wpsg_mod_discount', 'basket_toArray_discount', arraY(&$this, &$arReturn));
+			$this->shop->callMod('wpsg_mod_discount', 'basket_toArray_discount', array(&$this, &$arReturn));
 			
 			// Kundendaten einfÃŒgen			
@@ -1742,7 +1785,44 @@
 					$arReturn['sum']['preis_shipping'] = $arReturn['sum']['preis_shipping_brutto'];
 					
-					$arReturn['sum']['preis_gesamt'] += $arReturn['sum']['preis_payment_brutto'];
+					$arReturn['sum']['preis_gesamt'] += wpsg_getInt($arReturn['sum']['preis_payment_brutto']);
+					$arReturn['sum']['preis_payment'] = wpsg_getInt($arReturn['sum']['preis_payment_brutto']);
+					
+				}
+				
+				// Preise so anzeigen wie im Frontend (Firmenkunde/Endkunde)
+				foreach ($arReturn['produkte'] as $produkt_key => &$p) {
+					if ($arReturn['price_frontend'] == WPSG_NETTO)
+					{
+						$p['preis'] = $p['preis_netto'];
+					}
+					else
+					{
+						$p['preis'] = $p['preis_brutto'];
+					}
+				}
+				if ($arReturn['price_frontend'] == WPSG_NETTO)
+				{
+					$arReturn['sum']['preis'] = $arReturn['sum']['preis_netto'];
+					$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_netto'];
+					$arReturn['sum']['preis_payment'] = $arReturn['sum']['preis_payment_netto'];
+					$arReturn['sum']['preis_shipping'] = $arReturn['sum']['preis_shipping_netto'];
+					$arReturn['sum']['preis_rabatt'] = $arReturn['sum']['preis_rabatt_netto'];
+					if (array_key_exists('gs', $arReturn['sum']))
+					{
+						$arReturn['sum']['gs'] = $arReturn['sum']['gs_netto'];
+					}
+						
+				}
+				else
+				{
+					$arReturn['sum']['preis'] = $arReturn['sum']['preis_brutto'];
+					$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_brutto'];
 					$arReturn['sum']['preis_payment'] = $arReturn['sum']['preis_payment_brutto'];
-					
+					$arReturn['sum']['preis_shipping'] = $arReturn['sum']['preis_shipping_brutto'];
+					$arReturn['sum']['preis_rabatt'] = $arReturn['sum']['preis_rabatt_brutto'];
+					if (array_key_exists('gs', $arReturn['sum']))
+					{
+						$arReturn['sum']['gs'] = $arReturn['sum']['gs_brutto'];
+					}
 				}
 				
Index: /model/wpsg_country.class.php
===================================================================
--- /model/wpsg_country.class.php	(revision 5921)
+++ /model/wpsg_country.class.php	(revision 5922)
@@ -29,4 +29,15 @@
 		} // public function load($deliverynote_id)
 
+		/**
+		 * Gibt das Kuerzel des Landes zurÃŒck
+		 * @return mixed|null
+		 */
+		public function getShorttext()
+		{
+				
+			return __($this->kuerzel, 'wpsg');
+				
+		} // public function getShorttext()
+		
 		/**
 		 * LÃ¶scht das Land
Index: /mods/wpsg_mod_addressvalidation.class.php
===================================================================
--- /mods/wpsg_mod_addressvalidation.class.php	(revision 5921)
+++ /mods/wpsg_mod_addressvalidation.class.php	(revision 5922)
@@ -53,6 +53,6 @@
 		public function wpsg_enqueue_scripts()
 		{
-	
-			if (!is_admin() && wpsg_isSizedInt(get_the_ID()) && (
+			$id = get_the_ID();
+			if (!is_admin() && wpsg_isSizedInt($id) && (
 					get_the_ID() == $this->shop->get_option('wpsg_page_basket') ||
 					get_the_ID() == $this->shop->get_option('wpsg_page_mod_kundenverwaltung_profil') || 
@@ -111,5 +111,5 @@
 				}
 					
-				if ($astr != $_SESSION['wpsg']['Adressstring1'])
+				if ((array_key_exists('Adressstring1', $_SESSION['wpsg'])) && ($astr != $_SESSION['wpsg']['Adressstring1']))
 				{
 					$_SESSION['wpsg']['Adressstring1'] = $astr;
@@ -194,5 +194,5 @@
 					}
 						
-					if ($astr != $_SESSION['wpsg']['Adressstring2'])
+					if ((array_key_exists('Adressstring2', $_SESSION['wpsg'])) && ($astr != $_SESSION['wpsg']['Adressstring2']))
 					{
 						$_SESSION['wpsg']['Adressstring2'] = $astr;
@@ -241,5 +241,5 @@
 						
 								$this->shop->addFrontendError(__('Probleme mit dem Server (Adressvalidation)'.' ('.$result->{'status'}.')', 'wpsg'));
-								$error = true;
+								//$error = true;
 						
 							}
Index: /mods/wpsg_mod_discount.class.php
===================================================================
--- /mods/wpsg_mod_discount.class.php	(revision 5921)
+++ /mods/wpsg_mod_discount.class.php	(revision 5922)
@@ -78,4 +78,6 @@
 			$data_rabatt[0]['rabatt'] = wpsg_tf($_REQUEST['value'][0]['rabatt'], true);
  
+			$insert = 0;
+			
 			if (wpsg_tf($_REQUEST['neu']['value']) > 0 && wpsg_tf($_REQUEST['neu']['rabatt']) > 0)
 			{
@@ -116,7 +118,10 @@
 				$find = false;
 				foreach ($data_rabatt as $k2 => $v2)
-				{ 									
-					if (	wpsg_tf($v2['value']) == wpsg_tf($v['value']) &&
-							wpsg_tf($v2['value']) != $insert	) 
+				{ 			
+					$vval = wpsg_getInt($v['value']);
+					$v2val = wpsg_getInt($v2['value']);
+						
+					if (	wpsg_tf($v2val) == wpsg_tf($vval) &&
+							wpsg_tf($v2val) != $insert	) 
 					{
 						 
@@ -128,5 +133,6 @@
 				if ($find !== false)
 				{  
-					if ($v['del'] == 1) unset($data_rabatt[$find]);
+					$vdel = wpsg_getInt($v['del']);
+					if ($vdel == 1) unset($data_rabatt[$find]);
 					else $data_rabatt[$find]['rabatt'] = wpsg_tf($v['rabatt'], true);
 				}
@@ -428,4 +434,6 @@
 		private function cmp($a, $b)
 		{
+			$aval = wpsg_getInt($a['value']);
+			$bval = wpsg_getInt($b['value']);
 				
 			if ($a['value'] == $b['value']) return 0;
@@ -484,9 +492,12 @@
 			
 			$value = $arReturn['sum']['preis_gesamt_brutto'];
+			if ($value == 0) return;
+			
+			
 			
 			foreach ((array)$data_rabatt as $k => $v)
 			{
 				
-				if (!isset($v['value']) or $value >= $v['value']  && wpsg_tf($v['rabatt']) > 0)
+				if (!isset($v['value']) || $value >= $v['value']  && wpsg_tf($v['rabatt']) > 0)
 				{
 					
@@ -496,54 +507,193 @@
 				
 			}
-			
-			if ($discount !== false)
-			{
-				 
-				$discount = wpsg_tf($discount, true);
-				
-				if (strpos($discount, "%") !== false)
-				{
-					
-					$discount_value = $arReturn['sum']['preis_gesamt_brutto'] / 100 * wpsg_tf($discount);
-					
+
+			if ((isset($arReturn['backend'])) && ($arReturn['backend'] == true))
+			{
+				// Im Backend Rabatt nicht neu berechnen aus Bestellung entnehmen
+				$discount = $arReturn['order_rabatt'];
+				$discount_value = $discount;
+				$price_frontend = $arReturn['price_frontend'];
+				$discount_tax = 0.0;
+				if ($price_frontend == WPSG_NETTO)
+				{
+						
 					if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
 					{
-										 					
-						$discount_tax = $this->shop->subMwSt($arReturn, $discount_value);
-						
-					}
-					
-				}
-				else if ($discount)
-				{
-					
-					if ($this->shop->get_option('wpsg_preisangaben') == WPSG_NETTO)
-					{
-						
+							
+						$discount_tax = $this->shop->addMwSt($arReturn, $discount);
+						//$discount_tax = $this->shop->subMwSt($arReturn, $discount);
+						//$discount_value = $discount - $discount_tax;
+						$discount_tax = 0.0;
+					}
+						
+					if ($this->shop->addRoundedValues === true)
+					{
+					
+						$discount_brutto = round($discount_value + $discount_tax, 2);
+						$discount_netto = round($discount_value, 2);
+					
+					}
+					else
+					{
+					
+						$discount_brutto = $discount_value + $discount_tax;
+						$discount_netto = $discount_value;
+					
+					}
+						
+				}
+				else
+				{
+						
+					$discount_value = $discount;
+						
+					if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
+					{
+			
+						$discount_tax = $this->shop->subMwSt($arReturn, $discount);
+						
+					}
+						
+					if ($this->shop->addRoundedValues === true)
+					{
+					
+						$discount_brutto = round($discount_value, 2);
+						$discount_netto = round($discount_value - $discount_tax, 2);
+					
+					}
+					else
+					{
+					
+						$discount_brutto = $discount_value;
+						$discount_netto = $discount_value - $discount_tax;
+					
+					}
+				}	// if ($price_frontend == WPSG_NETTO)
+				
+				
+				$arReturn['sum']['preis_brutto'] -= $discount_brutto;
+				$arReturn['sum']['preis_netto'] -= $discount_netto;
+				$arReturn['sum']['preis_gesamt_brutto'] -= $discount_brutto;
+				$arReturn['sum']['preis_gesamt_netto'] -= $discount_netto;
+				$arReturn['sum']['preis_rabatt_netto'] = $discount_netto;
+				$arReturn['sum']['preis_rabatt_brutto'] = $discount_brutto;
+				
+				if ($this->shop->getFrontendTaxview() == WPSG_NETTO)
+				{
+				
+					$arReturn['sum']['preis_rabatt'] = $discount_netto;
+					$arReturn['sum']['preis'] = $arReturn['sum']['preis_netto'];
+					$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_netto'];
+						
+				}
+				else if ($this->shop->getFrontendTaxview() == WPSG_BRUTTO)
+				{
+						
+					$arReturn['sum']['preis_rabatt'] = $discount_brutto;
+					$arReturn['sum']['preis'] = $arReturn['sum']['preis_brutto'];
+					$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_brutto'];
+						
+				}
+				
+				
+			
+			}
+			else	// if ($arReturn['backend'] == true)
+			{
+				
+				if ($discount !== false)
+				{
+						
+					$discount = wpsg_tf($discount, true);
+				
+					if (strpos($discount, "%") !== false)
+					{
+							
+						$discount_value = $arReturn['sum']['preis_gesamt_brutto'] / 100 * wpsg_tf($discount);
+							
 						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
 						{
-						
-							$discount_tax = $this->shop->addMwSt($arReturn, $discount);
-							 
-						} 
-						
-						$discount_value = $discount + $discount_tax;
-						
+				
+							$discount_tax = $this->shop->subMwSt($arReturn, $discount_value);
+				
+						}
+							
+					}
+					else if ($discount)
+					{
+							
+						if ($this->shop->get_option('wpsg_preisangaben') == WPSG_NETTO)
+						{
+				
+							if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
+							{
+				
+								$discount_tax = $this->shop->addMwSt($arReturn, $discount);
+				
+							}
+				
+							$discount_value = $discount + $discount_tax;
+				
+						}
+						else
+						{
+				
+							$discount_value = $discount;
+				
+							if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
+							{
+									
+								$discount_tax = $this->shop->subMwSt($arReturn, $discount);
+				
+							}
+								
+						}
+							
+					}
+				
+					if ($this->shop->addRoundedValues === true)
+					{
+							
+						$discount_brutto = round($discount_value, 2);
+						$discount_netto = round($discount_value - $discount_tax, 2);
+							
 					}
 					else
 					{
-						
-						$discount_value = $discount;
-						
-						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
-						{
-							
-							$discount_tax = $this->shop->subMwSt($arReturn, $discount);
-						
-						}
-						 
-					}
-					
-				}
+					
+						$discount_brutto = $discount_value;
+						$discount_netto = $discount_value - $discount_tax;
+							
+					}
+					
+					$arReturn['sum']['preis_brutto'] -= $discount_brutto;
+					$arReturn['sum']['preis_netto'] -= $discount_netto;
+					$arReturn['sum']['preis_gesamt_brutto'] -= $discount_brutto;
+					$arReturn['sum']['preis_gesamt_netto'] -= $discount_netto;
+					$arReturn['sum']['preis_rabatt_netto'] = $discount_netto;
+					$arReturn['sum']['preis_rabatt_brutto'] = $discount_brutto;
+					
+					if ($this->shop->getFrontendTaxview() == WPSG_NETTO)
+					{
+					
+						$arReturn['sum']['preis_rabatt'] = $discount_netto;
+						$arReturn['sum']['preis'] = $arReturn['sum']['preis_netto'];
+						$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_netto'];
+							
+					}
+					else if ($this->shop->getFrontendTaxview() == WPSG_BRUTTO)
+					{
+							
+						$arReturn['sum']['preis_rabatt'] = $discount_brutto;
+						$arReturn['sum']['preis'] = $arReturn['sum']['preis_brutto'];
+						$arReturn['sum']['preis_gesamt'] = $arReturn['sum']['preis_gesamt_brutto'];
+							
+					}
+						
+				}
+			}  // else if ($arReturn['backend'] == true)
+			/*
+			if ($discount !== false)
+			{
 				
 				if ($this->shop->addRoundedValues === true)
@@ -586,5 +736,5 @@
 				} 
 				
-			}		
+			}	*/	
 			
 		} // public function basket_toArray_discount(&$basket, &$arBasket)
Index: /mods/wpsg_mod_gutschein.class.php
===================================================================
--- /mods/wpsg_mod_gutschein.class.php	(revision 5921)
+++ /mods/wpsg_mod_gutschein.class.php	(revision 5922)
@@ -577,63 +577,110 @@
 			if ($basket->gs_value !== false)
 			{
-				
-				$arReturn['gs'] = array(
-					'value' => $basket->gs_value,
-					'calc' => $basket->gs_calc,
-					'code' => $basket->gs_code
-				);
-				
-				$gs_value = $basket->gs_value;
-				$gs_tax = 0;
-				
-				// Bruttopreis des Gutscheins bestimmen
-				if ($basket->gs_calc == 'p')
-				{
-											
-					$gs_value = $arReturn['sum']['preis_gesamt_brutto'] / 100 * $basket->gs_value;
-					
-					if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
-					{
-												 					
-						$gs_tax = $this->shop->subMwSt($arReturn, $gs_value);
-						
-					}
-											
-				}
-				else 
-				{
-					
-					if ($this->shop->get_option('wpsg_preisangaben') == WPSG_NETTO)
-					{
-						
+				if ((isset($arReturn['backend'])) && $arReturn['backend'])
+				{
+					// Berechnung Gutschein im Backend je nach netto/brutto im Frontend
+				
+					$arReturn['gs'] = array(
+							'value' => $arReturn['gs_value'],
+							'calc' => $basket->gs_calc,
+							'code' => $basket->gs_code
+					);
+						
+					$gs_value = $arReturn['gs_value'];
+					$gs_tax = 0;
+						
+					if ((isset($arReturn['price_frontend'])) && ($arReturn['price_frontend'] == WPSG_BRUTTO))
+					{
+						//$gs_value = $basket->gs_value;
+				
 						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
 						{
-						
-							$gs_tax = $this->shop->addMwSt($arReturn, $basket->gs_value);
-							 
-						} 
-						
-						$gs_value = $basket->gs_value + $gs_tax;
-						
-					}
-					else
-					{
-						
-						$gs_value = $basket->gs_value;
-						
+				
+							$gs_tax = $this->shop->subMwSt($arReturn, $basket->gs_value);
+				
+						}
+						$gs_brutto = $gs_value;
+						$gs_netto = $gs_value - $gs_tax;
+				
+					}
+						
+					if ((isset($arReturn['price_frontend'])) && ($arReturn['price_frontend'] == WPSG_NETTO))
+					{
 						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
 						{
+				
+							$gs_tax = $this->shop->addMwSt($arReturn, $basket->gs_value);
+				
+						}
+						//$gs_value = $basket->gs_value + $gs_tax;
+						$gs_brutto = $gs_value + $gs_tax;
+						$gs_netto = $gs_value;
+				
+					}
+						
+				}
+				else
+				{
+					$arReturn['gs'] = array(
+							'value' => $basket->gs_value,
+							'calc' => $basket->gs_calc,
+							'code' => $basket->gs_code
+					);
+					
+					$gs_value = $basket->gs_value;
+					$gs_tax = 0;
+					
+					// Bruttopreis des Gutscheins bestimmen
+					if ($basket->gs_calc == 'p')
+					{
 							
-							$gs_tax = $this->shop->subMwSt($arReturn, $basket->gs_value);
+						$gs_value = $arReturn['sum']['preis_gesamt_brutto'] / 100 * $basket->gs_value;
 							
+						if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
+						{
+					
+							$gs_tax = $this->shop->subMwSt($arReturn, $gs_value);
+					
 						}
-						//die($gs_tax."=".$gs_value);
-					}
-										
-				}
-								 				 
-				$gs_brutto = $gs_value;
-				$gs_netto = $gs_value - $gs_tax; 
- 				
+							
+					}
+					else
+					{
+							
+						if ($this->shop->get_option('wpsg_preisangaben') == WPSG_NETTO)
+						{
+					
+							if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
+							{
+					
+								$gs_tax = $this->shop->addMwSt($arReturn, $basket->gs_value);
+					
+							}
+					
+							$gs_value = $basket->gs_value + $gs_tax;
+					
+						}
+						else
+						{
+					
+							$gs_value = $basket->gs_value;
+					
+							if ($this->shop->get_option('wpsg_kleinunternehmer') != '1')
+							{
+									
+								$gs_tax = $this->shop->subMwSt($arReturn, $basket->gs_value);
+									
+							}
+							//die($gs_tax."=".$gs_value);
+						}
+					
+					}
+					
+					$gs_brutto = $gs_value;
+					$gs_netto = $gs_value - $gs_tax;
+					
+				}
+				
+
 				$arReturn['sum']['preis_brutto'] -= $gs_brutto;
 				$arReturn['sum']['preis_netto'] -= $gs_netto;
Index: /mods/wpsg_mod_targo.class.php
===================================================================
--- /mods/wpsg_mod_targo.class.php	(revision 5921)
+++ /mods/wpsg_mod_targo.class.php	(revision 5922)
@@ -48,5 +48,8 @@
 			$this->shop->checkDefault('wpsg_mod_targo_success', '');
 			$this->shop->checkDefault('wpsg_mod_targo_error', '');
-			
+
+			$this->shop->checkDefault('wpsg_mod_targo_dealerShopURL', '');
+			$this->shop->checkDefault('wpsg_mod_targo_dealerAbortURL', '');
+				
 			$this->shop->checkDefault('wpsg_mod_targo_bezeichnung', 'Targobank');
 			$this->shop->checkDefault('wpsg_mod_targo_hint', 'ErmÃ¶glicht die Zahlungsabwicklung mit der Targobank');
@@ -95,4 +98,7 @@
 			$this->shop->update_option('wpsg_mod_targo_hashkey', $_REQUEST['wpsg_mod_targo_hashkey']);
 		
+			$this->shop->update_option('wpsg_mod_targo_dealerShopURL', $_REQUEST['wpsg_mod_targo_dealerShopURL']);
+			$this->shop->update_option('wpsg_mod_targo_dealerAbortURL', $_REQUEST['wpsg_mod_targo_dealerAbortURL']);
+				
 			$this->shop->update_option('wpsg_mod_targo_bezeichnung', $_REQUEST['wpsg_mod_targo_bezeichnung']);
 			$this->shop->update_option('wpsg_mod_targo_hint', $_REQUEST['wpsg_mod_targo_hint']);
Index: /views/admin/form/link.phtml
===================================================================
--- /views/admin/form/link.phtml	(revision 5922)
+++ /views/admin/form/link.phtml	(revision 5922)
@@ -0,0 +1,42 @@
+<div class="form-group form-group-sm <?php echo ((wpsg_isSizedString($this->view['field_config']['help']))?'has-feedback':''); ?>">
+
+	<label class="col-sm-6 control-label" for="<?php echo $this->view['field_id']; ?>"><?php echo $this->view['field_label']; ?></label>
+	
+	<div class="col-sm-6">
+	
+		<div class="wpsg_field_wrap" style="padding-top:3px;">
+			<a href="#"
+				class="<?php echo wpsg_getStr($this->view['field_config']['class'])  ?>"
+				name="<?php echo $this->view['field_name']; ?>"
+				autofocus="true"
+				tabindex="<?php
+
+					if (!isset($GLOBALS['wpsg']['tabindex']))
+					{
+
+						$GLOBALS['wpsg']['tabindex'] = 10;
+
+					}
+					else
+					{
+
+						$GLOBALS['wpsg']['tabindex'] += 10;
+
+					}
+
+					echo $GLOBALS['wpsg']['tabindex'];
+
+				?>"
+				id="<?php echo $this->view['field_id']; ?>"
+				><?php echo $this->view['field_link']; ?></a>
+
+			<?php if (wpsg_isSizedString($this->view['field_config']['help'])) { ?>
+				<a href="#" a-wpsg-tip="<?php echo $this->view['field_config']['help']; ?>" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=<?php echo $this->view['field_config']['help']; ?>" class="glyphicon glyphicon glyphicon-info-sign form-control-feedback" aria-hidden="true"></a>
+			<?php } ?>
+		</div>
+				
+	</div>
+
+	<div class="clearfix wpsg_clear"></div>
+	
+</div>
Index: /views/admin/kundendaten_tab2.phtml
===================================================================
--- /views/admin/kundendaten_tab2.phtml	(revision 5921)
+++ /views/admin/kundendaten_tab2.phtml	(revision 5922)
@@ -25,6 +25,6 @@
 		<tr class="wpsg_customervar_row_<?php echo $c_id; ?>">
 			<td class="col0"><?php echo $c_id; ?></td>
-			<td class="col2"><span class="wpsg_editable" id="kundenvariable_name_<?php echo $c_id; ?>"><?php echo wpsg_hspc($c['name']); ?></span></td>
-			<td class="col3">
+			<td class="col1"><span class="wpsg_editable" id="kundenvariable_name_<?php echo $c_id; ?>"><?php echo wpsg_hspc($c['name']); ?></span></td>
+			<td class="col2">
 				<select class="form-control" name="pflicht[custom][<?php echo $c_id; ?>][show]">
 					<option <?php echo (($c['show'] == '0')?'selected="selected"':''); ?> value="0"><?php echo __('Ja', 'wpsg'); ?></option>
Index: /views/mods/mod_creditcard/order_view_afterpayment.phtml
===================================================================
--- /views/mods/mod_creditcard/order_view_afterpayment.phtml	(revision 5922)
+++ /views/mods/mod_creditcard/order_view_afterpayment.phtml	(revision 5922)
@@ -0,0 +1,14 @@
+<?php
+
+	/**
+	 * Das Template wird in der Bestellansicht eingebunden und zeigt die Kreditkartendaten des Kunden an, die er wÃ€hrend der Bestellung angegeben hat
+	 */
+
+?>
+<br />
+<?php echo wpsg_drawForm_Input('', __('Typ der Kreditkarte', 'wpsg'), $this->view['wpsg_mod_creditcard']['typ'], array('text' => true, 'clear_after' => true, 'readonly' => true)); ?>
+<?php echo wpsg_drawForm_Input('', __('Inhaber der Kreditkarte', 'wpsg'), $this->view['wpsg_mod_creditcard']['inhaber'], array('text' => true, 'clear_after' => true, 'readonly' => true)); ?>
+<?php echo wpsg_drawForm_Input('', __('Kreditkarten-Nummer', 'wpsg'), $this->view['wpsg_mod_creditcard']['knr'], array('text' => true, 'clear_after' => true, 'readonly' => true)); ?>
+<?php echo wpsg_drawForm_Input('', __('PrÃŒfziffer', 'wpsg'), $this->view['wpsg_mod_creditcard']['pruefz'], array('text' => true, 'clear_after' => true, 'readonly' => true)); ?>
+<?php echo wpsg_drawForm_Input('', __('GÃŒltig bis', 'wpsg'), $this->view['wpsg_mod_creditcard']['gueltigm'].'/'.$this->view['wpsg_mod_creditcard']['gueltigj'], array('text' => true, 'clear_after' => true, 'readonly' => true)); ?>
+
Index: /views/mods/mod_crefopay/settings_edit.phtml
===================================================================
--- /views/mods/mod_crefopay/settings_edit.phtml	(revision 5921)
+++ /views/mods/mod_crefopay/settings_edit.phtml	(revision 5922)
@@ -24,13 +24,7 @@
 <?php echo wpsg_drawForm_Input('wpsg_mod_crefopay_frameheight', __('HÃ¶he des IFrames in px', 'wpsg'), $this->get_option('wpsg_mod_crefopay_frameheight'), array('help' => 'wpsg_mod_crefopay_frameheight')); ?>
 
-<div class="wpsg_form_field ">
-	<div class="wpsg_form_left">
-		<label for=""><?php echo __('MNS Statuswechsel', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right">
-		<a href="#" class="wpsg_mod_crefopay_switchstatemapping" onclick="return wpsg_mod_crefopay_mnsstatemapping();"><?php echo __('Bearbeiten', 'wpsg'); ?></a>						
-	</div>
-	<div class="wpsg_clear"></div>
-</div>
+<?php echo wpsg_drawForm_Link('wpsg_mod_crefopay_link', __('MNS Statuswechsel', 'wpsg'), 
+		__('Bearbeiten', 'wpsg'), array('class' => 'wpsg_mod_crefopay_switchstatemapping')); ?>
+
 <div class="wpsg_mod_crefopay_mnsstatemapping">
 	<?php foreach ($this->view['transactionMapping'] as $crefopay_status => $wpsg_status) { ?>
Index: /views/mods/mod_paypalapi/settings_edit.phtml
===================================================================
--- /views/mods/mod_paypalapi/settings_edit.phtml	(revision 5921)
+++ /views/mods/mod_paypalapi/settings_edit.phtml	(revision 5922)
@@ -41,17 +41,12 @@
 <br />
 
-<div class="wpsg_form_field ">
-	<div class="wpsg_form_left">
-		<label for=""><?php echo __('Stornierung bei Statuswechsel', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right">
-		<a href="#" class="wpsg_mod_paypalapi_stornostate"><?php echo __('Bearbeiten', 'wpsg'); ?></a>
-	</div>
-	<div class="wpsg_clear"></div>
-</div>
+<?php echo wpsg_drawForm_Link('wpsg_mod_paypalapi_link', __('Stornierung bei Statuswechsel', 'wpsg'), 
+		__('Bearbeiten', 'wpsg'), array('help' => 'wpsg_mod_paypalapi_link', 'class' => 'wpsg_mod_paypalapi_stornostate')); ?>
+
+
 <div class="wpsg_mod_paypalapi_stornostate_layer" style="display:none;">
 	
 	<?php foreach ($this->arStatus as $status_id => $status_label) { $arStornoStatus = (array)$this->get_option('wpsg_mod_paypalapi_stornostate'); ?>
-	<?php echo wpsg_drawForm_Checkbox('wpsg_mod_paypalapi_stornostate['.$status_id.']', __($status_label, 'wpsg'), $arStornoStatus[$status_id], array('labelright' => true)); ?>	
+	<?php echo wpsg_drawForm_Checkbox('wpsg_mod_paypalapi_stornostate['.$status_id.']', __($status_label, 'wpsg'), wpsg_getInt($arStornoStatus[$status_id]), array('labelright' => true)); ?>	
 	<?php } ?> 
 	
@@ -131,17 +126,17 @@
 
 			if (jQuery(this).is(':checked'))
--            {
--                
--                jQuery('.wpsg_mod_paypalapi_plus_aktiv').show();
--                jQuery('.wpsg_mod_paypalapi_plus_inaktiv').hide();
--                
--            }
--			else 
--            {
--             
--                jQuery('.wpsg_mod_paypalapi_plus_aktiv').hide();
--                jQuery('.wpsg_mod_paypalapi_plus_inaktiv').show();
--                
--            }
+            {
+                
+                jQuery('.wpsg_mod_paypalapi_plus_aktiv').show();
+                jQuery('.wpsg_mod_paypalapi_plus_inaktiv').hide();
+                
+            }
+			else 
+            {
+             
+                jQuery('.wpsg_mod_paypalapi_plus_aktiv').hide();
+                jQuery('.wpsg_mod_paypalapi_plus_inaktiv').show();
+                
+            }
 			
 		} ).change();
Index: /views/mods/mod_targo/order_done.phtml
===================================================================
--- /views/mods/mod_targo/order_done.phtml	(revision 5921)
+++ /views/mods/mod_targo/order_done.phtml	(revision 5922)
@@ -15,13 +15,19 @@
 ?>
 
-<p><?php echo __('Um den Betrag mit Targo zu bezahlen klicken Sie bitte auf folgendes Logo.', 'wpsg'); ?></p> 
+<p><?php echo __('Um den Betrag mit einer Finanzierung bei der TARGOBANK zu bezahlen, klicken Sie bitte auf folgendes Logo.', 'wpsg'); ?></p> 
 <p>
+<!--
 	<a title="<?php echo __('Mit Targo bezahlen', 'wpsg'); ?>" href="<?php echo $url; ?>">
-		<img src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" align="left" alt="<?php echo __('Mit Targo bezahlen', 'wpsg'); ?>" style="margin-right:7px;">
+		<img src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" align="left" alt="<?php echo __('Finanzierung bei Targo beantragen.', 'wpsg'); ?>" style="margin-right:7px;">
 	 
 	</a>
+-->
 </p>
 
-<form hidden class="wpsg_productform" id="wpsg_produktform" method="post" action="<?php echo $url ?>">
+<form class="wpsg_productform" id="wpsg_produktform" method="post" action="<?php echo $url ?>">
+
+<input type="image" name="image" src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" alt="<?php echo __('Finanzierung bei Targo beantragen.', 'wpsg'); ?>" style="margin-right:7px;">
+
+<div style="display:none;">
 <?php $o_id = $this->view['o_id'];
 	  $k_id = $this->view['k_id'];
@@ -46,8 +52,12 @@
 	  $nr = $oOrder-> getInvoiceStreetNr();
 	  
-	   
 ?>
 <?php ?>
-<?php ?>
+<?php 
+function toIso($string) {
+	return mb_convert_encoding($string, "ISO-8859-1");
+}
+
+?>
 
 <br /><br />
@@ -62,6 +72,6 @@
 
 <b>Optionale Daten fÃŒr Targobank</b><br />
-<input type="text" id="dealerShopURL" name="dealerShopURL" value="" placeholder="dealerShopURL"><br />
-<input type="text" id="dealerAbortURL" name="dealerAbortURL" value="" placeholder="dealerAbortURL"><br />
+<input type="text" id="dealerShopURL" name="dealerShopURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerShopURL');?>" placeholder="dealerShopURL"><br />
+<input type="text" id="dealerAbortURL" name="dealerAbortURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerAbortURL');?>" placeholder="dealerAbortURL"><br />
 <input type="text" id="hash" name="hash" value="" placeholder="hash">(hashkey)<br />
 <input type="text" id="" name="" value="" placeholder=""><br />
@@ -69,17 +79,41 @@
 
 <b>Adressdaten aus Kundendaten</b><br />
-<input type="text" id="surname" name="surname" value="<?php echo $oCustomer->getName();?>" placeholder="surname"><br />
-<input type="text" id="firstname" name="firstname" value="<?php echo $oCustomer->getFirstname();?>" placeholder="firstname"><br />
-<input type="text" id="street" name="street" value="<?php echo $oOrder->getInvoiceStreetClear(true);?>" placeholder="street"><br />
-<input type="text" id="streetnumber" name="streetnumber" value="<?php echo $oOrder->getInvoiceStreetNr();?>" placeholder="streetnumber"><br />
-<input type="text" id="zip" name="zip" value="<?php echo $oCustomer->getZip();?>" placeholder="zip"><br />
-<input type="text" id="city" name="city" value="<?php echo $oCustomer->getCity();?>" placeholder="city"><br />
+<?php
+$titel = $oCustomer->getTitle();
+$isotitel = '';
+if (($titel == "Herr") || ($titel == "Frau")) $isotitel = toIso($titel);
+?>
+<input type="text" id="surname" name="gender" value="<?php echo $isotitel;?>" placeholder="titel"><br />
+<input type="text" id="surname" name="surname" value="<?php echo toIso($oCustomer->getName());?>" placeholder="surname"><br />
+<input type="text" id="firstname" name="firstname" value="<?php echo toIso($oCustomer->getFirstname());?>" placeholder="firstname"><br />
+<input type="text" id="street" name="street" value="<?php echo toIso($oOrder->getInvoiceStreetClear(true));?>" placeholder="street"><br />
+<input type="text" id="streetnumber" name="streetnumber" value="<?php echo toIso($oOrder->getInvoiceStreetNr());?>" placeholder="streetnumber"><br />
+<input type="text" id="zip" name="zip" value="<?php echo toIso($oCustomer->getZip());?>" placeholder="zip"><br />
+<input type="text" id="city" name="city" value="<?php echo toIso($oCustomer->getCity());?>" placeholder="city"><br />
 <input type="text" id="telnocode" name="telnocode" value="" placeholder="vorwahl"><br />
-<input type="text" id="telno" name="telno" value="<?php echo $oCustomer->getPhone();?>" placeholder="telno"><br />
-<input type="text" id="birthday" name="birthday" value="<?php echo $oCustomer->getBirthdate("Y-m-d");?>" placeholder="birthday"><br />
-<input type="text" id="email" name="email" value="<?php echo $oCustomer->getEMail();?>"  placeholder="email"><br />
+<input type="text" id="telno" name="telno" value="<?php echo toIso($oCustomer->getPhone());?>" placeholder="telno"><br />
+<input type="text" id="birthday" name="birthday" value="<?php 
+	
+	$dt = $oCustomer->getBirthdate("Y-m-d");
+	
+	if ($oCustomer->geb == '0000-00-00' || strtotime($dt) === false)
+	{
+		
+		echo '';
+		
+	}
+	else
+	{
+		
+		echo $oCustomer->getBirthdate("Y-m-d");
+		
+	}
+
+?>" placeholder="birthday"><br />
+<input type="text" id="email" name="email" value="<?php echo toIso($oCustomer->getEMail());?>"  placeholder="email"><br />
 
 <input type="submit" id="submit" name="submit" value="submit" >
 
+</div>
 </form>
 
@@ -90,5 +124,6 @@
 	jQuery(document).ready(function() { 
 		window.setTimeout(function() {
-			location.href = "<?php echo $url;?>";
+			//location.href = "<?php echo $url;?>";
+			jQuery('#submit').trigger("click");
 		}, 1000);
 	} );
Index: /views/mods/mod_targo/settings_edit.phtml
===================================================================
--- /views/mods/mod_targo/settings_edit.phtml	(revision 5921)
+++ /views/mods/mod_targo/settings_edit.phtml	(revision 5922)
@@ -32,4 +32,9 @@
 <br />
 
+<?php echo wpsg_drawForm_Input('wpsg_mod_targo_dealerShopURL', __('Targo-Dealer-Shop-URL', 'wpsg'), $this->get_option('wpsg_mod_targo_dealerShopURL'), array('help' => 'wpsg_mod_targo_dealerShopURL')); ?>
+<?php echo wpsg_drawForm_Input('wpsg_mod_targo_dealerAbortURL', __('Targo-Dealer-Abort-URL', 'wpsg'), $this->get_option('wpsg_mod_targo_dealerAbortURL'), array('help' => 'wpsg_mod_targo_dealerAbortURL')); ?>
+
+<br />
+
 <?php echo wpsg_drawForm_Input('wpsg_mod_targo_gebuehr', __('GebÃŒhr/Rabatt', 'wpsg'), wpsg_ff($this->get_option('wpsg_mod_targo_gebuehr'), true), array('help' => 'wpsg_shippay_gebuehr', 'unit' => $this->get_option('wpsg_currency').' / %')); ?>
 <?php echo wpsg_drawForm_Select('wpsg_mod_targo_mwst', __('Mehrwertsteuersatz', 'wpsg'), wpsg_tax_groups(), $this->get_option('wpsg_mod_targo_mwst'), array('help' => 'wpsg_shippay_mwst')); ?>
Index: /views/order/index.phtml
===================================================================
--- /views/order/index.phtml	(revision 5921)
+++ /views/order/index.phtml	(revision 5922)
@@ -239,5 +239,6 @@
                         <td class="col_products">
 
-                            <?php foreach ($oOrder->getOrderProducts() as $oOrderProduct) { ?>
+                            <?php $oOrderProducts = $oOrder->getOrderProducts();
+                            foreach ($oOrderProducts as $oOrderProduct) { ?>
                             <?php echo wpsg_translate(__('#1# x <a href="#2#">#3#</a> fÃŒr je #4#', 'wpsg'),
                                 $oOrderProduct->getCount(),
Index: /views/order/view.phtml
===================================================================
--- /views/order/view.phtml	(revision 5921)
+++ /views/order/view.phtml	(revision 5922)
@@ -39,5 +39,23 @@
 
         <br />
+        <?php if ($this->hasMod('wpsg_mod_gutschein')) { ?>
+        	<?php //if (((array_key_exists('gs', $this->view['basket'])) && ($this->view['basket']['gs']['value'] == 0))) { ?>
+		        <a href="" id="LinkGutscheinNeu" onclick="return wpsg_addVoucher(<?php echo $_REQUEST['edit_id']; ?>);"><span class="glyphicon glyphicon-plus"></span>&nbsp;
+			 	<?php echo __("Neuer Gutschein.", "wpsg"); ?>
+			 	</a><br />
+            <?php //} ?>
+        <?php } ?>
 
+        <?php if ($this->hasMod('wpsg_mod_discount')) { ?>
+        	<?php //if (((array_key_exists('preis_rabatt', $this->view['basket']['sum'])) && ($this->view['basket']['sum']['preis_rabatt'] == 0))) { ?>
+		        <a href="" id="LinkRabattNeu" onclick="return wpsg_addDiscount(<?php echo $_REQUEST['edit_id']; ?>);"><span class="glyphicon glyphicon-plus"></span>&nbsp;
+			 	<?php echo __("Neuer Rabatt.", "wpsg"); ?>
+			 	</a><br />
+            <?php //} ?>
+        <?php } ?>
+		
+		
+		<div id='wpsg_kv_list'>
+		</div>
     </div>
 
@@ -57,4 +75,48 @@
 
 <script type="text/javascript">/* <![CDATA[ */
+
+
+	/**
+	 * FÃŒgt einen neuen Rabatt hinzu (nur wenn keiner da ist)
+	 */	                                            	
+	function wpsg_addDiscount(oid)
+	{
+		jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+		
+		jQuery.ajax( {
+			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=discountData&do=add&edit_id=' + oid + '&noheader=1',
+			success: function(data) {
+				jQuery('#wpsg_produkte_table').replaceWith(data);
+				jQuery('#LinkRabattNeu').hide();
+			}
+		} );
+	
+		return false;
+	
+	} // function wpsg_addRabatt()
+
+
+	/**
+	 * FÃŒgt einen neuen Gutschein hinzu (nur wenn keiner da ist)
+	 */	                                            	
+	function wpsg_addVoucher(oid)
+	{
+		jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+		
+		jQuery.ajax( {
+			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=add&edit_id=' + oid + '&noheader=1',
+			success: function(data) {
+				jQuery('#wpsg_produkte_table').replaceWith(data);
+				jQuery('#LinkGutscheinNeu').hide();
+				//jQuery('#wpsg_kv_list').html(data);
+				//location.href = location.href;
+				//jQuery('#wpsg_kv_list').html('');
+			}
+		} );
+	
+		return false;
+
+	} // function wpsg_addVoucher()
+
 
     jQuery(document).ready(function() {
Index: /views/order/view_orderdata.phtml
===================================================================
--- /views/order/view_orderdata.phtml	(revision 5921)
+++ /views/order/view_orderdata.phtml	(revision 5922)
@@ -8,5 +8,5 @@
 
 ?>
-
+<div id="wpsg_produkte_table">
 <?php echo wpsg_drawForm_AdminboxStart(__('Bestelldaten', 'wpsg')); ?>
     <table class="wpsg_produkte table">
@@ -48,8 +48,27 @@
         <?php $this->callMods('order_view_row', array(&$p, $i)); ?>
         <?php } ?>
-        <?php if (isset($this->view['basket']['gs'])) { ?>
+        <?php $gs_id = 0; 
+        if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs']['value'] > 0)) { ?>
         <tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?> wpsg_gutschein">
-            <td class="wpsg_cell_name"><?php echo __('Gutschein', 'wpsg'); ?> <?php echo ($this->view['basket']['gs']['code'] != '')? '('.$this->view['basket']['gs']['code'].')':'' ?></td>
-            <td class="wpsg_cell_preis"><?php echo '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); ?></td>
+        	<?php 
+        		$gs_id = 0;
+        		if (array_key_exists('gs_id', $_REQUEST))
+        		{
+        			$gs_id = wpsg_getInt($_REQUEST['gs_id']);
+        		}
+        		else
+        		{
+        			$gs_id = wpsg_getInt($this->view['data']['gs_id']);
+        		}
+        		$o_id = $_REQUEST['edit_id'];
+        		$link1 = '<span id="gsname_'.$gs_id.'" class="editable editable-click" data-original-title="" title="">'.$this->view['basket']['gs']['code'].'</span>';
+        		$val = '-'.wpsg_ff($this->view['basket']['sum']['gs']);
+        		$link2 = '<span id="gsvalue_'.$gs_id.'" class="editable editable-click" data-original-title="" title="">'.$val.'</span>';
+        		
+        	?>
+            <td class="wpsg_cell_name"><?php echo __('Gutschein', 'wpsg'); ?> <?php echo ($this->view['basket']['gs']['code'] != '')? '('.$link1.')':'' ?>
+            	<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein lÃ¶schen', 'wpsg'); ?>" onclick="return wpsg_removeVoucher(<?php echo $gs_id; ?>, <?php echo $o_id; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
+            </td>
+            <td class="wpsg_cell_preis"><?php echo $link2.' '.$this->get_option('wpsg_currency'); ?></td>
             <?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
             <td class="wpsg_cell_mwst"><?php echo __('anteilig', 'wpsg'); ?></td>
@@ -59,11 +78,17 @@
         </tr>
         <?php } ?>
-        <?php if (isset($this->view['basket']['sum']['preis_rabatt']) && $this->view['basket']['sum']['preis_rabatt'] > 0) { ?>
+        <?php $prval = 0; 
+        if (isset($this->view['basket']['sum']['preis_rabatt']) && $this->view['basket']['sum']['preis_rabatt'] > 0) { 
+        	$o_id = $_REQUEST['edit_id'];
+        	$prval = '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt']);
+        	$link2 = '<span id="discountvalue_'.$o_id.'" class="editable editable-click" data-original-title="" title="">'.$prval.'</span>';
+        ?>
         <tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?> wpsg_row_rabatt">
             <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_rabatt_label">
                 <?php echo __('AbzÃŒglich Rabatt', 'wpsg'); ?>
+                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Rabatt lÃ¶schen', 'wpsg'); ?>" onclick="return wpsg_removeDiscount(<?php echo $o_id; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
             </td>
             <td class="wpsg_cell_rabatt_value wpsg_cell_gesamtpreis">
-                <?php echo '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt'], $this->get_option('wpsg_currency')); ?>
+                <?php echo $link2.' '.$this->get_option('wpsg_currency'); ?>
             </td>
         </tr>
@@ -74,5 +99,7 @@
                     <?php echo wpsg_translate(__('Summe (zzgl. #1#)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
                 <?php } else { ?>
-                    <?php if ($this->getFrontendTaxview() == WPSG_NETTO) { ?>
+                    <?php //if ($this->getFrontendTaxview() == WPSG_NETTO) 
+                    if ($this->view['basket']['price_frontend'] == WPSG_NETTO)
+                    { ?>
                     <?php echo wpsg_translate(__('Summe (zzgl. #1#, zzgl. MwSt.)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
                     <?php } else { ?>
@@ -98,5 +125,11 @@
         <tr class="wpsg_row_payment">
             <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_payment_label">
-                <?php echo __('Zahlungsart', 'wpsg'); ?>
+                <?php echo __('Zahlungsart', 'wpsg');
+                //$order = $this->view['oOrder'];
+                $oOrder = wpsg_order::getInstance($_REQUEST['edit_id']);
+                $pid = $oOrder->getPaymentID();
+                echo __('  ('.$this->arPayment[$pid]['name'].')', 'wpsg');
+                ?>
+                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Zahlungsart Ã€ndern', 'wpsg'); ?>" onclick="return WPSG_BE_Payment.changePayment(<?php echo $pid; ?>, <?php echo $o_id; ?>);"><span class="glyphicon glyphicon-modal-window"></span></a>
             </td>
             <td class="wpsg_cell_payment_value wpsg_cell_gesamtpreis">
@@ -122,5 +155,5 @@
             </td>
             <td class="wpsg_cell_gesamt_value wpsg_cell_gesamtpreis">
-                <strong><?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt_brutto']); ?> <?php echo $this->get_option('wpsg_currency'); ?></strong>
+                <strong><?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt']); ?> <?php echo $this->get_option('wpsg_currency'); ?></strong>
             </td>
         </tr>
@@ -132,5 +165,9 @@
                     <?php echo $this->get_option('wpsg_kleinunternehmer_text'); ?>
                 <?php } else { ?>
-                    <?php echo wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $mwst['name']); ?>
+                    <?php if ($this->view['basket']['price_frontend'] == WPSG_NETTO) {
+                    	echo wpsg_translate(__('zuzÃŒglich MwSt. (#1#)', 'wpsg'), $mwst['name']);
+                    } else {
+                    	echo wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $mwst['name']); ?>
+                    <?php } ?>
                 <?php } ?>
             </td>
@@ -142,3 +179,295 @@
         <?php } ?>
     </table>
+
+
+<script type="text/javascript">/* <![CDATA[ */
+
+<?php if ($this->hasMod('wpsg_mod_gutschein')) { ?>
+	<?php if ((array_key_exists('gs', $this->view['basket'])) && ($this->view['basket']['gs']['value'] > 0)) { ?>
+
+	jQuery('#gsname_<?php echo $gs_id; ?>').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editname&noheader=1', {
+		submitdata: { 
+    		field: 'code',
+    		gs_id: '<?php echo $gs_id; ?>',
+    		edit_id: '<?php echo $o_id; ?>'
+		}, 					
+		submit  : '<?php echo __('Speichern', 'wpsg'); ?>',
+		placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+		indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
+    	tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+    	callback: function(data, config) {
+    		jQuery('#wpsg_produkte_table').replaceWith(data);
+    	}
+	});
+
+	jQuery('#gsvalue_<?php echo $gs_id; ?>').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editvalue&noheader=1', {
+		submitdata: { 
+    		field: 'value',
+    		gs_id: '<?php echo $gs_id; ?>',
+    		edit_id: '<?php echo $o_id; ?>',
+        	noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>',
+        	mwst: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
+        	price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>'
+		}, 					
+		submit  : '<?php echo __('Speichern', 'wpsg'); ?>',
+		placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+		indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
+    	tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+    	callback: function(data, config) {
+    		jQuery('#wpsg_produkte_table').replaceWith(data);
+    	}
+	});
+
+	<?php } ?>
+<?php } ?>
+
+<?php if ($this->hasMod('wpsg_mod_discount')) { ?>
+	<?php if (isset($this->view['basket']['sum']['preis_rabatt']) && $this->view['basket']['sum']['preis_rabatt'] > 0) { ?>
+
+	jQuery('#discountvalue_<?php echo $o_id; ?>').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=discountData&do=editvalue&noheader=1', {
+		submitdata: { 
+    		field: 'value',
+    		edit_id: '<?php echo $o_id; ?>',
+           	noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>',
+           	mwst: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
+           	price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>'
+		}, 					
+		submit  : '<?php echo __('Speichern', 'wpsg'); ?>',
+		placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+		indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
+    	tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+    	callback: function(data, config) {
+    		jQuery('#wpsg_produkte_table').replaceWith(data);
+    	}
+	});
+
+	<?php } ?>
+<?php } ?>
+		
+	/**
+	 * Wird aufgerufen wenn ein Gutschein gelÃ¶scht werden soll
+	 */
+	function wpsg_removeVoucher(gs_id, o_id)
+	{
+
+		if (!confirm('<?php echo __('Sind Sie sich sicher, dass sie diesen Gutschein lÃ¶schen mÃ¶chten?', 'wpsg'); ?>')) return false;
+
+		jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+		jQuery.ajax( {
+			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=remove&gs_id=' + gs_id + '&edit_id=' + o_id +'&noheader=1',
+			success: function(data) {
+				jQuery('#wpsg_produkte_table').replaceWith(data);
+				jQuery('#LinkGutscheinNeu').show();
+			}
+		} );
+	
+		return false;
+	}
+
+	/**
+	 * Wird aufgerufen wenn ein Rabatt gelÃ¶scht werden soll
+	 */
+	function wpsg_removeDiscount(o_id)
+	{
+
+		if (!confirm('<?php echo __('Sind Sie sich sicher, dass sie diesen Rabatt lÃ¶schen mÃ¶chten?', 'wpsg'); ?>')) return false;
+
+		jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+		
+		jQuery.ajax( {
+			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=discountData&do=remove&edit_id=' + o_id +'&noheader=1',
+			success: function(data) {
+				jQuery('#wpsg_produkte_table').replaceWith(data);
+				jQuery('#LinkRabattNeu').show();
+			}
+		} );
+	
+		return false;
+	}
+
+    jQuery(document).ready(function() {
+		gs_id = <?php echo $gs_id; ?>;
+		prval = <?php echo $prval; ?>;
+
+		if (gs_id > 0) { jQuery('#LinkGutscheinNeu').hide(); }
+		if (prval != 0) { jQuery('#LinkRabattNeu').hide(); }
+
+    } );
+
+
+    var Modul2 = {
+    	    eigenschaft : "wert",
+    	    methode : function () {
+    	        alert("Modul-Eigenschaft (ÃŒber window.Modul): " + Modul2.eigenschaft);
+    	        // Alternativ:
+    	        alert("Modul-Eigenschaft (ÃŒber this): " + this.eigenschaft);
+    	    }
+    };
+    //Modul2.methode();
+
+    
+    var WPSG_BE_Payment = {
+
+    	paymentinfos: 0,
+    	pidold: 0,
+    	oid: 0,
+
+		changePayment: function (id, oid) {
+
+			//alert('TEST OK neu');
+
+			//jQuery('#wpsg_payment_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+			
+			jQuery('#wpsg_payment_dialog').modal( { } )
+		
+			/*
+			jQuery.ajax({
+				url: 'admin.php?page=wpsg-Admin&subaction=kundendaten&noheader=1&show=code',
+				data: { 'kv_id': index },
+				success: function(data) { jQuery('#wpsg_payment_dialog .modal-body').html(data); }
+	    	});
+			*/
+			
+			this.paymentinfos = <?php  echo json_encode($this->arPayment, JSON_FORCE_OBJECT); ?>;
+			this.oid = oid;
+			this.pidold = id;
+			
+	 		jQuery('#zahlungsartid').empty();
+			jQuery.each(this.paymentinfos, function(i,n) {
+	    		console.log('element: ', n.name);
+	    		if (id == n.id) { 
+	    			jQuery('#zahlungsartid').append('<option value=' + n.id + ' "selected"="selected">' + n.name + '</option>');
+	    		} else {
+	    			jQuery('#zahlungsartid').append('<option value=' + n.id + '>' + n.name + '</option>');
+	    		}
+	    	});
+	
+			preis = this.paymentinfos[id].preis;
+			if (preis == false) { preis = '0,00'; } 
+			jQuery('#zahlungsartvalue').val(preis);
+	    	
+			return false;
+
+		}, // function changePayment(id, oid)
+
+		/**
+		 * Ãndern der Zahlungsdaten im Backend
+		 */	                          
+		dialog_OK: function() {
+			var
+				pid,
+				pval;
+
+			pid = jQuery('#zahlungsartid').val();
+			pval = jQuery('#zahlungsartvalue').val();
+			alert('OK neu: ' + this.pidold + ' / ' + pid + ' / ' + pval);
+			//TODO vergleichen oder nicht
+			if (this.pidold == pid) { 
+				jQuery('#wpsg_payment_dialog').modal('hide');
+				return false;
+			}
+			alert('OK neu: ' + pid + ' / ' + pval);
+			//TODO price_frontend
+			//TODO Frontend-Rabatt/Frontend-Gutschein bei Firmenkunde in Netto oder Brutto in der Datenbank?
+
+			//TODO
+    		//field: 'value',
+    		//gs_id: '<?php echo $gs_id; ?>',
+    		//edit_id: '<?php echo $o_id; ?>',
+        	//noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>',
+        	//mwst: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
+        	//price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>'
+			//data: { name: "John", location: "Boston" }
+			
+			data1: {
+				//price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>',
+				//noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>'
+			}
+					
+			url1 = 'wp-admin/admin.php?page=wpsg-Admin&subaction=paymentData&do=change&edit_id=' + this.oid + '&p_id=' + pid + '&p_value=' + pval + '&noheader=1';
+			jQuery.ajax( {
+				url: '<?php echo WPSG_URL_WP; ?>' + url1,
+				dataType: 'json',
+				data: {
+					price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>',
+					noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>' },
+				method: 'POST',
+				success: function(data) {
+					jQuery('#wpsg_produkte_table').replaceWith(data);
+				}
+			} );
+		
+			return false;
+		
+		}, // function dialog_OK()
+
+		/**
+		 * Ãndern der Zahlungsdaten im Backend
+		 */	                          
+		dialog_change: function() {
+			var
+				pid,
+				pval;
+			pid = jQuery('#zahlungsartid').val();
+			pval = this.paymentinfos[pid].preis;
+			jQuery('#zahlungsartvalue').val(pval);
+
+
+		},	// dialog_change()
+
+
+		changePayment2: function (id, oid) {
+
+			alert('TEST OK neu2');
+
+		} // function wpsg_changePayment2(id, oid)
+		
+    };	// WPSG_BE_Payment
+    //WPSG_BE_Payment.changePayment2(1, 2);
+    
+    
+	/* ]]> */</script>		
+
+    
+</div>
+
+<!-- Modaldialog fÃŒr Zahlungsart -->
+<div class="modal fade" id="wpsg_payment_dialog" tabindex="-1" role="dialog">
+  <div class="modal-dialog" role="document">
+    <div class="modal-content">
+      <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+        <h4 class="modal-title" id="myModalLabel"><?php echo __('Zahlungsart', 'wpsg'); ?></h4>
+      </div>
+      <div class="modal-body">
+      	<br />
+        <div class="row">
+          <div class="col-md-3 col-sm-6 control_label"><label for="zahlungsartid" ><?php echo _("Zahlungsart"); ?></label></div>
+          <div class="col-md-3">
+			<select name="zahlungsartid" id="zahlungsartid" onchange="return WPSG_BE_Payment.dialog_change();" class="form-control input-sm" size="1" class="select">
+				<option value=0>"[unbekannt]"</option>
+			</select>
+		  </div>
+        </div>
+        <div class="clearfix wpsg_clear"></div>
+        <div class="clearfix wpsg_clear"></div>
+        <br />
+        <div class="row">
+          <div class="col-md-3 col-sm-6 control_label"><label for="zahlungsartvalue"><?php echo _("GebÃŒhr/Kosten"); ?></label></div>
+          <div class="col-md-3">
+			<input type="text" name="zahlungsartvalue" id="zahlungsartvalue" class="form-control input-sm" size="1" class="select">
+		  </div>
+        </div>
+        <div class="clearfix wpsg_clear"></div>
+        
+      </div>
+      <div class="modal-footer">
+        <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
+        <button type="button" class="btn btn-primary" onclick="return WPSG_BE_Payment.dialog_OK();">OK</button>
+      </div>
+    </div>
+  </div>
+</div>
+    
 <?php echo wpsg_drawForm_AdminboxEnd(); ?>
Index: /views/produkttemplates/standard.phtml
===================================================================
--- /views/produkttemplates/standard.phtml	(revision 5921)
+++ /views/produkttemplates/standard.phtml	(revision 5922)
@@ -74,5 +74,5 @@
 					</span> <?php if (wpsg_isSizedString($this->view['data']['price_info'])) { echo '<div class="wpsg_priceinfo">'.wpsg_hspc($this->view['data']['price_info']).'</div>'; } ?>
 					
-					<?php if ($this->hasMod('wpsg_mod_discount') && $this->view['data']['preis_prediscount'] > 0 && wpsg_isSizedInt($this->get_option('wpsg_mod_discount_show'))) { ?>				
+					<?php if ($this->hasMod('wpsg_mod_discount') && wpsg_getInt($this->view['data']['preis_prediscount']) > 0 && wpsg_isSizedInt($this->get_option('wpsg_mod_discount_show'))) { ?>				
 					<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis new_price">
 	            		<?php echo __('Originalpreis', 'wpsg'); ?>: <span class="wpsg_preis_prediscount"><?php echo wpsg_ff($this->view['data']['preis_prediscount'], $this->get_option('wpsg_currency')); ?></span>		
Index: /views/warenkorb/checkout.phtml
===================================================================
--- /views/warenkorb/checkout.phtml	(revision 5921)
+++ /views/warenkorb/checkout.phtml	(revision 5922)
@@ -282,4 +282,20 @@
 		} );
 
+			
+		<?php if ($this->hasMod('wpsg_mod_addressvalidation')) { ?>
+			validateAddressBind( { 
+            	Strasse: '#strasse',
+            	Nr: '#nr',
+            	Ort: '#ort',
+            	PLZ: '#plz',
+            	Land: '#wpsg_land',
+            	Key: '<?php echo $this->get_option('wpsg_mod_addressvalidation_apikey');?>',
+            	StorageKey: 'KundenAddress',
+            	MsgTeil1: 'Kundenadresse'
+			} );
+		<?php } ?>
+			
+		//} );
+
 	/* ]]> */</script>
 	
