Index: /changelog
===================================================================
--- /changelog	(revision 8212)
+++ /changelog	(revision 8213)
@@ -559,2 +559,3 @@
 - Bugfix: user_views Templates werden aus dem Child-Theme geladen
 - Bugfix: Rechnungsmodul: Anzeigefehler von Produktsumme behoben
+- Bugfix: Link zum Download von multiRechnungen korrigiert
Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 8212)
+++ /controller/wpsg_OrderController.class.php	(revision 8213)
@@ -1642,5 +1642,5 @@
 
 							// Damit alle Produkte der Bestellung ausgewÃ€hlt werden
-							if(!$_REQUEST['invoice_products']) {
+							if(!isset($_REQUEST['invoice_products'])) {
 
 								$db_invoice_products = $this->db->fetchAssoc("
@@ -1700,13 +1700,15 @@
 						{
 
+                            /*
 							wpsg_debug($arIDs);
 							wpsg_debug(implode('_', $arIDs));
 							wpsg_debug(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&noheader=1&do=writeMultiRechnung&ids='.implode('_', $arIDs));
 							die();
-							
-							// Downloadlink buggy
-							$this->addBackendMessage(
+                            http://127.0.0.1/wp-admin/admin.php?page=wpsg-Order&noheader=1&wpsg_action=showRechnung&ids=12159_12160
+							*/
+
+                            $this->addBackendMessage(
 								'nohspc_'.wpsg_translate(__('#1# Rechnungen geschrieben', 'wpsg'), $nWriteRechnung)
-								.' <a href="'.WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&noheader=1&do=writeMultiRechnung&ids='.implode('_', $arIDs).'" target="_new">'.__('Download', 'wpsg').'</a>'
+								.' <a href="'.WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&noheader=1&wpsg_action=showRechnung&ids='.implode('_', $arIDs).'" target="_new">'.__('Download', 'wpsg').'</a>'
 							);
 
@@ -1790,5 +1792,5 @@
 						}
 						
-					} else if (is_numeric($_REQUEST['wpsg_action']) || preg_match('/\d+\_\d+/', $_REQUEST['wpsg_action'])) {
+					} else if (is_numeric($_REQUEST['wpsg_action']) || preg_match('/\d+\_\d+/', ($_REQUEST['wpsg_action']??''))) {
 
 						// Status setzen
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 8212)
+++ /controller/wpsg_ShopController.class.php	(revision 8213)
@@ -9,4 +9,6 @@
 		/**  Array mit allen Installierten Modulen */
 		var $arModule;
+
+        var $text_message;
 
 		/** True, wenn eine Lizenz verwendet wird */
@@ -1449,6 +1451,5 @@
                     
                 }
-                
-                
+
                 // Warenkorbseite
                 $page_id = $this->get_option('wpsg_page_basket');
@@ -1482,5 +1483,4 @@
                 	
                 }
-                	
 
                 // Produktdetailseite
@@ -3799,40 +3799,40 @@
 			$arReplace['/%rand%/'] = rand(0, 1000);
 
-			$arReplace['/%a%/'] = strftime('%a');
-			$arReplace['/%A%/'] = strftime('%A');
-			$arReplace['/%b%/'] = strftime('%b');
-			$arReplace['/%B%/'] = strftime('%B');
-			$arReplace['/%c%/'] = strftime('%c');
-			$arReplace['/%C%/'] = strftime('%C');
-			$arReplace['/%d%/'] = strftime('%d');
-			$arReplace['/%D%/'] = strftime('%D');
-			$arReplace['/%e%/'] = strftime('%e');
-			$arReplace['/%g%/'] = strftime('%g');
-			$arReplace['/%G%/'] = strftime('%G');
-			$arReplace['/%h%/'] = strftime('%h');
-			$arReplace['/%H%/'] = strftime('%H');
-			$arReplace['/%I%/'] = strftime('%I');
-			$arReplace['/%j%/'] = strftime('%j');
-			$arReplace['/%m%/'] = strftime('%m');
-			$arReplace['/%M%/'] = strftime('%M');
-			$arReplace['/%n%/'] = strftime('%n');
-			$arReplace['/%p%/'] = strftime('%p');
-			$arReplace['/%r%/'] = strftime('%r');
-			$arReplace['/%R%/'] = strftime('%R');
-			$arReplace['/%S%/'] = strftime('%S');
-			$arReplace['/%t%/'] = strftime('%t');
-			$arReplace['/%T%/'] = strftime('%T');
-			$arReplace['/%u%/'] = strftime('%u');
-			$arReplace['/%U%/'] = strftime('%U');
-			$arReplace['/%V%/'] = strftime('%V');
-			$arReplace['/%w%/'] = strftime('%w');
-			$arReplace['/%W%/'] = strftime('%W');
-			$arReplace['/%x%/'] = strftime('%x');
-			$arReplace['/%X%/'] = strftime('%X');
-			$arReplace['/%y%/'] = strftime('%y');
-			$arReplace['/%y1%/'] = strftime('%y', mktime(date('H'), date('i'), date('s'), date('n'), date('j'), date('Y') + 1));
-			$arReplace['/%Y%/'] = strftime('%Y');
-			$arReplace['/%Y1%/'] = strftime('%Y', mktime(date('H'), date('i'), date('s'), date('n'), date('j'), date('Y') + 1));
-			$arReplace['/%Z%/'] = strftime('%Z');
+			$arReplace['/%a%/'] = wpsg_strftime('%a');
+			$arReplace['/%A%/'] = wpsg_strftime('%A');
+			$arReplace['/%b%/'] = wpsg_strftime('%b');
+			$arReplace['/%B%/'] = wpsg_strftime('%B');
+			$arReplace['/%c%/'] = wpsg_strftime('%c');
+			$arReplace['/%C%/'] = wpsg_strftime('%C');
+			$arReplace['/%d%/'] = wpsg_strftime('%d');
+			$arReplace['/%D%/'] = wpsg_strftime('%D');
+			$arReplace['/%e%/'] = wpsg_strftime('%e');
+			$arReplace['/%g%/'] = wpsg_strftime('%g');
+			$arReplace['/%G%/'] = wpsg_strftime('%G');
+			$arReplace['/%h%/'] = wpsg_strftime('%h');
+			$arReplace['/%H%/'] = wpsg_strftime('%H');
+			$arReplace['/%I%/'] = wpsg_strftime('%I');
+			$arReplace['/%j%/'] = wpsg_strftime('%j');
+			$arReplace['/%m%/'] = wpsg_strftime('%m');
+			$arReplace['/%M%/'] = wpsg_strftime('%M');
+			$arReplace['/%n%/'] = wpsg_strftime('%n');
+			$arReplace['/%p%/'] = wpsg_strftime('%p');
+			$arReplace['/%r%/'] = wpsg_strftime('%r');
+			$arReplace['/%R%/'] = wpsg_strftime('%R');
+			$arReplace['/%S%/'] = wpsg_strftime('%S');
+			$arReplace['/%t%/'] = wpsg_strftime('%t');
+			$arReplace['/%T%/'] = wpsg_strftime('%T');
+			$arReplace['/%u%/'] = wpsg_strftime('%u');
+			$arReplace['/%U%/'] = wpsg_strftime('%U');
+			$arReplace['/%V%/'] = wpsg_strftime('%V');
+			$arReplace['/%w%/'] = wpsg_strftime('%w');
+			$arReplace['/%W%/'] = wpsg_strftime('%W');
+			$arReplace['/%x%/'] = wpsg_strftime('%x');
+			$arReplace['/%X%/'] = wpsg_strftime('%X');
+			$arReplace['/%y%/'] = wpsg_strftime('%y');
+			$arReplace['/%y1%/'] = wpsg_strftime('%y', mktime(date('H'), date('i'), date('s'), date('n'), date('j'), date('Y') + 1));
+			$arReplace['/%Y%/'] = wpsg_strftime('%Y');
+			$arReplace['/%Y1%/'] = wpsg_strftime('%Y', mktime(date('H'), date('i'), date('s'), date('n'), date('j'), date('Y') + 1));
+			$arReplace['/%Z%/'] = wpsg_strftime('%Z');
 
 			$arReplace['/%widerrufsformular_url%/i'] = WPSG_URL_UPLOADS.'wpsg_revocation/'.$this->get_option('wpsg_revocationform');
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 8212)
+++ /lib/functions.inc.php	(revision 8213)
@@ -1,5 +1,7 @@
 <?php
 
-    function wpsg_strftime($format, $timestamp) {
+    function wpsg_strftime($format, $timestamp = null) {
+
+        if ($timestamp === null) $timestamp = time();
 
         if (class_exists('IntlDateFormatter')) {
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 8212)
+++ /lib/wpsg_basket.class.php	(revision 8213)
@@ -12,5 +12,8 @@
 		/** @var wpsg_db */
 		var $db;
-		
+
+        /** @var array */
+        var $arOrder = [];
+
 		/** @var wpsg_ShopController */
 		var $shop;
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 8212)
+++ /lib/wpsg_calculation.class.php	(revision 8213)
@@ -1701,5 +1701,5 @@
 				$oCountry = \wpsg_country::getInstance($country_id);
 			
-				$tax_value = (($tax['key'] === '0')?0:$this->arCountry[$country_id][$tax['key']]);
+				$tax_value = (($tax['key'] === '0' || !isset($this->arCountry[$country_id][$tax['key']]))?0:$this->arCountry[$country_id][$tax['key']]);
 				
 				if ($oCountry->isLoaded()) {
Index: /lib/wpsg_fpdf.class.php
===================================================================
--- /lib/wpsg_fpdf.class.php	(revision 8212)
+++ /lib/wpsg_fpdf.class.php	(revision 8213)
@@ -242,6 +242,7 @@
 			$value = str_replace('â', '-', $value);
 			$value = str_replace("â¬", '&euro;', $value);
-			$value = utf8_decode($value);
-			$value = str_replace("&euro;", chr(128), $value); 
+			//$value = utf8_decode($value);
+			$value = iconv('UTF-8', 'ISO-8859-1', $value);
+            $value = str_replace("&euro;", chr(128), $value);
 			
 			return $value;
@@ -251,3 +252,2 @@
 	}
 
-?>
Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 8212)
+++ /model/wpsg_order.class.php	(revision 8213)
@@ -806,5 +806,5 @@
 			$arAnrede = explode('|', $this->shop->get_option('wpsg_admin_pflicht')['anrede_auswahl']);
 			if ($title < 0) return '';
-			else return $arAnrede[$title];
+			else return $arAnrede[$title]??'';
 			
 		}	// public function getShippingTitle()
Index: /model/wpsg_order_product.class.php
===================================================================
--- /model/wpsg_order_product.class.php	(revision 8212)
+++ /model/wpsg_order_product.class.php	(revision 8213)
@@ -101,5 +101,5 @@
 		public function getDescription() {
 			
-			return $this->data['beschreibung'];
+			return $this->data['beschreibung']??'';
 			
 		}
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 8212)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 8213)
@@ -1874,4 +1874,6 @@
 		 */
 		public function isVariantsProductKey($product_key) {
+
+            if ($product_key === null) $product_key = '';
 
 			if (preg_match('/^pv_\d+/', $product_key)) {
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 8212)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 8213)
@@ -76,5 +76,16 @@
 			
 		   	dbDelta($sql);
-		   	
+
+            $sql = "CREATE TABLE ".WPSG_TBL_ORDER_INVOICE." (
+                id int(25) NOT NULL AUTO_INCREMENT,
+                order_id INT(11) NOT NULL,
+                invoice_id INT(11) NOT NULL,
+                PRIMARY KEY  (id),
+				KEY order_id (order_id),
+				KEY invoice_id (invoice_id)
+            ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+
+            dbDelta($sql);
+
 		   	$this->shop->checkDefault('wpsg_rechnungen_pdfperpage', '10');
 			$this->shop->checkDefault('wpsg_mod_rechnungen_gutschrifttax', 'c');
@@ -780,5 +791,11 @@
 				
 		}
-		
+
+        public function systemcheck(&$arData) {
+
+
+
+        }
+
 		public function admin_emailconf_save()
 		{
@@ -2012,5 +2029,5 @@
 				
 			// StornierungsgebÃŒhr
-			if ($_REQUEST['storno_fee_set'] === '1') $storno_fee = $_REQUEST['storno_fee_value'];
+			if (($_REQUEST['storno_fee_set']??'0') === '1') $storno_fee = $_REQUEST['storno_fee_value'];
 			else $storno_fee = '';
 			
@@ -2184,16 +2201,21 @@
 			
 			$invoice_data = json_decode($oOrderProduct->getMeta('wpsg_mod_rechnungen_data', false, 'null'), true);
-			
-			foreach (array($invoice_data) as $id) {
-
-				try {
-				
-					$oInvoice = \wpsg\wpsg_invoice::getInstance($id['invoice_id']);
-
-					$arReturn[] = $oInvoice;
-					
-				} catch (\Exception $e) { }
-				
-			}
+
+            if (is_array($invoice_data)) {
+
+                foreach ($invoice_data as $id) {
+
+                    try {
+
+                        $oInvoice = \wpsg\wpsg_invoice::getInstance($id['invoice_id']);
+
+                        $arReturn[] = $oInvoice;
+
+                    } catch (\Exception $e) {
+                    }
+
+                }
+
+            }
 			
 			return $arReturn;
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 8212)
+++ /wpshopgermany.php	(revision 8213)
@@ -44,4 +44,5 @@
 	define('WPSG_TBL_VA', $prefix.'wpsg_versandarten');
 	define('WPSG_TBL_RECHNUNGEN', $prefix.'wpsg_rechnungen');
+	define('WPSG_TBL_ORDER_INVOICE', $prefix.'wpsg_order_invoice');
 	define('WPSG_TBL_GUTSCHEIN', $prefix.'wpsg_gutscheine');
  	define('WPSG_TBL_PRODUCTS_REL', $prefix.'wpsg_products_related');
