Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 5673)
+++ /controller/wpsg_OrderController.class.php	(revision 5674)
@@ -355,7 +355,8 @@
 				
 			}
-			
-			$this->shop->delOrder($_REQUEST['edit_id']);
-			
+
+			$oOrder = wpsg_order::getInstance($_REQUEST['edit_id']);
+			$oOrder->delete();
+
 			$this->shop->addBackendMessage(__('Bestellung erfolgreich gelÃ¶scht.', 'wpsg'));
 			$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order');
@@ -366,478 +367,159 @@
 		{
 
-			/*
-			$strQueryWHERE = '';
-			$strQueryStatusWHERE = '';
-			$strQueryFROM = '';
-			
 			if (wpsg_isSizedString($_REQUEST['do'], 'writeMultiRechnung') || wpsg_isSizedString($_REQUEST['wpsg_action'], 'showRechnung'))
 			{
-				
+
 				// Mehrere Rechnungen schreiben/anzeigen
-				if (isset($_REQUEST['ids']))
-				{
-					
-					$IDs = explode("_", $_REQUEST['ids']);
-					
-				}
-				else 
-				{
-					
-					$IDs = array_keys($_REQUEST['wpsg_multido']);
-						 
-				}
-				
+				if (isset($_REQUEST['ids'])) $IDs = explode("_", $_REQUEST['ids']);
+				else $IDs = array_keys($_REQUEST['wpsg_multido']);
+
 				// Hier die Rechnungen noch einmal nach CDATE sortieren
 				$IDs = $this->db->fetchAssocField("SELECT `id` FROM `".WPSG_TBL_ORDER."` WHERE `id` IN (".wpsg_q(implode(',', $IDs)).") ORDER BY `cdate` ASC");
 
-				include WPSG_PATH_LIB.'fpdf/fpdf.php';
-				include WPSG_PATH_LIB.'fpdf/fpdi.php';
-				 
+				require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
+				require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
+
 				if (sizeof($IDs) > 0)
 				{
-					
+
 					$pdf = new FPDI();
-					
+
 					foreach ($IDs as $o_id)
 					{
-						
+
 						$rnr_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `rnr` != '' AND `storno` = '0000-00-00 00:00:00' AND `o_id` = '".wpsg_q($o_id)."' ORDER BY `id` DESC");
 						$rnr = $rnr_db['rnr'];
-						
+
 						$path = $this->shop->callMod('wpsg_mod_rechnungen', 'getFilePath', array($o_id));
 
+						$rnr_file = false;
 						if (file_exists($path.'/R'.$rnr.'.pdf')) $rnr_file = $path.'/R'.$rnr.'.pdf';
 						else if (file_exists($path.'/R'.$rnr_db['id'].'.pdf')) $rnr_file = $path.'/R'.$rnr_db['id'].'.pdf';
 						else if (file_exists($path.'/'.$rnr_db['id'].'.pdf')) $rnr_file = $path.'/'.$rnr_db['id'].'.pdf';
 						else if (file_exists($path.'/'.$rnr_db['rnr'].'.pdf')) $rnr_file = $path.'/'.$rnr_db['rnr'].'.pdf';
-						
+
 						if (file_exists($rnr_file))
 						{
-							
+
 							$pagecount = $pdf->setSourceFile($rnr_file);
-							
-							for ($i = 1; $i <= $pagecount; $i++) 
+
+							for ($i = 1; $i <= $pagecount; $i++)
 							{
-							
+
 								$tplidx = $pdf->ImportPage($i);
-								$pdf->AddPage();	
+								$pdf->AddPage();
 								$pdf->useTemplate($tplidx);
-							
+
 							}
-								
+
 						}
-												
+
 					}
-					
+
 					die($pdf->Output());
-					
+
 				}
-				else 
+				else
 				{
+
 					die(__('Keine Rechnungen gewÃ€hlt!', 'wpsg'));
+
 				}
-				
-			}
-			
-			if (isset($_REQUEST['filter']))
-			{
-
-				$this->shop->view['filter'] = $_REQUEST['filter'];
-				
-			}
-			else
-			{
-				
-				$this->shop->view['filter'] = array();
-				
-				if (isset($_COOKIE['wpsg_order_status']) && !isset($_REQUEST['k_id']))
+
+			}
+			else if (isset($_REQUEST['wpsg_order_doaction']))
+			{
+				
+				if ($_REQUEST['wpsg_action'] == '-1') $this->addBackendError(__('Bitte eine Aktion wÃ€hlen!', 'wpsg'));
+				else if (!isset($_REQUEST['wpsg_multido']) || !is_array($_REQUEST['wpsg_multido'])) $this->addBackendError(__('Bitte mindestens eine Bestellung auswÃ€hlen!', 'wpsg'));
+				else
 				{
-					
-					$this->shop->view['filter']['status'] = $_COOKIE['wpsg_order_status'];
-					
-				}
-				
-			}
-			
-			if (!isset($_REQUEST['k_id']) && !wpsg_isSizedInt($this->shop->view['filter']['status']) && $this->shop->view['filter']['status'] != -1) $this->shop->view['filter']['status'] = 0;
-			else if (isset($_REQUEST['k_id']) && !wpsg_isSizedInt($this->shop->view['filter']['status'])) $this->shop->view['filter']['status'] = -1;
-			
-			if (is_numeric($this->shop->view['filter']['status']) && $this->shop->view['filter']['status'] >= 0)
-			{
-				
-				$strQueryStatusWHERE .= " AND O.`status` = '".wpsg_q($this->shop->view['filter']['status'])."' ";
-				
-			}
-			else if (preg_match('/\d+\,\d+/', $this->shop->view['filter']['status']))
-			{
-
-				$strQueryStatusWHERE .= " AND O.`status` IN (".wpsg_q($this->shop->view['filter']['status']).") ";
-				
-			}
-			
-			if (wpsg_isSizedInt($this->shop->view['filter']['k_id']))
-			{
-				
-				$strQueryWHERE .= " AND O.`k_id` = '".wpsg_q($this->shop->view['filter']['k_id'])."' ";
-				
-				$this->shop->view['kunde'] = $this->shop->cache->loadKunden($this->shop->view['filter']['k_id']);
-				
-			}
-						
-			if (@$this->shop->view['filter']['search'] != '')
-			{
-				
-				$strQueryWHERE .= " 
-					AND (
-						K.`vname` LIKE '%".wpsg_q($this->shop->view['filter']['search'])."%' OR
-						K.`email` LIKE '%".wpsg_q($this->shop->view['filter']['search'])."%' OR
-						K.`firma` LIKE '%".wpsg_q($this->shop->view['filter']['search'])."%' OR
-						K.`ustidnr` LIKE '%".wpsg_q($this->shop->view['filter']['search'])."%' OR						
-						K.`name` LIKE '%".wpsg_q($this->shop->view['filter']['search'])."%' OR
-						O.`onr` LIKE '%".wpsg_q($this->shop->view['filter']['search'])."%' OR
-						O.`id` = '".wpsg_q($this->shop->view['filter']['search'])."' OR
-						O.`custom_data` LIKE '%".wpsg_q($this->shop->view['filter']['search'])."%' 						
-					)
-				"; 
-				
-			}
-			
-			if (@$this->shop->view['filter']['invoice_month_von'] > 0 || @$this->shop->view['filter']['invoice_year_von'] > 0)
-			{
-				
-				$strQueryFROM .= " LEFT JOIN `".WPSG_TBL_RECHNUNGEN."` AS R ON (R.`o_id` = O.`id` AND R.`rnr` != '' AND R.`storno` = '0000-00-00') ";
-
-				if ($this->shop->view['filter']['invoice_month_von'] > 0)
-				{
-					
-					$strQueryWHERE .= " AND DATE_FORMAT(R.`datum`, '%m') = '".wpsg_q($this->shop->view['filter']['invoice_month_von'])."' ";
-					
-				}
-				
-				if ($this->shop->view['filter']['invoice_year_von'] > 0)
-				{
-					
-					$strQueryWHERE .= " AND DATE_FORMAT(R.`datum`, '%Y') = '".wpsg_q($this->shop->view['filter']['invoice_year_von'])."' ";
-					
-				}
-				
-			}
-			
-			if (@$this->shop->view['filter']['year_von'] != '' && $this->shop->view['filter']['year_von'] != '-1')
-			{
-				
-				$strQueryWHERE .= " AND DATE_FORMAT(O.`cdate`, '%Y') = '".wpsg_q($this->shop->view['filter']['year_von'])."' ";
-				
-			}
-			
-			if (@$this->shop->view['filter']['month_von'] != '' && $this->shop->view['filter']['month_von'] != '-1')
-			{
-				
-				$strQueryWHERE .= " AND DATE_FORMAT(O.`cdate`, '%m') = '".wpsg_q($this->shop->view['filter']['month_von'])."' ";
-				
-			}
-			
-			$strQueryORDER = '';
-				
-			if (!isset($this->shop->view['filter']['order']))
-			{
-			
-				$this->shop->view['filter']['order'] = 'nr';
-			
-			} 
-				
-			switch ($this->shop->view['filter']['order'])
-			{
-			
-				case 'customer': $strQueryORDER = " K.`name` "; break;
-				case 'payment': $strQueryORDER = " `payment_name` "; break;			
-				case 'produkte': $strQueryORDER = " `produkt_menge` "; break;
-				case 'amount': $strQueryORDER = " O.`price_gesamt` "; break;
-				case 'status': $strQueryORDER = " `status_name` "; break;				
-				case 'abo': $strQueryORDER = " `abo` "; break;
-				default: $strQueryORDER = " O.`cdate` "; break;
-			
-			}
-							
-			if (!isset($this->shop->view['filter']['ascdesc']))
-			{
-			
-				$this->shop->view['filter']['ascdesc'] = 'DESC';
-			
-			}
-			
-			$nPerPage = $this->get_option('wpsg_order_perpage');
-			if ($nPerPage <= 0) $nPerPage = 10;
-			
-			if (isset($_REQUEST['seite'])) $seite = $_REQUEST['seite']; else $seite = 1;
-				
-			// Bestellungen nach Status zÃ€hlen
-			$this->shop->view['arStatus'] = array();
-			foreach ((array)$this->shop->arStatus as $status_id => $status)
-			{
-					
-				$count = $this->db->fetchOne("
-					SELECT
-						COUNT(*)
-					FROM
-						`".WPSG_TBL_ORDER."` AS O
-							LEFT JOIN `".WPSG_TBL_KU."` AS K ON (K.`id` = O.`k_id`)
-							".$strQueryFROM."
-					WHERE
-						1
-						".$strQueryWHERE."
-						AND O.`status` = '".wpsg_q($status_id)."'
-				");
-							
-				$this->shop->view['arStatus'][$status_id] = $count;
-					
-				if ($this->shop->get_option('wpsg_showincompleteorder') != '1' && $status_id == wpsg_ShopController::STATUS_UNVOLLSTAENDIG) unset($this->shop->view['arStatus'][$status_id]);
-				
-			}
-							
-			//if (!isset($this->shop->view['filter']['status']) || !array_key_exists($this->shop->view['filter']['status'], $this->shop->view['arStatus'])) $this->shop->view['filter']['status'] = '-1';
-			
-			//if (wpsg_isSizedString($this->shop->view['filter']['status']))
-			//{
-			 
-			if (is_numeric($this->shop->view['filter']['status']) && $this->shop->view['filter']['status'] >= 0)
-			{
-			
-				$strQueryStatusWHERE .= " AND O.`status` = '".wpsg_q($this->shop->view['filter']['status'])."' ";
-				
-			}
-			else if (preg_match('/\d+\,\d+/', $this->shop->view['filter']['status']))
-			{
-				
-				$strQueryStatusWHERE .= " AND O.`status` IN (".wpsg_q($this->shop->view['filter']['status']).") ";
-				
-			}					
-			else if (wpsg_isSizedString($this->shop->view['filter']['status'], '-1'))
-			{
-				
-				$strQueryStatusWHERE .= " AND O.`status` != '".wpsg_q(wpsg_ShopController::STATUS_UNVOLLSTAENDIG)."' ";
-				
-			}
-			
-			//}
-			
-			$this->shop->view['count'] = $this->db->fetchOne("
-				SELECT
-					COUNT(*)
-				FROM	
-					`".WPSG_TBL_ORDER."` AS O
-						LEFT JOIN `".WPSG_TBL_KU."` AS K ON (K.`id` = O.`k_id`)
-						".$strQueryFROM."
-				WHERE 
-					1
-					".$strQueryWHERE."
-					".$strQueryStatusWHERE."
-			");
-			
-			$this->shop->view['countAll'] = $this->db->fetchOne("
-				SELECT
-					COUNT(*)
-				FROM
-					`".WPSG_TBL_ORDER."` AS O
-						LEFT JOIN `".WPSG_TBL_KU."` AS K ON (K.`id` = O.`k_id`)
-						".$strQueryFROM."
-				WHERE
-					1
-					".$strQueryWHERE."
-			");
-			 		
-			$this->shop->view['seite'] = $seite;
-			$this->shop->view['pages'] = ceil($this->shop->view['count'] / $nPerPage); 			
-			if ($this->shop->view['seite'] <= 0 || $this->shop->view['seite'] > $this->shop->view['pages']) $this->shop->view['seite'] = 1;
-
-			$strQueryLIMIT = "";
-
-			// Beim Export Pager ignorieren
-			if (!wpsg_isSizedInt($_REQUEST['submit_export']))
-			{
-
-				$strQueryLIMIT .= "
-					LIMIT
-						".(($this->shop->view['seite'] - 1) * $nPerPage).", ".$nPerPage."
-				";
-				
-			}
-
-			$strQuerySELECT = "";
-			if (sizeof($this->shop->arPayment) >= 1 && $this->shop->view['filter']['order'] == 'payment') 
-			{
-			
-				$strQuerySELECT .= " (CASE O.`type_payment` ";				
-				foreach ($this->shop->arPayment as $p) { $strQuerySELECT .= " WHEN '".wpsg_q($p['id'])."' THEN '".wpsg_q($p['name'])."' "; }
-				$strQuerySELECT .= " END) AS `payment_name`, ";
-						
-			}
-			 
-			if (sizeof($this->shop->arShipping) >= 1 && $this->shop->view['filter']['order'] == 'shipping')
-			{
-					
-				$strQuerySELECT .= " (CASE O.`type_shipping` ";
-				foreach ($this->shop->arShipping as $s) { $strQuerySELECT .= " WHEN '".wpsg_q($s['id'])."' THEN '".wpsg_q($s['name'])."' "; }
-				$strQuerySELECT .= " END) AS `payment_name`, ";
-			
-			}
-			
-			if ($this->shop->view['filter']['order'] == 'abo')
-			{
-				
-				$strQuerySELECT  = " (
-					IF (
-						O.`wpsg_mod_abo_origin_order` > 0,
-						(SELECT ABO.`cdate` FROM `".WPSG_TBL_ABO."` AS ABO WHERE `order_id` = O.`wpsg_mod_abo_origin_order`),
-						(SELECT ABO.`cdate` FROM `".WPSG_TBL_ABO."` AS ABO WHERE `order_id` = O.`id`)  
-					)		 
-				) AS `abo`, ";
-				
-			}
-			
-			if ($this->shop->view['filter']['order'] == 'produkte')
-			{
-				
-				$strQuerySELECT .= " (SELECT SUM(OP.`menge`) FROM `".WPSG_TBL_ORDERPRODUCT."` AS OP WHERE OP.`o_id` = O.`id`) AS `produkt_menge`, ";
-				
-			}
-			
-			if ($this->shop->view['filter']['order'] == 'status')
-			{
-				
-				$strQuerySELECT .= " (CASE O.`status` ";
-				foreach ($this->shop->arStatus as $s_id => $s) { $strQuerySELECT .= " WHEN '".wpsg_q($s_id)."' THEN '".wpsg_q($s)."' "; }
-				$strQuerySELECT .= " END) AS `status_name`, ";
-				
-			}
-						
-			$strQuery = "
-				SELECT
-					O.*, K.*,
-					".$strQuerySELECT."
-					O.`status` AS `status`, 
-					O.`comment` AS `order_comment`, 
-					O.`id` AS id
-				FROM	
-					`".WPSG_TBL_ORDER."` AS O
-						LEFT JOIN `".WPSG_TBL_KU."` AS K ON (K.`id` = O.`k_id`)
-						".$strQueryFROM."
-				WHERE
-					1 
-					".$strQueryWHERE."
-					".$strQueryStatusWHERE."
-				ORDER BY					
-					".wpsg_q($strQueryORDER)." ".wpsg_q($this->shop->view['filter']['ascdesc']).", O.`cdate` DESC 
-					".$strQueryLIMIT."				
-			"; 
-			 
-			$this->shop->view['data'] = $this->db->fetchAssoc($strQuery); 	
-			
-			if (isset($_REQUEST['wpsg_action']))
-			{
-				
-				if ($_REQUEST['wpsg_action'] == '-1')
-				{
-					$this->addBackendError(__('Bitte eine Aktion wÃ€hlen!', 'wpsg'));
-				}
-				else if (!isset($_REQUEST['wpsg_multido']) || !is_array($_REQUEST['wpsg_multido']))
-				{
-					$this->addBackendError(__('Bitte mindestens eine Bestellung auswÃ€hlen!', 'wpsg'));
-				}
-				else 
-				{
-					
+
 					if ($_REQUEST['wpsg_action'] == 'multiDelete')
 					{
-						
+
+						$arOrderID = $this->db->fetchAssocField("SELECT `id` FROM `".WPSG_TBL_ORDER."` WHERE `id` IN (".wpsg_q(implode(',', array_keys($_REQUEST['wpsg_multido']))).") ");
+						$arOrder = wpsg_order::getInstance($arOrderID);
+
+						foreach ($arOrder as $oOrder) { $oOrder->delete(); }
+
+						$this->shop->addBackendError(wpsg_translate(__('#1# Bestellung(en) gelÃ¶scht.', 'wpsg'), sizeof($arOrder)));
+
+					}
+					else if ($_REQUEST['wpsg_action'] == 'writeRechnung')
+					{
+
+						$nWriteRechnung = 0;
+
+						// E-Mail an Kunden senden
+						$_REQUEST['wpsg_rechnungen_sendmail'] = '1';
+
+						// Rechnungsdatum
+						$_REQUEST['wpsg_rechnungen_datum'] = date('d.m.Y');
+
+						// Status setzen
+						$_REQUEST['wpsg_rechnungen_status'] = '1';
+
+						// Neuer Status
+						$_REQUEST['wpsg_rechnungen_status_neu'] = '110';
+
+						// FuÃtext
+						if ($this->shop->get_option('wpsg_rechnungen_foottext_standard') !== false)
+						{
+
+							$wpsg_rechnungen_footer = $this->get_option("wpsg_rechnungen_footer");
+ 							if (!is_array($wpsg_rechnungen_footer)) $wpsg_rechnungen_footer = unserialize($this->get_option("wpsg_rechnungen_footer"));
+							if (!is_array($wpsg_rechnungen_footer)) $wpsg_rechnungen_footer = Array();
+
+							$_REQUEST['wpsg_rechnungen_fusstext'] = wpsg_getStr($wpsg_rechnungen_footer[$this->shop->get_option('wpsg_rechnungen_foottext_standard')][1]);
+
+						}
+						else
+						{
+
+							$_REQUEST['wpsg_rechnungen_fusstext'] = '';
+
+						}
+
+						// URL Benachrichtigung
+						$_REQUEST['wpsg_rechnungen_url'] = '0';
+
+						// FÃ€lligkeit anzeigen
+						$_REQUEST['wpsg_rechnungen_faelligkeit'] = '1';
+
+						$arIDs = array();
+
 						// Sortieren nach CDDATE
 						$arIDs_write = $this->db->fetchAssocField("SELECT `id` FROM `".WPSG_TBL_ORDER."` WHERE `id` IN (".wpsg_q(implode(',', array_keys($_REQUEST['wpsg_multido']))).") ORDER BY `cdate` ASC");
-						
+
 						// Rechnung fÃŒr mehrere Bestellungen schreiben
 						foreach ($arIDs_write as $k)
 						{
-							
-							$this->shop->delOrder($k);
-							
+
+							$bRechnungExists = $this->db->fetchOne("SELECT COUNT(*) FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `rnr` != '' AND `o_id` = '".wpsg_q($k)."' AND `storno` = '0000-00-00 00:00:00'");
+
+							// E-Mail aus Bestellung
+							$_REQUEST['wpsg_rechnungen_email'] = $this->db->fetchOne("SELECT K.`email` FROM `".WPSG_TBL_ORDER."` AS O LEFT JOIN `".WPSG_TBL_KU."` AS K ON (O.`k_id` = K.`id`) WHERE O.`id` = '".wpsg_q($k)."'");
+
+							if ($bRechnungExists <= 0)
+							{
+
+								$this->shop->callMod('wpsg_mod_rechnungen', 'writeRechnung', array($k, false, false));
+								$arIDs[] = $k;
+								$nWriteRechnung ++;
+
+							}
+
 						}
-						
-						$this->shop->addBackendError(wpsg_translate(__('#1# Bestellung(en) gelÃ¶scht.', 'wpsg'), sizeof($arIDs_write)));
-						
-					}
-					else if ($_REQUEST['wpsg_action'] == 'writeRechnung')
-					{
-						
-						$nWriteRechnung = 0;
-						
-						// E-Mail an Kunden senden
-						$_REQUEST['wpsg_rechnungen_sendmail'] = '1';
-						
-						// Rechnungsdatum
-						$_REQUEST['wpsg_rechnungen_datum'] = date('d.m.Y');
-						
-						// Status setzen
-						$_REQUEST['wpsg_rechnungen_status'] = '1';
-						
-						// Neuer Status 
-						$_REQUEST['wpsg_rechnungen_status_neu'] = '110';
-						
-						// FuÃtext
-						if ($this->shop->get_option('wpsg_rechnungen_foottext_standard') !== false)
+
+						if ($nWriteRechnung <= 0)
 						{
-							
-							$wpsg_rechnungen_footer = $this->get_option("wpsg_rechnungen_footer");
- 							if (!is_array($wpsg_rechnungen_footer)) $wpsg_rechnungen_footer = unserialize($this->get_option("wpsg_rechnungen_footer"));
-							if (!is_array($wpsg_rechnungen_footer)) $wpsg_rechnungen_footer = Array();
-							
-							$_REQUEST['wpsg_rechnungen_fusstext'] = $wpsg_rechnungen_footer[$this->shop->get_option('wpsg_rechnungen_foottext_standard')][1];
+
+							$this->addBackendError(__('FÃŒr die gewÃ€hlten Bestellungen konnten keine Rechnungen geschrieben werden, bestehende Rechnungen mÃŒssen erst storniert werden.', 'wpsg'));
 
 						}
 						else
 						{
-							
-							$_REQUEST['wpsg_rechnungen_fusstext'] = '';
-							
-						}
-												
-						// URL Benachrichtigung
-						$_REQUEST['wpsg_rechnungen_url'] = '0';
-						
-						// FÃ€lligkeit anzeigen
-						$_REQUEST['wpsg_rechnungen_faelligkeit'] = '1';
-						
-						$arIDs = array();
-						
-						// Sortieren nach CDDATE
-						$arIDs_write = $this->db->fetchAssocField("SELECT `id` FROM `".WPSG_TBL_ORDER."` WHERE `id` IN (".wpsg_q(implode(',', array_keys($_REQUEST['wpsg_multido']))).") ORDER BY `cdate` ASC");
-						
-						// Rechnung fÃŒr mehrere Bestellungen schreiben
-						foreach ($arIDs_write as $k)
-						{
-
-							$bRechnungExists = $this->db->fetchOne("SELECT COUNT(*) FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `rnr` != '' AND `o_id` = '".wpsg_q($k)."' AND `storno` = '0000-00-00 00:00:00'");
-
-							// E-Mail aus Bestellung
-							$_REQUEST['wpsg_rechnungen_email'] = $this->db->fetchOne("SELECT K.`email` FROM `".WPSG_TBL_ORDER."` AS O LEFT JOIN `".WPSG_TBL_KU."` AS K ON (O.`k_id` = K.`id`) WHERE O.`id` = '".wpsg_q($k)."'");
-							
-							if ($bRechnungExists <= 0)
-							{
-							
-								$this->shop->callMod('wpsg_mod_rechnungen', 'writeRechnung', array($k, false, false));
-								$arIDs[] = $k;
-								$nWriteRechnung ++;
-								
-							}
-														
-						}
-						
-						if ($nWriteRechnung <= 0)
-						{
-							
-							$this->addBackendError(__('FÃŒr die gewÃ€hlten Bestellungen konnten keine Rechnungen geschrieben werden, bestehende Rechnungen mÃŒssen erst storniert werden.', 'wpsg'));
-							
-						}
-						else 
-						{
-							
+
 							$this->addBackendMessage(
 								'nohspc_'.
@@ -845,70 +527,28 @@
 								' <a href="'.WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&noheader=1&do=writeMultiRechnung&ids='.implode('_', $arIDs).'" target="_new">'.__('Download', 'wpsg').'</a>'
 							);
-							
+
 						}
-						
+
 					}
 					else if (is_numeric($_REQUEST['wpsg_action']))
 					{
-						
-						// Status setzen						
+
+						// Status setzen
 						foreach ($_REQUEST['wpsg_multido'] as $k => $v)
 						{
-							
+
 							$this->shop->setOrderStatus($k, $_REQUEST['wpsg_action'], false);
-							
+
 						}
-						
+
 						$this->addBackendMessage(wpsg_translate(__('Status von #1# Bestellungen aktualisiert (Kunden wurden nicht benachrichtigt)', 'wpsg'), sizeof($_REQUEST['wpsg_multido'])));
-						
+
 					}
-										
+
 				}
-				
-				$requestString = http_build_query(array("filter" => $_REQUEST['filter']), null, '&');					
-				if ($_REQUEST['seite'] > 0) $requestString .= "&seite=".$_REQUEST['seite'];
-				
-				$this->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order'.$requestString);
-				
-			}
-			
-			foreach ($this->shop->view['data'] as $k => $v)
-			{
-				
-				$basket = new wpsg_basket();
-				$basket->initFromDB($v['id'], true);
-				$this->shop->view['data'][$k]['basket'] = $basket->toArray(true);
-
-				// Bestellobjekt
-				$this->shop->view['data'][$k]['oOrder'] = wpsg_order::getInstance($v['id']);
-				
-				if ($v['shipping_land'] > 0) $this->shop->view['data'][$k]['land_krzl'] = $this->db->fetchOne("SELECT L.`kuerzel` FROM `".WPSG_TBL_LAND."` AS L WHERE L.`id` = '".wpsg_q($v['shipping_land'])."' ");
-				else if ($v['land'] > 0) $this->shop->view['data'][$k]['land_krzl'] = $this->db->fetchOne("SELECT L.`kuerzel` FROM `".WPSG_TBL_LAND."` AS L WHERE L.`id` = '".wpsg_q($v['land'])."' ");
-				else $this->shop->view['data'][$k]['land_krzl'] = '12';
-				
-			}
-			
-			$this->shop->view['years'] = $this->db->fetchAssocField("SELECT DISTINCT DATE_FORMAT(`cdate`, '%Y') FROM `".WPSG_TBL_ORDER."`");
-									
-			if ($this->shop->hasMod('wpsg_mod_rechnungen'))
-			{
-				
-				$this->shop->view['invoice_years'] = $this->db->fetchAssocField("SELECT DISTINCT DATE_FORMAT(`datum`, '%Y') FROM `".WPSG_TBL_RECHNUNGEN."` WHERE `storno` = '0000-00-00' AND `gnr` = '' ");
-				
-			}
-			
-			if (isset($_REQUEST['submit_export']) && $_REQUEST['submit_export'] == '1')
-			{
-				
-				$this->shop->callMod('wpsg_mod_export', 'handleExport');
-				
-			}
-			else
-			{
-				
-				$this->shop->render(WPSG_PATH_VIEW.'/order/index.phtml');
-			
-			}
-			*/
+
+				$this->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order');
+
+			}
 
 			$nPerPage = $this->get_option('wpsg_order_perpage');
@@ -920,13 +560,19 @@
 			$this->shop->view['arFilter'] = array(
 				'order' => 'cdate',
-				'ascdesc' => 'DESC'
+				'ascdesc' => 'ASC',
+				'status' => '0',
+				'page' => '1'
 			);
-			
+
 			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'];
 
 			foreach ($this->shop->arStatus as $status_key => $status_label)
 			{
 
-				$count = wpsg_order::count(array('status' => $status_key));
+				$arFilterState = $this->shop->view['arFilter'];
+				$arFilterState['status'] = $status_key;
+
+				$count = wpsg_order::count($arFilterState);
 
 				if (wpsg_isSizedInt($count)) $this->shop->view['arStatus'][$status_key] = array('label' => $status_label, 'count' => $count);
@@ -934,10 +580,25 @@
 			}
 
-			$this->shop->view['countAll'] = wpsg_order::count(array());
-
-			$this->shop->view['seite'] = 1;
+			$arFilterState = $this->shop->view['arFilter'];
+			$arFilterState['NOTstatus'] = wpsg_ShopController::STATUS_UNVOLLSTAENDIG;
+
+			$this->shop->view['arStatus'] = wpsg_array_merge(array('-1' => array('label' => __('Alle', 'wpsg'), 'count' => wpsg_Order::count($arFilterState))), $this->shop->view['arStatus']);
+
+			$this->shop->view['countAll'] = wpsg_order::count($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 ($this->shop->view['seite'] <= 0 || $this->shop->view['seite'] > $this->shop->view['pages']) $this->shop->view['seite'] = 1;
-
+			if ($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::find($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.'/order/index.phtml');
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 5673)
+++ /controller/wpsg_ShopController.class.php	(revision 5674)
@@ -3213,16 +3213,5 @@
 			
 		} // public function wp_foot()
-		
-		/**
-		 * LÃ¶scht eine einzellne Bestellung und  alle AbhÃ€ngigkeiten
-		 */
-		public function delOrder($order_id)
-		{
-			
-			$oOrder = wpsg_order::getInstance($order_id);
-			$oOrder->delete();
-									
-		} // public function delOrder()
-		
+		 		
 		/**
 		 * Verteilt den Wert $value auf die MwSt SÃ€tze in $arBasket
@@ -3656,5 +3645,5 @@
 			{
 				
-				return __($this->arShipping[$this->view['basket']['checkout']['shipping']]['sub'][$shipping_key]['name'], 'wpsg');
+				return wpsg_translate(__('Deaktivierte Versandart (#1#)', 'wpsg'), $shipping_key);
 				
 			}
Index: /controller/wpsg_SystemController.class.php
===================================================================
--- /controller/wpsg_SystemController.class.php	(revision 5673)
+++ /controller/wpsg_SystemController.class.php	(revision 5674)
@@ -202,5 +202,5 @@
 			
 			// Wenn schon drin, dann nichts machen
-			if (array_key_exists($message_key, (array)$_SESSION['wpsg']['backendError'])) return;
+			if (@array_key_exists($message_key, (array)$_SESSION['wpsg']['backendError'])) return;
 			
 			if (wpsg_isSizedString($hideLinkKey) && $addBlendOut === true)
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 5673)
+++ /lib/functions.inc.php	(revision 5674)
@@ -1009,5 +1009,5 @@
 	{
 		
-		if (!isset($value) || !wpsg_isSizedString($value)) return $default;
+		if (!isset($value) || !wpsg_isSizedString($value)) return strval($default);
 		
 		return $value;		
Index: /model/wpsg_customer.class.php
===================================================================
--- /model/wpsg_customer.class.php	(revision 5673)
+++ /model/wpsg_customer.class.php	(revision 5674)
@@ -20,5 +20,12 @@
 			
 		} // public function load($id)
-		
+
+		public function getTitle()
+		{
+
+			return $this->title;
+
+		} // public function getTitle()
+
 		/**
 		 * Gibt das Geschlecht des Kunden zurÃŒck
Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 5673)
+++ /model/wpsg_order.class.php	(revision 5674)
@@ -7,7 +7,7 @@
 	{
 
-		var $customer = false; // Kundenobjekt 
-		var $bShippingAdress = false; // Wenn true, dann gibt es eine separate Versandadresse 
-						
+		var $customer = false; // Kundenobjekt
+		var $bShippingAdress = false;
+
 		/* Klassenvariablen */
 		var $_innerEu = null;
@@ -112,40 +112,5 @@
 			
 		} // public function getMeta($meta_key)
-		
-		/**
-		 * Gibt den Namen der Versandart zurÃŒck
-		 * Ist wichtig geworden, da die Versandart aus mehreren Versandarten zusammengesetzt sein kann
-		 * Die Methode getShippingName im ShopController funktioniert nur fÃŒr die Session wenn in arShipping 
-		 * schon die zusammengesetzt Versandart drin ist. Die Ãbersetzung ÃŒbernimmt aber die getShippingName im ShopController
-		 */
-		public function getShippingTypName()
-		{
-
-			if (preg_match('/(.*)-(.*)/', $this->type_shipping))
-			{
-				
-				// Versandart ist zusammengesetzt
-				$arShippingKey = explode('-', $this->type_shipping);
-				$arShippingNames = array();
-				
-				foreach ($arShippingKey as $shipping_key)
-				{
-
-					$arShippingNames[] = $this->shop->getShippingName($shipping_key);
-					
-				}
-				
-				return implode(' + ', $arShippingNames);
-				
-			}
-			else
-			{
-				
-				return $this->shop->getShippingName($this->type_shipping);
-				
-			}
-			
-		} // public function getShippingTypName()
-		
+
 		public function getPaymentTaxAmount()
 		{
@@ -336,5 +301,58 @@
 			
 		} // public function getPaymentID()
-		
+
+		/**
+		 * @return String Name der verwendeten Zahlungsart
+		 */
+		public function getPaymentLabel()
+		{
+
+			if (!array_key_exists($this->getPaymentID(), $this->shop->arPayment)) return wpsg_translate(__('Deaktivierte Zahlungsart (#1#)', 'wpsg'), $this->getPaymentID());
+			else return $this->shop->arPayment[$this->getPaymentID()]['name'];
+
+ 		} // public function getPaymentLabel()
+
+		/**
+		 * @return String Name der verwendeten Versandart
+		 */
+		public function getShippingLabel()
+		{
+
+			if (preg_match('/(.*)-(.*)/', $this->type_shipping))
+			{
+
+				// Versandart ist zusammengesetzt
+				$arShippingKey = explode('-', $this->type_shipping);
+				$arShippingNames = array();
+
+				foreach ($arShippingKey as $shipping_key)
+				{
+
+					$arShippingNames[] = $this->shop->getShippingName($shipping_key);
+
+				}
+
+				return implode(' + ', $arShippingNames);
+
+			}
+			else
+			{
+
+				return $this->shop->getShippingName($this->type_shipping);
+
+			}
+
+		} // public function getShippingLabel()
+
+		/**
+		 * @return String Key der verwendeten Versandart
+		 */
+		public function getShippingID()
+		{
+
+			return $this->data['type_shipping'];
+
+		} // public function getShippingID()
+
 		/**
 		 * Gibt einen Array mit ProduktKeys zurÃŒck, die in dieser Bestellung bestellt wurden
@@ -356,4 +374,14 @@
 		} // public function getProductKeys()
 
+		public function getInvoiceTitle()
+		{
+			
+			$invoice_title = $this->customer->getTitle();
+
+			if ($invoice_title == '-1') return '';
+			else return $invoice_title;
+			
+		}
+		
 		/**
 		 * Gibt das Geschlecht des RechnungsempfÃ€ngers zurÃŒck
@@ -474,5 +502,31 @@
 			
 		} // public function getInvoiceCountryName()
-		
+
+		/**
+		 * Gibt die Bezeichnung des Status der Bestellung zurÃŒck
+		 * @return String
+		 */
+		public function getStateLabel()
+		{
+
+			if (!array_key_exists($this->status, $this->shop->arStatus))
+			return wpsg_translate(__('Unbekannter Statuscode (#1#)', 'wpsg'), $this->status);
+			else return $this->shop->arStatus[$this->status];
+
+		} // public function getStateLabel()
+
+		/**
+		 * Gibt die Anrede der Versandadresse zurÃŒck
+		 */
+		public function getShippingTitle()
+		{
+			
+			$shipping_title = $this->shipping_title;
+
+			if ($shipping_title == '-1') return '';
+			else return $shipping_title;
+			
+		} // public function getShippingTitle() {
+
 		/**
 		 * Gibt das Geschlecht des EmpfÃ€ngers der Bestellung zurÃŒck
@@ -639,5 +693,7 @@
 			
 		} // public function getShippingZip()
-		
+
+		public function getNr() { return $this->onr; }
+
 		/**
 		 * Gibt den Wohnort des EmpfÃ€ngers zurÃŒck
@@ -661,5 +717,10 @@
 			
 		} // public function getShippingCity()
-				
+
+		public function getInvoiceCountryID()
+		{
+
+		}
+
 		/**
 		 * Gibt das Lieferland der Bestellung zurÃŒck
@@ -778,5 +839,15 @@
 			
 		} // public function isInnerEu()
-		
+
+		/**
+		 * return Boolean true, wenn eine separate Versandadresse verwendet wurde
+		 */
+		public function hasShippingAdress()
+		{
+
+			return $this->bShippingAdress;
+
+		} // public function hasShippingAdress()
+
 		/**
 		 * Speichert die Bestelldaten in die Datenbank
@@ -820,5 +891,5 @@
 		{
 
-			list($strQueryWHERE, $strQueryJOIN, $strQueryHAVING) = self::getQueryString($arFilter);
+			list($strQuerySELECT, $strQueryWHERE, $strQueryJOIN, $strQueryHAVING, $strQueryORDER) = self::getQueryString($arFilter);
 
 			$strQuery = "
@@ -834,7 +905,10 @@
 						WHERE
 							1
-							".$strQueryWHERE."	
+							".$strQueryWHERE."
 						GROUP BY 
-							O.`id` 					
+							O.`id` 
+						HAVING
+							1
+							".$strQueryHAVING."											
 					) AS innerSelect
 			";
@@ -851,9 +925,14 @@
 		{
 			
-			list($strQueryWHERE, $strQueryJOIN, $strQueryHAVING) = self::getQueryString($arFilter);
-			
+			list($strQuerySELECT, $strQueryWHERE, $strQueryJOIN, $strQueryHAVING, $strQueryORDER) = self::getQueryString($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
@@ -861,10 +940,16 @@
 				WHERE
 					1
-					".$strQueryWHERE."	
+					".$strQueryWHERE."
 				GROUP BY 
 					O.`id`
+				HAVING
+					1
+					".$strQueryHAVING."
+				ORDER BY
+					".$strQueryORDER."
+				".$strLimit."
 			";
-			 
-			$arOrderID = $GLOBALS['wpsg_db']->fetchAssocField($strQuery);
+ 
+			$arOrderID = $GLOBALS['wpsg_db']->fetchAssocField($strQuery, "id", "id");
 
 			if ($load !== true) return $arOrderID;
@@ -887,13 +972,21 @@
 		{
 
+			$strQuerySELECT = "";
 			$strQueryWHERE = "";
 			$strQueryJOIN = "";
 			$strQueryHAVING = "";
+			$strQueryORDER = "";
 
 			$bJoinProducts = false;
+			$bJoinCustomer = false;
+			$bJoinInvoice = 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'])."' "; $bJoinProducts = 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['invoicedate_y']) && $arFilter['invoicedate_y'] != '-1') { $bJoinInvoice = true; $strQueryWHERE .= " AND YEAR(I.`datum`) = '".wpsg_q($arFilter['invoicedate_y'])."' "; }
+			if (wpsg_isSizedString($arFilter['invoicedate_m']) && $arFilter['invoicedate_m'] != '-1') { $bJoinInvoice = true; $strQueryWHERE .= " AND MONTH(I.`datum`) = '".wpsg_q(ltrim($arFilter['invoicedate_m'], '0'))."' "; }
 			if (wpsg_isSizedString($arFilter['s']))
 			{
@@ -910,37 +1003,110 @@
 				";
 
+				$bJoinCustomer = true;
+
+			}
+
+			if (wpsg_isSizedInt($arFilter['status']) || $arFilter['status'] == '0')
+			{
+
+				$strQueryWHERE .= " AND O.`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(C.`vname`, ' ', C.`name`) "; $bJoinCustomer = 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'))
+			{
+
 				$bJoinProducts = true;
-
-			}
-
-			if (wpsg_isSizedInt($arFilter['status']))
-			{
-
-				$strQueryWHERE .= " AND O.`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'])).") ";
-
-			}
-
+				$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 ($bJoinProducts === true) $strQueryJOIN = " LEFT JOIN `".WPSG_TBL_ORDERPRODUCT."` AS OP ON (O.`id` = OP.`o_id`) ";
-
-			return array($strQueryWHERE, $strQueryJOIN, $strQueryHAVING);
+			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` != '') ";
+
+			return array($strQuerySELECT, $strQueryWHERE, $strQueryJOIN, $strQueryHAVING, $strQueryORDER);
 
 		}
Index: /model/wpsg_order_product.class.php
===================================================================
--- /model/wpsg_order_product.class.php	(revision 5673)
+++ /model/wpsg_order_product.class.php	(revision 5674)
@@ -111,15 +111,18 @@
 		public function getProductId()
 		{
-			
-			if (wpsg_isSizedString($this->mod_vp_varkey))
+
+			$mod_vp_varkey = $this->mod_vp_varkey;
+			$productkey = $this->productkey;
+
+			if (wpsg_isSizedString($mod_vp_varkey))
 			{
 				
-				return $this->shop->getProduktID($this->mod_vp_varkey);
+				return $this->shop->getProduktID($mod_vp_varkey);
 				
 			}
-			else if (wpsg_isSizedString($this->productkey))
+			else if (wpsg_isSizedString($productkey))
 			{
 				
-				return $this->shop->getProduktID($this->productkey);
+				return $this->shop->getProduktID($productkey);
 				
 			}
Index: /mods/wpsg_mod_crefopay.class.php
===================================================================
--- /mods/wpsg_mod_crefopay.class.php	(revision 5673)
+++ /mods/wpsg_mod_crefopay.class.php	(revision 5674)
@@ -1055,5 +1055,5 @@
 				'couponAbsolute' => '', // Coupon amount - Amount in smallest possible denomination e.g. 12366 ct; Amounts have always to be including all applicable taxes
 				'riskclassOverall' => (($this->shop->get_option('wpsg_mod_crefopay_riskclass') !== false)?$this->shop->get_option('wpsg_mod_crefopay_riskclass'):1),							
-				'shippingText' => $oOrder->getShippingTypName(), // Shipping option selected by the end user, e.g. âStandard deliveryâ
+				'shippingText' => $oOrder->getShippingLabel(), // Shipping option selected by the end user, e.g. âStandard deliveryâ
 				'phoneNumber' => $oCustomer->tel, // Userâs phone number
 				'transactionType' => (($this->shop->get_option('wpsg_mod_crefopay_autocapture') === '1')?'DIRECT':'RETAIL'), // transaction type â even though this filed is mandatory omitting the field will use the default setting which is RETAIL
Index: /mods/wpsg_mod_shippingadress.class.php
===================================================================
--- /mods/wpsg_mod_shippingadress.class.php	(revision 5673)
+++ /mods/wpsg_mod_shippingadress.class.php	(revision 5674)
@@ -196,5 +196,5 @@
 												WHERE
 													`id` = '".wpsg_q($o_id)."'");
-	
+
 			if (wpsg_isSizedArray($arrAdrShipping))
 			{
@@ -202,6 +202,7 @@
 			}
 
-			if (wpsg_isSizedArray($arrDiff))
-			{
+			if (wpsg_isSizedArray($arrDiff) && implode('', $arrAdrShipping) != "")
+			{
+
 				return true;
 			}
Index: /views/admin/form/text.phtml
===================================================================
--- /views/admin/form/text.phtml	(revision 5673)
+++ /views/admin/form/text.phtml	(revision 5674)
@@ -5,5 +5,10 @@
 	<div class="col-sm-6 <?php echo wpsg_getStr($this->view['field_config']['class_content_wrap']); ?>">
 		<div class="wpsg_field_wrap">
+
+            <?php if (wpsg_isTrue($this->view['field_config']['noP'])) { ?>
+            <?php echo $this->view['field_value']; ?>
+            <?php } else { ?>
 			<p class="form-control-static" style="padding-left:0px;"><?php echo $this->view['field_value']; ?></p>
+            <?php } ?>
 				
 			<?php if (wpsg_isSizedString($this->view['field_config']['help'])) { ?>
Index: /views/css/admin.css
===================================================================
--- /views/css/admin.css	(revision 5673)
+++ /views/css/admin.css	(revision 5674)
@@ -32,4 +32,18 @@
 #wpsg-bs .list-group-head a { color:#FFFFFF; }
 #wpsg-bs .modal-dialog { width:70%; }
+#wpsg-bs .table-bordered thead { background-color:#FFFFFF; }
+
+/* Allgemeine Klassen */
+.wpsg_grey { color:#999999; }
+
+/* Tabellensortierung */
+.wpsg-table-order .wpsg_order { position:relative; }
+.wpsg-table-order .wpsg_order:after { content:"\e150"; position:absolute; font-size:1em; font-weight:normal; bottom:8px; right:8px; display:block; font-family:'Glyphicons Halflings'; opacity:0.2; color:#337AB7; }
+.wpsg-table-order .wpsg_order:hover { cursor:pointer; }
+.wpsg-table-order .wpsg_order:hover:after { content:"\e155"; opacity:0.8; }
+.wpsg-table-order .wpsg_order.wpsg_order_asc:after { content:"\e155"; opacity:1; }
+.wpsg-table-order .wpsg_order.wpsg_order_desc:after { content:"\e156"; opacity:1; }
+.wpsg-table-order .wpsg_order.wpsg_order_asc:hover:after { content:"\e156"; }
+.wpsg-table-order .wpsg_order.wpsg_order_desc:hover:after { content:"\e155"; }
 
 /* Inline Edit */
@@ -103,10 +117,14 @@
 
 /* Bestellverwaltung */
-.wpsg_order .wpsg_status_link_wrap ul li { list-style:none; float:left; }
-.wpsg_order .wpsg_status_link_wrap ul li:after { content:" | "; width:15px; text-align:center; display:inline-block; }
-.wpsg_order .wpsg_status_link_wrap ul li:last-child:after { content:""; width:auto; }
-.wpsg_order .wpsg-filter { max-width:800px; margin-left:0px; }
+.wpsg_order .wpsg_status_link_wrap { min-height:50px; float:left; display:inline-block; }
+.wpsg_order .col_checkbox { width:20px; }
+.wpsg_order .col_checkbox input { margin-top:-2px; }
+.wpsg_order .col_nr { width:200px; }
+.wpsg_order .col_nr .actions a { font-size:0.9em; }
+.wpsg_order .col_nr .glyphicon { margin-top:5px; font-size:1.2em; margin-right:5px; text-decoration:none; }
+.wpsg_order .col_nr .glyphicon.shippingadress { color:red; }
+.wpsg_order .col_nr .glyphicon.admincomment { color:red; }
 
-    /* Modulverwaltung */
+/* Modulverwaltung */
 .wpsg_admin_submenu .list-group-item.modul_akt { color:#3c763d; font-weight:bold; }
 .wpsg_admin_submenu .list-group-item.modul_akt .glyphicon { position:absolute; right:5px; top:5px; color:#3c763d; }
Index: /views/js/admin.js
===================================================================
--- /views/js/admin.js	(revision 5673)
+++ /views/js/admin.js	(revision 5674)
@@ -149,5 +149,20 @@
 
 	jQuery(document).ready(function() {
-		 
+
+        // Sortierung
+        jQuery('th.wpsg_order').bind('click', function() {
+
+            var direction = "ASC";
+            if (jQuery(this).hasClass('wpsg_order_asc') && jQuery('#wpsg_order').val() == jQuery(this).attr("data-order")) direction = "DESC";
+
+            jQuery('#wpsg_ascdesc').val(direction);
+            jQuery('#wpsg_order').val(jQuery(this).attr("data-order"));
+
+            jQuery('#filter_form').submit();
+
+		    return false;
+
+        } );
+
 		// Hilfe Tooltips
 		jQuery('*[data-wpsg-tip]').bind('click', function() { 
Index: /views/mods/mod_rechnungen/rechnung_pdf.phtml
===================================================================
--- /views/mods/mod_rechnungen/rechnung_pdf.phtml	(revision 5673)
+++ /views/mods/mod_rechnungen/rechnung_pdf.phtml	(revision 5674)
@@ -450,5 +450,5 @@
 
 		$pdf->setXY($prod_left + 10, $prod_top + $offset);
-		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingTypName()), 1, 0, 'L');
+		$pdf->Cell( ((sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')?87:102), 8, wpsg_translate(__('Versandkosten "#1#"', 'wpsg'), $this->view['oOrder']->getShippingLabel()), 1, 0, 'L');
 		
 		if (sizeof($this->view['basket']['mwst']) >= 1 || $this->get_option('wpsg_showMwstAlways') == '1')
Index: /views/order/index.phtml
===================================================================
--- /views/order/index.phtml	(revision 5673)
+++ /views/order/index.phtml	(revision 5674)
@@ -20,8 +20,5 @@
 				</ul>
 				<ul class="nav navbar-nav navbar-right">
-					<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'import'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=import&noheader=1"><span class="glyphicon glyphicon-import"></span><?php echo __("Import", "wpsg"); ?></a></li>
-					<?php if (wpsg_isSizedArray($this->view['data'])) { ?>
-						<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'export'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=export&noheader=1"><span class="glyphicon glyphicon-export"></span><?php echo __("Export", "wpsg"); ?></a></li>
-					<?php } ?>
+
 				</ul>
 			</div>
@@ -29,31 +26,57 @@
 		<div class="wpsg-filter container-fluid form-horizontal" style="display:<?php echo (($this->view['hasFilter'] === true)?'block':'none'); ?>;">
 			<div class="row">
-				<div class="col-lg-12">
+				<div class="col-lg-4">
 					<form method="post" id="filter_form">
 
-						<input id="wpsg_seite" type="text" name="seite" value="<?php echo $this->view['seite']; ?>" class="current-page" />
-						<input id="wpsg_order" type="text" name="filter[order]" value="<?php echo $this->view['arFilter']['order']; ?>" />
-						<input id="wpsg_ascdesc" type="text" name="filter[ascdesc]" value="<?php echo $this->view['arFilter']['ascdesc']; ?>" />
-
-						<div class="container-fluid">
-							<div class="row">
-								<div class="col-lg-6">
-									<?php echo wpsg_drawForm_Input('filter[s]', __('Suchfeld', 'wpsg'), wpsg_getStr($_REQUEST['s'])); ?>
-								</div>
-								<div class="col-lg-6">
-									<?php echo wpsg_drawForm_Select('filter[status]', __('Bestellstatus', 'wpsg'), $this->arStatus, wpsg_getStr($_REQUEST['s'])); ?>
-								</div>
-							</div>
-						</div>
-
-						<div class="container-fluid">
-							<div class="row">
-								<div class="col-lg-6">
-								</div>
-								<div class="col-lg-6">
-									<?php echo wpsg_drawForm_SubmitButton(__('Bestellungen suchen')); ?>
-								</div>
-							</div>
-						</div>
+						<input id="wpsg_seite" type="hidden" name="seite" value="<?php echo $this->view['arFilter']['page']; ?>" class="current-page" />
+						<input id="wpsg_order" type="hidden" name="filter[order]" value="<?php echo $this->view['arFilter']['order']; ?>" />
+						<input id="wpsg_ascdesc" type="hidden" name="filter[ascdesc]" value="<?php echo $this->view['arFilter']['ascdesc']; ?>" />
+
+						<?php echo wpsg_drawForm_Input('filter[s]', __('Suchfeld', 'wpsg'), wpsg_getStr($this->view['arFilter']['s'])); ?>
+						<?php echo wpsg_drawForm_Select('filter[status]', __('Bestellstatus', 'wpsg'), wpsg_array_merge(array('-1' => __('Alle', 'wpsg')), $this->arStatus), $this->view['arFilter']['status']); ?>
+
+                        <?php echo wpsg_drawForm_TextStart(); ?>
+                        <div class="row">
+                            <div class="col-lg-6">
+                                <select name="filter[cdate_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>
+                                    <?php } ?>
+                                </select>
+                            </div>
+                            <div class="col-lg-6">
+                                <select name="filter[cdate_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 } ?>
+                                </select>
+                            </div>
+                        </div>
+                        <?php echo wpsg_drawForm_TextEnd(__('Bestelldatum (Monat/Jahr)', 'wpsg'), array('noP' => true)); ?>
+
+                        <?php echo wpsg_drawForm_TextStart(); ?>
+                        <div class="row">
+                            <div class="col-lg-6">
+                                <select name="filter[invoicedate_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']['invoicedate_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[invoicedate_y]" class="form-control input-sm">
+                                    <option value="-1"><?php echo __("Alle", "wpsg"); ?></option>
+                                    <?php foreach ($this->view['invoicedate_years'] as $y) { ?>
+                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['invoicedate_y']) == $y)?'selected="selected"':''); ?> value="<?php echo $y; ?>"><?php echo $y; ?></option>
+                                    <?php } ?>
+                                </select>
+                            </div>
+                        </div>
+                        <?php echo wpsg_drawForm_TextEnd(__('Rechnungsdatum (Monat/Jahr)', 'wpsg'), array('noP' => true)); ?>
+
+    					<br /><?php echo wpsg_drawForm_SubmitButton(__('Bestellungen suchen')); ?><br />
 
 					</form>
@@ -63,10 +86,9 @@
 	</nav>
 
-	<?php if ($this->view['pages'] > 1) { ?>
-	<div class="wpsg_status_link_wrap">
-
-		<ul>
+	<div class="pagination_wrap wpsg_status_link_wrap">
+
+		<ul class="pagination">
 			<?php foreach ($this->view['arStatus'] as $status_key => $status_info) { ?>
-			<li><a href="#"><?php echo wpsg_translate(__('#1# (#2#)', 'wpsg'), $status_info['label'], $status_info['count']); ?></a></li>
+			<li class="<?php echo ((wpsg_getStr($this->view['arFilter']['status']) == $status_key)?'active':''); ?>"><a href="#" onclick="return wpsg_setFilterStatus('<?php echo $status_key; ?>');"><?php echo wpsg_translate(__('#1# <span>(#2#)<span>', 'wpsg'), $status_info['label'], $status_info['count']); ?></a></li>
 			<?php } ?>
 		</ul>
@@ -74,14 +96,15 @@
 	</div>
 
+	<?php if ($this->view['pages'] > 1) { ?>
 	<nav class="pagination_wrap">
 		<ul class="pagination">
-			<?php if ($this->view['seite'] > 1) { ?>
-				<li><a onclick="return goPage(<?php echo $this->view['seite'] - 1; ?>);" href="#" aria-label="<?php echo __('Vorherige Seite'); ?>"><span aria-hidden="true">&laquo;</span></a></li>
+			<?php if ($this->view['arFilter']['page'] > 1) { ?>
+				<li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] - 1; ?>);" href="#" aria-label="<?php echo __('Vorherige Seite'); ?>"><span aria-hidden="true">&laquo;</span></a></li>
 			<?php } ?>
 			<?php for ($i = 1; $i <= $this->view['pages']; $i ++) { ?>
-				<li class="<?php echo (($i == $this->view['seite'])?'active':''); ?>"><a onclick="return goPage(<?php echo $i; ?>);" href="#"><?php echo $i; ?></a></li>
+				<li class="<?php echo (($i == $this->view['arFilter']['page'])?'active':''); ?>"><a onclick="return goPage(<?php echo $i; ?>);" href="#"><?php echo $i; ?></a></li>
 			<?php } ?>
-			<?php if ($this->view['seite'] + 1 <= $this->view['pages']) { ?>
-				<li><a onclick="return goPage(<?php echo $this->view['seite'] + 1; ?>);" href="#" aria-label="<?php echo __('NÃ€chste Seite'); ?>"><span aria-hidden="true">&raquo;</span></a></li>
+			<?php if ($this->view['arFilter']['page'] + 1 <= $this->view['pages']) { ?>
+				<li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] + 1; ?>);" href="#" aria-label="<?php echo __('NÃ€chste Seite'); ?>"><span aria-hidden="true">&raquo;</span></a></li>
 			<?php } ?>
 		</ul>
@@ -89,9 +112,183 @@
 	<?php } ?>
 
+	<div class="wpsg_clear"></div>
+
 	<?php echo $this->writeBackendMessage(); ?>
 
+    <?php $this->callMods('produkt_index_head'); ?>
+    <?php $this->callMods('produkt_index_aftersearch'); ?>
+
 	<div class="content">
 
-		<?php if (is_array($this->view['data']) && sizeof($this->view['data']) > 0) { ?>
+		<?php if (is_array($this->view['arData']) && sizeof($this->view['arData']) > 0) { ?>
+
+        <form method="post" action="<?php echo WPSG_URL_WP ?>wp-admin/admin.php?page=wpsg-Order&noheader=1">
+
+            <table class="table table-bordered table-hover table-striped wpsg-table-order">
+                <thead>
+                    <tr>
+                        <th class="col_checkbox"><input type="checkbox" onclick="return wpsg_order_checkAll();" /></th>
+                        <th class="col_nr wpsg_order" data-order="cdate"><?php echo __('Nr', 'wpsg'); ?></th>
+                        <th class="col_customer wpsg_order" data-order="customer"><?php echo __('Kunde', 'wpsg'); ?></th>
+                        <th class="col_payment wpsg_order" data-order="payment"><?php echo __('Bezahlmethode', 'wpsg'); ?></th>
+                        <th class="col_shipping wpsg_order" data-order="shipping"><?php echo __('Versandart', 'wpsg'); ?></th>
+                        <th class="col_products wpsg_order" data-order="products"><?php echo __('Produkte', 'wpsg'); ?></th>
+                        <th class="col_sum wpsg_order" data-order="amount"><?php echo __('Bestellwert', 'wpsg'); ?></th>
+                        <th class="col_state wpsg_order" data-order="state"><?php echo __('Status', 'wpsg'); ?></th>
+                    </tr>
+                </thead>
+                <tbody>
+                    <?php foreach ($this->view['arData'] as $oOrder) { ?>
+                    <tr>
+                        <td class="col_checkbox">
+
+                            <input class="col_set_checkbox" name="wpsg_multido[<?php echo $oOrder->id; ?>]" type="checkbox" />
+
+                        </td>
+                        <td class="col_nr">
+
+                            <?php echo $oOrder->getNr(); ?> <span class="wpsg_grey"><?php echo wpsg_formatTimestamp(strtotime($oOrder->cdate), false); ?></span><br />
+
+                            <div class="actions">
+                                <span class="view"><a title="<?php echo __("Diese Bestellung 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 Bestellung stornieren mÃ¶chten?', 'wpsg'); ?>');" title="<?php echo __("Diese Bestellung 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 __("Stornieren", "wpsg"); ?></a></span>
+                                |
+                                <span class="delete"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie diese Bestellung lÃ¶schen mÃ¶chten?', 'wpsg'); ?>');" title="<?php echo __('Diese Bestellung 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 if (trim($oOrder->admincomment) != "") { ?>
+                            <a title="<?php echo __("Kommentar (Admin): ", "wpsg").htmlspecialchars($oOrder->admincomment); ?>" onclick="return false;" class="glyphicon glyphicon-info-sign admincomment" href="#"></a>
+                            <?php } ?>
+
+                            <?php if (trim($oOrder->comment) != "") { ?>
+                            <a title="<?php echo __("Kommentar (Kunde): ", "wpsg").htmlspecialchars($oOrder->comment); ?>" onclick="return false;" class="glyphicon glyphicon-info-sign customercomment" href="#"></a>
+                            <?php } ?>
+
+                            <?php if ($oOrder->hasShippingAdress()) { ?>
+                            <a title="<?php echo __("Lieferadresse beachten", "wpsg"); ?>" onclick="return false;" class="glyphicon glyphicon-map-marker shippingadress" href="#"></a>
+                            <?php } ?>
+
+                            <?php if ($this->hasMod('wpsg_mod_abo')) { ?>
+                                <?php if ($this->callMod('wpsg_mod_abo', 'isAboOrder', array($oOrder->id)) === 1) { ?>
+                                    <?php echo $this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id)) ?>
+                                <?php } else if ($this->callMod('wpsg_mod_abo', 'isAboOrder', array($oOrder->id)) === 2) { ?>
+                                    <?php
+
+                                        $origin_order_id = $this->callMod('wpsg_mod_abo', 'getOriginOrder', array($oOrder->id));
+                                        $origin_order_data = $this->cache->loadOrder($origin_order_id);
+
+                                    ?>
+                                    <?php echo $this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($origin_order_data['id'])) ?><br />
+                                    <?php echo wpsg_translate(__('VerlÃ€ngerung zu Bestellung <a href="#1#">#2#</a>', 'wpsg'), WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$origin_order_id, $origin_order_data['onr']); ?>
+                                <?php } ?>
+                            </td>
+                            <?php } ?>
+
+                        </td>
+                        <td class="col_customer">
+                            <?php $firma = $oOrder->getCustomer()->firma; if (wpsg_isSizedString($firma)) { ?>
+                            <?php echo $firma; ?><br />
+                            <?php } ?>
+                            <?php echo $oOrder->getInvoiceTitle(); ?> <?php echo $oOrder->getCustomer()->vname; ?> <?php echo $oOrder->getCustomer()->name; ?>
+                            <br />
+                            <span class="wpsg_grey"><?php echo $oOrder->getCustomer()->strasse; ?><br />
+                            <?php echo ltrim($oOrder->getCustomer()->plz.' '.$oOrder->getCustomer()->ort); ?> <?php echo $oOrder->getCustomer()->getCountryKuerzel(); ?>
+                            </span>
+                        </td>
+                        <td class="col_payment">
+
+                            <?php /* Bei Crefopay wird die Darstellung der Zahlungsart ÃŒber das Modul geregelt */ ?>
+                            <?php if ($oOrder->getPaymentID() == 4000 && $this->hasMod('wpsg_mod_crefopay')) { ?>
+                                <?php echo wpsg_hspc($this->callMod('wpsg_mod_crefopay', 'getOrderPaymentName', array($oOrder->id))); ?>
+                            <?php } else { ?>
+                                <?php echo $oOrder->getPaymentLabel(); ?>
+                            <?php } ?>
+
+                            <?php if ($oOrder->getPaymentAmount() > 0) { ?>
+                            &nbsp;-&nbsp;<?php echo wpsg_ff($oOrder->getPaymentAmount(), $this->get_option('wpsg_currency')); ?>
+                            <?php } ?>
+
+                        </td>
+                        <td class="col_shipping">
+
+                            <?php echo $oOrder->getShippingLabel(); ?>
+
+                            <?php if ($oOrder->getShippingAmount() > 0) { ?>
+                            &nbsp;-&nbsp;<?php echo wpsg_ff($oOrder->getShippingAmount(), $this->get_option('wpsg_currency')); ?>
+                            <?php } ?>
+
+                            <?php if ($oOrder->hasShippingAdress()) { ?>
+                                <br />
+                                <?php echo $oOrder->getShippingTitle(); ?><?php echo $oOrder->getShippingFirstName(); ?> <?php echo $oOrder->getShippingName(); ?><br />
+                                <span class="wpsg_grey">
+                                    <?php echo $oOrder->getShippingStreet(); ?>
+                                    <?php echo $oOrder->getShippingZip(); ?> <?php echo $oOrder->getShippingCity(); ?> <?php echo $oOrder->getShippingCountryKuerzel(); ?><br />
+                            </span
+                            <?php } ?>
+
+                        </td>
+                        <td class="col_products">
+
+                            <?php foreach ($oOrder->getOrderProducts() as $oOrderProduct) { ?>
+                            <?php echo wpsg_translate(__('#1# x <a href="#2#">#3#</a> fÃŒr je #4#', 'wpsg'),
+                                $oOrderProduct->getCount(),
+                                WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id='.$oOrderProduct->getProductId(),
+                                $oOrderProduct->getProduct()->getProductName(),
+                                wpsg_ff($oOrderProduct->getAmount(), $this->get_option('wpsg_currency'))
+                            ); ?><br />
+                            <?php } ?>
+
+                        </td>
+                        <td class="col_sum">
+                            <?php echo wpsg_ff($oOrder->getAmount(), $this->get_option('wpsg_currency')); ?>
+                        </td>
+                        <td class="col_state">
+                            <?php echo $oOrder->getStateLabel(); ?>
+                        </td>
+                    </tr>
+                    <?php } ?>
+                </tbody>
+            </table>
+
+            <div class="alignleft actions">
+
+                <select name="wpsg_action" id="wpsg_action">
+                    <option value="-1"><?php echo __('Aktion wÃ€hlen', 'wpsg'); ?></option>
+                    <?php foreach ($this->arStatus as $k => $status) { ?>
+                    <option value="<?php echo $k; ?>"><?php echo wpsg_translate(__('Status auf "#1#" setzen.', 'wpsg'), $status); ?></option>
+                    <?php } ?>
+                    <option value="multiDelete"><?php echo __('Bestellungen lÃ¶schen', 'wpsg'); ?></option>
+                    <?php if ($this->hasMod('wpsg_mod_rechnungen')) { ?>
+                    <option value="writeRechnung"><?php echo __('Rechnung schreiben', 'wpsg'); ?></option>
+                    <option value="showRechnung"><?php echo __('Rechnung ansehen', 'wpsg'); ?></option>
+                    <?php } ?>
+                </select>
+
+                <input onclick="if (jQuery('#wpsg_action').val() == 'multiDelete') { if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false; }" type="submit" value="<?php echo __('AusfÃŒhren', 'wpsg'); ?>" class="button-secondary action" id="doaction" name="wpsg_order_doaction" />
+
+            </div>
+
+            <?php if ($this->view['pages'] > 1) { ?>
+            <nav class="pagination_wrap">
+                <ul class="pagination">
+                    <?php if ($this->view['arFilter']['page'] > 1) { ?>
+                        <li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] - 1; ?>);" href="#" aria-label="<?php echo __('Vorherige Seite'); ?>"><span aria-hidden="true">&laquo;</span></a></li>
+                    <?php } ?>
+                    <?php for ($i = 1; $i <= $this->view['pages']; $i ++) { ?>
+                        <li class="<?php echo (($i == $this->view['arFilter']['page'])?'active':''); ?>"><a onclick="return goPage(<?php echo $i; ?>);" href="#"><?php echo $i; ?></a></li>
+                    <?php } ?>
+                    <?php if ($this->view['arFilter']['page'] + 1 <= $this->view['pages']) { ?>
+                        <li><a onclick="return goPage(<?php echo $this->view['arFilter']['page'] + 1; ?>);" href="#" aria-label="<?php echo __('NÃ€chste Seite'); ?>"><span aria-hidden="true">&raquo;</span></a></li>
+                    <?php } ?>
+                </ul>
+            </nav>
+            <?php } ?>
+
+            <div class="wpsg_clear"></div>
+
+            <?php $this->callMod('wpsg_mod_export', 'produkt_index_foot'); ?>
+
+        </form>
 
 		<?php } else { ?>
@@ -103,11 +300,31 @@
 <script type="text/javascript">/* <![CDATA[ */
 
-	var wpsg_order = '<?php echo wpsg_getStr($this->view['search']['order']); ?>';
-	var wpsg_ascdesc = '<?php echo wpsg_getStr($this->view['search']['ascdesc']); ?>';
+    <?php if (wpsg_isSizedString($this->view['arFilter']['order']) && wpsg_isSizedString($this->view['arFilter']['ascdesc'])) { ?>
+    jQuery('th[data-order="<?php echo $this->view['arFilter']['order']; ?>"]').addClass('wpsg_order_<?php echo strtolower($this->view['arFilter']['ascdesc']); ?>');
+    <?php } ?>
+
+    function wpsg_order_checkAll()
+    {
+
+        jQuery('.col_set_checkbox').each(function() { jQuery(this).prop('checked', !jQuery(this).prop('checked')); } );
+
+    }
+
+	function wpsg_setFilterStatus(state)
+	{
+
+		jQuery('#filterstatus').val(state);
+
+		jQuery('#seite').val(1);
+		jQuery('#filter_form').submit();
+
+		return false;
+
+	}
 
 	function goPage(page)
 	{
 
-		if (page <= 0 || page == <?php echo $this->view['seite']; ?> || page > <?php echo wpsg_getStr($this->view['pages'], '0'); ?>) return;
+		if (page <= 0 || page == <?php echo $this->view['arFilter']['page']; ?> || page > <?php echo wpsg_getStr($this->view['pages'], '0'); ?>) return;
 
 		jQuery('#wpsg_seite').val(page);
@@ -118,29 +335,3 @@
 	} // function goPage(page)
 
-	function wpsg_setOrder(order)
-	{
-
-		if (order == wpsg_order)
-		{
-
-			// Nur Richtung Ã€ndern
-			if (wpsg_ascdesc == 'asc') jQuery('#wpsg_ascdesc').val('desc');
-			else jQuery('#wpsg_ascdesc').val('asc');
-
-		}
-		else
-		{
-
-			jQuery('#wpsg_order').val(order);
-			jQuery('#wpsg_ascdesc').val('asc');
-
-		}
-
-		jQuery('#seite').val(1);
-		jQuery('#filter_form').submit();
-
-		return false;
-
-	} // function wpsg_setOrder(order)
-
 /* <![CDATA[ */</script>
Index: /views/order/view.phtml
===================================================================
--- /views/order/view.phtml	(revision 5673)
+++ /views/order/view.phtml	(revision 5674)
@@ -262,5 +262,5 @@
 							<div class="wpsg_form_right">
 								<p>					
-									<?php echo wpsg_hspc($this->view['oOrder']->getShippingTypName()); ?>
+									<?php echo wpsg_hspc($this->view['oOrder']->getShippingLabel()); ?>
 									<?php if (isset($this->view['basket']['sum']['preis_shipping']) && $this->view['basket']['sum']['preis_shipping'] > 0) { ?>
 									(<?php echo wpsg_ff($this->view['basket']['sum']['preis_shipping'], $this->get_option('wpsg_currency')); ?>)
Index: /views/produkt/index.phtml
===================================================================
--- /views/produkt/index.phtml	(revision 5673)
+++ /views/produkt/index.phtml	(revision 5674)
@@ -34,5 +34,6 @@
 					
 						<input id="wpsg_seite" type="hidden" name="seite" value="<?php echo $this->view['seite']; ?>" class="current-page" />
-						<input id="wpsg_order" type="hidden" name="search[order]" value="<?php echo $this->view['search']['order']; ?>" />
+
+                        <input id="wpsg_order" type="hidden" name="search[order]" value="<?php echo $this->view['search']['order']; ?>" />
 						<input id="wpsg_ascdesc" type="hidden" name="search[ascdesc]" value="<?php echo $this->view['search']['ascdesc']; ?>" />
 										
@@ -41,5 +42,5 @@
 						<?php echo $this->callMod('wpsg_mod_productgroups', 'produkt_index_filter'); ?>
 						
-						<?php echo wpsg_drawForm_SubmitButton(__('Produkte suchen')); ?>
+						<?php echo wpsg_drawForm_SubmitButton(__('Produkte suchen')); ?><br />
 						
 					</form>				
@@ -69,5 +70,5 @@
 	<div class="content">	
 		<?php if (is_array($this->view['data']) && sizeof($this->view['data']) > 0) { ?>
-		<table class="widefat post fixed">
+		<table class="table table-bordered table-hover table-striped wpsg-table-order">
 			<thead>
 				<tr>
@@ -75,44 +76,18 @@
 					<th class="manage-column column-title wpsg_pic_col"></th>
 					<?php } ?>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'name')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('name');">
-							<span><?php echo __("Name", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a>
-					</th>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'anr')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('anr');">
-							<span><?php echo __("Artikelnummer", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a> 
-					</th>	
+                    <th class="wpsg_order" data-order="name"><?php echo __("Name", 'wpsg'); ?></th>
+                    <th class="wpsg_order" data-order="anr"><?php echo __("Artikelnummer", 'wpsg'); ?></th>
+
 					<?php if ($this->hasMod('wpsg_mod_productgroups')) { ?>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'pgruppe')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('pgruppe');">
-							<span><?php echo __("Produktgruppe", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a> 
-					</th>
+                    <th class="wpsg_order" data-order="pgruppe"><?php echo __("Produktgruppe", 'wpsg'); ?></th>
 					<?php } ?>
+
 					<?php if ($this->hasMod('wpsg_mod_stock') && $this->get_option('wpsg_mod_stock_showBackendStock') == '1') { ?>
-					<th class="manage-column column-title wpsg_stock_col <?php echo (($this->view['search']['order'] == 'stock')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('stock');">
-							<span><?php echo __('Lagerbestand', 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a>
-					</th>
+					<th class="wpsg_order" data-order="stock"><?php echo __("Lagerbestand", 'wpsg'); ?></th>
 					<?php } ?>
-					<th class="manage-column column-title wpsg_mwst_col <?php echo (($this->view['search']['order'] == 'mwst')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">				
-						<a href="#" onclick="return wpsg_setOrder('mwst');">
-							<span><?php echo __("MwSt.", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a>
-					</th>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'price')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('price');">
-							<span><?php echo __("Preis", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a> 
-					</th>							
+
+                    <th class="wpsg_order" data-order="mwst"><?php echo __("MwSt.", 'wpsg'); ?></th>
+
+                    <th class="wpsg_order" data-order="price"><?php echo __("Preis", 'wpsg'); ?></th>
 				</tr>
 			</thead>
@@ -189,51 +164,4 @@
 				<?php } ?>
 			</tbody>
-			<tfoot>
-				<tr>
-					<?php if ($this->hasMod('wpsg_mod_produktbilder')) { ?>
-					<th class="manage-column column-title wpsg_pic_col"></th>
-					<?php } ?>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'name')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('name');">
-							<span><?php echo __("Name", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a>
-					</th>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'anr')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('anr');">
-							<span><?php echo __("Artikelnummer", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a> 
-					</th>
-					<?php if ($this->hasMod('wpsg_mod_productgroups')) { ?>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'pgruppe')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('pgruppe');">
-							<span><?php echo __("Produktgruppe", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a> 
-					</th>
-					<?php } ?>
-					<?php if ($this->hasMod('wpsg_mod_stock') && $this->get_option('wpsg_mod_stock_showBackendStock') == '1') { ?>
-					<th class="manage-column column-title wpsg_stock_col <?php echo (($this->view['search']['order'] == 'stock')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('stock');">
-							<span><?php echo __('Lagerbestand', 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a>
-					</th>
-					<?php } ?>
-					<th class="manage-column column-title wpsg_mwst_col <?php echo (($this->view['search']['order'] == 'mwst')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">				
-						<a href="#" onclick="return wpsg_setOrder('mwst');">
-							<span><?php echo __("MwSt.", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a>
-					</th>
-					<th class="manage-column column-title <?php echo (($this->view['search']['order'] == 'price')?'sorted':'sortable'); ?> <?php echo (($this->view['search']['ascdesc'] == 'asc')?'asc':'desc'); ?>" scope="col">
-						<a href="#" onclick="return wpsg_setOrder('price');">
-							<span><?php echo __("Preis", 'wpsg'); ?></span>
-							<span class="sorting-indicator"></span>
-						</a> 
-					</th>				
-				</tr>
-			</tfoot>		
 		</table>
 			
@@ -248,6 +176,7 @@
 <script type="text/javascript">/* <![CDATA[ */
 
-	var wpsg_order = '<?php echo $this->view['search']['order']; ?>';
-	var wpsg_ascdesc = '<?php echo $this->view['search']['ascdesc']; ?>';
+	<?php if (wpsg_isSizedString($this->view['search']['order']) && wpsg_isSizedString($this->view['search']['ascdesc'])) { ?>
+    jQuery('th[data-order="<?php echo $this->view['search']['order']; ?>"]').addClass('wpsg_order_<?php echo strtolower($this->view['search']['ascdesc']); ?>');
+    <?php } ?>
 
 	function goPage(page)
@@ -263,29 +192,3 @@
 	} // function goPage(page)
 
-	function wpsg_setOrder(order)
-	{
-
-		if (order == wpsg_order)
-		{
-
-			// Nur Richtung Ã€ndern
-			if (wpsg_ascdesc == 'asc') jQuery('#wpsg_ascdesc').val('desc');
-			else jQuery('#wpsg_ascdesc').val('asc');
-
-		}
-		else
-		{
-
-			jQuery('#wpsg_order').val(order);
-			jQuery('#wpsg_ascdesc').val('asc');
-
-		}
-
-		jQuery('#seite').val(1);
-		jQuery('#filter_form').submit();
-
-		return false;
-
-	} // function wpsg_setOrder(order)
-
 /* ]]> */</script>
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 5673)
+++ /wpshopgermany.php	(revision 5674)
@@ -215,4 +215,4 @@
 	
 	$GLOBALS['wpsg_sc']->callMods('load', array());
-	
+
 ?>
