Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7811)
+++ /controller/wpsg_ShopController.class.php	(revision 7812)
@@ -790,5 +790,5 @@
             $ses = $_SESSION;
             if (session_status() !== PHP_SESSION_ACTIVE) session_start();
-            $_SESSION = $ses;
+            $_SESSION = $ses; 
 
         }
Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 7811)
+++ /model/wpsg_order.class.php	(revision 7812)
@@ -23,11 +23,10 @@
 		 * LÃ€dt die Daten der Bestellung
 		 */
-		public function load($order_id)
-		{
+		public function load($order_id) {
 
 			parent::load($order_id);
 						
-			@$this->data = &$this->shop->cache->loadOrder($order_id, true);
-			@$this->customer = &$this->shop->cache->loadCustomerObject($this->data['k_id']);
+			@$this->data = $this->shop->cache->loadOrder($order_id, true);
+			@$this->customer = $this->shop->cache->loadCustomerObject($this->data['k_id']);
 
 			if (is_array($this->data)) {
Index: /mods/mod_abo/wpsg_abo.php
===================================================================
--- /mods/mod_abo/wpsg_abo.php	(revision 7811)
+++ /mods/mod_abo/wpsg_abo.php	(revision 7812)
@@ -123,18 +123,6 @@
             
         }
-        
-        public static function getFromOrderAndProductKey($order_id, $product_key) {
- 
-            $abo_id = intval(
-                wpsg_ShopController::getShop()->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `product_key` = '".wpsg_q($product_key)."' ")
-            );
-
-            if ($abo_id <= 0) throw new \wpsg\Exception(__('Kein Abo zu dieser Bestellung und Produkt gefunden.'));
-
-            return wpsg_abo::getInstance($abo_id);
-            
-        }
-
-        public static function getFromOrderAndProduct($order_id, $order_product_id) {
+         
+        public static function getFromOrderAndOrderProduct($order_id, $order_product_id) {
 
             $abo_id = intval(
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 7811)
+++ /mods/wpsg_mod_abo.class.php	(revision 7812)
@@ -83,6 +83,5 @@
 	  			cdate datetime NOT NULL,
 				order_id int(11) NOT NULL,
-				order_product_id int(11) NOT NULL,
-				product_key varchar(255) NOT NULL,
+				order_product_id int(11) NOT NULL, 
 				expiration DATETIME NOT NULL,
 				inform_expiration int(1) DEFAULT '0' NOT NULL,
@@ -92,6 +91,5 @@
 				mail_admin_stop DATETIME NOT NULL COMMENT 'Wird auf 1 gesetzt, wenn der Admin das Abo stoppen soll',
 				PRIMARY KEY  (id),
-	  			KEY order_id (order_id),
-				KEY product_key (product_key),
+	  			KEY order_id (order_id), 
 				KEY order_product_id (order_product_id)
 			) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
@@ -373,5 +371,5 @@
 			{
 				
-				$abo_status = $this->getAboProductStatus($order_id, $oOrderProduct->getProductKey());
+				$abo_status = $this->getAboProductStatus($order_id, $oOrderProduct->getProductId());
 				
 				if ($inform) $this->sendCustomerMailResign($abo_status);
@@ -455,5 +453,4 @@
 								'cdate' => 'NOW()',
 								'order_id' => wpsg_q($order_id),
-								'product_key' => wpsg_q($product['productkey']),
 								'order_product_id' => wpsg_q($product['order_product_id']),
 								'rebuy' => '0',
@@ -492,5 +489,5 @@
 			}
 
-		} // public function setOrderStatus($order_id, $status_id, $inform)
+		} 
 		
 		public function calculation_saveOrder(&$oCalculation, $arCalculation, &$db_data, $finish_order) { 
@@ -529,5 +526,6 @@
 			foreach ($arAboExpiration as $a) {
 
-				$product_id = $this->shop->getProduktID($a['product_key']);
+			    $oOrderProduct = wpsg_order_product::getInstance(intval($a['order_product_id']));
+			    $product_id = $oOrderProduct->getProductId();
 				
 				// URL Benachrichtigung
@@ -553,5 +551,5 @@
                 
 				    // Mail mit Benachrichtigung senden
-				    $this->sendAboExpirationMail($a['order_id'], $a['product_key']);
+				    $this->sendAboExpirationMail($a['order_id'], $a['order_product_id']);
                     
                 }
@@ -578,8 +576,9 @@
             foreach ($arAboInformation as $a) {
                 
-                $product_id = $this->shop->getProduktID($a['product_key']);
+                $oOrderProduct = wpsg_order_product::getInstance(intval($a['order_product_id']));                
+                $product_id = $oOrderProduct->getProductId();
                 
                 $wpsg_mod_abo_autoexpire_informationtime = intval($this->getSetting('wpsg_mod_abo_autoexpire_informationtime', $product_id));
-                $interval = intval(date_diff(date_create($a['expiration']), date('Y-m-d'))->format('%a'));
+                $interval = intval(date_diff(date_create($a['expiration']), date_create(date('Y-m-d')))->format('%a'));
                 
                 if ($wpsg_mod_abo_autoexpire_informationtime > 0 && $interval === $wpsg_mod_abo_autoexpire_informationtime) {
@@ -590,5 +589,5 @@
                     if ($wpsg_mod_abo_expiremode === self::EXPIRE_AUTO && $wpsg_mod_abo_autoexpire_information == '1') {
                     
-                        $this->sendAboRenewInformation($a['order_id'], $a['product_key']);
+                        $this->sendAboRenewInformation($a['order_id'], $a['order_product_id']);
                     
                         $this->db->UpdateQuery(WPSG_TBL_ABO, array(
@@ -645,11 +644,9 @@
 		} // public function admin_emailconf()
 
-		public function template_redirect()
-		{
+		public function template_redirect() {		 
 
 			if (!isset($_REQUEST['mod']) || $_REQUEST['mod'] != 'wpsg_mod_abo') return false;
 
-			if (!isset($_REQUEST['product_key']) || !isset($_REQUEST['order_id']))
-			{
+			if (!isset($_REQUEST['product_key']) || !isset($_REQUEST['order_id'])) {
 
 				throw new \wpsg\Exception(__('Beim VerlÃ€ngerungslink keine BestellID oder ProductKey ÃŒbergeben', 'wpsg'));
@@ -907,12 +904,14 @@
         public function order_ajax() {
 
-	        $_REQUEST['edit_id'] = wpsg_sinput("key", $_REQUEST['edit_id']);
-	        $_REQUEST['product_key'] = wpsg_sinput("key", $_REQUEST['product_key']);
+	        $_REQUEST['edit_id'] = intval($_REQUEST['edit_id']);
+	        $_REQUEST['order_product_id'] = intval($_REQUEST['order_product_id']);
 
             if (wpsg_isSizedString($_REQUEST['do'], 'run')) {
                 
-                $abo_status = $this->getAboProductStatus($_REQUEST['edit_id'], $_REQUEST['product_key']);                
+                $oOrderProduct = wpsg_order_product::getInstance($_REQUEST['order_product_id']);
+                
+                $abo_status = $this->getAboProductStatus($_REQUEST['edit_id'], $_REQUEST['order_product_id']);                
                 $bNotify = $this->startRenewal($abo_status);                
-                $product_id = $this->shop->getProduktID($_REQUEST['product_key']);                
+                $product_id = $oOrderProduct->getProductId();         
                 $wpsg_mod_abo_expiremode = $this->getSetting('wpsg_mod_abo_expiremode', $product_id);
                 
@@ -928,7 +927,9 @@
             } else if (wpsg_isSizedString($_REQUEST['do'], 'stop')) {
 
-                $abo_status = $this->getAboProductStatus($_REQUEST['edit_id'], $_REQUEST['product_key']);
+                $oOrderProduct = wpsg_order_product::getInstance($_REQUEST['order_product_id']);
+                
+                $abo_status = $this->getAboProductStatus($_REQUEST['edit_id'], $_REQUEST['order_product_id']);
                 $bNotify = $this->stopRenewal($abo_status);
-                $product_id = $this->shop->getProduktID($_REQUEST['product_key']);
+                $product_id = $oOrderProduct->getProductId();
                 $wpsg_mod_abo_expiremode = $this->getSetting('wpsg_mod_abo_expiremode', $product_id);
                 
@@ -1072,5 +1073,5 @@
             
             $order_id = intval($_REQUEST['order_id']);
-            $product_key = sanitize_text_field($_REQUEST['product_key']);
+            $order_product_id = intval($_REQUEST['order_product_id']);
             $tDate = strtotime($_REQUEST['date']);
             
@@ -1081,7 +1082,7 @@
             $this->db->UpdateQuery(WPSG_TBL_ABO, [
                 'expiration' => wpsg_q(date('Y-m-d H:i:s', $tDate))
-            ], " `order_id` = '".wpsg_q($order_id)."' AND `product_key` = '".wpsg_q($product_key)."' ");
-
-            $oAbo = wpsg_abo::getFromOrderAndProductKey($order_id, $product_key);
+            ], " `order_id` = '".wpsg_q($order_id)."' AND `order_product_id` = '".wpsg_q($order_product_id)."' ");
+
+            $oAbo = wpsg_abo::getFromOrderAndOrderProduct($order_id, $order_product_id);
             
             wpsg_header::JSONData([
@@ -1097,6 +1098,5 @@
          * VerlÃ€ngerung anhalten
          */
-		private function stopRenewal($abo_status)
-        {
+		private function stopRenewal($abo_status) {
 
             $this->db->UpdateQuery(WPSG_TBL_ABO, Array('status' => self::STATUS_STOPPED), " `id` = '".wpsg_q($abo_status['id'])."' ");
@@ -1104,6 +1104,5 @@
             $url = $this->getNotifyURL($this->shop->getProduktID($abo_status['product_key']));
                 
-            if (wpsg_isSizedString($url))
-            {
+            if (wpsg_isSizedString($url)) {
 
                 $this->shop->notifyURL($url, $abo_status['product_key'], 1, $abo_status['order_id'], 3, array(
@@ -1176,5 +1175,5 @@
             foreach ($arOrderProducts as $oOrderProduct) {
 
-                $abo_status = $this->getAboProductStatus($oOrder->id, $oOrderProduct->getProductKey());
+                $abo_status = $this->getAboProductStatus($oOrder->id, $oOrderProduct->getId());
  
                 if ($oOrderProduct->getProductKey() === $_REQUEST['product_key'] && wpsg_isSizedInt($abo_status['id'])) {
@@ -1303,6 +1302,11 @@
          * @param $product_key
          */
-		public function autoExtendOrder($order_id, $product_key) {
-            
+		public function autoExtendOrder($order_id, $order_product_id) {
+            
+		    $oOrderProduct = wpsg_order_product::getInstance($order_product_id);
+            $product_id = $oOrderProduct->getProductId();
+		    
+		    if (!is_numeric($product_id)) throw new \Exception(__('Nicht vorgesehen!', 'wpsg'));
+		    
             $this->shop->addShipPay();
             
@@ -1311,7 +1315,5 @@
             unset($_SESSION['wpsg']['basket']);
             unset($_SESSION['wpsg']['checkout']);
-
-            $product_id = $this->shop->getProduktID($product_key);
-            
+ 
             $_SESSION['wpsg']['checkout']['id'] = $oOrder->k_id;
             $_SESSION['wpsg']['checkout']['payment'] = $this->getSetting('wpsg_mod_abo_autoexpire_payment', $product_id);
@@ -1337,5 +1339,5 @@
             $oBasket = new wpsg_basket();
           
-            $oBasket->addProduktToSession($product_key, 1);
+            $oBasket->addProduktToSession('abo_'.$order_id.'_'.$order_product_id, 1);
             
             $oBasket->initFromSession(true); $arBasket = $oBasket->toArray();
@@ -1346,5 +1348,5 @@
             $arBasket['checkout']['datum'] = time();
  
-            $bCustomerMail = false;
+            $bCustomerMail = false;  
             $bAdminMail = false;
             
@@ -1352,7 +1354,9 @@
             if ($this->getSetting('wpsg_mod_abo_autoexpire_adminmail', $product_id) === '1') $bAdminMail = true;
             
+            $oOrder->addLogEntry(__('VerlÃ€ngerung erworben', 'wpsg'), 'OrderID: '.$new_o_id);
+            
             $oBasket->sendOrderSaveMails($new_o_id, $arBasket, $bCustomerMail, $bAdminMail);
             
-        } // public function autoExtendOrder($order_id, $product_key)
+        }  
 
         /**
@@ -1390,12 +1394,11 @@
          * @return mixed
          */
-        public function getAboProductStatus($order_id, $product_key)
-        {
-            
-            $abo_product = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `product_key` = '".wpsg_q($product_key)."' ");
+        public function getAboProductStatus($order_id, $order_product_id) {
+            
+            $abo_product = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `order_product_id` = '".wpsg_q($order_product_id)."' ");
             
             return $abo_product;
                         
-        } // public function getAboProductStatus($order_id, $product_id)
+        }  
         
 		/**
@@ -1418,6 +1421,5 @@
 		 * 2 - Folgebestellung
 		 */
-		public function isAboOrder($order_id)
-		{
+		public function isAboOrder($order_id) {
 
             // Folgebestellung testen
@@ -1466,6 +1468,5 @@
 		 * @param unknown_type $order_id
 		 */
-		public function getOrderAboExpiration($order_id, $product_key)
-		{
+		public function getOrderAboExpiration($order_id, $order_product_id) {
 
 			$data = null;
@@ -1478,5 +1479,5 @@
                 WHERE 
                     `order_id` = '".wpsg_q($order_id)."' AND
-                    `product_key` = '".wpsg_q($product_key)."'
+                    `order_product_id` = '".wpsg_q($order_product_id)."'
             "), false);
 
@@ -1504,10 +1505,11 @@
 		 * @param String $product_id ProduktKey
 		 */
-		public function sendAboFirstBuyMail($order_id, $product_key)
-		{
+		public function sendAboFirstBuyMail($order_id, $order_product_id) {
 
 			if ($this->shop->get_option('wpsg_mod_abo_wpsgmodabofirstbuy') != '1') return;
 
-			$product_data = $this->shop->cache->loadProduct($this->shop->getProduktID($product_key));
+			$oOrderProduct = wpsg_order_product::getInstance($order_product_id);
+			
+			$product_data = $this->shop->cache->loadProduct($oOrderProduct->getProductId());
 			$order_data = $this->shop->cache->loadOrder($order_id);
 			$customer_data = $this->shop->cache->loadKunden($order_data['k_id']);
@@ -1516,5 +1518,5 @@
 			$this->shop->view['customer'] = $customer_data;
 			$this->shop->view['order'] = $order_data;
-			$this->shop->view['rebuyLink'] = $this->getRebuyLink($order_id, $product_key);
+			$this->shop->view['rebuyLink'] = $this->getRebuyLink($order_id, $order_product_id);
 
 			if ($this->shop->get_option('wpsg_htmlmail') === '1')
@@ -1544,7 +1546,9 @@
          * @param String $product_key ProduktKey
          */
-        public function sendAboRenewInformation($order_id, $product_key) {
-
-            $product_id = $this->shop->getProduktID($product_key);
+        public function sendAboRenewInformation($order_id, $order_product_id) {
+
+            $oOrderProduct = wpsg_order_product::getInstance($order_product_id);
+            
+            $product_id = $oOrderProduct->getProductId();
             
             if ($this->getSetting('wpsg_mod_abo_autoexpire_information', $product_id) !== '1') return;
@@ -1566,4 +1570,7 @@
 
             $this->shop->sendMail($mail_text, $customer_data['email'], 'wpsgmodabautoinfo', array(), $order_id, $customer_data['id'], $mail_html);
+            
+            $oOrder = wpsg_order::getInstance($order_id);
+            $oOrder->addLogEntry(__('Benachrichtigung Abo Ablauf', 'wpsg'), $mail_text);
 
             return true;
@@ -1577,12 +1584,15 @@
 		 * @return boolean
 		 */
-		public function sendAboExpirationMail($order_id, $product_key) {
-
-		    $product_id = $this->shop->getProduktID($product_key);
+		public function sendAboExpirationMail($order_id, $order_product_id) {
+
+		    $oOrderProduct = wpsg_order_product::getInstance($order_product_id);
+		    $oOrder = wpsg_order::getInstance($order_id);
+		    
+		    $product_id = $oOrderProduct->getProductId();
 		    $wpsg_mod_abo_wpsgmodaboexpiration = $this->getSetting('wpsg_mod_abo_wpsgmodaboexpiration', $product_id);
 		    
 			if ($wpsg_mod_abo_wpsgmodaboexpiration != '1') return;
 
-			$product_data = $this->shop->cache->loadProduct($this->shop->getProduktID($product_key));
+			$product_data = $this->shop->cache->loadProduct($product_id);
 			$order_data = $this->shop->cache->loadOrder($order_id);
 			$customer_data = $this->shop->cache->loadKunden($order_data['k_id']);
@@ -1591,15 +1601,12 @@
 			$this->shop->view['customer'] = $customer_data;
 			$this->shop->view['order'] = $order_data;
-			$this->shop->view['rebuyLink'] = $this->getRebuyLink($order_id, $product_key);
-			$this->shop->view['allowRebuy'] = $this->canReBuyAbo($order_id, $product_key);
-
-			if ($this->shop->get_option('wpsg_htmlmail') === '1')
-			{
+			$this->shop->view['rebuyLink'] = $this->getRebuyLink($order_id, $order_product_id);
+			$this->shop->view['allowRebuy'] = $this->canReBuyAbo($order_id, $order_product_id);
+
+			if ($this->shop->get_option('wpsg_htmlmail') === '1') {
 
 				$mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_abo/mail_expiration_html.phtml');
 
-			}
-			else
-			{
+			} else {
 
 				$mail_html = false;
@@ -1610,4 +1617,5 @@
 
 			$this->shop->sendMail($mail_text, $customer_data['email'], 'wpsgmodaboexpiration', array(), $order_id, $customer_data['id'], $mail_html);
+            $oOrder->addLogEntry(__('Abo Ablauf', 'wpsg'), $mail_text);
 
 			return true;
@@ -1662,19 +1670,17 @@
 		 * @param String $product_key ProduktKey
 		 */
-		public function canReBuyAbo($order_id, $product_key)
-		{
-
-			$product_data = $this->shop->cache->loadProduct($this->shop->getProduktID($product_key));
-
-			if ($product_data['wpsg_mod_abo_resell'] == '0')
-			{
+		public function canReBuyAbo($order_id, $order_product_id) {
+		    
+		    $oOrderProduct = wpsg_order_product::getInstance($order_product_id);
+
+			$product_data = $this->shop->cache->loadProduct($oOrderProduct->getProductKey());
+
+			if ($product_data['wpsg_mod_abo_resell'] == '0') {
 
 				return true;
 
-			}
-			else
-			{
-
-				$rebuy = $this->db->fetchOne("SELECT `rebuy` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `product_key` = '".wpsg_q($product_key)."'");
+			} else {
+
+				$rebuy = $this->db->fetchOne("SELECT `rebuy` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `order_product_id` = '".wpsg_q($order_product_id)."'");
 
 				if ($rebuy < $product_data['wpsg_mod_abo_resell'])
@@ -1708,6 +1714,7 @@
 		 * @param int $product_key ProduktKey
 		 */
-		public function getRebuyLink($order_id, $product_key)
-		{
+		public function getRebuyLink($order_id, $order_product_id) {
+		    
+		    $oOrderProduct = wpsg_order_product::getInstance($order_product_id);
 
 			$url = get_permalink($this->shop->get_option('wpsg_page_basket'));
@@ -1715,5 +1722,5 @@
 			$url .= ((strpos($url, '?') === false)?'?mod=wpsg_mod_abo':'&mod=wpsg_mod_abo');
 			$url .= ((strpos($url, '?') === false)?'?order_id=':'&order_id=').$order_id;
-			$url .= ((strpos($url, '?') === false)?'?product_key=':'&product_key=').$product_key;
+			$url .= ((strpos($url, '?') === false)?'?product_key=':'&product_key=').$oOrderProduct->getProductKey();
 
 			return $url;
Index: /mods/wpsg_mod_kundenverwaltung.class.php
===================================================================
--- /mods/wpsg_mod_kundenverwaltung.class.php	(revision 7811)
+++ /mods/wpsg_mod_kundenverwaltung.class.php	(revision 7812)
@@ -91,9 +91,7 @@
 		} // public function install()
 		
-		public function be_ajax() 
-		{ 
+		public function be_ajax() { 
 					    
-			if ($_REQUEST['wpsg_mod_kundenverwaltung_setActiv'] == '1')
-			{
+			if (wpsg_getStr($_REQUEST['wpsg_mod_kundenverwaltung_setActiv']) == '1') {
 				
 				$this->db->UpdateQuery(WPSG_TBL_KU, array(
@@ -104,7 +102,5 @@
 				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_kundenverwaltung');
 				
-			}
-			else if ($_REQUEST['wpsg_mod_kundenverwaltung_setInactiv'] == '1')
-			{
+			} else if (wpsg_getStr($_REQUEST['wpsg_mod_kundenverwaltung_setInactiv']) == '1') {
 				
 				$this->db->UpdateQuery(WPSG_TBL_KU, array(
@@ -116,5 +112,7 @@
 				
 			} else if ($_REQUEST['be_ajax'] === 'su' && is_admin()) {
-	
+
+                $this->shop->send_headers();
+			    
 				unset($_SESSION['wpsg']);
                 
@@ -2191,7 +2189,6 @@
 		 * Der Kunde sollte in der Datenbank existieren das muss vorher abgefragt werden
 		 */
-		public function login($kunde_id)
-		{
-			
+		public function login($kunde_id) {
+		    
 			$kunde = $this->db->fetchRow("
 				SELECT
@@ -2217,8 +2214,8 @@
 					C.`status` != '0' AND C.`status` != '-1'
 			");
-			
+			 
 			if ($kunde['id'] != $kunde_id) return;
-			
-			$this->db->UpdateQuery(WPSG_TBL_KU, ['last_login' => 'NOW()'], " `id` = '".wpsg_q($kunde['id'])."' ");
+            
+            $this->db->UpdateQuery(WPSG_TBL_KU, ['last_login' => 'NOW()'], " `id` = '".wpsg_q($kunde['id'])."' ");
 			
 			$kunde['custom'] = @unserialize($kunde['customin']);
@@ -2226,11 +2223,9 @@
 			if (!is_array($_SESSION['wpsg']['checkout'])) $_SESSION['wpsg']['checkout'] = array();
 		
-			if (wpsg_isSizedInt($_SESSION['wpsg']['order_id']))
-			{
+			if (wpsg_isSizedInt($_SESSION['wpsg']['order_id'])) {
 			
 				$temp_k_id = $this->db->fetchOne("SELECT `k_id` FROM `".WPSG_TBL_ORDER."` WHERE `id` = '".wpsg_q($_SESSION['wpsg']['order_id'])."' ");
 			
-				if (wpsg_isSizedInt($temp_k_id) && $temp_k_id != $kunde_id)
-				{
+				if (wpsg_isSizedInt($temp_k_id) && $temp_k_id != $kunde_id) {
 			
 					// TemporÃ€ren Kunden lÃ¶schen
@@ -2239,6 +2234,5 @@
 			
 					if ($count_order > 0) throw new \wpsg\Exception(__('Die Daten eines Bestellobjekts konnten nicht geladen werden', 'wpsg'));
-					else
-					{
+					else {
 			
 						$oCustomer = wpsg_customer::getInstance($temp_k_id);
@@ -2274,6 +2268,5 @@
 			unset($_REQUEST['checkout']);
 			
-			if ($this->shop->get_option('wpsg_mod_kundenverwaltung_wpuser') == '1')
-			{
+			if ($this->shop->get_option('wpsg_mod_kundenverwaltung_wpuser') == '1') {
 				
 				/*
Index: /views/mods/mod_abo/index.phtml
===================================================================
--- /views/mods/mod_abo/index.phtml	(revision 7811)
+++ /views/mods/mod_abo/index.phtml	(revision 7812)
@@ -251,5 +251,5 @@
 								<?php if (in_array(strval($this->callMod('wpsg_mod_abo', 'isAboOrder', array($oOrder->id))), array(1))) { ?>
 	
-									<?php $abo_expiration = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getProductKey()))); ?>
+									<?php $abo_expiration = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getId()))); ?>
 	
 									<?php if ($abo_expiration > time()) { ?>
Index: /views/mods/mod_abo/order_view.phtml
===================================================================
--- /views/mods/mod_abo/order_view.phtml	(revision 7811)
+++ /views/mods/mod_abo/order_view.phtml	(revision 7812)
@@ -13,5 +13,5 @@
 	try {
     
-		$oAbo = wpsg_abo::getFromOrderAndProduct($view['oOrder']->getId(), $oOrderProduct->getId());
+		$oAbo = wpsg_abo::getFromOrderAndOrderProduct($view['oOrder']->getId(), $oOrderProduct->getId());
 		
 		?>
@@ -23,6 +23,6 @@
 		); ?>
 	
-			<?php $tExpire = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', Array($_REQUEST['edit_id'], $oOrderProduct->getProductKey()))); ?>
-			<?php echo wpsg_drawForm_Text(__('Laufzeit', 'wpsg'), wpsg_formatTimestamp($tExpire), 'wpsg_mod_abo_duration', Array('class_content_wrap' => 'wpsg_abo_state wpsg_abo_state_class_'.$oAbo->getState())); ?>
+			<?php $tExpire = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', Array($_REQUEST['edit_id'], $oOrderProduct->getId()))); ?>
+			<?php echo wpsg_drawForm_Text(__('Laufzeit', 'wpsg'), wpsg_formatTimestamp($tExpire), 'wpsg_mod_abo_duration_'.$oOrderProduct->getProductIndex(), Array('class_content_wrap' => 'wpsg_abo_state wpsg_abo_state_class_'.$oAbo->getState())); ?>
 		
 			<script>
@@ -30,5 +30,5 @@
 				moment.locale('de');
 				
-				jQuery('#wpsg_mod_abo_duration').editable({
+				jQuery('#wpsg_mod_abo_duration_<?php echo $oOrderProduct->getProductIndex(); ?>').editable({
 					type: 'combodate',
 					display: function(value) {
@@ -43,11 +43,11 @@
 							data: {
 								field: 'duration',
-								product_key: '<?php echo $oOrderProduct->getProductKey(); ?>',
+								order_product_id: '<?php echo $oOrderProduct->getId(); ?>',
 								order_id: '<?php echo $view['oOrder']->getId() ?>',
 								date: newValue.format()
 							},
 							success: function(response) {
-	 
-								jQuery('.wpsg_abo_state').attr("class", "col-sm-6 wpsg_abo_state_class_" + response.state)
+
+                                jQuery('#wpsg_mod_abo_duration_<?php echo $oOrderProduct->getProductIndex(); ?>').parent().parent().attr("class", "col-sm-6 wpsg_abo_state_class_" + response.state)
 															
 							}
@@ -70,5 +70,5 @@
 			<?php
 		
-				$strURL = $this->callMod('wpsg_mod_abo', 'getRebuyLink', [$view['oOrder']->getId(), $oOrderProduct->getProductKey()]);
+				$strURL = $this->callMod('wpsg_mod_abo', 'getRebuyLink', [$view['oOrder']->getId(), $oOrderProduct->getId()]);
 				$strURL = '<a href="'.$strURL.'">'.$strURL.'</a>';
 		
@@ -79,5 +79,5 @@
 			<?php echo wpsg_drawForm_TextStart(); ?>
 			
-				<?php $abo_product_status = $this->callMod('wpsg_mod_abo', 'getAboProductStatus', Array($_REQUEST['edit_id'], $oOrderProduct->getProductKey())); ?>
+				<?php $abo_product_status = $this->callMod('wpsg_mod_abo', 'getAboProductStatus', Array($_REQUEST['edit_id'], $oOrderProduct->getId())); ?>
 		
 				<?php if ($abo_product_status['status'] === wpsg_mod_abo::STATUS_ACTIVE) { ?>
Index: /views/mods/mod_abo/page_abo.phtml
===================================================================
--- /views/mods/mod_abo/page_abo.phtml	(revision 7811)
+++ /views/mods/mod_abo/page_abo.phtml	(revision 7812)
@@ -65,5 +65,5 @@
 							<span class="value">
 								
-								<?php $exp = $this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getProductKey())); ?>
+								<?php $exp = $this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getId())); ?>
 								
 								<?php if ($oAbo->getState() === wpsg_abo::STATE_RUNNING) { ?>
Index: /views/order/index.phtml
===================================================================
--- /views/order/index.phtml	(revision 7811)
+++ /views/order/index.phtml	(revision 7812)
@@ -351,5 +351,16 @@
                             <?php $oOrderProducts = $oOrder->getOrderProducts(); ?>
                             
-                            <?php foreach ($oOrderProducts as $oOrderProduct) { $product_id = $oOrderProduct->getProductId(); ?>
+                            <?php foreach ($oOrderProducts as $oOrderProduct) { 
+                            	
+                            		$product_id = $oOrderProduct->getProductId();
+                                	$oAbo = null;
+                            		
+                            		if ($this->hasMod('wpsg_mod_abo')) {
+                            			
+                            			try { $oAbo = wpsg_abo::getFromOrderAndOrderProduct($oOrder->getId(), $oOrderProduct->getId()); } catch (\Exception $e) {  }
+                            			
+                                    }
+								
+								?>
                             
                                 <?php echo wpsg_translate(__('#1# x <a href="#2#">#3#</a> fÃŒr je #4#', 'wpsg'),
@@ -360,21 +371,19 @@
                                 ); ?><br />
                                 
-                                <?php if ($this->hasMod('wpsg_mod_abo')) { ?>
-
-                                    <?php if (in_array(strval($this->callMod('wpsg_mod_abo', 'isAboOrder', array($oOrder->id))), array(1))) { ?>
-
-                                        <?php $abo_expiration = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getProductKey()))); ?>
-
-                                        <?php echo __('Abo Laufzeit:', 'wpsg'); ?>
-
-                                        <?php if ($abo_expiration > time()) { ?>
-                                            <span class="wpsg_mod_abo_future_expire"><?php echo wpsg_formatTimestamp($abo_expiration); ?></span>
-                                        <?php } else { ?>
-                                            <span class="wpsg_mod_abo_expired"><?php echo wpsg_formatTimestamp($abo_expiration); ?></span>
-                                        <?php } ?>
-
-                                        <br />
-                                        
-                                    <?php } ?>
+                                <?php if ($oAbo !== null) { ?>
+ 
+									<?php
+									 
+										$state = $oAbo->getState();
+									
+										echo __('Abo Laufzeit:', 'wpsg'); 
+									
+									?>
+
+									<?php if ($state === wpsg_abo::STATE_INEXTENSION) { ?><span style="color:orange;"><?php echo $oAbo->getStateLabel(); ?></span>
+									<?php } else if ($state === wpsg_abo::STATE_RUNNING) { ?><span style="color:green;"><?php echo $oAbo->getStateLabel(); ?></span>
+									<?php } else if ($state === wpsg_abo::STATE_EXTEND) { ?><span style="color:red;"><?php echo $oAbo->getStateLabel(); ?></span><?php } ?>
+									 
+									<br />  
                                     
                                 <?php } ?>
Index: /views/order/view_orderlog.phtml
===================================================================
--- /views/order/view_orderlog.phtml	(revision 7811)
+++ /views/order/view_orderlog.phtml	(revision 7812)
@@ -15,5 +15,17 @@
         <div class="panel-heading" data-toggle="collapse" href="#collapse<?php echo $k; ?>" style="cursor:pointer;">
             <h4 class="panel-title" style="float:right;"><?php echo wpsg_formatTimestamp($ol['cdate']); ?></h4>
-            <h4 class="panel-title"><?php echo $ol['title']; ?></h4>
+            <h4 class="panel-title"><?php 
+				
+				if (preg_match('/OrderID:\040(\d+)?/', $ol['mailtext'], $m)) {
+					
+					$oAboExtendOrder = wpsg_order::getInstance(intval($m[1]));
+					
+					$title = '<a href="'.wpsg_admin_url('Order', 'view', ['edit_id' => $oAboExtendOrder->getId()]).'">Bestellung '.$oAboExtendOrder->getNr().'&nbsp;/&nbsp;'.$oAboExtendOrder->getStateLabel().'</a>';
+					
+                } else $title = $ol['title'];
+				
+				echo $title;
+					
+			?></h4>
         </div>
         <div id="collapse<?php echo $k; ?>" class="panel-collapse collapse">
