Index: /changelog
===================================================================
--- /changelog	(revision 7716)
+++ /changelog	(revision 7717)
@@ -351,7 +351,8 @@
 
 #4.2.3
-- Bugfix: Kein Fehler bei aktivierter FÃŒllmenge und erstmaligem speichern eines Produktes
+- Feature: PayPal API unterstÃŒtzt jetzt V2 der Rest API
 - Feature: Filter wpsg_sendMail zur Anpassung von Mails hinzugefÃŒgt
 - Feature: Suche nach ID: in der Produktverwaltung im Suchstring
+- Bugfix: Kein Fehler bei aktivierter FÃŒllmenge und erstmaligem speichern eines Produktes
 - Bugfix: Die Funktion "Zuordnung Produkt zu Artikel", erzwingt nicht mehr die neu generierung des Posts, nur noch bei Bedarf
 - Bugfix: Die Request ÃberprÃŒfung fÃŒr lokale URLs erlaubt auch URLs ohne Protokoll, die mit "/" beginnen
@@ -362,2 +363,3 @@
 - Bugfix: Updtate der VerschlÃŒsselung innerhalb Kreditkartenmodul / Task #727
 - Bugfix: Logo in E-Mail Konfiguration lÃ€sst sich speichern / Task #726
+- Bugfix: Einmal als bezahlt gemeldete Bestellungen ignorieren zukÃŒnftige ZahlungsbestÃ€tigungen auf diesen Bestellungen
Index: /controller/wpsg_AdminController.class.php
===================================================================
--- /controller/wpsg_AdminController.class.php	(revision 7716)
+++ /controller/wpsg_AdminController.class.php	(revision 7717)
@@ -1116,5 +1116,5 @@
 				{
 
-					$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&amp;subaction=deinstallieren');
+					$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=deinstallieren');
 
 				}
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7716)
+++ /controller/wpsg_ShopController.class.php	(revision 7717)
@@ -2643,8 +2643,15 @@
 
 			$basket_url = $this->getURL(wpsg_ShopController::URL_BASKET);
-			
-			$rand = wpsg_genCode(128);
-			$this->db->UpdateQuery(WPSG_TBL_ORDER, ['secret' => wpsg_q($rand)], " `id` = '".wpsg_q($order_id)."' ");
-			$code = md5($rand.$order_id.$rand);
+
+			$secret = $this->db->fetchOne("SELECT `secret` FROM `".WPSG_TBL_ORDER."` WHERE `id` = '".wpsg_q($order_id)."' ");
+
+			if (!wpsg_isSizedString($secret)) {
+
+                $secret = wpsg_genCode(128);
+			    $this->db->UpdateQuery(WPSG_TBL_ORDER, ['secret' => wpsg_q($secret)], " `id` = '".wpsg_q($order_id)."' ");
+
+            }
+
+			$code = md5($secret.$order_id.$secret);
 			
 			if (strpos($basket_url, '?') === false) {
Index: /lib/filter_functions.inc.php
===================================================================
--- /lib/filter_functions.inc.php	(revision 7716)
+++ /lib/filter_functions.inc.php	(revision 7717)
@@ -661,10 +661,9 @@
      * Funktion, die vor dem Update aufgerufen wird um die Dateien aus dem Verzeichnis zu schieben die nicht gelÃ¶scht werden sollen
      */
-    function wpsg_pre_install($test)
-    {
+    function wpsg_pre_install($test) {
     
         global $wp_filesystem;
     
-        if ($_REQUEST['plugin'] != WPSG_FOLDERNAME.'/wpshopgermany.php') return;
+        if (!isset($_REQUEST['plugin']) && $_REQUEST['plugin'] != WPSG_FOLDERNAME.'/wpshopgermany.php') return;
     
         if (!isset($_REQUEST['_ajax_nonce'])) echo __('Kopiere Shop aus dem Pluginverzeichnis ...', 'wpsg').'<br />';
Index: /model/wpsg_model.class.php
===================================================================
--- /model/wpsg_model.class.php	(revision 7716)
+++ /model/wpsg_model.class.php	(revision 7717)
@@ -198,4 +198,6 @@
 
             }
+
+            $this->arMeta = null;
 
         } // public function setMeta($meta_key, $meta_value)
Index: /mods/wpsg_mod_discount.class.php
===================================================================
--- /mods/wpsg_mod_discount.class.php	(revision 7716)
+++ /mods/wpsg_mod_discount.class.php	(revision 7717)
@@ -968,6 +968,5 @@
 		 * Bearbeitet einen Array mit Produktinformationen mit dem Rabatt
 		 */
-		public function applyDiscountToProductData($discount_value, &$product_data, $discount_type)
-		{
+		public function applyDiscountToProductData($discount_value, &$product_data, $discount_type) {
 
 			$mwst_value = $product_data['mwst_value'];
@@ -1106,6 +1105,5 @@
 		 * Gibt einen Array mit den Rabattinformationen bezÃŒglich des Produktrabattes zurÃŒck
 		 */
-		public function getProductDiscount($product_id)
-		{
+		public function getProductDiscount($product_id) {
 
 			if (!$this->hasProductDiscount($product_id)) return 0;
Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 7716)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 7717)
@@ -512,12 +512,20 @@
 			if ($oOrder->getPaymentID() != $this->id) return;
 			
-			$wpsg_mod_paypalapi_paymentId = $oOrder->getMeta('wpsg_mod_paypalapi_paymentId');
-
-			if (wpsg_isSizedString($wpsg_mod_paypalapi_paymentId)) {
-
-				$payment_info = $this->api_getPaymentInfo_v2($wpsg_mod_paypalapi_paymentId, true);
-
-				$amount_approved = floatval($payment_info['purchase_units'][0]['amount']['value']);
-				 
+			$wpsg_mod_paypalapi_paymentid = $oOrder->getMeta('wpsg_mod_paypalapi_paymentid');
+
+			if (wpsg_isSizedString($wpsg_mod_paypalapi_paymentid)) {
+
+                if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1') {
+
+                    $payment_info = $this->api_getPaymentInfo($wpsg_mod_paypalapi_paymentid, true);
+                    $amount_approved = floatval($payment_info['transactions'][0]['amount']['total']);
+
+                } else {
+
+				    $payment_info = $this->api_getPaymentInfo_v2($wpsg_mod_paypalapi_paymentid, true);
+				    $amount_approved = floatval($payment_info['purchase_units'][0]['amount']['value']);
+
+                }
+
 				//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!
@@ -529,23 +537,52 @@
 				    try {
 
-				        $payment_info_execute = $this->api_executePayment_v2($oOrder->getMeta('wpsg_mod_paypalapi_paymentId'), $oOrder->getMeta('wpsg_mod_paypalapi_payer_id'));
-
-                        if (wpsg_isSizedString($payment_info_execute['purchase_units'][0]['payments']['captures'][0]['id'])) {
-
-                            $sale_id = $payment_info_execute['purchase_units'][0]['payments']['captures'][0]['id'];
-
-                            $oOrder->setMeta('wpsg_mod_paypalapi_saleid', $sale_id);
-                            $oOrder->setMeta('wpsg_mod_paypalapi_salestate', $payment_info_execute['purchase_units'][0]['payments']['captures'][0]['status']);
-                            $oOrder->setMeta('wpsg_mod_paypalapi_paymentstate', $payment_info_execute['status']);
-
-                            if ($payment_info_execute['status'] === 'COMPLETED') {
-
-                                $this->shop->view['wpsg_mod_paypalapi']['done'] = '2';
-                                $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_paypalapi/order_done.phtml');
-
-                                return;
+				        $payment_info_execute = $this->api_executePayment_v2($oOrder->getMeta('wpsg_mod_paypalapi_paymentid'), $oOrder->getMeta('wpsg_mod_paypalapi_payer_id'));
+
+                        if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1') {
+
+                            if (wpsg_isSizedString($payment_info_execute['transactions'][0]['related_resources'][0]['sale']['id']))
+                            {
+
+                                $sale_id = $payment_info_execute['transactions'][0]['related_resources'][0]['sale']['id'];
+
+                                $oOrder->setMeta('wpsg_mod_paypalapi_saleid', $sale_id);
+                                $oOrder->setMeta('wpsg_mod_paypalapi_salestate', $payment_info_execute['transactions'][0]['related_resources'][0]['sale']['state']);
+                                $oOrder->setMeta('wpsg_mod_paypalapi_paymentstate', $payment_info_execute['state']);
+
+                                if ($payment_info_execute['state'] == 'approved')
+                                {
+
+                                    $this->shop->view['wpsg_mod_paypalapi']['done'] = '2';
+                                    $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_paypalapi/order_done.phtml');
+
+                                    return;
+
+                                }
+
+                                else $payment_info = $payment_info_execute;
 
                             }
-                            else $payment_info = $payment_info_execute;
+
+                        } else {
+
+                            if (wpsg_isSizedString($payment_info_execute['purchase_units'][0]['payments']['captures'][0]['id'])) {
+
+                                $sale_id = $payment_info_execute['purchase_units'][0]['payments']['captures'][0]['id'];
+
+                                $oOrder->setMeta('wpsg_mod_paypalapi_saleid', $sale_id);
+                                $oOrder->setMeta('wpsg_mod_paypalapi_salestate', $payment_info_execute['purchase_units'][0]['payments']['captures'][0]['status']);
+                                $oOrder->setMeta('wpsg_mod_paypalapi_paymentstate', $payment_info_execute['status']);
+
+                                if ($payment_info_execute['status'] === 'COMPLETED') {
+
+                                    $this->shop->view['wpsg_mod_paypalapi']['done'] = '2';
+                                    $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_paypalapi/order_done.phtml');
+
+                                    return;
+
+                                }
+                                else $payment_info = $payment_info_execute;
+
+                            }
 
                         }
@@ -562,5 +599,25 @@
 			}
 
- 			if (isset($payment_info['status']) && $payment_info['status'] == 'COMPLETED') {
+            if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1') {
+
+                if ($payment_info['state'] == 'approved') {
+
+                    $this->shop->view['wpsg_mod_paypalapi']['done'] = '1';
+
+                } else {
+
+                    $json_data = $this->api_startPayment($done_view['basket'], $order_id);
+
+                    $approval_url = "";
+                    foreach ($json_data['links'] as $k => $l) if ($l['rel'] == 'approval_url') $approval_url = $l['href'];
+
+                    $this->shop->view['wpsg_mod_paypalapi']['approval_url'] = $approval_url;
+                    $this->shop->view['wpsg_mod_paypalapi']['mode'] = (($this->isSandbox())?'sandbox':'live');
+
+                }
+
+            } else {
+
+ 			    if (isset($payment_info['status']) && $payment_info['status'] == 'COMPLETED') {
 			
 				$this->shop->view['wpsg_mod_paypalapi']['done'] = '1';				
@@ -577,5 +634,7 @@
 
 			}
-			
+
+            }
+
 			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_paypalapi/order_done.phtml');
 		
@@ -628,7 +687,7 @@
 				$oOrder = wpsg_order::getInstance($order_id);
 				
-				$oOrder->setMeta('wpsg_mod_paypalapi_paymentId', $_SESSION['wpsg']['checkout']['paymentId']);
+				$oOrder->setMeta('wpsg_mod_paypalapi_paymentid', $_SESSION['wpsg']['checkout']['paymentId']);
 				$oOrder->setMeta('wpsg_mod_paypalapi_payer_id', $_SESSION['wpsg']['checkout']['payer_id']);
-				
+
 			}
 			
@@ -727,5 +786,5 @@
 			$jsonData = json_decode($bodyReceived, true);
 
-			if ($jsonData['event_type']['PAYMENT.CAPTURE.COMPLETED']) {
+			if ($jsonData['event_type'] === 'PAYMENT.CAPTURE.COMPLETED') {
 
 			    $saleID = $jsonData['resource']['id'];
@@ -744,25 +803,45 @@
             if ($oOrder === false) die(__('Keine Bestellung zu PaymentID gefunden.', 'wpsg'));
 
-            list($payment_state, $sale_state, $result) = $this->getState($order_id);
-            $orderPaymentID = $oOrder->getMeta('wpsg_mod_paypalapi_paymentid');
-
-            if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1' && $this->shop->setPayMent($oOrder->id, $amount) && $orderPaymentID === $payment_id && $payment_state === 'approved' && $sale_state === 'completed') {
-
-                $oOrder->log(__('PayPalAPI V1 WebHook Erfolg', 'wpsg'), print_r($jsonData, 1));
-			    
-				$this->shop->setOrderStatus($oOrder->id, 100, true);					 			
-
-            } else if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v2' && $this->shop->setPayMent($oOrder->id, $amount) && $payment_state === 'COMPLETED' && $sale_state === 'COMPLETED') {
-
-                $oOrder->log(__('PayPal Status', 'wpsg'), print_r($result, true));
-                $oOrder->log(__('PayPalAPI V2 WebHook Erfolg', 'wpsg'), print_r($jsonData, 1));
-
-                $this->shop->setOrderStatus($oOrder->id, 100, true);
-
-            } else {
-				
-				$oOrder->log(__('PayPalAPI Abgelehnt', 'wpsg'), print_r($jsonData, 1)."\r\nOrder PaymentID:".$orderPaymentID."\r\nRequest PaymentID:".$payment_id);
-									
-			}
+            // Ich ignoriere Zahlungen die bereits extern gezahlt gemeldet wurden
+            if ($oOrder->__get('ext_payed') === '1') exit;
+
+            if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1') {
+
+                list($payment_state, $sale_state) = $this->getState($order_id);
+                $orderPaymentID = $oOrder->getMeta('wpsg_mod_paypalapi_paymentid');
+
+                if ($this->shop->setPayMent($oOrder->id, $amount) && $orderPaymentID === $payment_id && $payment_state === 'approved' && $sale_state === 'completed') {
+
+                    $oOrder->log(__('PayPalAPI V1 WebHook Erfolg', 'wpsg'), print_r($jsonData, 1));
+
+                    $this->shop->setOrderStatus($oOrder->id, 100, true);
+                    $this->db->UpdateQuery(WPSG_TBL_ORDER, ['ext_payed' => '1'], " `id` = '".wpsg_q($oOrder->getId())."' ");
+
+                } else {
+
+                    $oOrder->log(__('PayPalAPI Abgelehnt', 'wpsg'), print_r($jsonData, 1)."\r\nOrder PaymentID:".$orderPaymentID."\r\nRequest PaymentID:".$payment_id);
+
+                }
+
+            } else if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v2') {
+
+                list($payment_state, $sale_state, $result) = $this->getState($order_id);
+                $orderPaymentID = $oOrder->getMeta('wpsg_mod_paypalapi_paymentid');
+
+                if ($this->shop->setPayMent($oOrder->id, $amount) && $payment_state === 'COMPLETED' && $sale_state === 'COMPLETED') {
+
+                    $oOrder->log(__('PayPal Status', 'wpsg'), print_r($result, true));
+                    $oOrder->log(__('PayPalAPI V2 WebHook Erfolg', 'wpsg'), print_r($jsonData, 1));
+
+                    $this->shop->setOrderStatus($oOrder->id, 100, true);
+                    $this->db->UpdateQuery(WPSG_TBL_ORDER, ['ext_payed' => '1'], " `id` = '".wpsg_q($oOrder->getId())."' ");
+
+                } else {
+
+                    $oOrder->log(__('PayPalAPI Abgelehnt', 'wpsg'), print_r($jsonData, 1)."\r\nOrder PaymentID:".$orderPaymentID."\r\nRequest PaymentID:".$payment_id);
+
+                }
+
+            }
 
 			header('HTTP/1.1 200 OK'); exit(1);
@@ -793,10 +872,18 @@
 		public function returnPayPalExpressRedirect() {
 
-            $_REQUEST['paymentId'] = sanitize_text_field($_REQUEST['token']);
-
-			$json_data = $this->api_getPaymentInfo_v2($_REQUEST['paymentId']);
+            if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1') {
+
+                $json_data = $this->api_getPaymentInfo($_REQUEST['paymentId']);
+
+            } else {
+
+                $_REQUEST['paymentId'] = sanitize_text_field($_REQUEST['token']);
+
+			    $json_data = $this->api_getPaymentInfo_v2($_REQUEST['paymentId']);
+
+            }
 
 			$order_id = $this->db->fetchOne("SELECT `target_id` FROM `".WPSG_TBL_META."` WHERE `meta_table` = 'WPSG_TBL_ORDER' AND `meta_key` = 'wpsg_mod_paypalapi_paymentid' AND `meta_value` = '".wpsg_q($_REQUEST['paymentId'])."' ");
-			
+
 			if (wpsg_isSizedInt($order_id)) {
 				
@@ -861,5 +948,14 @@
 			$_SESSION['wpsg']['checkout']['payment_amount'] = $json_data['purchase_units'][0]['amount']['value'];
 			$_SESSION['wpsg']['checkout']['paymentId'] = $json_data['id'];
-			$_SESSION['wpsg']['checkout']['payer_id'] = $json_data['payer']['payer_id'];
+
+            if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1') {
+
+                $_SESSION['wpsg']['checkout']['payer_id'] = $json_data['payer']['payer_info']['payer_id'];
+
+            } else {
+
+			    $_SESSION['wpsg']['checkout']['payer_id'] = $json_data['payer']['payer_id'];
+
+            }
 			
 			$this->shop->basket->initFromSession(true);
@@ -1027,15 +1123,33 @@
 			else {
 
-                $payment_info = $this->api_getPaymentInfo_v2($paymentID);
-
-                $payment_state = wpsg_getStr($payment_info['status']);
-                $sale_state = wpsg_getStr($payment_info['purchase_units'][0]['payments']['captures'][0]['status'], __('Unbekannt', 'wpsg'));
-
-                if (!wpsg_isSizedString($payment_state)) return false;
-
-                if (wpsg_isSizedString($payment_state)) $oOrder->setMeta('wpsg_mod_paypalapi_paymentstate', $payment_state);
-                if (wpsg_isSizedString($sale_state)) $oOrder->setMeta('wpsg_mod_paypalapi_salestate', $sale_state);
-
-                return array($payment_state, $sale_state, $payment_info);
+                if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v1') {
+
+                    $payment_info = $this->api_getPaymentInfo($oOrder->getMeta('wpsg_mod_paypalapi_paymentid'));
+
+                    $payment_state = $payment_info['state'];
+                    $sale_state = $payment_info['transactions'][0]['related_resources'][0]['sale']['state'];
+
+                    if (!wpsg_isSizedString($payment_state)) return false;
+
+                    if (wpsg_isSizedString($payment_state)) $oOrder->setMeta('wpsg_mod_paypalapi_paymentstate', $payment_state);
+                    if (wpsg_isSizedString($sale_state)) $oOrder->setMeta('wpsg_mod_paypalapi_salestate', $sale_state);
+
+                    return array($payment_state, $sale_state, $payment_info);
+
+                } else {
+
+                    $payment_info = $this->api_getPaymentInfo_v2($paymentID);
+
+                    $payment_state = wpsg_getStr($payment_info['status']);
+                    $sale_state = wpsg_getStr($payment_info['purchase_units'][0]['payments']['captures'][0]['status'], __('Unbekannt', 'wpsg'));
+
+                    if (!wpsg_isSizedString($payment_state)) return false;
+
+                    if (wpsg_isSizedString($payment_state)) $oOrder->setMeta('wpsg_mod_paypalapi_paymentstate', $payment_state);
+                    if (wpsg_isSizedString($sale_state)) $oOrder->setMeta('wpsg_mod_paypalapi_salestate', $sale_state);
+
+                    return array($payment_state, $sale_state, $payment_info);
+
+                }
 
             }
@@ -1048,5 +1162,5 @@
 			if ($oOrder === false) throw new \wpsg\Exception(__('Bei einer Stornierung konnte Bestellung nicht geladen werden', 'wpsg'));
 
-			$payment_id = $oOrder->getMeta('wpsg_mod_paypalapi_paymentId');
+			$payment_id = $oOrder->getMeta('wpsg_mod_paypalapi_paymentid');
 			$sale_id = $oOrder->getMeta('wpsg_mod_paypalapi_saleid');
 
@@ -1553,5 +1667,9 @@
             $json_data = $this->api_call('v1/payments/payment', $post_data, $access_token);
 
-            if (wpsg_isSizedString($json_data['id'])) $oOrder->setMeta('wpsg_mod_paypalapi_paymentId', $json_data['id']);
+            if (wpsg_isSizedString($json_data['id'])) {
+
+                $oOrder->setMeta('wpsg_mod_paypalapi_paymentid', $json_data['id']);
+
+            }
 
             return $json_data;
@@ -1770,5 +1888,5 @@
                 $response = json_decode(json_encode($response), true)['result'];
 
-                if (wpsg_isSizedString($response['id'])) $oOrder->setMeta('wpsg_mod_paypalapi_paymentId', $response['id']);
+                if (wpsg_isSizedString($response['id'])) $oOrder->setMeta('wpsg_mod_paypalapi_paymentid', $response['id']);
 
                 //echo '<pre>'.print_r($response, true).'</pre>';
Index: /mods/wpsg_mod_printshop.class.php
===================================================================
--- /mods/wpsg_mod_printshop.class.php	(revision 7716)
+++ /mods/wpsg_mod_printshop.class.php	(revision 7717)
@@ -52,4 +52,6 @@
             $this->shop->view['wpsg_mod_printshop']['mode'] = intval($oProduct->getMeta('wpsg_mod_printshop_mode'));
             $this->shop->view['wpsg_mod_printshop']['unit_price'] = sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_price'));
+            $this->shop->view['wpsg_mod_printshop']['unit_input'] = sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_input'));
+            $this->shop->view['wpsg_mod_printshop']['factor_price_input'] = sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'));
             $this->shop->view['wpsg_mod_printshop']['width_step'] = intval($oProduct->getMeta('wpsg_mod_printshop_width_step'));
             $this->shop->view['wpsg_mod_printshop']['width_min'] = intval($oProduct->getMeta('wpsg_mod_printshop_width_min'));
@@ -81,4 +83,6 @@
 		        'mode' => intval(@$_REQUEST['wpsg_mod_printshop']['mode']),
                 'unit_price' => sanitize_text_field(@$_REQUEST['wpsg_mod_printshop']['unit_price']),
+                'unit_input' => sanitize_text_field(@$_REQUEST['wpsg_mod_printshop']['unit_input']),
+                'factor_price_input' => wpsg_tf($_REQUEST['wpsg_mod_printshop']['factor_price_input']),
                 'width' => wpsg_tf(@$_REQUEST['wpsg_mod_printshop']['width']),
                 'width_step' => intval(@$_REQUEST['wpsg_mod_printshop']['width_step']),
@@ -100,4 +104,6 @@
                 $oProduct->setMeta('wpsg_mod_printshop_mode', $r['mode']);
                 $oProduct->setMeta('wpsg_mod_printshop_unit_price', $r['unit_price']);
+                $oProduct->setMeta('wpsg_mod_printshop_unit_input', $r['unit_input']);
+                $oProduct->setMeta('wpsg_mod_printshop_factor_price_input', $r['factor_price_input']);
 
                 if ($r['mode'] === self::MODE_AREA) {
@@ -156,4 +162,5 @@
 						
 					$mode = intval($oProduct->getMeta('wpsg_mod_printshop_mode'));
+					$factor = wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'));
 
 					if ($mode === wpsg_mod_printshop::MODE_AREA) {
@@ -203,5 +210,5 @@
 					} else throw wpsg\Exception::getInvalidFunctionException();
 
-                    $price = round($width * $r['length'], 2) * $price_onepice;
+                    $price = round(($width * $factor) * ($r['length'] * $factor), 2) * $price_onepice;
 
 					$this->set_data = [
@@ -239,8 +246,12 @@
                     'length' => wpsg_tf($p['wpsg_mod_printshop']['length']),
                     'price_onepice' => $oProduct->getPrice($p['product_key']),
-                    'unit_price' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_price'))
+                    'unit_input' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_input')),
+                    'unit_price' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_price')),
+                    'factor_price_input' => wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'))
                 ];
 
-                $this->shop->view['wpsg_mod_printshop']['area'] = round($this->shop->view['wpsg_mod_printshop']['width'] * $this->shop->view['wpsg_mod_printshop']['length'], 2);
+                $factor = wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'));
+
+                $this->shop->view['wpsg_mod_printshop']['area'] = round(($this->shop->view['wpsg_mod_printshop']['width'] * $factor) * ($this->shop->view['wpsg_mod_printshop']['length'] * $factor), 2);
 
                 $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_printshop/basket_row_before.phtml');
@@ -411,8 +422,12 @@
                     'price_onepice' => wpsg_tf($oOrderProduct->getMeta('wpsg_mod_printshop_price_onepice')),
                     'unit_price' => sanitize_text_field($oOrderProduct->getMeta('wpsg_mod_printshop_unit_price')),
+                    'unit_input' => sanitize_text_field($oOrderProduct->getMeta('wpsg_mod_printshop_unit_input')),
+                    'factor_price_input' => wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input')),
                     'arFiles' => $this->getFiles($oOrderProduct->getOrder()->getId(), $oOrderProduct->getProductIndex())
                 ];
 
-                $this->shop->view['wpsg_mod_printshop']['area'] = round($this->shop->view['wpsg_mod_printshop']['width'] * $this->shop->view['wpsg_mod_printshop']['length'], 2);
+                $factor = wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'));
+
+                $this->shop->view['wpsg_mod_printshop']['area'] = round(($this->shop->view['wpsg_mod_printshop']['width'] * $factor) * ($this->shop->view['wpsg_mod_printshop']['length'] * $factor), 2);
 
                 $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_printshop/order_view_row.phtml');
@@ -436,8 +451,12 @@
                     'length' => wpsg_tf($oOrderProduct->getMeta('wpsg_mod_printshop_length')),
                     'price_onepice' => wpsg_tf($oOrderProduct->getMeta('wpsg_mod_printshop_price_onepice')),
-                    'unit_price' => sanitize_text_field($oOrderProduct->getMeta('wpsg_mod_printshop_unit_price'))
+                    'unit_input' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_input')),
+                    'unit_price' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_price')),
+                    'factor_price_input' => wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'))
                 ];
 
-                $this->shop->view['wpsg_mod_printshop']['area'] = round($this->shop->view['wpsg_mod_printshop']['width'] * $this->shop->view['wpsg_mod_printshop']['length'], 2);
+                $factor = wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'));
+
+                $this->shop->view['wpsg_mod_printshop']['area'] = round(($this->shop->view['wpsg_mod_printshop']['width'] * $factor) * ($this->shop->view['wpsg_mod_printshop']['length'] * $factor), 2);
 
                 if ($this->shop->htmlMail === true)
@@ -460,8 +479,12 @@
                     'length' => wpsg_tf($p['wpsg_mod_printshop']['length']),
                     'price_onepice' => $oProduct->getPrice($p['product_key']),
-                    'unit_price' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_price'))
+                    'unit_input' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_input')),
+                    'unit_price' => sanitize_text_field($oProduct->getMeta('wpsg_mod_printshop_unit_price')),
+                    'factor_price_input' => wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'))
                 ];
 
-                $this->shop->view['wpsg_mod_printshop']['area'] = round($this->shop->view['wpsg_mod_printshop']['width'] * $this->shop->view['wpsg_mod_printshop']['length'], 2);
+                $factor = wpsg_tf($oProduct->getMeta('wpsg_mod_printshop_factor_price_input'));
+
+                $this->shop->view['wpsg_mod_printshop']['area'] = round(($this->shop->view['wpsg_mod_printshop']['width'] * $factor) * ($this->shop->view['wpsg_mod_printshop']['length'] * $factor), 2);
 
                 $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_printshop/overview_row_before.phtml');
Index: /mods/wpsg_mod_su.class.php
===================================================================
--- /mods/wpsg_mod_su.class.php	(revision 7716)
+++ /mods/wpsg_mod_su.class.php	(revision 7717)
@@ -196,4 +196,6 @@
 					$order = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ORDER."` WHERE `id` = '".wpsg_q($_REQUEST['user_variable_2'])."'");
 					if ($order['id'] <= 0) die();
+
+                    if ($order['ext_payed'] === '1') exit;
 					
 					$oOrder = wpsg_order::getInstance($order['id']);
@@ -264,4 +266,5 @@
 						
 						$this->shop->setOrderStatus($order['id'], 100, true);
+                        if ($oOrder->__get('ext_payed') === '1') exit;
 						
 					} else throw new \Exception(__('Hash konnte nicht verifiziert werden.', 'wpsg'));
@@ -370,3 +373,2 @@
 	} // class wpsg_mod_su extends wpsg_mod_basic
 
-?>
Index: /views/css/admin.css
===================================================================
--- /views/css/admin.css	(revision 7716)
+++ /views/css/admin.css	(revision 7717)
@@ -76,8 +76,8 @@
 .wp-admin #wpsg-bs .checkbox input { margin-top:3px; width:15px; height:15px; }
 
-.branch-5-3.wp-admin #wpsg-bs .checkbox input:before { margin:1px 0 0 1px; width:10px; height:10px; }
-.branch-5-3 #wpsg-bs input[type=checkbox], input[type=radio] { width:16px; height:16px; }
-.branch-5-3 #wpsg-bs input[type=checkbox]:checked::before { width:14px; height:14px; margin:0; }
-.branch-5-3 #wpsg-bs input[type=radio]:checked::before { width:6px; height:6px; margin:4px; }
+.wp-admin #wpsg-bs .checkbox input:before { margin:1px 0 0 1px; width:10px; height:10px; }
+#wpsg-bs input[type=checkbox], input[type=radio] { width:16px; height:16px; }
+#wpsg-bs input[type=checkbox]:checked::before { width:14px; height:14px; margin:0; }
+#wpsg-bs input[type=radio]:checked::before { width:6px; height:6px; margin:4px; }
 
 /* Allgemeine Klassen */
Index: /views/mods/mod_paypalapi/order_view_afterpayment.phtml
===================================================================
--- /views/mods/mod_paypalapi/order_view_afterpayment.phtml	(revision 7716)
+++ /views/mods/mod_paypalapi/order_view_afterpayment.phtml	(revision 7717)
@@ -6,6 +6,6 @@
 	
 	$wpsg_mod_paypalapi_paymentid = $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_paymentid');
-	$wpsg_mod_paypalapi_saleid = $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_saleid')
-	
+	$wpsg_mod_paypalapi_saleid = $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_saleid');
+
 ?>
 
@@ -18,5 +18,5 @@
 			//WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=ajax&noheader=1&mod=wpsg_mod_paypalapi&do=refresh&edit_id='.$this->view['oOrder']->id
 		),
-		wpsg_translate(__('#1# (#2#)', 'wpsg'), $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_paymentid'), $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_paymentstate'))
+		wpsg_translate(__('#1# (#2#)', 'wpsg'), $wpsg_mod_paypalapi_paymentid, $this->view['oOrder']->getMeta('wpsg_mod_paypalapi_paymentstate'))
 	); ?>
 
Index: /views/mods/mod_printshop/basket_row_before.phtml
===================================================================
--- /views/mods/mod_printshop/basket_row_before.phtml	(revision 7716)
+++ /views/mods/mod_printshop/basket_row_before.phtml	(revision 7717)
@@ -26,5 +26,5 @@
         <span class="label"><?php echo __("FlÃ€che", "wpsg"); ?></span>
         <span class="rect">
-            (<?php echo wpsg_ff($view['width'], $view['unit_price'], true, 0); ?> x <?php echo wpsg_ff($view['length'], $view['unit_price'], true, 0); ?>)
+            (<?php echo wpsg_ff($view['width'], $view['unit_input'], true, 0); ?> x <?php echo wpsg_ff($view['length'], $view['unit_input'], true, 0); ?>)
         </span>
     </div>
Index: /views/mods/mod_printshop/mail_row.phtml
===================================================================
--- /views/mods/mod_printshop/mail_row.phtml	(revision 7716)
+++ /views/mods/mod_printshop/mail_row.phtml	(revision 7717)
@@ -10,9 +10,9 @@
 
     // 150,55 m x 1,5 m = 225,83 mÂ²
-    $strOut = wpsg_ff($view['width'], $view['unit_price'], true, 0).' x '.wpsg_ff($view['length'], $view['unit_price'], true, 0).' = '.wpsg_ff($view['area'], $view['unit_price'].'Â²');
+    $strOut = wpsg_ff($view['width'], $view['unit_input'], true, 0).' x '.wpsg_ff($view['length'], $view['unit_input'], true, 0).' = '.wpsg_ff($view['area'], $view['unit_price'].'Â²');
 
     // (1 mÂ² â
  1,00 EUR)
-    $strOut .= '('.wpsg_ff($view['price_onepice'], $this->get_option('wpsg_currency').' / '.$view['unit_price'].'Â²').')';
+    $strOut .= ' ('.wpsg_ff($view['price_onepice'], $this->get_option('wpsg_currency').' / '.$view['unit_price'].'Â²').')';
 
     echo wpsg_pad_left(__('GrÃ¶Ãe:', 'wpsg').' ', 12); ?><?php echo $strOut; ?>
Index: /views/mods/mod_printshop/mail_row_html.phtml
===================================================================
--- /views/mods/mod_printshop/mail_row_html.phtml	(revision 7716)
+++ /views/mods/mod_printshop/mail_row_html.phtml	(revision 7717)
@@ -14,5 +14,5 @@
     <td style="padding:4px; line-height:100%; vertical-align:middle;" class="col_pos">&nbsp;</td>
     <td style="padding:4px; line-height:100%; vertical-align:middle;" class="col_productvars_value" colspan="<?php echo ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?'5':'4'); ?>">
-        <?php echo __('GrÃ¶Ãe', 'wpsg'); ?>:&nbsp;<?php echo wpsg_ff($view['width'], $view['unit_price'], true, 0); ?> x <?php echo wpsg_ff($view['length'], $view['unit_price'], true, 0); ?> = <?php echo wpsg_ff($view['area'], $view['unit_price'].'Â²'); ?>
+        <?php echo __('GrÃ¶Ãe', 'wpsg'); ?>:&nbsp;<?php echo wpsg_ff($view['width'], $view['unit_input'], true, 0); ?> x <?php echo wpsg_ff($view['length'], $view['unit_input'], true, 0); ?> = <?php echo wpsg_ff($view['area'], $view['unit_price'].'Â²'); ?>
         (1 <?php echo $view['unit_price'] ?>Â² &cong; <?php echo wpsg_ff($view['price_onepice'], $this->get_option('wpsg_currency')); ?>)
     </td>
Index: /views/mods/mod_printshop/overview_row_before.phtml
===================================================================
--- /views/mods/mod_printshop/overview_row_before.phtml	(revision 7716)
+++ /views/mods/mod_printshop/overview_row_before.phtml	(revision 7717)
@@ -26,5 +26,5 @@
         <span class="label"><?php echo __("FlÃ€che", "wpsg"); ?></span>
         <span class="rect">
-            (<?php echo wpsg_ff($view['width'], $view['unit_price'], true, 0); ?> x <?php echo wpsg_ff($view['length'], $view['unit_price'], true, 0); ?>)
+            (<?php echo wpsg_ff($view['width'], $view['unit_input'], true, 0); ?> x <?php echo wpsg_ff($view['length'], $view['unit_input'], true, 0); ?>)
         </span>
     </div>
Index: /views/mods/mod_printshop/produkt_addedit_content.phtml
===================================================================
--- /views/mods/mod_printshop/produkt_addedit_content.phtml	(revision 7716)
+++ /views/mods/mod_printshop/produkt_addedit_content.phtml	(revision 7717)
@@ -43,5 +43,7 @@
 		<br />
 		
-		<?php echo wpsg_drawForm_Input('wpsg_mod_printshop[unit_price]', __('Einheit (Ohne Â²)'), $view['unit_price']); ?>
+		<?php echo wpsg_drawForm_Input('wpsg_mod_printshop[unit_price]', __('Preiseinheit (Ohne Â²)', 'wpsg'), $view['unit_price']); ?>
+        <?php echo wpsg_drawForm_Input('wpsg_mod_printshop[unit_input]', __('Eingabeeinheit (Ohne Â²)', 'wpsg'), $view['unit_input']); ?>
+        <?php echo wpsg_drawForm_Input('wpsg_mod_printshop[factor_price_input]', __('Faktor Preis- zu Eingabeeinheit', 'wpsg'), wpsg_ff($view['factor_price_input'], false, true, 0)); ?>
 		
 		<div class="wpsg_mod_printshop_mode wpsg_mod_printshop_mode_<?php echo wpsg_mod_printshop::MODE_AREA; ?>">
@@ -194,5 +196,5 @@
     jQuery(document).ready(function() {
 
-        jQuery('#wpsg_mod_printshop_productupload_set').on('change', function() {
+        jQuery('#wpsg_mod_printshopproductupload_set').on('change', function() {
 
             if (jQuery(this).prop('checked') === true) {
