Index: /changelog
===================================================================
--- /changelog	(revision 7985)
+++ /changelog	(revision 7987)
@@ -503,4 +503,6 @@
 - Bugfix: KompatibilitÃ€t mit alten Bestellungen verbessert (KostenschlÃŒssel Versandarten auf Gewicht)
 - Bugfix: Leere HTML Mails 
+- Bugfix: Verwendung unter PHP8 erzeugt keinen Fehler mehr wenn kein Winkel bei den Textfeldern Gutscheinprodukt definiert ist
+- Feature: Neue Platzhalter fÃŒr Liefer- und Rechnungsadresse 
 - Feature: Staffelpreise kÃ¶nnen jetzt angewendet werden wenn im Backend ein Produkt hinzugefÃŒgt wird #776
 - Feature: Abo Modul: Spalten im Backend lassen sich sortieren
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7985)
+++ /controller/wpsg_ShopController.class.php	(revision 7987)
@@ -1166,6 +1166,8 @@
 		 * Gibt ein Modul -1 zurÃŒck wird kein weiteres Modul mehr angefragt
 		 */
-		public function callMods($func_name, $arParam = array()) {
+		public function callMods($func_name, $arParam = array(), $fixView = false) {
 		                
+			if ($fixView) $view = $this->view;
+			
 		    \do_action('wpsg_'.$func_name, $arParam);
 		    
@@ -1176,12 +1178,18 @@
 					$b = call_user_func_array(array($m, $func_name), $arParam);
 
-                    //echo $m_key.":".$func_name.":".$b."\r\n";
-
 					if ($b == -1) break;
-					else if ($b == -2) return false;
-
-				}
-
-			}
+					else if ($b == -2) {
+					
+						if ($fixView) $this->view = $view;
+						
+						return false;
+
+					}
+
+				}
+
+			}
+			
+			if ($fixView) $this->view = $view;
 			
 			return true;
@@ -2587,7 +2595,7 @@
             if ($this->view['order']['status'] == $status_id) return false;
 
-            // Muss vor der Mailsache aufgerufen werden da sonst die Felder der Bestellung nicht gesetzt sind (Paketverfolgung)
+			// Muss vor der Mailsache aufgerufen werden da sonst die Felder der Bestellung nicht gesetzt sind (Paketverfolgung)
             // Die Bestellung darf auch noch nicht geladen sein, sonst wird das Objekt aus dem Cache genommen
-            $this->callMods('setOrderStatus', array($order_id, $status_id, $inform));
+            $this->callMods('setOrderStatus', array($order_id, $status_id, $inform), true);
             
 			if (trim($this->view['order']['language']) != '') {
@@ -3556,5 +3564,6 @@
 				
 				$order_data = $this->cache->loadOrder($order_id);
-
+				$oOrder = wpsg_order::getInstance($order_id);
+				
 				if (!wpsg_isSizedInt($kunden_id)) {
 
@@ -3580,5 +3589,25 @@
 				$arReplace['/%order_cdate_format_de%/i'] = date("d.m.Y | H:i", strtotime($order_data['cdate']));
 				$arReplace['/%order_done_url%/i'] = $this->getDoneURL($order_id);
-
+ 
+				$arReplace['/%order_shipping_title%/i'] = $oOrder->getShippingTitle();
+				$arReplace['/%order_shipping_name%/i'] = $oOrder->getShippingName();
+				$arReplace['/%order_shipping_vname%/i'] = $oOrder->getShippingFirstName();
+				$arReplace['/%order_shipping_firma%/i'] = $oOrder->getShippingCompany();
+				$arReplace['/%order_shipping_strasse%/i'] = $oOrder->getShippingStreetClear();
+				$arReplace['/%order_shipping_nr%/i'] = $oOrder->getShippingStreetNr();
+				$arReplace['/%order_shipping_plz%/i'] = $oOrder->getShippingZip();
+				$arReplace['/%order_shipping_ort%/i'] = $oOrder->getShippingCity();
+				$arReplace['/%order_shipping_land%/i'] = $oOrder->getShippingCountryName();
+				
+				$arReplace['/%order_invoice_title%/i'] = $oOrder->getInvoiceTitle();
+				$arReplace['/%order_invoice_name%/i'] = $oOrder->getInvoiceName();
+				$arReplace['/%order_invoice_vname%/i'] = $oOrder->getInvoiceFirstName();
+				$arReplace['/%order_invoice_firma%/i'] = $oOrder->getInvoiceCompany();
+				$arReplace['/%order_invoice_strasse%/i'] = $oOrder->getInvoiceStreetClear();
+				$arReplace['/%order_invoice_nr%/i'] = $oOrder->getInvoiceStreetNr();
+				$arReplace['/%order_invoice_plz%/i'] = $oOrder->getInvoiceZip();
+				$arReplace['/%order_invoice_ort%/i'] = $oOrder->getInvoiceCity();
+				$arReplace['/%order_invoice_land%/i'] = $oOrder->getInvoiceCountryName();
+				
 			}
 
Index: /controller/wpsg_SystemController.class.php
===================================================================
--- /controller/wpsg_SystemController.class.php	(revision 7985)
+++ /controller/wpsg_SystemController.class.php	(revision 7987)
@@ -163,5 +163,5 @@
             if (is_object($result) && get_class($result) == 'WP_Error') {
 
-                throw new \Exception($result->get_error_message());
+                throw new \Exception($result->get_error_message().':'.$url);
 
             } else return $result['body'];
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7985)
+++ /lib/wpsg_calculation.class.php	(revision 7987)
@@ -1036,5 +1036,6 @@
 					'product_set' => wpsg_q($p['set']),
 					'product_bruttonetto' => wpsg_q($p['bruttonetto']),
-					'euleistungsortregel' => wpsg_q($p['eu'])
+					'euleistungsortregel' => wpsg_q($p['eu']),
+					//'mod_vp_varkey' => getmypid() // GehÃ¶rt Raus, nur Debug
 				];
 				
Index: /lib/wpsg_fpdf.class.php
===================================================================
--- /lib/wpsg_fpdf.class.php	(revision 7985)
+++ /lib/wpsg_fpdf.class.php	(revision 7987)
@@ -92,5 +92,6 @@
 				if ($angle == "" || $angle == 0) 
 				{
-					
+				
+					$angle = 0;
 					$x = $x - $h;
 											
Index: /model/wpsg_order_product.class.php
===================================================================
--- /model/wpsg_order_product.class.php	(revision 7985)
+++ /model/wpsg_order_product.class.php	(revision 7987)
@@ -181,5 +181,5 @@
 				
 			} else {
-				
+			 
 				return intval($this->p_id);
 				
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 7985)
+++ /mods/wpsg_mod_abo.class.php	(revision 7987)
@@ -537,10 +537,38 @@
 
 			date_default_timezone_set('Europe/Berlin');
-
+									
+			$upload_dir = wp_upload_dir();
+			$pid_file = $upload_dir['basedir'].'/wpsg_cron_abo';
+			
+			file_put_contents($upload_dir['basedir'].'/wpsg_cron_abo_log', date('d.m.Y H:i:s').' '.getmypid().' '.$_SERVER['REQUEST_URI'].' '.file_exists($pid_file)."\r\n", FILE_APPEND);
+			
+			if (file_exists($pid_file)) die("Cron lÃ€uft seit ".date('d.m.Y H:i:s', intval(file_get_contents($pid_file))));
+			else file_put_contents($pid_file, time());
+			
 			$t_start = microtime(true);
-			
+			 
+			$checkEndCron = function() use ($t_start, $pid_file) {
+			
+				if (($GLOBALS['wpsg_mod_abo_cron_count']??0) > 50) {
+					
+					$this->shop->update_option('wpsg_mod_abo_cron_lastrun', time());
+					$this->shop->update_option('wpsg_mod_abo_cron_run', '0');
+		
+					unlink($pid_file); die("END");
+					
+				}
+				
+			};
+						
 			// Parallele AusfÃŒhrung verhindern
-			$wpsg_mod_abo_cron_lastrun = intval($this->shop->get_option('wpsg_mod_abo_cron_lastrun'));			
-			if ($wpsg_mod_abo_cron_lastrun > 0 && $wpsg_mod_abo_cron_lastrun > time() - 1 * 60) return;
+			//$wpsg_mod_abo_cron_lastrun = intval($this->shop->get_option('wpsg_mod_abo_cron_lastrun'));			
+			//if ($wpsg_mod_abo_cron_lastrun > 0 && $wpsg_mod_abo_cron_lastrun > time() - 120 * 60) return;
+			if (intval($this->shop->get_option('wpsg_mod_abo_cron_run')) === 1) return;			
+			
+			$this->shop->update_option('wpsg_mod_abo_cron_run', 1);
+			$this->shop->update_option('wpsg_mod_abo_cron_start', time());
+			 
+			@ini_set('memory_limit', '2000M');
+			@set_time_limit(60 * 4);
 			
             //$d1 = date_create('2022-04-20 12:05:00');
@@ -598,5 +626,6 @@
 						
 						//wpsg_debug("1");
-                    	$this->autoExtendOrder($a['order_id'], $a['order_product_id']);
+                    	$this->autoExtendOrder($a['order_id'], $a['order_product_id'], intval($a['id']));
+						$checkEndCron();
 
                     	$handledAboIDs[] = intval($a['id']);
@@ -643,6 +672,7 @@
 
 					//wpsg_debug("2");
-                    $this->autoExtendOrder($a['order_id'], $a['order_product_id']);
-
+                    $this->autoExtendOrder($a['order_id'], $a['order_product_id'], intval($a['id']));
+					$checkEndCron();
+					
                 } else {
 
@@ -660,9 +690,8 @@
 
             $this->shop->update_option('wpsg_mod_abo_cron_lastrun', time());
-
-			$t_end = microtime(true) - $t_start;
-			
-			//mail("", "CRON: ".$t_end.'s', '');
-			
+			$this->shop->update_option('wpsg_mod_abo_cron_run', '0');
+
+			unlink($pid_file);
+						
 		}
 
@@ -730,4 +759,5 @@
 			// Ist so ein Abo Produkt schon im Warenkorb?
 			$nDrin = false;
+			
 			if (wpsg_isSizedArray($_SESSION['wpsg']['basket'])) {
 
@@ -779,4 +809,15 @@
 				    $_SESSION['wpsg']['checkout']['payment'] = $oOrderProduct->getOrder()->getPaymentID();
 
+					if (intval($_SESSION['wpsg']['checkout']['payment']) === 20) {
+						
+						$_SESSION['wpsg']['checkout']['mod_autodebit_name'] = $oOrderProduct->getOrder()->__get('mod_autodebit_name');
+						$_SESSION['wpsg']['checkout']['mod_autodebit_blz'] = $oOrderProduct->getOrder()->__get('mod_autodebit_blz');
+						$_SESSION['wpsg']['checkout']['mod_autodebit_bic'] = $oOrderProduct->getOrder()->__get('mod_autodebit_bic');
+						$_SESSION['wpsg']['checkout']['mod_autodebit_inhaber'] = $oOrderProduct->getOrder()->__get('mod_autodebit_inhaber');
+						$_SESSION['wpsg']['checkout']['mod_autodebit_knr'] = $oOrderProduct->getOrder()->__get('mod_autodebit_knr');
+						$_SESSION['wpsg']['checkout']['mod_autodebit_iban'] = $oOrderProduct->getOrder()->__get('mod_autodebit_iban');
+												
+					} 
+					
                 } else {
 
@@ -784,4 +825,25 @@
 
                 }
+				
+				$shipping_adress_id = intval($oOrderProduct->getOrder()->__get('shipping_adress_id'));
+				
+				if ($shipping_adress_id > 0) {
+				
+					$row_adress = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ADRESS."` WHERE `id` = '".wpsg_q($shipping_adress_id)."' ");
+					
+					$_SESSION['wpsg']['checkout']['diff_shippingadress'] = '1';
+					
+					$_SESSION['wpsg']['checkout']['shipping_title'] = $row_adress['title'];
+					$_SESSION['wpsg']['checkout']['shipping_plz'] = $row_adress['plz'];
+					$_SESSION['wpsg']['checkout']['shipping_vname'] = $row_adress['vname'];
+					$_SESSION['wpsg']['checkout']['shipping_name'] = $row_adress['name'];
+					$_SESSION['wpsg']['checkout']['shipping_strasse'] = $row_adress['strasse'];
+					$_SESSION['wpsg']['checkout']['shipping_nr'] = $row_adress['nr'];
+					$_SESSION['wpsg']['checkout']['shipping_ort'] = $row_adress['ort'];
+					$_SESSION['wpsg']['checkout']['shipping_land'] = $row_adress['land'];
+					$_SESSION['wpsg']['checkout']['shipping_firma'] = $row_adress['firma'];
+					$_SESSION['wpsg']['checkout']['shipping_firma'] = $row_adress['firma'];
+						 	  					
+				}
 
 				$this->shop->addFrontendMessage(wpsg_translate(__('Abo VerlÃ€ngerung fÃŒr Produkt #1# eingefÃŒgt', 'wpsg'), $product_data['name']));
@@ -939,5 +1001,5 @@
 
         } // public function order_view($order_id, &$arSidebarArray)
-
+ 
         public function order_ajax() {
 
@@ -1108,4 +1170,19 @@
         }
 
+		private function resetCronAction() {
+			
+			$this->shop->update_option('wpsg_mod_abo_cron_run', false);
+			
+			$upload_dir = wp_upload_dir();
+			$pid_file = $upload_dir['basedir'].'/wpsg_cron_abo';
+			
+			unlink($pid_file);
+			
+			$this->shop->addBackendMessage(__('CRON ZurÃŒckgesetzt.', 'wpsg'));
+			
+			$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_abo');
+			
+		}
+		
         private function admin_inlineEditAction() {
 
@@ -1344,12 +1421,12 @@
          * @param $product_key
          */
-		public function autoExtendOrder($order_id, $order_product_id) {
+		public function autoExtendOrder($order_id, $order_product_id, $abo_id) {
 		
 		    $oOrderProduct = wpsg_order_product::getInstance($order_product_id);
             $product_id = $oOrderProduct->getProductId();
 
-            $order_extend_exist = intval($this->db->fetchOne("
+			$strQuery = "
 				SELECT
-					O.`id`
+					COUNT(*)
 				FROM
 					`".WPSG_TBL_ORDERPRODUCT."` AS OP
@@ -1360,11 +1437,15 @@
 					O.`payed_date` = '0000-00-00 00:00:00' AND
 					O.`status` != '".wpsg_ShopController::STATUS_STORNIERT."' 					
-			"));
-
+			";
+			
+            $order_extend_exist = intval($this->db->fetchOne($strQuery));
+			
 			//wpsg_debug('....');
 			//wpsg_debug("VerlÃ€ngere1: ".$order_id.":".$order_product_id);
 			
             if ($order_extend_exist > 0) return;
-						
+					
+			$GLOBALS['wpsg_mod_abo_cron_count'] = ($GLOBALS['wpsg_mod_abo_cron_count']??0) + 1; 
+			
 			//wpsg_debug("VerlÃ€ngere1.5: ".$order_id.":".$order_product_id);
 			
@@ -1426,9 +1507,24 @@
             $new_o_id = $oBasket->save(true, false);
 
-			$this->db->UpdateQuery(WPSG_TBL_ORDER, [
-				'type_shipping' => wpsg_q($oOrder->type_shipping)
-			], " `id` = '".wpsg_q($oOrder->getId())."' ");
-			
-			//mail("daniel@maennchen1.de", "CRON TEST: ".'abo_'.$order_id.'_'.$order_product_id.' = '.$new_o_id, "VerlÃ€ngere ".$order_id.":".$order_product_id);
+			$db_update = [
+				'type_shipping' => wpsg_q($oOrder->type_shipping),
+				'shipping_key' => wpsg_q($oOrder->shipping_key),
+				'shipping_set' => wpsg_q($oOrder->shipping_set)
+			];
+			
+			if ($this->shop->hasMod('wpsg_mod_autodebit')) {
+				 
+				$order_data_old = $this->shop->cache->loadOrder($order_id);
+				
+				$db_update['mod_autodebit_name'] = wpsg_q($order_data_old['mod_autodebit_name']);
+				$db_update['mod_autodebit_blz'] = wpsg_q($order_data_old['mod_autodebit_blz']);
+				$db_update['mod_autodebit_bic'] = wpsg_q($order_data_old['mod_autodebit_bic']);
+				$db_update['mod_autodebit_inhaber'] = wpsg_q($order_data_old['mod_autodebit_inhaber']);
+				$db_update['mod_autodebit_knr'] = wpsg_q($order_data_old['mod_autodebit_knr']);
+				$db_update['mod_autodebit_iban'] = wpsg_q($order_data_old['mod_autodebit_iban']);
+				 
+			}
+			
+			$this->db->UpdateQuery(WPSG_TBL_ORDER, $db_update, " `id` = '".wpsg_q($new_o_id)."' ");
 			
             $arBasket['checkout']['knr'] = $customer_db_data['knr'];
@@ -1444,5 +1540,5 @@
 			//wpsg_debug("VerlÃ€ngere5: ".$order_id.":".$order_product_id.":".$oOrder->getId());
 			
-            $oOrder->addLogEntry(__('VerlÃ€ngerung erworben', 'wpsg'), 'OrderID: '.$order_id.'/'.$new_o_id);
+            $oOrder->addLogEntry(__('VerlÃ€ngerung erworben', 'wpsg'), 'OrderID: '.$order_id.'/'.$order_product_id.'/'.$product_id.'/'.$new_o_id.'/'.$abo_id.'/'.getmypid());
 
             $oBasket->sendOrderSaveMails($new_o_id, $arBasket, $bCustomerMail, $bAdminMail);
@@ -1739,5 +1835,5 @@
 
 		/**
-		 * Sendet die Mail bei verlÃ€ngerung eines Abos
+		 * Sendet die Mail bei VerlÃ€ngerung eines Abos
 		 * @param int $order_key BestellID
 		 * @param String $product_id ProduktKey
Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 7985)
+++ /mods/wpsg_mod_export.class.php	(revision 7987)
@@ -169,10 +169,9 @@
         } // public function profilList()
 
-        public function handleExport()
-        {
-
+        public function handleExport() {
+			
             $arProfile = wpsg_xss(array_values($_REQUEST['wpsg_mod_export_profile']));
 
-            set_time_limit(300);
+            set_time_limit(2400);
 
             parse_str($_REQUEST['filter'], $filter);
Index: /views/mailtemplates/adminmail.phtml
===================================================================
--- /views/mailtemplates/adminmail.phtml	(revision 7985)
+++ /views/mailtemplates/adminmail.phtml	(revision 7987)
@@ -7,4 +7,6 @@
 	$this->htmlMail = false;
  
+    
+    
 ?><?php echo __('Hallo Administrator,', 'wpsg'); ?> 
  
Index: /views/mods/mod_abo/settings_edit.phtml
===================================================================
--- /views/mods/mod_abo/settings_edit.phtml	(revision 7985)
+++ /views/mods/mod_abo/settings_edit.phtml	(revision 7987)
@@ -123,5 +123,17 @@
 
 <?php echo wpsg_drawForm_Input(false, __('CRON URL', 'wpsg'), site_url().'/?wpsg_cron=1', ['readonly' => true]); ?>
-<?php echo wpsg_drawForm_Text(__('Letzter Cron Aufruf', 'wpsg'), wpsg_formatTimestamp($this->get_option('wpsg_mod_abo_cron_lastrun'), false, true)); ?>
+
+<?php echo wpsg_drawForm_TextStart(); ?>
+
+    <span><?php echo __('Letzter Lauf: ', 'wpsg'); ?><?php echo wpsg_formatTimestamp($this->get_option('wpsg_mod_abo_cron_lastrun'), false, true); ?></span><br />
+    <span>
+        <?php echo __('Status: ', 'wpsg'); ?><?php echo (($this->get_option('wpsg_mod_abo_cron_run') === '1')?_('LÃ€uft gerade'):_('Wartend')); ?> 
+        <?php if ($this->get_option('wpsg_mod_abo_cron_run') === '1') { ?>
+            (<?php echo __('Start: ', 'wpsg'); ?><?php echo wpsg_formatTimestamp($this->get_option('wpsg_mod_abo_cron_start'), false, true); ?>)
+            <a href="<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_abo&subaction=resetCron&noheader=1'; ?>"><?php echo __('ZurÃŒcksetzen', 'wpsg'); ?></a>
+        <?php } ?>
+    </span>
+
+<?php echo wpsg_drawForm_TextEnd(__('Cron Status')); ?>
 
 <br /> 
Index: /views/mods/mod_shippingadress/checkout_inner_prebutton.phtml
===================================================================
--- /views/mods/mod_shippingadress/checkout_inner_prebutton.phtml	(revision 7985)
+++ /views/mods/mod_shippingadress/checkout_inner_prebutton.phtml	(revision 7987)
@@ -35,6 +35,6 @@
 				<option value="-1"><?php echo __('Bitte auswÃ€hlen', 'wpsg'); ?></option>
 				<?php $i=0; foreach (explode("|", $this->view['pflicht']['anrede_auswahl']) as $t) { ?>
-				<option value="<?php echo $i; /*wpsg_hspc($t);*/ $i++; ?>" <?php echo ((wpsg_isSizedString($this->view['basket']['checkout']['shipping_title'], $t))?'selected="selected"':''); ?>><?php echo $t; ?></option>
-				<?php } ?>
+				<option value="<?php echo $i; /*wpsg_hspc($t);*/ ?>" <?php echo ((($this->view['basket']['checkout']['shipping_title']??'') === strval($i))?'selected="selected"':''); ?>><?php echo $t; ?></option>
+				<?php $i++; } ?>
 				</select>
 			</div>
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 7985)
+++ /wpshopgermany.php	(revision 7987)
@@ -15,5 +15,5 @@
 
 	global $wpdb;
-	
+ 
 	if (defined('MULTISITE') && MULTISITE === true && get_site_option('wpsg_multiblog_standalone', true) != '1') {
 		
