Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 6866)
+++ /controller/wpsg_OrderController.class.php	(revision 6867)
@@ -54,4 +54,8 @@
 			{
 				$this->stornoAction();
+			}
+			else if (wpsg_isSizedString($_REQUEST['action'], 'resign'))
+			{
+				$this->resignAction();
 			}
 			else if (wpsg_isSizedString($_REQUEST['action'], 'delete'))
@@ -944,4 +948,18 @@
 
 		/**
+		 * Wird beim KÃŒndigen eines Abos aufgerufen
+		 */
+		public function resignAction()
+		{
+			
+			//$this->shop->setOrderStatus($_REQUEST['edit_id'], wpsg_ShopController::STATUS_GEKUENDIGTEABOS, true);
+			$this->shop->callMod('wpsg_mod_abo', setAboStatus, array($_REQUEST['edit_id'], wpsg_ShopController::STATUS_GEKUENDIGTEABOS, true));
+			$this->shop->addBackendMessage(__('Abo wurde gekÃŒndigt und Kunde benachrichtigt.', 'wpsg'));
+			
+			$this->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Abo');
+			
+		} // public function resignAction()
+		
+		/**
 		 * Zeigt eine Bestellung an
 		 */
@@ -1088,6 +1106,10 @@
 
 			$this->shop->addBackendMessage(__('Bestellung erfolgreich gelÃ¶scht.', 'wpsg'));
-			$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order');
-						
+			
+			if (isset($_REQUEST['abo']))
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Abo');
+			else
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order');
+			
 		} // public function deleteAction()
 		
@@ -1322,5 +1344,6 @@
 
 			if (!isset($this->shop->view['arFilter']['status'])) $this->shop->view['arFilter']['status'] = '0';
-
+			if ($this->shop->view['arFilter']['status'] >= wpsg_ShopController::STATUS_AKTIVABO) $this->shop->view['arFilter']['status'] = '0';
+			
             // Filter gesetzt?
             foreach (Array('s', 'k_id', 'cdate_m', 'cdate_y', 'invoicedate_m', 'invoicedate_y') as $field)
Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 6866)
+++ /model/wpsg_order.class.php	(revision 6867)
@@ -279,5 +279,5 @@
 			return $this->getAmount($brutto_netto) - $this->getShippingAmount($brutto_netto) - $this->getPaymentAmount($brutto_netto); 
 				
-		} // public function getAmount()
+		} // public function getProductAmount($brutto_netto = WPSG_BRUTTO)
 		
 		/**
@@ -343,5 +343,5 @@
 				return $arReturn;
 				
-			}
+			}	// public function getOrderProducts()
 			
 		} // public function getOrderProducts()
@@ -760,5 +760,5 @@
 			else return $this->getInvoiceCompany(); 
 			
-		}
+		}	// public function getShippingCompany()
 		
 		/** 
@@ -783,5 +783,5 @@
 			else return $arAnrede[$title];
 			
-		}
+		}	// public function getShippingTitle()
 		
 		/**
@@ -933,5 +933,5 @@
 			else return $this->getShippingCountry()->getName(); 
 			
-		}
+		}	// public function getShippingCountryName()
 		
 		/**
@@ -1026,4 +1026,7 @@
 			$this->shop->callMods('delOrder', array(&$this->id));
 				
+			// Alle Abo-Produkte zu dieser Bestellung in der Tabelle WP_WPSG_ABO lÃ¶schen
+			$this->db->Query("DELETE FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($this->id)."' ");
+			
 			// Bestelldaten aus der Bestelltabelle lÃ¶schen
 			$this->db->Query("DELETE FROM `".WPSG_TBL_ORDER."` WHERE `id` = '".wpsg_q($this->id)."' ");
@@ -1122,5 +1125,5 @@
 			return $arReturn;
 			
-		} // public static function find($arFilter = array())
+		} // public static function find($arFilter = array(), $load = true)
 
 		public static function getQueryParts($arFilter = array())
@@ -1155,5 +1158,5 @@
 						C.`email` LIKE '%".wpsg_q($arFilter['s'])."%' OR
 						OA.`firma` LIKE '%".wpsg_q($arFilter['s'])."%' OR
-						C.`ustidnr` LIKE '%".wpsg_q($arFilter['s'])."%' OR					
+						C.`ustidnr` LIKE '%".wpsg_q($arFilter['s'])."%' OR
 						O.`onr` LIKE '%".wpsg_q($arFilter['s'])."%' OR
 						O.`id` = '".wpsg_q($arFilter['s'])."' 
@@ -1270,6 +1273,243 @@
 			return array($strQuerySELECT, $strQueryWHERE, $strQueryJOIN, $strQueryHAVING, $strQueryORDER);
 
-		}
-
+		}	// public static function getQueryParts($arFilter = array())
+
+		/**
+		 * ZÃ€hlt die Abo-Bestellungen anhand des Filters
+		 */
+		public static function countAbo($arFilter)
+		{
+			
+			list($strQuerySELECT, $strQueryWHERE, $strQueryJOIN, $strQueryHAVING, $strQueryORDER) = self::getQueryPartsAbo($arFilter);
+			
+			$strQuery = "
+				SELECT
+					COUNT(*)
+				FROM
+					(
+						SELECT
+						  	DISTINCT O.`id`
+						FROM
+							`".WPSG_TBL_ORDER."` AS O
+							".$strQueryJOIN."
+						WHERE
+							1
+							".$strQueryWHERE."
+						HAVING
+							1
+							".$strQueryHAVING."
+					) AS innerSelect
+			";
+			
+			return $GLOBALS['wpsg_db']->fetchOne($strQuery);
+			
+		} // public static function countAbo($arFilter)
+		
+		/**
+		 * Gibt einen Array von Abo-Bestellungen zurÃŒck, die auf den ÃŒbergebenen Filter passen
+		 * @param array $arFilter
+		 */
+		public static function findAbo($arFilter = array(), $load = true)
+		{
+			
+			list($strQuerySELECT, $strQueryWHERE, $strQueryJOIN, $strQueryHAVING, $strQueryORDER) = self::getQueryPartsAbo($arFilter);
+			
+			$strLimit = "";
+			
+			if (wpsg_isSizedArray($arFilter['limit'])) $strLimit = "LIMIT ".wpsg_q($arFilter['limit'][0]).", ".wpsg_q($arFilter['limit'][1]);
+			
+			$strQuery = "
+				SELECT
+					O.`id`
+					".$strQuerySELECT."
+				FROM
+					`".WPSG_TBL_ORDER."` AS O
+					".$strQueryJOIN."
+				WHERE
+					1
+					".$strQueryWHERE."
+				GROUP BY
+					O.`id`
+				HAVING
+					1
+					".$strQueryHAVING."
+				ORDER BY
+					".$strQueryORDER."
+				".$strLimit."
+			";
+			
+			$arOrderID = $GLOBALS['wpsg_db']->fetchAssocField($strQuery, "id", "id");
+			
+			if ($load !== true) return $arOrderID;
+			
+			$arReturn = array();
+			
+			foreach ($arOrderID as $order_id)
+			{
+				
+				$oOrder = $GLOBALS['wpsg_sc']->cache->loadOrderObject($order_id);
+				$arReturn[] = $oOrder;
+				
+			}
+			
+			return $arReturn;
+			
+		} // public static function findAbo($arFilter = array(), $load = true)
+		
+		public static function getQueryPartsAbo($arFilter = array())
+		{
+			
+			$strQuerySELECT = "";
+			$strQueryWHERE = "";
+			$strQueryJOIN = "";
+			$strQueryHAVING = "";
+			$strQueryORDER = "";
+			
+			$bJoinOrderProducts = true;
+			$bJoinCustomer = false;
+			$bJoinInvoice = false;
+			$bJoinAbo = false;
+			$bJoinOrderAdress = false;
+			
+			if (wpsg_isSizedInt($arFilter['k_id'])) $strQueryWHERE .= " AND O.`k_id` = '".wpsg_q($arFilter['k_id'])."' ";
+			if (wpsg_isSizedInt($arFilter['cdate_from'])) $strQueryWHERE .= " AND O.`cdate` > '".wpsg_date('Y-m-d', $arFilter['cdate_from'])."' ";
+			if (wpsg_isSizedInt($arFilter['product_id'])) { $strQueryWHERE .= " AND OP.`p_id` = '".wpsg_q($arFilter['product_id'])."' "; $bJoinOrderProducts = true; }
+			if (wpsg_isSizedString($arFilter['cdate_y']) && $arFilter['cdate_y'] != '-1') { $strQueryWHERE .= " AND YEAR(O.`cdate`) = '".wpsg_q($arFilter['cdate_y'])."' "; }
+			if (wpsg_isSizedString($arFilter['cdate_m']) && $arFilter['cdate_m'] != '-1') { $strQueryWHERE .= " AND MONTH(O.`cdate`) = '".wpsg_q(ltrim($arFilter['cdate_m'], '0'))."' "; }
+			if (wpsg_isSizedString($arFilter['enddate_y']) && $arFilter['enddate_y'] != '-1') { $bJoinAbo= true; $strQueryWHERE .= " AND YEAR(A.`expiration`) = '".wpsg_q($arFilter['enddate_y'])."' "; }
+			if (wpsg_isSizedString($arFilter['enddate_m']) && $arFilter['enddate_m'] != '-1') { $bJoinAbo= true; $strQueryWHERE .= " AND MONTH(A.`expiration`) = '".wpsg_q(ltrim($arFilter['enddate_m'], '0'))."' "; }
+			if (wpsg_isSizedString($arFilter['s']))
+			{
+				
+				$strQueryWHERE .= "
+					AND
+					(
+						OA.`vname` LIKE '%".wpsg_q($arFilter['s'])."%' OR
+						OA.`name` LIKE '%".wpsg_q($arFilter['s'])."%' OR
+						C.`email` LIKE '%".wpsg_q($arFilter['s'])."%' OR
+						OA.`firma` LIKE '%".wpsg_q($arFilter['s'])."%' OR
+						C.`ustidnr` LIKE '%".wpsg_q($arFilter['s'])."%' OR
+						O.`onr` LIKE '%".wpsg_q($arFilter['s'])."%' OR
+						O.`id` = '".wpsg_q($arFilter['s'])."'
+					)
+				";
+				
+				$bJoinOrderAdress = true;
+				$bJoinCustomer = true;
+				
+			}
+			
+			if (wpsg_isSizedInt($arFilter['status']) || $arFilter['status'] == '0')
+			{
+				
+				$strQueryWHERE .= " AND A.`status` = '".wpsg_q($arFilter['status'])."' ";
+				
+			}
+			else if (wpsg_isSizedArray($arFilter['status']))
+			{
+				
+				$strQueryWHERE .= " AND O.`status` IN (".wpsg_q(implode(',', $arFilter['status'])).") ";
+				
+			}
+			
+			if (wpsg_isSizedInt($arFilter['NOTstatus']))
+			{
+				
+				$strQueryWHERE .= " AND O.`status` != '".wpsg_q($arFilter['NOTstatus'])."' ";
+				
+			}
+			else if (wpsg_isSizedArray($arFilter['NOTstatus']))
+			{
+				
+				$strQueryWHERE .= " AND O.`status` NOT IN (".wpsg_q(implode(',', $arFilter['NOTstatus'])).") ";
+				
+			}
+			
+			// Sortierung
+			if (wpsg_isSizedString($arFilter['order'], 'cdate')) { $strQueryORDER = " O.`cdate` "; }
+			else if (wpsg_isSizedString($arFilter['order'], 'nr')) { $strQueryORDER = " O.`onr` "; }
+			else if (wpsg_isSizedString($arFilter['order'], 'customer')) { $strQueryORDER = " CONCAT(OA.`vname`, ' ', OA.`name`) "; $bJoinCustomer = true; $bJoinOrderAdress = true; }
+			else if (wpsg_isSizedString($arFilter['order'], 'payment')) {
+				
+				$strQuerySELECT .= " , (SELECT CASE `type_payment` ";
+				
+				foreach ($GLOBALS['wpsg_sc']->arPayment as $payment_key => $payment_info)
+				{
+					
+					$strQuerySELECT .= " WHEN '".wpsg_q($payment_key)."' THEN '".wpsg_q($payment_info['name'])."' ";
+					
+				}
+				
+				$strQuerySELECT .= " ELSE CONCAT('".wpsg_q(__('Deaktivierte Zahlungsart (', 'wpsg'))."', O.`type_payment`, '".wpsg_q(__(')'))."') ";
+				$strQuerySELECT .= "END) AS `paymentlabel` ";
+				
+				$strQueryORDER = " CONCAT(`paymentlabel`, ' - ', `price_payment`) ";
+				
+			}
+			else if (wpsg_isSizedString($arFilter['order'], 'shipping')) {
+				
+				$strQuerySELECT .= " , (SELECT CASE `type_shipping` ";
+				
+				foreach ($GLOBALS['wpsg_sc']->arShipping as $shipping_key => $shipping_info)
+				{
+					
+					$strQuerySELECT .= " WHEN '".wpsg_q($shipping_key)."' THEN '".wpsg_q($shipping_info['name'])."' ";
+					
+				}
+				
+				$strQuerySELECT .= " ELSE CONCAT('".wpsg_q(__('Deaktivierte Versandart (', 'wpsg'))."', O.`type_shipping`, '".wpsg_q(__(')'))."') ";
+				$strQuerySELECT .= "END) AS `shippinglabel` ";
+				
+				$strQueryORDER = " CONCAT(`shippinglabel`, ' - ', `price_shipping`) ";
+				
+			}
+			else if (wpsg_isSizedString($arFilter['order'], 'products'))
+			{
+				
+				$bJoinOrderProducts = true;
+				$strQuerySELECT .= ", COUNT(OP.`id`) AS `count_products` ";
+				$strQueryORDER = " `count_products` ";
+				
+			}
+			else if (wpsg_isSizedString($arFilter['order'], 'amount')) $strQueryORDER .= " `price_gesamt_brutto` ";
+			else if (wpsg_isSizedString($arFilter['order'], 'state'))
+			{
+				
+				$strQuerySELECT .= " , (SELECT CASE `status` ";
+				
+				foreach ($GLOBALS['wpsg_sc']->arStatus as $state_key => $state_label)
+				{
+					
+					$strQuerySELECT .= " WHEN '".wpsg_q($state_key)."' THEN '".wpsg_q($state_label)."' ";
+					
+				}
+				
+				$strQuerySELECT .= " ELSE CONCAT('".wpsg_q(__('Unbekannter Statuscode (', 'wpsg'))."', O.`status`, '".wpsg_q(__(')'))."') ";
+				$strQuerySELECT .= "END) AS `statelabel` ";
+				$strQueryORDER = " `statelabel` ";
+				
+			}
+			else $strQueryORDER = " O.`id` ";
+			
+			// Richtung
+			if (wpsg_isSizedString($arFilter['ascdesc'], "DESC")) $strQueryORDER .= " DESC ";
+			else $strQueryORDER .= " ASC ";
+			
+			// Optionale Joins
+			if ($bJoinOrderProducts === true) $strQueryJOIN .= " LEFT JOIN `".WPSG_TBL_ORDERPRODUCT."` AS OP ON (O.`id` = OP.`o_id`) ";
+			if ($bJoinCustomer === true) $strQueryJOIN .= " LEFT JOIN `".WPSG_TBL_KU."` AS C ON (C.`id` = O.`k_id`) ";
+			if ($bJoinInvoice === true) $strQueryJOIN .= " LEFT JOIN `".WPSG_TBL_RECHNUNGEN."` AS I ON (I.`o_id` =  O.`id` AND I.`storno` = '0000-00-00 00:00:00' AND I.`rnr` != '') ";
+			if ($bJoinOrderAdress === true) $strQueryJOIN .= " LEFT JOIN `".WPSG_TBL_ADRESS."` AS OA ON (OA.`id` = O.`adress_id`) ";
+
+			// Abo-Tabelle immer dazu wegen Abo-Status
+			$bJoinAbo = true;
+			if ($bJoinAbo === true) $strQueryJOIN .= " LEFT JOIN `".WPSG_TBL_ABO."` AS A ON (A.`order_id` =  O.`id`) ";
+			$strQueryWHERE .= " AND P.`wpsg_mod_abo_activ` = 1 ";
+			$strQueryJOIN .= " LEFT JOIN `".WPSG_TBL_PRODUCTS."` AS P ON (P.`id` = OP.`p_id`) ";
+			
+			return array($strQuerySELECT, $strQueryWHERE, $strQueryJOIN, $strQueryHAVING, $strQueryORDER);
+			
+		}	// public static function getQueryPartsAbo($arFilter = array())
+		
 	} // class wpsg_mod_order extends wpsg_model
  
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 6866)
+++ /mods/wpsg_mod_abo.class.php	(revision 6867)
@@ -112,5 +112,5 @@
 		 * Ãbersicht ÃŒber die Kunden im Backend
 		 */
-		private function be_indexAction()
+		private function be_indexActionxxxx()
 		{
 		
@@ -167,4 +167,97 @@
 		} // private function be_indexAction()
 		
+		/**
+		 * Ãbersicht ÃŒber die Kunden im Backend
+		 */
+		private function be_indexAction()
+		{
+		
+			$nPerPage = $this->shop->get_option('wpsg_mod_abo_perpage');
+			if ($nPerPage <= 0) $nPerPage = 10;
+			
+			$this->shop->view['hasFilter'] = false;
+			$this->shop->view['pages'] = 0;
+			$this->shop->view['arStatus'] = array();
+			$this->shop->view['arFilter'] = array(
+					'order' => 'cdate',
+					'ascdesc' => 'DESC',
+					'status' => '0',
+					'page' => '1'
+			);
+			
+			$this->shop->view['tabs'] = array('left' => array(), 'right' => array());
+			
+			$this->shop->callMods('order_index_tab', array(&$this->shop->view['tabs']));
+			
+			if (wpsg_isSizedArray($_REQUEST['filter']))
+			{
+				
+				$this->shop->view['arFilter'] = $_REQUEST['filter'];
+				
+			}
+			else if (wpsg_isSizedArray($_SESSION['wpsg']['backend']['order']['arFilter']))
+			{
+				
+				$this->shop->view['arFilter'] = $_SESSION['wpsg']['backend']['order']['arFilter'];
+				
+			}
+			
+			if (!isset($this->shop->view['arFilter']['status'])) $this->shop->view['arFilter']['status'] = '0';
+			if (($this->shop->view['arFilter']['status'] >= '0') && ($this->shop->view['arFilter']['status'] < wpsg_ShopController::STATUS_AKTIVABO)) $this->shop->view['arFilter']['status'] = wpsg_ShopController::STATUS_AKTIVABO;
+			
+			// Filter gesetzt?
+			foreach (Array('s', 'k_id', 'cdate_m', 'cdate_y', 'enddate_m', 'enddate_y') as $field)
+			{
+				
+				if (wpsg_isSizedString($this->shop->view['arFilter'][$field]) && $this->shop->view['arFilter'][$field] != '-1') { $this->shop->view['hasFilter'] = true; break; }
+				
+			}
+			
+			foreach ($this->shop->arStatus as $status_key => $status_label)
+			{
+				
+				//if ($this->shop->get_option('wpsg_showincompleteorder') != '1' && $status_key == wpsg_ShopController::STATUS_UNVOLLSTAENDIG) continue;
+				
+				$arFilterState = $this->shop->view['arFilter'];
+				$arFilterState['status'] = $status_key;
+				
+				if ($status_key >= wpsg_ShopController::STATUS_AKTIVABO)
+				{
+					$count = wpsg_order::countAbo($arFilterState);
+				
+					if (wpsg_isSizedInt($count)) $this->shop->view['arStatus'][$status_key] = array('label' => $status_label, 'count' => $count);
+				}
+				
+			}
+			
+			$arFilterState = $this->shop->view['arFilter']; unset($arFilterState['status']);
+			$arFilterState['NOTstatus'] = wpsg_ShopController::STATUS_UNVOLLSTAENDIG;
+			
+			$this->shop->view['arStatus'] = wpsg_array_merge(array('-1' => array('label' => __('Alle', 'wpsg'), 'count' => wpsg_Order::countAbo($arFilterState))), $this->shop->view['arStatus']);
+			
+			if ($this->shop->view['arFilter']['status'] == '-1') $this->shop->view['arFilter']['NOTstatus'] = wpsg_ShopController::STATUS_UNVOLLSTAENDIG;
+			
+			$this->shop->view['countAll'] = wpsg_order::countAbo($this->shop->view['arFilter']);
+			
+			if (wpsg_isSizedInt($_REQUEST['seite'])) $this->shop->view['arFilter']['page'] = $_REQUEST['seite'];
+			
+			$this->shop->view['pages'] = ceil($this->shop->view['countAll'] / $nPerPage);
+			if (!isset($this->shop->view['arFilter']['page']) || $this->shop->view['arFilter']['page'] <= 0 || $this->shop->view['arFilter']['page'] > $this->shop->view['pages']) $this->shop->view['arFilter']['page'] = 1;
+			
+			$this->shop->view['arFilter']['limit'] = array(($this->shop->view['arFilter']['page'] - 1) * $nPerPage, $nPerPage);
+			
+			// Filter speichern
+			$_SESSION['wpsg']['backend']['order']['arFilter'] = $this->shop->view['arFilter'];
+			
+			$this->shop->view['arData'] = wpsg_order::findAbo($this->shop->view['arFilter']);
+			
+			$this->shop->view['cdate_years'] = $this->db->fetchAssocField("SELECT DISTINCT DATE_FORMAT(`cdate`, '%Y') FROM `".WPSG_TBL_ORDER."` ORDER BY `cdate` ASC ");
+			//if ($this->shop->hasMod('wpsg_mod_rechnungen')) $this->shop->view['invoicedate_years'] = $this->db->fetchAssocField("SELECT DISTINCT DATE_FORMAT(`datum`, '%Y') FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `storno` = '0000-00-00' AND `gnr` = '' ORDER BY `datum` ASC ");
+			
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_abo/index.phtml');
+			
+			
+		} // private function be_indexAction()
+		
 		public function dispatch()
 		{
@@ -197,18 +290,18 @@
 			$this->shop->update_option('wpsg_mod_abo_wpsgmodaboexpiration', $_REQUEST['wpsg_mod_abo_wpsgmodaboexpiration']);
 			$this->shop->update_option('wpsg_mod_abo_wpsgmodabrebuy', $_REQUEST['wpsg_mod_abo_wpsgmodabrebuy']);
-      $this->shop->update_option('wpsg_mod_abo_expiremode', $_REQUEST['wpsg_mod_abo_expiremode']);            
-            
-      $this->shop->update_option('wpsg_mod_abo_autoexpire_payment', $_REQUEST['wpsg_mod_abo_autoexpire_payment']);
-     	$this->shop->update_option('wpsg_mod_abo_autoexpire_customermail', $_REQUEST['wpsg_mod_abo_autoexpire_customermail']);
-      $this->shop->update_option('wpsg_mod_abo_autoexpire_adminmail', $_REQUEST['wpsg_mod_abo_autoexpire_adminmail']);
-      $this->shop->update_option('wpsg_mod_abo_autoexpire_customer', $_REQUEST['wpsg_mod_abo_autoexpire_customer']);
-            
-      $this->shop->update_option('wpsg_mod_abo_moreorder', $_REQUEST['wpsg_mod_abo_moreorder']);
-      $this->shop->update_option('wpsg_mod_abo_moreorder_text', $_REQUEST['wpsg_mod_abo_moreorder_text']);
-      $this->shop->update_option('wpsg_mod_abo_nomoreorder_text', $_REQUEST['wpsg_mod_abo_nomoreorder_text']);
+			$this->shop->update_option('wpsg_mod_abo_expiremode', $_REQUEST['wpsg_mod_abo_expiremode']);            
+            
+			$this->shop->update_option('wpsg_mod_abo_autoexpire_payment', $_REQUEST['wpsg_mod_abo_autoexpire_payment']);
+			$this->shop->update_option('wpsg_mod_abo_autoexpire_customermail', $_REQUEST['wpsg_mod_abo_autoexpire_customermail']);
+			$this->shop->update_option('wpsg_mod_abo_autoexpire_adminmail', $_REQUEST['wpsg_mod_abo_autoexpire_adminmail']);
+			$this->shop->update_option('wpsg_mod_abo_autoexpire_customer', $_REQUEST['wpsg_mod_abo_autoexpire_customer']);
+            
+			$this->shop->update_option('wpsg_mod_abo_moreorder', $_REQUEST['wpsg_mod_abo_moreorder']);
+			$this->shop->update_option('wpsg_mod_abo_moreorder_text', $_REQUEST['wpsg_mod_abo_moreorder_text']);
+			$this->shop->update_option('wpsg_mod_abo_nomoreorder_text', $_REQUEST['wpsg_mod_abo_nomoreorder_text']);
            
-      $this->shop->update_option('wpsg_mod_abo_moreorder_product', $_REQUEST['wpsg_mod_abo_moreorder_product']);
-      $this->shop->update_option('wpsg_mod_abo_moreorder_producttext', $_REQUEST['wpsg_mod_abo_moreorder_producttext']);    
-      $this->shop->update_option('wpsg_mod_abo_nomoreorder_product_text', $_REQUEST['wpsg_mod_abo_nomoreorder_product_text']);
+			$this->shop->update_option('wpsg_mod_abo_moreorder_product', $_REQUEST['wpsg_mod_abo_moreorder_product']);
+			$this->shop->update_option('wpsg_mod_abo_moreorder_producttext', $_REQUEST['wpsg_mod_abo_moreorder_producttext']);    
+			$this->shop->update_option('wpsg_mod_abo_nomoreorder_product_text', $_REQUEST['wpsg_mod_abo_nomoreorder_product_text']);
             
             
@@ -292,4 +385,31 @@
 		} // public function produkt_save(&$produkt_id)
 
+		public function setAboStatus($order_id, $status_id, $inform)
+		{
+		
+			$this->db->UpdateQuery(WPSG_TBL_ABO, array(
+					'status' => $status_id
+			), "`order_id` = '".wpsg_q($order_id)."'");
+			
+			$oOrder = wpsg_order::getInstance($order_id);
+			$this->shop->view['stornoDate'] = time();
+			
+			$this->shop->view['customer']['vname'] = $oOrder->getInvoiceFirstName();;
+			$this->shop->view['customer']['name'] = $oOrder->getInvoiceName();;
+			$this->shop->view['customer']['email'] = $oOrder->getCustomer()->getEMail();
+			
+			$arOrderProducts = $this->getAboProductsFromOrder($order_id);
+			
+			foreach ($arOrderProducts as $oOrderProduct)
+			{
+				
+				$abo_status = $this->getAboProductStatus($order_id, $oOrderProduct->getProductKey());
+				
+				if ($inform) $this->sendCustomerMailResign($abo_status);
+				
+			}
+			
+		}	// public function setAboStatus($order_id, $status_id, $inform)
+		
 		public function setOrderStatus($order_id, $status_id, $inform)
 		{
@@ -963,4 +1083,42 @@
             
         } // private function sendAdminMailStopRenewal($abo_status)
+
+        /**
+         * Sendet eine Mail an den Kunden, wenn der Admin ein Abo gekÃŒndigt hat
+         *
+         * @param $abo_status
+         */
+        private function sendCustomerMailResign($abo_status)
+        {
+        	
+        	if (strtotime($abo_status['mail_admin_stop']) > 0) throw new \wpsg\Exception(wpsg_translate(__('Admin wurde bereits am #1# benachrichtigt das Abo zu stoppen.'), wpsg_formatTimestamp($abo_status['mail_admin_stop'], false)));
+        	
+        	$this->db->UpdateQuery(WPSG_TBL_ABO, Array(
+        			'mail_admin_stop' => 'NOW()'
+        			), " `id` = '".wpsg_q($abo_status['id'])."' ");
+        	
+        	// Mail senden
+        	$this->shop->view['oOrder'] = wpsg_order::getInstance($abo_status['order_id']);
+        	$this->shop->view['oCustomer'] = $this->shop->view['oOrder']->getCustomer();
+        	$this->shop->view['oProduct'] = wpsg_product::getInstance($abo_status['product_key']);
+        	$this->shop->view['product_key'] = $abo_status['product_key'];
+        	
+        	if ($this->shop->get_option('wpsg_htmlmail') === '1') $mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_abo/mail_storno_html.phtml', false);
+        	else $mail_html = false;
+        	
+        	$mail_text = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_abo/mail_storno.phtml', false);
+        	
+        	//$to = $this->shop->get_option('wpsg_wpsgmodaboadminstoprenewal_empfaenger');
+        	$to = $this->shop->view['customer']['email'];
+        	
+        	$oProduct = wpsg_product::getInstance($this->shop->getProduktID($abo_status['product_key']));
+        	
+        	// Protokoll
+        	$oOrder = wpsg_order::getInstance($abo_status['order_id']);
+        	$oOrder->log(wpsg_translate(__('Mail an Kunden (Abo gekÃŒndigt)', 'wpsg'), $oProduct->getProductName()), $mail_text);
+        	
+        	$this->shop->sendMail($mail_text, $to, 'wpsgmodaboadminresign', array(), $abo_status['order_id'], false, $mail_html);
+        	
+        } // private function sendCustomerMailResign($abo_status)
         
         /**
Index: /views/mods/mod_abo/index.phtml
===================================================================
--- /views/mods/mod_abo/index.phtml	(revision 6866)
+++ /views/mods/mod_abo/index.phtml	(revision 6867)
@@ -61,16 +61,16 @@
                         <div class="row">
                             <div class="col-lg-6">
-                                <select name="filter[cdate_m]" class="form-control input-sm">
+                                <select name="filter[enddate_m]" class="form-control input-sm">
                                     <option value="-1"><?php echo __("Alle", "wpsg"); ?></option>
                                     <?php for ($i = 1; $i <= 12; $i ++) { ?>
-                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['cdate_m']) == $i)?'selected="selected"':''); ?> value="<?php echo str_pad($i, 2, '0', STR_PAD_LEFT); ?>"><?php echo strftime("%B", mktime(0, 0, 0, $i, 1, 2000)); ?></option>
+                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['enddate_m']) == $i)?'selected="selected"':''); ?> value="<?php echo str_pad($i, 2, '0', STR_PAD_LEFT); ?>"><?php echo strftime("%B", mktime(0, 0, 0, $i, 1, 2000)); ?></option>
                                     <?php } ?>
                                 </select>
                             </div>
                             <div class="col-lg-6">
-                                <select name="filter[cdate_y]" class="form-control input-sm">
+                                <select name="filter[enddate_y]" class="form-control input-sm">
                                     <option value="-1"><?php echo __("Alle", "wpsg"); ?></option>
-                                    <?php foreach ($this->view['cdate_years'] as $y) { ?>
-                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['cdate_y']) == $y)?'selected="selected"':''); ?> value="<?php echo $y; ?>"><?php echo $y; ?></option>
+                                    <?php foreach ($this->view['enddate_years'] as $y) { ?>
+                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['enddate_y']) == $y)?'selected="selected"':''); ?> value="<?php echo $y; ?>"><?php echo $y; ?></option>
                                     <?php } ?>
                                 </select>
@@ -131,5 +131,5 @@
                             <input class="col_set_checkbox" name="wpsg_multido[<?php echo $oOrder->id; ?>]" type="checkbox" />
 
-                        </td>                       
+                        </td>
                         <td class="col_nr">
 
@@ -137,11 +137,13 @@
 
                             <div class="actions">
-                                <span class="view"><a title="<?php echo __("Diese Abonnement ansehen", "wpsg"); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&edit_id=<?php echo $oOrder->id; ?>"><?php echo __("Ansehen", "wpsg"); ?></a></span>
+                                <span class="view"><a title="<?php echo __("Dieses Abonnement ansehen", "wpsg"); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&edit_id=<?php echo $oOrder->id; ?>"><?php echo __("Ansehen", "wpsg"); ?></a></span>
                                 |
-                                <span class="storno"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie diese Abonnement kÃŒndigen mÃ¶chten?', 'wpsg'); ?>');" title="<?php echo __("Diese Abonnement stornieren", "wpsg"); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=storno&noheader=1&edit_id=<?php echo $oOrder->id; ?>"><?php echo __("KÃŒndigen", "wpsg"); ?></a></span>
+                                <?php if ($this->view['arFilter']['status'] != wpsg_ShopController::STATUS_GEKUENDIGTEABOS) { ?>
+                                <span class="storno"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie dieses Abonnement kÃŒndigen mÃ¶chten?', 'wpsg'); ?>');" title="<?php echo __("Dieses Abonnement kÃŒndigen", "wpsg"); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=resign&noheader=1&edit_id=<?php echo $oOrder->id; ?>"><?php echo __("KÃŒndigen", "wpsg"); ?></a></span>
                                 |
-                                <span class="delete"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie dieses Abonnement lÃ¶schen mÃ¶chten?', 'wpsg'); ?>');" title="<?php echo __('Diese Abonnement lÃ¶schen', 'wpsg'); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=delete&noheader=1&edit_id=<?php echo $oOrder->id; ?>"><?php echo __('LÃ¶schen', 'wpsg'); ?></a></span>
-                            </div>
-												
+                                <?php } ?>
+                                <span class="delete"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie dieses Abonnement lÃ¶schen mÃ¶chten?', 'wpsg'); ?>');" title="<?php echo __('Dieses Abonnement lÃ¶schen', 'wpsg'); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=delete&abo=1&noheader=1&edit_id=<?php echo $oOrder->id; ?>"><?php echo __('LÃ¶schen', 'wpsg'); ?></a></span>
+                            </div>
+							
                             <?php if (trim($oOrder->admincomment) != "") { ?>
                             <a title="<?php echo __("Kommentar (Admin): ", "wpsg").htmlspecialchars($oOrder->admincomment); ?>" onclick="return false;" class="glyphicon glyphicon-question-sign admincomment" href="#"></a>
@@ -154,7 +156,7 @@
                             <?php if ($oOrder->hasShippingAdress()) { ?>
                             <a title="<?php echo __("Lieferadresse beachten", "wpsg"); ?>" onclick="return false;" class="glyphicon glyphicon-map-marker shippingadress" href="#"></a>
-                            <?php } ?>                                                  
-
-                        </td>                        
+                            <?php } ?>
+
+                        </td>
                         <td class="col_customer">
                             <?php $firma = $oOrder->getInvoiceCompany(); if (wpsg_isSizedString($firma)) { ?>
@@ -166,5 +168,5 @@
                             <?php echo ltrim($oOrder->getInvoiceZip().' '.$oOrder->getInvoiceCity()); ?> <?php echo $oOrder->getInvoiceCountryKuerzel(); ?>
                             </span>
-                        </td>                        
+                        </td>
                         <td class="col_payment">
 
@@ -180,5 +182,5 @@
                             <?php } ?>
 
-                        </td>                        
+                        </td>
                         <td class="col_shipping">
 
@@ -198,5 +200,5 @@
                             <?php } ?>
 
-                        </td>                     
+                        </td>
                         <td class="col_products">
 
@@ -219,11 +221,9 @@
                         </td>
                         
-                        /* Laufzeitspalte */
+                        <?php /* Laufzeitspalte */ ?>
                         <td class="col_time">
                             <?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()) { ?>
@@ -267,5 +267,4 @@
             <div class="wpsg_clear"></div>
 
-
 		<?php } else { ?>
 
