Index: /controller/wpsg_BasketController.class.php
===================================================================
--- /controller/wpsg_BasketController.class.php	(revision 7339)
+++ /controller/wpsg_BasketController.class.php	(revision 7343)
@@ -268,5 +268,5 @@
 			$this->shop->checkPaymentAvailable();
 
-            if (!in_array($_SESSION['wpsg']['checkout']['shipping'], array_keys($this->shop->arShipping)) || !in_array($_SESSION['wpsg']['checkout']['payment'], array_keys($this->shop->arPayment))) {
+            if (sizeof($this->shop->arShipping) > 0 && (!in_array($_SESSION['wpsg']['checkout']['shipping'], array_keys($this->shop->arShipping)) || !in_array($_SESSION['wpsg']['checkout']['payment'], array_keys($this->shop->arPayment)))) {
 
                 if (!in_array($_SESSION['wpsg']['checkout']['shipping'], array_keys($this->shop->arShipping))) $_SESSION['wpsg']['checkout']['shipping'] = array_keys($this->shop->arShipping)[0];
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7339)
+++ /controller/wpsg_ShopController.class.php	(revision 7343)
@@ -2481,6 +2481,5 @@
             $this->callMods('setOrderStatus', array($order_id, $status_id, $inform));
             
-			if (trim($this->view['order']['language']) != '')
-			{
+			if (trim($this->view['order']['language']) != '') {
 
 				// Die Bestellung wurde in einer anderen Sprache durchgefÃŒhrt, hier wechsel ich auf die wÃ€hrend der Bestellung gesetzte Sprach
@@ -2488,9 +2487,7 @@
 
 			}
-
-			if ($status_id == 100)
-			{
-
-				// Bestellung wechselt auf Zahlungakzeptiert
+			
+			// Bestellung wechselt auf Zahlungakzeptiert
+			if ($status_id == 100) {
 
 				// URL Benachrichtigung bei Zahlung ?
@@ -2505,9 +2502,7 @@
 				");
 
-				foreach ($arProdukts as $p)
-				{
-
-					if ($p['posturl'] != '' && $p['posturl_bezahlung'] == '1')
-					{
+				foreach ($arProdukts as $p) {
+
+					if ($p['posturl'] != '' && $p['posturl_bezahlung'] == '1') {
 
 						if ($p['productkey'] != '') $produkt_id = $p['productkey'];
@@ -2526,4 +2521,5 @@
 					'payed_date' => date('Y-m-d')
 				);
+				
 				$this->db->updateQuery(WPSG_TBL_ORDER, $arrUpdate, "`id` = '".$order_id."'");
 
@@ -2533,6 +2529,5 @@
 			$status_neu = __($this->arStatus[$status_id], 'wpsg');
 
-			if ($inform)
-			{
+			if ($inform) {
 
 				$this->view['kunde'] = $this->cache->loadKunden($this->view['order']['k_id']);
@@ -2567,6 +2562,5 @@
 
 			}
-			else
-			{
+			else {
 
 				// Ins Protokoll eintragen
@@ -2585,5 +2579,7 @@
 
 			$this->restoreTempLocale();
-
+			
+			$this->callMods('setOrderStatus_after', array($order_id, $status_id, $inform));
+			
 			return true;
 
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7339)
+++ /lib/wpsg_calculation.class.php	(revision 7343)
@@ -946,5 +946,5 @@
 				$payment = $this->shop->arPayment[$_SESSION['wpsg']['checkout']['payment']];
 				
-				if (wpsg_isSizedArray($payment)) $this->addPayment(wpsg_getFloat($payment['price']), $this->shop->getBackendTaxview(), $payment['mwst_key'], $_SESSION['wpsg']['checkout']['payment']);
+				if (wpsg_isSizedArray($payment)) $this->addPayment(wpsg_getFloat($payment['price']), $this->shop->getBackendTaxview(), @$payment['mwst_key'], $_SESSION['wpsg']['checkout']['payment']);
 				
 			}
@@ -955,5 +955,5 @@
 				$shipping = $this->shop->arShipping[$_SESSION['wpsg']['checkout']['shipping']];
 				
-				if (wpsg_isSizedArray($shipping)) $this->addShipping(wpsg_getFloat($shipping['price']), $this->shop->getBackendTaxview(), $shipping['mwst_key'], $_SESSION['wpsg']['checkout']['shipping']);
+				if (wpsg_isSizedArray($shipping)) $this->addShipping(wpsg_getFloat($shipping['price']), $this->shop->getBackendTaxview(), @$shipping['mwst_key'], $_SESSION['wpsg']['checkout']['shipping']);
 				
 			}
Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 7339)
+++ /model/wpsg_order.class.php	(revision 7343)
@@ -168,5 +168,5 @@
 		{
 
-			return $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_OL."` WHERE `o_id` = '".wpsg_q($this->id)."' ORDER BY `cdate` DESC ");
+			return $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_OL."` WHERE `o_id` = '".wpsg_q($this->id)."' ORDER BY `cdate` DESC, `id` DESC ");
 
 		}
@@ -185,15 +185,15 @@
 		 * Setzt einen Wert in der META Tabelle 
 		 */
-		public function setMeta($meta_key, $meta_value)
-		{
-			
-			if (is_null($meta_value))
-			{
+		public function setMeta($meta_key, $meta_value) {
+			
+			$target_id = $this->id;
+			
+			if (!wpsg_isSizedInt($target_id)) return;
+			
+			if (is_null($meta_value)) {
 				
 				$this->db->Query("DELETE FROM `".WPSG_TBL_META."` WHERE `meta_key` = '".wpsg_q($meta_key)."' AND `target_id` = '".wpsg_q($this->id)."' AND `meta_table` = 'WPSG_TBL_ORDER' ");
 				
-			}
-			else
-			{
+			} else {
 			
 				$nExistsID = $this->db->fetchOne("SELECT M.`id` FROM `".WPSG_TBL_META."` AS M WHERE M.`meta_table` = 'WPSG_TBL_ORDER' AND M.`meta_key` = '".wpsg_q($meta_key)."' AND `target_id` = '".wpsg_q($this->id)."' ");
Index: /mods/wpsg_mod_fuellmenge.class.php
===================================================================
--- /mods/wpsg_mod_fuellmenge.class.php	(revision 7339)
+++ /mods/wpsg_mod_fuellmenge.class.php	(revision 7343)
@@ -150,5 +150,5 @@
 		
 				$variInfo = $this->shop->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($product_key));
-				$fuellmenge = $product_data_db['fuellmenge'] + $variInfo['fuellmenge'];
+				$fuellmenge = @$product_data_db['fuellmenge'] + @$variInfo['fuellmenge'];
 		
 			}
@@ -156,5 +156,5 @@
 			{
 		
-				$fuellmenge = $product_data_db['fuellmenge'];
+				$fuellmenge = @$product_data_db['fuellmenge'];
 		
 			}
Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 7339)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 7343)
@@ -248,6 +248,6 @@
 		public function calcPayment(&$arBasket)
 		{
-		    
-			if ($this->id == $arBasket['checkout']['payment'])
+		   
+			if (isset($arBasket['checkout']['payment']) && $this->id == $arBasket['checkout']['payment'])
 			{
                 
@@ -456,6 +456,7 @@
 			if ($oOrder->getPaymentID() != $this->id) return;
 			
-			if (wpsg_isSizedString(($oOrder->getMeta('wpsg_mod_paypalapi_paymentId'))))
-			{
+			$wpsg_mod_paypalapi_paymentId = $oOrder->getMeta('wpsg_mod_paypalapi_paymentId');
+			
+			if (wpsg_isSizedString($wpsg_mod_paypalapi_paymentId)) {
 				
 				$payment_info = $this->api_getPaymentInfo($oOrder->getMeta('wpsg_mod_paypalapi_paymentId'), true);
@@ -465,5 +466,8 @@
 				//if ($amount_approved === floatval($oOrder->getAmount()) && !wpsg_isSizedString($oOrder->getMeta('wpsg_mod_paypalapi_saleid')))
 				// AusfÃŒhren bei Approved und Created! Wenn der Iframe angezeigt wird, wird die alte PayMent ID verworfen!
-				if ($amount_approved === floatval($oOrder->getAmount()) && !wpsg_isSizedString($oOrder->getMeta('wpsg_mod_paypalapi_saleid')))
+				
+				$wpsg_mod_paypalapi_saleid = $oOrder->getMeta('wpsg_mod_paypalapi_saleid');
+				
+				if ($amount_approved === floatval($oOrder->getAmount()) && !wpsg_isSizedString($wpsg_mod_paypalapi_saleid))
 				{
 					
@@ -653,8 +657,6 @@
 						
 			// Log BEGIN
-			if ($this->shop->get_option('wpsg_mod_paypalapi_webhook_log') == '1')
-			{
-			
-				//$log_file = '/var/home/htdocs/shop.maennchen1.de/logs/webHook.log';
+			if ($this->shop->get_option('wpsg_mod_paypalapi_webhook_log') == '1') {
+			 
 				$log_file = $this->shop->get_option('wpsg_mod_paypalapi_webhook_logfile');
 				
@@ -681,6 +683,5 @@
 			$orderPaymentID = $oOrder->getMeta('wpsg_mod_paypalapi_paymentid');
 			
-			if ($this->shop->setPayMent($oOrder->id, $amount) && $orderPaymentID === $payment_id && $payment_state === 'approved' && $sale_state === 'completed')
-			{
+			if ($this->shop->setPayMent($oOrder->id, $amount) && $orderPaymentID === $payment_id && $payment_state === 'approved' && $sale_state === 'completed') {
 
                 $oOrder->log(__('PayPalAPI WebHook Erfolg', 'wpsg'), print_r($jsonData, 1));
@@ -688,7 +689,5 @@
 				$this->shop->setOrderStatus($oOrder->id, 100, true);					 			
 								
-			}
-			else 
-			{
+			} else {
 				
 				$oOrder->log(__('PayPalAPI Abgelehnt', 'wpsg', print_r($jsonData, 1)."\r\nOrder PaymentID:".$orderPaymentID."\r\nRequest PaymentID:".$payment_id."\r\nOrder State:".$state));
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 7339)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 7343)
@@ -1141,5 +1141,5 @@
 		} // private function writeRechnung($order_id)
 
-		public function setOrderStatus($order_id, $status_id, $inform)
+		public function setOrderStatus_after($order_id, $status_id, $inform)
 		{
 			
Index: /views/mailtemplates/html/status.phtml
===================================================================
--- /views/mailtemplates/html/status.phtml	(revision 7339)
+++ /views/mailtemplates/html/status.phtml	(revision 7343)
@@ -7,9 +7,11 @@
 	/* Wichtig, da die Module sonst kein HTML zurÃŒckgeben */
 	$this->htmlMail = true;
-
+	
+	$oCustomer = wpsg_customer::getInstance($this->view['kunde']['id']);
+	
 	include(WPSG_PATH_VIEW . 'mailtemplates/html/logo.phtml');
 
 ?>
-<p><?php echo wpsg_translate(__('Hallo #1# #2#,', 'wpsg'), $this->view['kunde']['vname'], $this->view['kunde']['name']); ?></p> 
+<p><?php echo wpsg_translate(__('Hallo #1# #2#,', 'wpsg'), $oCustomer->getTitle(), $oCustomer->getFirstname(), $oCustomer->getName()); ?></p> 
   
 <p><?php echo wpsg_translate(
Index: /views/mailtemplates/status.phtml
===================================================================
--- /views/mailtemplates/status.phtml	(revision 7339)
+++ /views/mailtemplates/status.phtml	(revision 7343)
@@ -7,8 +7,7 @@
 	$this->htmlMail = false;
 	
-	$arPflicht = $this->loadPflichtFeldDaten();
-	$arTitle = explode('|', $arPflicht['anrede_auswahl']);
-
-?><?php echo wpsg_translate(__('Hallo #1# #2# #3#,', 'wpsg'), @$arTitle[$this->view['basket']['checkout']['title']], $this->view['basket']['checkout']['vname'], $this->view['basket']['checkout']['name']); ?>
+	$oCustomer = wpsg_customer::getInstance($this->view['kunde']['id']);
+	
+?><?php echo wpsg_translate(__('Hallo #1# #2# #3#,', 'wpsg'), $oCustomer->getTitle(), $oCustomer->getFirstname(), $oCustomer->getName()); ?>
  
 <?php echo wpsg_translate(
Index: /views/mods/mod_paypalapi/order_view_afterpayment.phtml
===================================================================
--- /views/mods/mod_paypalapi/order_view_afterpayment.phtml	(revision 7339)
+++ /views/mods/mod_paypalapi/order_view_afterpayment.phtml	(revision 7343)
@@ -4,8 +4,11 @@
 	 * Template fÃŒr die Integration der PayPal Zahlungsart in die Bestellverwaltung
 	 */
-
+	
+	$wpsg_mod_paypalapi_paymentid = $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_paymentid');
+	$wpsg_mod_paypalapi_saleid = $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_saleid')
+	
 ?>
 
-<?php if (wpsg_isSizedString($this->view['oOrder']->getMeta('wpsg_mod_paypalapi_paymentid'))) { ?>
+<?php if (wpsg_isSizedString($wpsg_mod_paypalapi_paymentid)) { ?>
 
 	<?php echo wpsg_drawForm_Text(
@@ -19,5 +22,5 @@
 <?php } ?>
 
-<?php if (wpsg_isSizedString($this->view['oOrder']->getMeta('wpsg_mod_paypalapi_saleid'))) { ?>
+<?php if (wpsg_isSizedString($wpsg_mod_paypalapi_saleid)) { ?>
 
 	<?php echo wpsg_drawForm_Text(__('SaleID', 'wpsg'), wpsg_translate(__('#1# (#2#)', 'wpsg'), $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_saleid'), $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_salestate'))); ?>
