Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7257)
+++ /controller/wpsg_ShopController.class.php	(revision 7258)
@@ -721,4 +721,38 @@
         } // public function init()
         
+		public function getShopLocations() {
+        	
+        	$arReturn = [
+        		1 => [
+					'label' => __('Hauptsitz', 'wpsg'),
+					'street' => $this->get_option('wpsg_shopdata_street'),
+					'zip' => $this->get_option('wpsg_shopdata_zip'),
+					'city' => $this->get_option('wpsg_shopdata_city'),
+					'country' => $this->getDefaultCountry()->getName(),
+					'tel' => $this->get_option('wpsg_shopdata_tel'),
+					'fax' => $this->get_option('wpsg_shopdata_fax'),
+					'email' => $this->get_option('wpsg_shopdata_email')
+				],
+			];
+        	
+        	if ($this->get_option('wpsg_shopdata_2') === '1') { 
+        		
+        		$arReturn[2] = [
+        			'label' => __('Zweigstelle', 'wpsg'),
+        			'street' => $this->get_option('wpsg_shopdata_2_street'),
+					'zip' => $this->get_option('wpsg_shopdata_2_zip'),
+					'city' => $this->get_option('wpsg_shopdata_2_city'),
+					'country' => $this->get_option('wpsg_shopdata_2_country'),
+					'tel' => $this->get_option('wpsg_shopdata_2_tel'),
+					'fax' => $this->get_option('wpsg_shopdata_2_fax'),
+					'email' => $this->get_option('wpsg_shopdata_2_email')
+				];
+					
+			}
+			
+			return $arReturn;
+        	
+		}
+		
 		/**
 		 * Initiiert den Shop
Index: /lib/wpsg_basket_widget.class.php
===================================================================
--- /lib/wpsg_basket_widget.class.php	(revision 7257)
+++ /lib/wpsg_basket_widget.class.php	(revision 7258)
@@ -41,6 +41,8 @@
 
 	  		$GLOBALS['wpsg_sc']->render(WPSG_PATH_VIEW.'/warenkorb/index.phtml');
-	  	 	
-	  	} // function widget($args, $settings)
+		  
+			$GLOBALS['wpsg_sc']->basket->reset();
+		  
+		} // function widget($args, $settings)
 		
 	  	function form($instance) 
Index: ds/wpsg_mod_anschreiben.class.php
===================================================================
--- /mods/wpsg_mod_anschreiben.class.php	(revision 7257)
+++ 	(revision )
@@ -1,618 +1,0 @@
-<?php
-
-	/**
-	 * Modul zur Generierung von Anschreibenen
-	 * @author Daschmi
-	 */
-	class wpsg_mod_anschreiben extends wpsg_mod_basic
-	{
-		
-		var $lizenz = 0;
-		var $id = 2200;
-		var $hilfeURL = 'http://wpshopgermany.maennchen1.de/?p=3667';
-
-		
-		public function __construct()
-		{
-			
-			parent::__construct();
-				
-			$this->name = __('Anschreiben', 'wpsg');
-			$this->group = __('Bestellung', 'wpsg');
-			$this->desc = __('ErmÃ¶glicht die Erstellung von Anschreibenen.', 'wpsg');
-						
-		} // public function __construct()
-		
-		public function init()
-		{
-			
-			require_once(dirname(__FILE__).'/mod_anschreiben/wpsg_anschreiben.class.php');
-			
-			$this->fields = array(
-				'firma' => __('Firmenname', 'wpsg'),
-				'name' => __('Name', 'wpsg'),
-				'strasse' => __('StraÃe', 'wpsg'),
-				'plzort' => __('PLZ/Ort', 'wpsg'),
-				'land' => __('Land', 'wpsg'),
-				'tel' => __('Tel', 'wpsg'),
-				'fax' => __('Fax', 'wpsg'),
-				'mail' => __('E-Mail', 'wpsg'),
-				'web' => __('Web', 'wpsg'),
-				'strnr' => __('Steuer-Nr', 'wpsg'),
-				'ustidnr' => __('UStIdNr.', 'wpsg'),
-				'knr' => __('Kontonummer', 'wpsg'),
-				'blz' => __('BLZ', 'wpsg'),
-				'bank' => __('Bank', 'wpsg'),
-				'user1' => __('Benutzer 1', 'wpsg'),
-				'user2' => __('Benutzer 2', 'wpsg'),
-				'user3' => __('Benutzer 3', 'wpsg'),
-				'user4' => __('Benutzer 4', 'wpsg'),
-				'user5' => __('Benutzer 5', 'wpsg')
-			);
-			
-		} // public function init()
-		 
-		public function install()
-		{
-			
-			require_once(WPSG_PATH_WP.'/wp-admin/includes/upgrade.php');
-				
-			/**
-			 * Tabelle fÃŒr die Lieferanten
-			*/
-			$sql = "CREATE TABLE ".WPSG_TBL_anschreiben." (
-				id int(25) NOT NULL AUTO_INCREMENT,
-				order_id int(25) NOT NULL ,
-				cdate DATETIME NOT NULL ,
-				lnr VARCHAR(255) NOT NULL ,
-				delivery_date DATETIME NOT NULL ,
-				note TEXT NOT NULL,
-				cancel int(1) NOT NULL,		
-				product_indexes TEXT NOT NULL,
-				PRIMARY KEY  (id) 
-			) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
-							
-			// FrÃŒher gab es "product_keys" welches aber nicht eindeutig war, da es aktuell mehrmals den gleichen SchlÃŒssel im Warenkorb geben kann
-			
-			dbDelta($sql); 
-
-						
-			if ($this->shop->get_option('wpsg_mod_anschreiben_texte') === false) $this->resetAction();				
-			
-		} // public function install()
-
-		public function settings_edit()
-		{
-
-			$this->shop->view['wpsg_mod_anschreiben']['fields'] = $this->fields;
-			$this->shop->view['wpsg_mod_anschreiben']['arTexte'] = $this->shop->get_option('wpsg_mod_anschreiben_texte');
-			if (!is_array($this->shop->view['wpsg_mod_anschreiben']['arTexte'])) $this->shop->view['wpsg_mod_anschreiben']['arTexte'] = array();
-
-			if (file_exists($this->getFilePath('').'wpsg_anschreiben_bp.jpg'))
-			{
-				$this->shop->view['wpsg_mod_anschreiben']['bp'] = $this->getFilePath('', true).'wpsg_anschreiben_bp.jpg';
-			}
-			else if (file_exists($this->getFilePath('').'wpsg_anschreiben_bp.pdf'))
-			{
-				$this->shop->view['wpsg_mod_anschreiben']['bp'] = $this->getFilePath('', true).'wpsg_anschreiben_bp.pdf';
-			}
-			else
-			{
-				$this->shop->view['wpsg_mod_anschreiben']['bp'] = false;
-			}
-
-			if (file_exists($this->getFilePath('').'wpsg_anschreiben_logo.jpg'))
-			{
-				$this->shop->view['wpsg_mod_anschreiben']['logo'] = $this->getFilePath('', true).'wpsg_anschreiben_logo.jpg';
-			}
-			else
-			{
-				$this->shop->view['wpsg_mod_anschreiben']['logo'] = false;
-			}
-
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_anschreiben/settings_edit.phtml');
-
-		} // public function settings_edit()
-		
-		/**
-		 * zeigt das Formular zum Drucken in der Bestellverwaltung
-		 */
-		public function order_view($order_id, &$arSidebarArray)
-		{
-			
-			$arSidebarArray[$this->id] = array(
-				'title' => $this->name,
-				'content' => $this->shop->render(WPSG_PATH_VIEW.'mods/mod_anschreiben/order_view.phtml', false)
-			);
-			
-		} // public function order_view_content($order_id)
-
-		public function settings_save()
-		{
-
-			$this->shop->update_option("wpsg_mod_anschreiben_texte", $_REQUEST['text']);
-			$this->shop->update_option('wpsg_mod_anschreiben_adressrow', $_REQUEST['wpsg_mod_anschreiben_adressrow']);
-
-
-
-			if (file_exists($_FILES['wpsg_mod_anschreiben_bp']['tmp_name']))
-			{
-
-				$ending = strtolower(preg_replace("/(.*)\./", "", $_FILES['wpsg_mod_anschreiben_bp']['name']));
-
-				if ($ending != "jpg" && $ending != "jpeg" && $ending != "pdf")
-				{
-					$this->shop->addBackendError(__("UngÃŒltiger Dateityp (Briefpapier) ! Es sind nur JPG und PDF Dateien erlaubt!", "wpsg"));
-				}
-				else if ($ending == "jpg" || $ending == "jpeg")
-				{
-					move_uploaded_file($_FILES['wpsg_mod_anschreiben_bp']['tmp_name'], $this->getFilePath('').'wpsg_anschreiben_bp.jpg');
-				}
-				else if ($ending == "pdf")
-				{
-					move_uploaded_file($_FILES['wpsg_mod_anschreiben_bp']['tmp_name'], $this->getFilePath('').'wpsg_anschreiben_bp.pdf');
-				}
-
-			}
-			else if ((array_key_exists('wpsg_mod_anschreiben_bp_del', $_REQUEST)) && ($_REQUEST['wpsg_mod_anschreiben_bp_del'] == "1"))
-			{
-
-				@unlink($this->getFilePath('').'wpsg_anschreiben_bp.jpg');
-				@unlink($this->getFilePath('').'wpsg_anschreiben_bp.pdf');
-
-				$this->shop->addBackendMessage(__('Briefpapier wurde erfolgreich gelÃ¶scht.', 'wpsg'));
-
-			}
-
-
-			if (array_key_exists('wpsg_mod_anschreiben_logo_position_left', $_REQUEST) && strpos($_REQUEST['wpsg_mod_anschreiben_logo_position_left'], 'selected') !== false)
-				$wpsg_mod_anschreiben_logo_position = "left";
-
-			if (array_key_exists('wpsg_mod_anschreiben_logo_position_center', $_REQUEST) && strpos($_REQUEST['wpsg_mod_anschreiben_logo_position_center'], 'selected') !== false)
-				$wpsg_mod_anschreiben_logo_position = "center";
-
-			if (array_key_exists('wpsg_mod_anschreiben_logo_position_right', $_REQUEST) && strpos($_REQUEST['wpsg_mod_anschreiben_logo_position_right'], 'selected') !== false)
-				$wpsg_mod_anschreiben_logo_position = "right";
-
-
-			if (file_exists($_FILES['wpsg_mod_anschreiben_logo']['tmp_name']))
-			{
-
-				$ending = strtolower(preg_replace("/(.*)\./", "", $_FILES['wpsg_mod_anschreiben_logo']['name']));
-
-				if ($ending != "jpg" && $ending != "jpeg")
-				{
-					$this->shop->addBackendError(__("UngÃŒltiger Dateityp (Logo) ! Es sind nur JPG und PDF Dateien erlaubt!", "wpsg"));
-				}
-				else if ($ending == "jpg" || $ending == "jpeg")
-				{
-					move_uploaded_file($_FILES['wpsg_mod_anschreiben_logo']['tmp_name'], $this->getFilePath('').'wpsg_anschreiben_logo.jpg');
-				}
-
-			}
-			else if ((array_key_exists('wpsg_mod_anschreiben_logo_del', $_REQUEST)) && ($_REQUEST['wpsg_mod_anschreiben_logo_del'] == "1"))
-			{
-
-				@unlink($this->getFilePath('').'wpsg_anschreiben_logo.jpg');
-
-				$this->shop->addBackendMessage(__('Logo wurde erfolgreich gelÃ¶scht.', 'wpsg'));
-
-			}
-
-			$this->shop->update_option("wpsg_mod_anschreiben_logo_position", $wpsg_mod_anschreiben_logo_position ? $wpsg_mod_anschreiben_logo_position : null);
-			$this->shop->update_option("wpsg_mod_anschreiben_logo_transparency", $_REQUEST['wpsg_mod_anschreiben_logo_transparency']);
-
-		} // public function settings_save()
-
-		public function admin_presentation() 
-		{
-			
-			echo wpsg_drawForm_Checkbox('wpsg_mod_anschreiben_pdf_beschreibung', __('Produktbeschreibung auf Anschreiben anzeigen', 'wpsg'), $this->shop->get_option('wpsg_mod_anschreiben_pdf_beschreibung'));
-			if ($this->shop->hasMod('wpsg_mod_productvariants')) echo wpsg_drawForm_Checkbox('wpsg_mod_anschreiben_pdf_varianten', __('Varianten auf Anschreiben anzeigen', 'wpsg'), $this->shop->get_option('wpsg_mod_anschreiben_pdf_varianten'));
-			
-		} // public function admin_presentation()
-		
-		public function admin_presentation_submit() 
-		{ 
-			
-			$this->shop->update_option('wpsg_mod_anschreiben_pdf_beschreibung', $_REQUEST['wpsg_mod_anschreiben_pdf_beschreibung']);
-			
-		} // public function admin_presentation_submit()
-		
-		public function order_ajax()
-		{
-
-			if (isset($_REQUEST['wpsg_anschreiben_preview']))
-			{
-
-				// Vorschau eines Anschreibenes aus der Bestellverwaltung
-				$this->writeanschreiben(
-					$_REQUEST['edit_id'],
-					explode(',', $_REQUEST['wpsg_mod_anschreiben_productindexes']),
-					strtotime($_REQUEST['wpsg_mod_anschreiben_date']),
-					true
-				);
-			
-				die();
-			
-			}
-			else if (wpsg_getStr($_REQUEST['do']) == 'get')
-			{
-				
-				$dn = new wpsg_anschreiben();
-				$dn->load($_REQUEST['dn_id']);
-				
-				if ($dn->order_id != $_REQUEST['edit_id']) throw new \wpsg\Exception(__('Es wurde versucht ein Anschreiben von einer anderen Bestellung anzuzeigen', 'wpsg'));
-				
-				$filename = 'anschreiben_'.$dn->id.'.pdf';
-				$file = $this->getFilePath($_REQUEST['edit_id']).$filename;
-				
-				wpsg_header::PDFPlugin($file);
-				
-			}
-			else if (isset($_REQUEST['wpsg_mod_anschreiben_write']))
-			{
-				
-				if ($_REQUEST['edit_id'] <= 0) throw new \wpsg\Exception(__('Beim Erstellen des Anschreibendokumentes wurde keine BestellID ÃŒbergeben', 'wpsg'));
-				
-				$lnr = $this->buildLnr($_REQUEST['edit_id']);
-				
-				$arProductIndexes = explode(',', $_REQUEST['wpsg_mod_anschreiben_productindexes']);
-				
-				foreach ($arProductIndexes as $product_key)
-				{
-			 
-					if (!wpsg_anschreiben::checkProductKey($product_key, $_REQUEST['edit_id'])) throw new \wpsg\Exception(__('Ein Anschreiben wurde fÃŒr ein Produkt bereits erstellt', 'wpsg'));
-					
-				} 
-				
-				// In Datenbank eintragen
-				$dn_id = $this->db->ImportQuery(WPSG_TBL_anschreiben, array(
-					'order_id' => wpsg_q($_REQUEST['edit_id']),
-					'cdate' => "NOW()",
-					'delivery_date' => date('Y-m-d', strtotime($_REQUEST['wpsg_mod_anschreiben_date'])),
-					'lnr' => wpsg_q($lnr),
-					'cancel' => '0',
-					'product_indexes' => wpsg_q($_REQUEST['wpsg_mod_anschreiben_productindexes'])
-				));
-				
-				$filename = 'anschreiben_'.$dn_id.'.pdf';
-								
-				// Anschreiben erstellen
-				$bOK = $this->writeanschreiben(
-					$_REQUEST['edit_id'], 
-					explode(',', $_REQUEST['wpsg_mod_anschreiben_productindexes']), 
-					strtotime($_REQUEST['wpsg_mod_anschreiben_date']),
-					false,
-					$lnr,
-					$filename
-				);
-				
-				if ($bOK === true)
-				{
-				
-					$file = $this->getFilePath($_REQUEST['edit_id']).'/'.$filename;
-					 
-					if (!file_exists($file) || !is_file($file))
-					{
-						
-						$this->db->Query("DELETE FROM `".WPSG_TBL_anschreiben."` WHERE `id` = '".wpsg_q($dn_id)."'");
-						throw new \wpsg\Exception(__('Das Anschreibendokument wurde nicht wie vorgesehen angelegt', 'wpsg'));
-						
-					}
-					 										
-					wpsg_header::PDFPlugin($file);					
-										
-				}
-				else
-				{
-					
-					$this->db->Query("DELETE FROM `".WPSG_TBL_anschreiben."` WHERE `id` = '".wpsg_q($dn_id)."'");
-					throw new \wpsg\Exception(__('Beim Erstellen des Anschreibendokumentes ist ein Fehler aufgetreten', 'wpsg'));
-					
-				}
-				
-			}
-			
-		} // public function order_ajax()
-		
-
-		public function delOrder(&$order_id)
-		{
-				
-			// Anschreibene in der Datenbank lÃ¶schen
-			$this->db->Query("DELETE FROM `".WPSG_TBL_anschreiben."` WHERE `order_id` = '".wpsg_q($order_id)."'");
-				
-			// Anschreibene im Dateisystem lÃ¶schen
-			$path = $this->getFilePath($order_id); wpsg_rrmdir($path);
-				
-		} // public function delOrder(&$order_id)
-		
-			
-		public function be_ajax()
-		{
-				
-			if ($_REQUEST['do'] == 'reset')
-			{
-			
-				$this->resetAction();
-				$this->shop->addBackendMessage(__('Grundeinstellungen wieder hergestellt', 'wpsg'));
-			
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul='.$_REQUEST['modul']); 
-			
-			}
-			else if ($_REQUEST['do'] == 'orderAjax')
-			{
-
-				$this->order_ajax();
-
-			}
-			
-			
-		} // public function be_ajax()
-		
-		
-
-		/**
-		 * Generiert das Anschreiben fÃŒr eine Bestellung
-		 */
-		public function writeanschreiben($order_id, $arProductIndexes, $preview = false, $lnr = false, $filename = false)
-		{
-
-			if($preview && is_null($order_id)) $order_id = 1;
-
-			$this->shop->view['order'] = $this->shop->cache->loadOrder($order_id);
-			$this->shop->view['customer'] = $this->shop->cache->loadKunden($this->shop->view['order']['k_id']);
-			$this->shop->view['data'] = array();
-
-			// Wurde die Bestellung in einer anderen Sprache gemacht
-			if (trim($this->shop->view['order']['language']) != '') $this->shop->setTempLocale($this->shop->view['order']['language']);
-			
-			$oOrder = wpsg_order::getInstance($order_id);
-			
-			// Rechnungsadresse		
-			$this->shop->view['data']['id'] = $this->shop->view['customer']['id'];
-			$this->shop->view['data']['firma'] = $this->shop->view['customer']['firma'];
-			$this->shop->view['data']['vname'] = $this->shop->view['customer']['vname'];
-			$this->shop->view['data']['name'] = $this->shop->view['customer']['name'];
-			$this->shop->view['data']['strasse'] = $this->shop->view['customer']['strasse'];
-			$this->shop->view['data']['hausnr'] = $this->shop->view['customer']['nr'];
-			$this->shop->view['data']['plz'] = $this->shop->view['customer']['plz'];
-			$this->shop->view['data']['ort'] = $this->shop->view['customer']['ort'];
-			$this->shop->view['data']['land'] = $this->shop->view['customer']['land'];
-			$this->shop->view['data']['land'] = strtoupper($oOrder->getInvoiceCountryName());
-
-			// Lieferadresse?
-			if ($this->shop->hasMod('wpsg_mod_shippingadress'))
-			{
-				
-				if ($this->shop->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array($this->shop->view['order']['k_id'], $order_id)))
-				{
-					
-					$adata = $this->db->fetchRow("SELECT A.* FROM `".WPSG_TBL_ADRESS."` AS A WHERE A.`id` = '".wpsg_q($this->shop->view['order']['shipping_adress_id'])."'");
-						
-					
-					$this->shop->view['data']['firma'] = $adata['firma'];
-					$this->shop->view['data']['vname'] = $adata['vname'];
-					$this->shop->view['data']['name'] = $adata['name'];
-					$this->shop->view['data']['strasse'] = $adata['strasse'];
-					$this->shop->view['data']['hausnr'] = $adata['nr'];
-					$this->shop->view['data']['plz'] = $adata['plz'];
-					$this->shop->view['data']['ort'] = $adata['ort'];
-					$this->shop->view['data']['land'] = $adata['land'];
-					$this->shop->view['data']['land'] = strtoupper($oOrder->getShippingCountryName());
-					
-				}
-								
-			}
-			 
-			if (wpsg_isSizedInt($this->shop->view['data']['land']))
-			{
-				
-				$this->shop->view['data']['land'] = $this->db->fetchRow("SELECT L.* FROM `".WPSG_TBL_LAND."` AS L WHERE L.`id` = '".wpsg_q($this->shop->view['data']['land'])."'");
-				
-			}
-			
-			$this->shop->view['preview'] = $preview;
-						
-			if ($liefer_datum === false) $this->shop->view['lDatum'] = time();
-			else $this->shop->view['lDatum'] = $liefer_datum;
-			
-			$this->shop->view['data']['products'] = array();
-			
-			foreach ($arProductIndexes as $product_index)
-			{
-				
-				$product_data = $this->db->fetchRow("
-					SELECT
-						OP.*,
-						P.`name`
-					FROM
-						`".WPSG_TBL_ORDERPRODUCT."` AS OP
-							LEFT JOIN `".WPSG_TBL_PRODUCTS."` AS P ON (OP.`p_id` = P.`id`)
-					WHERE
-						OP.`product_index` = '".wpsg_q($product_index)."' AND
-						OP.`o_id` = '".wpsg_q($order_id)."'
-				");
-				 
-				if ($this->shop->isOtherLang())
-				{
-				
-					$produkt_trans = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($product_data['p_id'])."' AND `lang_code` = '".wpsg_q($this->shop->getCurrentLanguageCode())."'");
-				 
-					if ($produkt_trans['id'] > 0)
-					{
-							
-						$product_data['name'] = $produkt_trans['name']; 
-				
-					}
-				
-				}
-				
-				$this->shop->view['data']['products'][$product_index] = $product_data;
-				
-			}
-			
-			if ($preview === true)
-			{
-				
-				$this->shop->view['filename'] = __('AnschreibenVorschau.pdf', 'wpsg');
-				$this->shop->view['title'] = __('Anschreiben Vorschau', 'wpsg');
-				$this->shop->view['lnr'] = $this->buildLnr($order_id);
-								
-			}
-			else
-			{
-				
-				$this->shop->view['filename'] = $filename;
-				$this->shop->view['title'] = __('Anschreiben', 'wpsg');
-				$this->shop->view['lnr'] = $lnr;
-				
-			}
-
-			$this->shop->view['oOrder'] = $this->shop->cache->loadOrderObject($order_id);
-			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_anschreiben/anschreiben_pdf.phtml');
-
-			$this->shop->restoreTempLocale();
-			
-			return true;
-			
-		} // public function writeanschreiben($order_id, $preview = false)
-		
-		
-		/**
-		 * LÃ€dt die Anschreibene einer Bestellung
-		 * @param int $order_id ID der Bestellung
-		 */
-		public function loadanschreibensFromOrder($order_id)
-		{
-			
-			$anschreiben_ids = $this->db->fetchAssocField("SELECT DN.`id` FROM `".WPSG_TBL_anschreiben."` AS DN WHERE `order_id` = '".wpsg_q($order_id)."' ");
-			
-			$arReturn = array();
-			
-			foreach ($anschreiben_ids as $anschreiben_id)
-			{
-				
-				$anschreiben = new wpsg_anschreiben();
-				$anschreiben->load($anschreiben_id);
-				
-				$arReturn[$anschreiben_id] = $anschreiben;
-				
-			}
-			
-			return $arReturn;
-			
-		} // public function loadanschreibensFromOrder($order_id)
-
-		
-		/**
-		 * Gibt die Texte fÃŒr das PDF in der korrekten Sprache und mit ÃŒbersetzen Platzhaltern zurÃŒck
-		 */
-		public function getTexte($order_id)
-		{
-				
-			$arTexte = $this->shop->get_option("wpsg_mod_anschreiben_texte");
-				
-			foreach ($arTexte as $k => $v)
-			{
-		
-				$arTexte[$k]['text'] = $this->shop->replaceUniversalPlatzhalter(__($arTexte[$k]['text'], 'wpsg'), $order_id);
-		
-			}
-				
-			return $arTexte;
-				
-		} // public function getTexte($order_id)
-		
-		/**
-		 * LÃ€dt die vordefinierten Textfelder
-		 */
-		public function resetAction()
-		{
-			
-			$arData = array(
-				"firma" => array("aktiv" => "1", "x" => "24", "y" => "10", "fontsize" => 8, "text" => "%shopinfo_name%", "color" => "#000000"),
-				"name" => array("aktiv" => "1", "x" => "24", "y" => "13", "fontsize" => 8, "text" => "Inh. %shopinfo_owner%", "color" => "#000000"),
-				"strasse" => array("aktiv" => "1", "x" => "24", "y" => "16", "fontsize" => 8, "text" => "%shopinfo_street%", "color" => "#000000"),
-				"plzort" => array("aktiv" => "1", "x" => "24", "y" => "19", "fontsize" => 8, "text" => "%shopinfo_zip% %shopinfo_city%", "color" => "#000000"),
-				"land" => array("aktiv" => "1", "x" => "24", "y" => "22", "fontsize" => 8, "text" => "DEUTSCHLAND", "color" => "#000000"),
-				"tel" => array("aktiv" => "1", "x" => "75", "y" => "10", "fontsize" => 8, "text" => "Tel. %shopinfo_tel%", "color" => "#000000"),
-				"fax" => array("aktiv" => "1", "x" => "75", "y" => "13", "fontsize" => 8, "text" => "Fax. %shopinfo_fax%", "color" => "#000000"),
-				"mail" => array("aktiv" => "1", "x" => "75", "y" => "16", "fontsize" => 8, "text" => "Mail: %shopinfo_email%", "color" => "#000000"),
-				"web" => array("aktiv" => "1", "x" => "75", "y" => "19", "fontsize" => 8, "text" => "Web: ".site_url(), "color" => "#000000"),
-				"strnr" => array("aktiv" => "1", "x" => "24", "y" => "270", "fontsize" => 8, "text" => "Steuer-Nr.: %shopinfo_taxnr%", "color" => "#000000"),
-				"ustidnr" => array("aktiv" => "1", "x" => "24", "y" => "273", "fontsize" => 8, "text" => "USt-IdNr.: %shopinfo_ustidnr%", "color" => "#000000"),
-				"knr" => array("aktiv" => "1", "x" => "24", "y" => "276", "fontsize" => 8, "text" => "IBAN: %shopinfo_iban%", "color" => "#000000"),
-				"blz" => array("aktiv" => "1", "x" => "24", "y" => "279", "fontsize" => 8, "text" => "BIC: %shopinfo_bic%", "color" => "#000000"),
-				"bank" => array("aktiv" => "1", "x" => "24", "y" => "282", "fontsize" => 8, "text" => "Bank: %shopinfo_bankname%", "color" => "#000000"),
-			);
-			 
-			$this->shop->update_option("wpsg_mod_anschreiben_adressrow", "Absender: %shopinfo_name% %shopinfo_street% %shopinfo_zip% %shopinfo_city%");
-			$this->shop->update_option("wpsg_mod_anschreiben_texte", $arData);
-			
-		} // public function resetAction()
-		
-		/**
-		 * Gibt den Absoluten Pfad zurÃŒck wo die Anschreibene gespeichert sind
-		 */
-		public function getFilePath($order_id, $url = false) {
-		
-			if ($order_id == '') {
-			    
-			    // Briefpapier/Logo
-				if ($this->shop->isMultiBlog()) {
-					
-					$path = WPSG_PATH_CONTENT.'/'.WPSG_MB_UPLOADS.'/wpsg/wpsg_anschreiben/'.$order_id.'/';
-					$url_content = WPSG_URL_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_anschreiben/';
-					
-					if ($url) $strReturn = $url_content.$order_id.'/';
-					else $strReturn = $path;
-					
-				} else {
-					
-					$path = WPSG_PATH_CONTENT.'uploads/wpsg/wpsg_anschreiben/'.$order_id.'/';
-					
-					if ($url) $strReturn = WPSG_URL_CONTENT.'uploads/wpsg/wpsg_anschreiben/'.$order_id.'/';
-					else $strReturn = $path.'/';
-					
-				}
-				
-			} else {
-			    
-			    // Anschreiben aus Bestellung
-				$anschreiben = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_anschreiben."` AS DN WHERE `order_id` = '".wpsg_q($order_id)."' ");
-				$datum = $anschreiben['cdate'];
-				$ym = date('Y/m/', strtotime($datum));
-				
-				if ($this->shop->isMultiBlog()) {
-					
-					$path = WPSG_PATH_CONTENT.'/'.WPSG_MB_UPLOADS.'/wpsg/wpsg_anschreiben/'.$ym.$order_id.'/';
-					$url_content = WPSG_URL_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_anschreiben/'.$ym;
-					
-					if ($url) $strReturn = $url_content.$order_id.'/';
-					else $strReturn = $path;
-					
-				} else {
-					
-					$path = WPSG_PATH_CONTENT.'uploads/wpsg/wpsg_anschreiben/'.$ym.$order_id.'/';
-					
-					if ($url) $strReturn = WPSG_URL_CONTENT.'uploads/wpsg/wpsg_anschreiben/'.$ym.$order_id.'/';
-					else $strReturn = $path.'/';
-					
-				}
-				
-			} // if ($order_id == '')
-			
-			$this->shop->protectDirectory($path, [
-                'wpsg_anschreiben_logo.jpg', 'wpsg_anschreiben_bp.jpg', 'wpsg_anschreiben_bp.pdf'
-            ] );	
-            				
-			return $strReturn;
-		
-		} // private function getFilePath($produkt_id, $url = false)
-		 
-	} // class wpsg_mod_anschreiben extends wpsg_mod_basic
-
-?>
Index: /mods/wpsg_mod_coverletter.class.php
===================================================================
--- /mods/wpsg_mod_coverletter.class.php	(revision 7258)
+++ /mods/wpsg_mod_coverletter.class.php	(revision 7258)
@@ -0,0 +1,477 @@
+<?php
+	
+	define('WPSG_TBL_COVERLETTER', $this->shop->prefix.'wpsg_coverletter');
+	
+	/**
+	 * Modul zur Generierung von Anschreibenen
+	 * @author Daschmi
+	 */
+	class wpsg_mod_coverletter extends wpsg_mod_basic {
+		
+		var $lizenz = 0;
+		var $id = 2200;
+		var $hilfeURL = 'http://wpshopgermany.maennchen1.de/?p=3667';
+		
+		public function __construct() {
+			
+			parent::__construct();
+						
+			$this->name = __('Anschreiben', 'wpsg');
+			$this->group = __('Bestellung', 'wpsg');
+			$this->desc = __('ErmÃ¶glicht die Erstellung von Anschreibenen.', 'wpsg');
+			
+		} // public function __construct()
+		
+		public function init() {
+			
+			$this->fields = array(
+				'company' => __('Firmenname', 'wpsg'),
+				'name' => __('Name', 'wpsg'),
+				'street' => __('StraÃe', 'wpsg'),
+				'zipcity' => __('PLZ/Ort', 'wpsg'),
+				'country' => __('Land', 'wpsg'),
+				'tel' => __('Tel', 'wpsg'),
+				'fax' => __('Fax', 'wpsg'),
+				'mail' => __('E-Mail', 'wpsg'),
+				'web' => __('Web', 'wpsg'),
+				'taxnr' => __('Steuer-Nr', 'wpsg'),
+				'ustidnr' => __('UStIdNr.', 'wpsg'),
+				'bank' => __('Bank', 'wpsg'),
+				'iban' => __('IBAN', 'wpsg'),
+				'bic' => __('BIC', 'wpsg'),
+				'user1' => __('Benutzer 1', 'wpsg'),
+				'user2' => __('Benutzer 2', 'wpsg'),
+				'user3' => __('Benutzer 3', 'wpsg'),
+				'user4' => __('Benutzer 4', 'wpsg'),
+				'user5' => __('Benutzer 5', 'wpsg')
+			);
+			
+		} // public function init()
+		 
+		public function install() {
+			
+			require_once(WPSG_PATH_WP.'/wp-admin/includes/upgrade.php');
+				
+			/**
+			 * Tabelle fÃŒr die Lieferanten
+			*/
+			$sql = "CREATE TABLE ".WPSG_TBL_COVERLETTER." (
+				id int(25) NOT NULL AUTO_INCREMENT,
+				cdate DATETIME NOT NULL,
+				order_id int(25) NOT NULL,
+				text TEXT NOT NULL,
+				KEY order_id (order_id), 
+				PRIMARY KEY  (id) 
+			) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+				 
+			dbDelta($sql);  
+			
+		} // public function install()
+		
+		public function settings_edit() {
+					
+			$this->shop->view['wpsg_mod_coverletter']['fields'] = $this->fields;			
+			$this->shop->view['wpsg_mod_coverletter']['arTexts'] = $this->shop->get_option('wpsg_mod_coverletter_texts');
+			
+			if (!is_array($this->shop->view['wpsg_mod_coverletter']['arTexts'])) $this->shop->view['wpsg_mod_coverletter']['arTexts'] = array();
+
+			if (file_exists($this->getFilePath('').'wpsg_coverletter_bp.jpg')) {
+				
+				$this->shop->view['wpsg_mod_coverletter']['bp'] = $this->getFilePath('', true).'wpsg_coverletter_bp.jpg';
+				
+			} else if (file_exists($this->getFilePath('').'wpsg_coverletter_bp.pdf')) {
+				
+				$this->shop->view['wpsg_mod_coverletter']['bp'] = $this->getFilePath('', true).'wpsg_coverletter_bp.pdf';
+				
+			} else {
+				
+				$this->shop->view['wpsg_mod_coverletter']['bp'] = false;
+				
+			}
+
+			if (file_exists($this->getFilePath('').'wpsg_coverletter_logo.jpg')) {
+				
+				$this->shop->view['wpsg_mod_coverletter']['logo'] = $this->getFilePath('', true).'wpsg_coverletter_logo.jpg';
+				
+			} else {
+				
+				$this->shop->view['wpsg_mod_coverletter']['logo'] = false;
+				
+			}
+
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_coverletter/settings_edit.phtml');
+
+		} // public function settings_edit()
+		
+		/**
+		 * zeigt das Formular zum Drucken in der Bestellverwaltung
+		 */
+		public function order_view($order_id, &$arSidebarArray) {
+			
+			$arSidebarArray[$this->id] = array(
+				'title' => $this->name,
+				'content' => $this->shop->render(WPSG_PATH_VIEW.'mods/mod_coverletter/order_view.phtml', false)
+			);
+			
+		} // public function order_view_content($order_id)
+
+		public function settings_save() {
+
+			$this->shop->update_option("wpsg_mod_coverletter_texts", $_REQUEST['text']); 
+
+			if (file_exists($_FILES['wpsg_mod_coverletter_bp']['tmp_name'])) {
+
+				$ending = strtolower(preg_replace("/(.*)\./", "", $_FILES['wpsg_mod_coverletter_bp']['name']));
+ 
+				if ($ending != "jpg" && $ending != "jpeg" && $ending != "pdf") {
+					
+					$this->shop->addBackendError(__("UngÃŒltiger Dateityp (Briefpapier) ! Es sind nur JPG und PDF Dateien erlaubt!", "wpsg"));
+					
+				} else if ($ending == "jpg" || $ending == "jpeg") {
+					
+					move_uploaded_file($_FILES['wpsg_mod_coverletter_bp']['tmp_name'], $this->getFilePath('').'wpsg_coverletter_bp.jpg');
+					
+				} else if ($ending == "pdf") {
+					
+					move_uploaded_file($_FILES['wpsg_mod_coverletter_bp']['tmp_name'], $this->getFilePath('').'wpsg_coverletter_bp.pdf');
+					
+				}
+
+			} else if ((array_key_exists('wpsg_mod_coverletter_bp_del', $_REQUEST)) && ($_REQUEST['wpsg_mod_coverletter_bp_del'] == "1")) {
+
+				@unlink($this->getFilePath('').'wpsg_coverletter_bp.jpg');
+				@unlink($this->getFilePath('').'wpsg_coverletter_bp.pdf');
+
+				$this->shop->addBackendMessage(__('Briefpapier wurde erfolgreich gelÃ¶scht.', 'wpsg'));
+
+			}
+
+			if (array_key_exists('wpsg_mod_coverletter_logo_position_left', $_REQUEST) && strpos($_REQUEST['wpsg_mod_coverletter_logo_position_left'], 'selected') !== false)
+				$wpsg_mod_coverletter_logo_position = "left";
+
+			if (array_key_exists('wpsg_mod_coverletter_logo_position_center', $_REQUEST) && strpos($_REQUEST['wpsg_mod_coverletter_logo_position_center'], 'selected') !== false)
+				$wpsg_mod_coverletter_logo_position = "center";
+
+			if (array_key_exists('wpsg_mod_coverletter_logo_position_right', $_REQUEST) && strpos($_REQUEST['wpsg_mod_coverletter_logo_position_right'], 'selected') !== false)
+				$wpsg_mod_coverletter_logo_position = "right";
+ 
+			if (file_exists($_FILES['wpsg_mod_coverletter_logo']['tmp_name'])) {
+
+				$ending = strtolower(preg_replace("/(.*)\./", "", $_FILES['wpsg_mod_coverletter_logo']['name']));
+				
+				if ($ending != "jpg" && $ending != "jpeg") {
+					
+					$this->shop->addBackendError(__("UngÃŒltiger Dateityp (Logo) ! Es sind nur JPG und PDF Dateien erlaubt!", "wpsg"));
+					
+				} else if ($ending == "jpg" || $ending == "jpeg") {
+					
+					move_uploaded_file($_FILES['wpsg_mod_coverletter_logo']['tmp_name'], $this->getFilePath('').'wpsg_coverletter_logo.jpg');
+					
+				}
+
+			} else if ((array_key_exists('wpsg_mod_coverletter_logo_del', $_REQUEST)) && ($_REQUEST['wpsg_mod_coverletter_logo_del'] == "1")) {
+
+				@unlink($this->getFilePath('').'wpsg_coverletter_logo.jpg');
+
+				$this->shop->addBackendMessage(__('Logo wurde erfolgreich gelÃ¶scht.', 'wpsg'));
+
+			}
+			
+			$this->shop->update_option("wpsg_mod_coverletter_logo_position", $wpsg_mod_coverletter_logo_position?$wpsg_mod_coverletter_logo_position:null);
+			$this->shop->update_option("wpsg_mod_coverletter_logo_transparency", $_REQUEST['wpsg_mod_coverletter_logo_transparency']);
+
+		} // public function settings_save()
+		
+		public function order_ajax() {
+
+			if (isset($_REQUEST['wpsg_coverletter_preview'])) {
+
+				// Vorschau eines Anschreibenes aus der Bestellverwaltung
+				$this->writeCoverLetter(
+					$_REQUEST['edit_id'],
+					$_REQUEST['text'],
+					true,
+					__('Vorschau', 'wpsg'),
+					'coverletter-preview.pdf'
+				);
+			
+				die();
+			
+			} else if (isset($_REQUEST['wpsg_mod_coverletter_write'])) {
+				 
+				if ($_REQUEST['edit_id'] <= 0) throw new \wpsg\Exception(__('Beim Erstellen des Anschreibendokumentes wurde keine BestellID ÃŒbergeben', 'wpsg'));
+				
+				// In Datenbank eintragen
+				$cl_id = $this->db->ImportQuery(WPSG_TBL_COVERLETTER, array(
+					'order_id' => wpsg_q($_REQUEST['edit_id']),
+					'cdate' => "NOW()",
+					'text' => wpsg_q($_REQUEST['text'])
+				));
+				
+				$filename = $this->getFilePath($_REQUEST['edit_id']).'/coverletter_'.$cl_id.'.pdf';
+								
+				// Anschreiben erstellen
+				$bOK = $this->writeCoverLetter(
+					$_REQUEST['edit_id'], 
+					$_REQUEST['text'], 
+					false,
+					$cl_id,
+					$filename
+				);
+				
+				if ($bOK === true) {
+				 
+					if (!file_exists($filename) || !is_file($filename)) {
+						
+						$this->db->Query("DELETE FROM `".WPSG_TBL_COVERLETTER."` WHERE `id` = '".wpsg_q($cl_id)."'");
+						
+						throw new \wpsg\Exception(__('Das Anschreibendokument wurde nicht wie vorgesehen angelegt', 'wpsg'));
+						
+					}
+					 										
+					wpsg_header::PDFPlugin($filename);					
+										
+				}
+				else
+				{
+					
+					$this->db->Query("DELETE FROM `".WPSG_TBL_COVERLETTER."` WHERE `id` = '".wpsg_q($cl_id)."'");
+					
+					throw new \wpsg\Exception(__('Beim Erstellen des Anschreibendokumentes ist ein Fehler aufgetreten', 'wpsg'));
+					
+				}
+				
+			}
+			
+		} // public function order_ajax()
+		
+		public function delOrder(&$order_id) {
+				
+			// Anschreibene in der Datenbank lÃ¶schen
+			$this->db->Query("DELETE FROM `".WPSG_TBL_COVERLETTER."` WHERE `order_id` = '".wpsg_q($order_id)."'");
+				
+			// Anschreibene im Dateisystem lÃ¶schen
+			$path = $this->getFilePath($order_id); wpsg_rrmdir($path);
+				
+		} // public function delOrder(&$order_id)
+					
+		public function be_ajax() {
+				
+			if ($_REQUEST['do'] == 'reset') {
+			
+				$this->resetAction();
+				$this->shop->addBackendMessage(__('Grundeinstellungen wieder hergestellt', 'wpsg'));
+			
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul='.$_REQUEST['modul']);
+				
+			} else if (wpsg_isSizedString($_REQUEST['do'], 'getBp')) {
+				
+				$file = '';
+				
+				if (file_exists($this->getFilePath('')."wpsg_coverletter_bp.pdf")) {
+										
+					$file = $this->getFilePath('')."wpsg_coverletter_bp.pdf";
+					
+					header('Content-Type: application/pdf');
+					
+				} else if (file_exists($this->getFilePath('')."wpsg_coverletter_bp.jpg")) {
+					
+					$file = $this->getFilePath('')."wpsg_coverletter_bp.jpg";
+					
+					header("Content-type: image/jpeg");
+					
+				}
+				
+				readfile($file);				
+				
+			} else if (wpsg_isSizedString($_REQUEST['do'], 'getLogo')) {
+				
+				$logo = $this->getFilePath('').'wpsg_coverletter_logo.jpg';
+				
+				header("Content-type: image/jpeg");
+				readfile($logo);
+				
+			} else if ($_REQUEST['do'] == 'orderAjax') {
+
+				$this->order_ajax();
+
+			}			
+			
+		} // public function be_ajax()
+		 
+		/**
+		 * Generiert das Anschreiben fÃŒr eine Bestellung
+		 */
+		public function writeCoverLetter($order_id, $text, $preview, $clnr, $filename) {
+
+			if ($preview === true && !wpsg_isSizedInt($order_id)) {
+				
+				$this->shop->view['order'] = [
+					'onr' => __('Vorschau', 'wpsg'),
+					'cdate' => date('d.m.Y')
+				];
+				$this->shop->view['customer'] = [
+					'knr' => __('Vorschau', 'wpsg')
+				];
+				
+			} else {
+				
+				$this->shop->view['order'] = $this->shop->cache->loadOrder($order_id);			
+				$this->shop->view['customer'] = $this->shop->cache->loadKunden($this->shop->view['order']['k_id']);			
+				$this->shop->view['data'] = array();
+				
+			}
+
+			// Wurde die Bestellung in einer anderen Sprache gemacht
+			if (trim($this->shop->view['order']['language']) != '') $this->shop->setTempLocale($this->shop->view['order']['language']);
+			
+			$oOrder = wpsg_order::getInstance($order_id);
+			$this->shop->view['oOrder'] = $oOrder;
+			
+			// Rechnungsadresse		
+			$this->shop->view['data']['id'] = $this->shop->view['customer']['id'];
+			$this->shop->view['data']['company'] = $this->shop->view['customer']['firma'];
+			$this->shop->view['data']['firstname'] = $this->shop->view['customer']['vname'];
+			$this->shop->view['data']['name'] = $this->shop->view['customer']['name'];
+			$this->shop->view['data']['street'] = $this->shop->view['customer']['strasse'];
+			$this->shop->view['data']['hnr'] = $this->shop->view['customer']['nr'];
+			$this->shop->view['data']['zip'] = $this->shop->view['customer']['plz'];
+			$this->shop->view['data']['city'] = $this->shop->view['customer']['ort'];
+			
+			$this->shop->view['data']['country'] = '';			
+			if ($oOrder->getInvoiceCountryID() !== $this->shop->getDefaultCountry(true)) $this->shop->view['data']['country'] = strtoupper($oOrder->getInvoiceCountryName());
+ 
+			if ($preview === true && !wpsg_isSizedInt($order_id)) {
+												
+				$this->shop->view['data']['company'] = __('Musterfirma', 'wpsg');
+				$this->shop->view['data']['firstname'] = __('Max', 'wpsg');
+				$this->shop->view['data']['name'] = __('Mustermann', 'wpsg');
+				$this->shop->view['data']['street'] = __('MusterstraÃe');
+				$this->shop->view['data']['hnr'] = '1';
+				$this->shop->view['data']['zip'] = '12345';
+				$this->shop->view['data']['city'] = __('Musterhausen', 'wpsg');
+				$this->shop->view['data']['country'] = ''; // strtoupper($this->shop->getDefaultCountry()->getName());
+				
+			}
+			  			
+			$this->shop->view['preview'] = $preview;
+			$this->shop->view['filename'] = $filename; 			
+			$this->shop->view['text'] = $text;
+			
+			// Benutzerdefinierte Felder
+			$this->shop->view['arTexts'] = $this->shop->get_option('wpsg_mod_coverletter_texts');
+			
+			foreach ($this->shop->view['arTexts'] as $k => $t) {
+				
+				$this->shop->view['arTexts'][$k]['text'] = $this->shop->replaceUniversalPlatzhalter($t['text'], $oOrder->id);
+				
+			}
+			
+			$this->shop->view['title'] = __('Anschreiben', 'wpsg');
+			$this->shop->view['clnr'] = $clnr;
+			
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_coverletter/coverletter_pdf.phtml');
+
+			$this->shop->restoreTempLocale();
+			
+			return true;
+			
+		} // public function writeCoverLetter($order_id, $text, $preview, $nr, $filename) {
+		 
+		/**
+		 * LÃ€dt die Anschreibene einer Bestellung
+		 * @param int $order_id ID der Bestellung
+		 */
+		public function getCoverLetterFromOrder($order_id) {
+			
+			return $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_COVERLETTER."` WHERE `order_id` = '".wpsg_q($order_id)."' "); 
+			
+		} // public function loadanschreibensFromOrder($order_id)
+				
+		/**
+		 * Gibt den Absoluten Pfad zurÃŒck wo die Anschreibene gespeichert sind
+		 */
+		public function getFilePath($order_id, $url = false) {
+		
+			if ($order_id == '') {
+			    
+			    // Briefpapier/Logo
+				if ($this->shop->isMultiBlog()) {
+					
+					$path = WPSG_PATH_CONTENT.'/'.WPSG_MB_UPLOADS.'/wpsg/wpsg_coverletter/'.$order_id.'/';
+					$url_content = WPSG_URL_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_coverletter/';
+					
+					if ($url) $strReturn = $url_content.$order_id.'/';
+					else $strReturn = $path;
+					
+				} else {
+					
+					$path = WPSG_PATH_CONTENT.'uploads/wpsg/wpsg_coverletter/'.$order_id.'/';
+					
+					if ($url) $strReturn = WPSG_URL_CONTENT.'uploads/wpsg/wpsg_coverletter/'.$order_id.'/';
+					else $strReturn = $path.'/';
+					
+				}
+				
+			} else {
+			    
+			    // Anschreiben aus Bestellung
+				$cl = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_COVERLETTER."` WHERE `order_id` = '".wpsg_q($order_id)."' ");
+				$ym = date('Y/m', strtotime($cl['cdate'])).'/';
+				
+				if ($this->shop->isMultiBlog()) {
+					
+					$path = WPSG_PATH_CONTENT.'/'.WPSG_MB_UPLOADS.'/wpsg/wpsg_coverletter/'.$ym.$order_id.'/';
+					$url_content = WPSG_URL_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_coverletter/'.$ym;
+					
+					if ($url) $strReturn = $url_content.$order_id.'/';
+					else $strReturn = $path;
+					
+				} else {
+					
+					$path = WPSG_PATH_CONTENT.'uploads/wpsg/wpsg_coverletter/'.$ym.$order_id.'/';
+					
+					if ($url) $strReturn = WPSG_URL_CONTENT.'uploads/wpsg/wpsg_coverletter/'.$ym.$order_id.'/';
+					else $strReturn = $path.'/';
+					
+				}
+				
+			} // if ($order_id == '')
+			
+			$this->shop->protectDirectory($path, [
+                'wpsg_coverletter_logo.jpg', 'wpsg_coverletter_bp.jpg', 'wpsg_coverletter_bp.pdf'
+            ] );	
+            				
+			return $strReturn;
+		
+		} // private function getFilePath($produkt_id, $url = false)
+		
+		/* Private Funktionen */ 
+		
+		/**
+		 * LÃ€dt die vordefinierten Textfelder
+		 */
+		private function resetAction() {
+			
+			$arData = array(
+				"company" => array("aktiv" => "1", "x" => "24", "y" => "10", "fontsize" => 8, "text" => "%shopinfo_name%", "color" => "#000000"),
+				"name" => array("aktiv" => "1", "x" => "24", "y" => "13", "fontsize" => 8, "text" => "Inh. %shopinfo_owner%", "color" => "#000000"),
+				"street" => array("aktiv" => "1", "x" => "24", "y" => "16", "fontsize" => 8, "text" => "%shopinfo_street%", "color" => "#000000"),
+				"zipcity" => array("aktiv" => "1", "x" => "24", "y" => "19", "fontsize" => 8, "text" => "%shopinfo_zip% %shopinfo_city%", "color" => "#000000"),
+				"country" => array("aktiv" => "1", "x" => "24", "y" => "22", "fontsize" => 8, "text" => "DEUTSCHLAND", "color" => "#000000"),
+				"tel" => array("aktiv" => "1", "x" => "75", "y" => "10", "fontsize" => 8, "text" => "Tel. %shopinfo_tel%", "color" => "#000000"),
+				"fax" => array("aktiv" => "1", "x" => "75", "y" => "13", "fontsize" => 8, "text" => "Fax. %shopinfo_fax%", "color" => "#000000"),
+				"mail" => array("aktiv" => "1", "x" => "75", "y" => "16", "fontsize" => 8, "text" => "Mail: %shopinfo_email%", "color" => "#000000"),
+				"web" => array("aktiv" => "1", "x" => "75", "y" => "19", "fontsize" => 8, "text" => "Web: ".site_url(), "color" => "#000000"),
+				"taxnr" => array("aktiv" => "1", "x" => "145", "y" => "279", "fontsize" => 8, "text" => "Steuer-Nr.: %shopinfo_taxnr%", "color" => "#000000"),
+				"ustidnr" => array("aktiv" => "1", "x" => "145", "y" => "282", "fontsize" => 8, "text" => "USt-IdNr.: %shopinfo_ustidnr%", "color" => "#000000"),
+				"bank" => array("aktiv" => "1", "x" => "24", "y" => "279", "fontsize" => 8, "text" => "Bank: %shopinfo_bankname%", "color" => "#000000"),
+				"iban" => array("aktiv" => "1", "x" => "24", "y" => "282", "fontsize" => 8, "text" => "IBAN: %shopinfo_iban%", "color" => "#000000"),
+				"bic" => array("aktiv" => "1", "x" => "24", "y" => "285", "fontsize" => 8, "text" => "BLZ: %shopinfo_bic%", "color" => "#000000"),
+			);
+			
+			$this->shop->update_option("wpsg_mod_coverletter_texts", $arData);
+			
+		} // public function resetAction()
+		
+	} // class wpsg_mod_coverletter extends wpsg_mod_basic
Index: /views/admin/form/textarea.phtml
===================================================================
--- /views/admin/form/textarea.phtml	(revision 7257)
+++ /views/admin/form/textarea.phtml	(revision 7258)
@@ -1,4 +1,12 @@
 <div class="form-group form-group-sm form-textarea <?php echo ((wpsg_isSizedString($this->view['field_config']['help']))?'has-feedback':''); ?>">
-
+	
+	<?php if (wpsg_isSizedString($this->view['field_config']['fullLabel'])) { ?>
+		
+		<br />
+	
+		<label class="col-sm-12 control-label" style="text-align:left;" for="<?php echo $this->view['field_id']; ?>"><?php echo $this->view['field_label']; ?></label>
+		
+	<?php } ?>
+	
     <?php if (!isset($this->view['field_config']['noLabel']) || $this->view['field_config']['noLabel'] != true) { ?>
 	<label class="col-sm-6 control-label" for="<?php echo $this->view['field_id']; ?>"><?php echo $this->view['field_label']; ?></label>
Index: /views/mods/mod_coverletter/coverletter_pdf.phtml
===================================================================
--- /views/mods/mod_coverletter/coverletter_pdf.phtml	(revision 7258)
+++ /views/mods/mod_coverletter/coverletter_pdf.phtml	(revision 7258)
@@ -0,0 +1,147 @@
+<?php
+
+	/**
+	 * FPDF Template fÃŒr die Generierung des Lieferscheins
+	 */
+
+	require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
+	require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
+	require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
+	
+	global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
+			
+	if (!function_exists('addCoverLetterPage')) {
+	
+		function addCoverLetterPage($shop, $pdf) {
+	
+			global $absender_left, $absender_top, $adress_left, $adress_top, $dndata_left, $dndata_top;
+							
+			$rdata_left = 0;
+			$pdf->AddPage();
+			
+			if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.pdf")) {
+				
+				$pdf->setSourceFile($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.pdf");
+				$tplidx = $pdf->importPage(1, '/MediaBox');
+				$pdf->useTemplate($tplidx, 0, 0, 210);
+			
+			} else if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.jpg")) {
+				
+				$pdf->image($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_bp.jpg", 0, 0, 210, 297, 'jpg');
+				
+			}
+
+			if (file_exists($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg")) {
+
+				list($width, $height, $type, $attr) = getimagesize($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg");
+
+				// Umrechnung von Inch zu Pixel
+				$wPix = (25.4 * $width) / 96;
+				$hPix = (25.4 * $height) / 96;
+  
+				$transparency = str_replace("%", "", $shop->get_option('wpsg_mod_coverletter_logo_transparency'));
+				if($transparency !== "100") $transparency = str_replace(array("0", "00"), "", $transparency);
+
+				$alpha = 1;
+				if (wpsg_isSizedString($transparency) && $transparency !== "100") $alpha = "0.$transparency";
+				if (wpsg_isSizedString($transparency) && $transparency === "100") $alpha = $transparency;
+
+				$logo_pos = $shop->get_option('wpsg_mod_coverletter_logo_position');
+
+				if(isset($logo_pos) && $logo_pos === "left") { $abscissa = 0; }
+				if(isset($logo_pos) && $logo_pos === "center") { $abscissa = 105 - ($wPix / 2); }
+				if(isset($logo_pos) && $logo_pos === "right") { $abscissa = 210 - $wPix; }
+
+				$pdf->SetAlpha($alpha);
+				$pdf->image($shop->callMod('wpsg_mod_coverletter', 'getFilePath', array(''))."wpsg_coverletter_logo.jpg", $abscissa, 0, $wPix, $hPix);
+				$pdf->SetAlpha(1);
+
+			}
+								
+			// Adresse des Kunden
+			$pdf->SetFont('Arial', '', 12);
+			$pdf->Text($adress_left, $adress_top, $shop->view['data']['company']);
+			$pdf->Text($adress_left, $adress_top + 5, $shop->view['data']['firstname'].' '.$shop->view['data']['name']);
+			$pdf->Text($adress_left, $adress_top + 10, $shop->view['data']['street'].' '.$shop->view['data']['hnr']);
+			$pdf->Text($adress_left, $adress_top + 15, $shop->view['data']['zip'].' '.$shop->view['data']['city']);
+			$pdf->Text($adress_left, $adress_top + 20, $shop->view['data']['country']);
+			
+			// Daten
+			$pdf->SetFont('Arial', 'B', 16);
+			$pdf->Text($dndata_left, $dndata_top, $shop->view['title']);
+			$pdf->SetFont('Arial', 'B', 9);
+			$pdf->Text($dndata_left, $dndata_top + 6, $shop->view['clnr']);
+			$pdf->SetFont('Arial', '', 9);
+			
+			$pdf->Text($rdata_left + 100, $dndata_top, __("Kunden-Nr", "wpsg"));
+			$pdf->Text($rdata_left + 100, $dndata_top + 6, (($shop->view['customer']['knr'] != '')?$shop->view['customer']['knr']:$shop->view['customer']['id']));
+				
+			$pdf->Text($rdata_left + 125, $dndata_top, __("Best. Nr.", "wpsg"));
+			$pdf->Text($rdata_left + 125, $dndata_top + 6, ((trim($shop->view['order']['onr']) != '')?$shop->view['order']['onr']:$shop->view['order']['id']));
+			
+			$pdf->Text($rdata_left + 145, $dndata_top, __("Bestelldatum", "wpsg"));
+			$pdf->Text($rdata_left + 145, $dndata_top + 6, wpsg_formatTimestamp(strtotime($shop->view['order']['cdate']), true));
+				
+			$pdf->Text($rdata_left + 170, $dndata_top, __("Datum", "wpsg"));
+			$pdf->Text($rdata_left + 170, $dndata_top + 6, wpsg_formatTimestamp(time(), true));
+			 			
+			foreach ($shop->view['arTexts'] as $text) {
+			
+				if (isset($text['aktiv']) && $text['aktiv'] == 1) {
+						
+					$pdf->SetFont('Arial', 'B', ((intval($text['fontsize']) > 0)?intval($text['fontsize']):10));
+					$pdf->wpsg_SetTextColor($text['color']);
+					$pdf->wpsg_MultiCell($text['x'], $text['y'], 5, $text['text']);
+					$pdf->wpsg_SetTextColor("#000000");
+						
+				}
+			
+			}
+			
+			// Text
+			$pdf->setFont('Arial', '', 10);
+			$pdf->wpsg_MultiCell($dndata_left - 1, $dndata_top + 12, 4, $shop->view['text']); 
+			
+		}
+		
+	}
+	
+	// Positionierung der Absenderadresszeile
+	$absender_left				= 25;
+	$absender_top				= 50;
+	
+	// Positionierung der Zieladress
+	$adress_left 				= 25;
+	$adress_top					= 55;
+	
+	// Positionierund des Lieferscheinkopfes
+	$dndata_left				= 25;
+	$dndata_top					= 90;
+	
+	// Positionierung der Produktdaten
+	$prod_left					= 25;
+	$prod_top					= 105;
+	
+	// Anzahl an Produkten pro Seite
+	$prod_break					= 10;
+	
+	$pdf = new wpsg_fpdf();
+	$pdf->SetAutoPageBreak(true, 5);
+	addCoverLetterPage($this, $pdf);
+
+	$offset += 5;
+	 
+    ob_end_clean();
+	
+	if ($this->view['preview']) {
+		
+		$pdf->Output($this->view['filename'], 'I');
+		
+	} else {
+	
+		$pdf->Output($this->view['filename'], 'F');
+	
+		if ($this->view['output'] === true) $pdf->Output($this->view['filename'], 'I');
+			
+	}
+	
Index: /views/mods/mod_coverletter/order_view.phtml
===================================================================
--- /views/mods/mod_coverletter/order_view.phtml	(revision 7258)
+++ /views/mods/mod_coverletter/order_view.phtml	(revision 7258)
@@ -0,0 +1,91 @@
+<?php
+	
+	/**
+	 * Template fÃŒr die Integration des Anschreiben Moduls in die Bestellverwaltung
+	 */
+
+?>
+	
+<?php echo wpsg_drawForm_AdminboxStart(__('Anschreiben', 'wpsg'));?>
+
+	<?php if (sizeof($this->view['mod_anschreiben']['aranschreiben']) == 0 ) { ?>
+	   
+	   <p><?php echo __('Bisher kein Anschreiben geschrieben.', 'wpsg'); ?></p>
+	   
+	   <?php } else { ?>
+	   	<table>
+	        <?php foreach ($this->view['mod_anschreiben']['aranschreiben_gesamt'] as $a) { ?>
+	            <tr>
+	                <td>#<?php echo ($a['anr'] != ''); ?>
+						
+						<?php if ($a['anr'] != "") { ?>
+	                    	<?php echo wpsg_translate(__('Anschreiben gespeichert am #1#', 'wpsg'), date("d.m.Y", $a['ts_datum'])); ?>
+	                    <?php } ?>
+	
+	                </td>
+	                <td style="text-align:right;">
+	
+	                    <?php if ($a['anr'] != "") {
+
+	                    	$rfile = $this->callMod('wpsg_mod_anschreiben', 'getFilePath', array($this->view['data']['id'], true)).'A'.$r['anr'].'.pdf';
+	                        
+	                    } ?>
+
+	            	</td>
+	        	</tr>
+	    	<?php } ?>
+	 	</table>
+	 <?php } ?>
+	
+	<br>
+	
+	<div class="wpsg_clear"></div>
+	
+	<hr />
+	
+	<div class="inside">						
+		<div>
+			
+			<form target="_blank" method="post" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&edit_id=<?php echo $this->view['data']['id']; ?>&action=ajax&noheader=1" id="wpsg_mod_coverletter_form">	
+
+				<?php $arShopLocations = $this->getShopLocations(); ?>
+				<?php $arShopLocationLabels = []; foreach ($arShopLocations as $l_id => $l) $arShopLocationLabels[$l_id] = $l['label']; ?>
+				
+				<?php if (sizeof($arShopLocations) > 1) { ?>
+					
+					<?php echo wpsg_drawForm_Select('target', __('Shop Adresse', 'wpsg'), $arShopLocationLabels, '1'); ?>
+					
+				<?php } else { ?>
+					
+					<input type="hidden" name="target" value="1" />
+					
+				<?php } ?>
+
+				<?php echo wpsg_drawForm_Textarea('text', __('Text', 'wpsg'),'', ['noLabel' => true, 'fullLabel' => __('Text fÃŒr das Anschreiben', 'wpsg'), 'style' => 'height:200px']); ?>
+				
+				<br />
+				
+				<input type="submit" name="wpsg_mod_coverletter_write" value="<?php echo __("Speichern & Drucken", "wpsg"); ?>" style="float:left;" class="button button-primary" />
+				
+				<div class="wpsg_clear"></div>
+				
+			</form>
+			
+		</div>
+	</div>
+
+<?php echo wpsg_drawForm_AdminboxEnd(); ?>
+
+<script>
+	
+	jQuery('#wpsg_mod_coverletter_form').on('submit', function() {
+		
+		setTimeout(function() {
+			
+			location.reload();
+			
+		}, 1000);
+				
+	} );
+	
+</script>
Index: /views/mods/mod_coverletter/settings_edit.phtml
===================================================================
--- /views/mods/mod_coverletter/settings_edit.phtml	(revision 7258)
+++ /views/mods/mod_coverletter/settings_edit.phtml	(revision 7258)
@@ -0,0 +1,213 @@
+<?php
+
+	/**
+ * Template fÃŒr die Einstellungen des "Anschreiben" Moduls
+ */
+
+?>
+
+<div>
+	<ul class="nav nav-tabs" role="tablist">
+		<li role="presentation" class="active"><a href="#tab1" aria-controls="home" role="tab" data-toggle="tab"><?php echo __('Vordefinierte Textfelder', 'wpsg'); ?></a></li>
+	</ul>
+	<div class="tab-content">
+		<div role="tabpanel" class="tab-pane active" id="tab1">
+		
+			<?php echo wpsg_drawForm_TextStart(); ?>
+			<div style="position:relative;">
+				<?php if ($this->view['wpsg_mod_coverletter']['bp'] === false) { ?>
+					<p><?php echo __('Es wurde bisher kein Briefpapier hochgeladen', 'wpsg'); ?></p>
+				<?php } else { ?>
+					<a target="_blank" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_coverletter&do=getBp&noheader=1" target="_blank"><?php echo __('Derzeitiges Briefpapier', 'wpsg'); ?></a>
+				<?php } ?>
+				<a class="wpsg_glyphicon_right glyphicon glyphicon-question-sign form-control-feedback" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_coverletter_bp" data-wpsg-tip="mod_coverletter_bp" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_coverletter_bp"></a>
+				<input type="file" name="wpsg_mod_coverletter_bp">
+				<?php $strSuffix = ''; if ($this->view['wpsg_mod_coverletter']['bp'] !== false) { $strSuffix = '
+                    <label>
+						<input type="checkbox" name="wpsg_mod_coverletter_bp_del" value="1" />&nbsp;'.__('LÃ¶schen', 'wpsg').'
+					</label>';
+					echo __($strSuffix);
+				} ?>
+			</div>
+			<?php echo wpsg_drawForm_TextEnd(__('Briefpapier (PDF/JPG)', 'wpsg'), array('noP' => true, 'helps' => 'wpsg_mod_coverletter_bp')); ?>
+
+			<hr>
+			
+			<?php echo wpsg_drawForm_TextStart(); ?>
+			<div style="position:relative;">
+				<?php if ($this->view['wpsg_mod_coverletter']['logo'] === false) { ?>
+					<p><?php echo __('Es wurde bisher kein Logo hochgeladen', 'wpsg'); ?></p>
+				<?php } else { ?>
+					<a target="_blank" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_coverletter&do=getLogo&noheader=1" target="_blank"><?php echo __('Derzeitiges Logo', 'wpsg'); ?></a>
+				<?php } ?>
+				<a class="wpsg_glyphicon_right glyphicon glyphicon-question-sign form-control-feedback" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_coverletter_logo" data-wpsg-tip="mod_coverletter_logo" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_coverletter_logo"></a>
+				<input type="file" name="wpsg_mod_coverletter_logo">
+				<?php $logo_pos = $this->get_option("wpsg_mod_coverletter_logo_position"); ?>
+				<?php $defaultAlign = !isset($logo_pos) || empty($logo_pos) ? "align-buttons-active" : ""; ?>
+
+				<?php $alignLeft = $logo_pos === 'left' ? "align-buttons-active" : ""; ?>
+				<?php $alignCenter = $logo_pos === 'center' ? "align-buttons-active" : ""; ?>
+				<?php $alignRight = $logo_pos === 'right' ? "align-buttons-active" : ""; ?>
+
+				<?php $logo_transparency = $this->get_option("wpsg_mod_coverletter_logo_transparency") ?: "0%"; ?>
+
+				<?php $strSuffix = ''; if ($this->view['logo'] !== false) { $strSuffix = '
+					<div class="row">
+						<div class="col-md-4">
+							<div class="align-buttons">
+								<input type="input" data-toggle="tooltip" class="logo-align-button logo-align-button-left '.$alignLeft.'" name="wpsg_mod_coverletter_logo_position_left" value="&#xf036" onclick="handleLogoAlignClick($(this))" onkeydown="return false;" onfocus="return false;" autocomplete="off" title="'.__("Logo linksbÃŒndig ausrichten").'">
+								<input type="input" data-toggle="tooltip" class="logo-align-button logo-align-button-center '.$alignCenter.'" name="wpsg_mod_coverletter_logo_position_center" value="&#xf037" onclick="handleLogoAlignClick($(this))" onkeydown="return false;" onfocus="return false;" autocomplete="off" title="'.__("Logo zentrieren").'">
+								<input type="input" data-toggle="tooltip" class="logo-align-button logo-align-button-right '.$alignRight.' '.$defaultAlign.'" name="wpsg_mod_coverletter_logo_position_right" value="&#xf038" onclick="handleLogoAlignClick($(this))" onkeydown="return false;" onfocus="return false;" autocomplete="off" title="'.__("Logo rechtsbÃŒndig ausrichten").'">
+							</div>
+						</div>
+						<div class="col-md-8 logo-transparency">
+							<label>
+								<input type="text" name="wpsg_mod_coverletter_logo_transparency" value="'.$logo_transparency.'" />&nbsp;'.__('Logodeckkraft', 'wpsg').'
+							</label>		
+						</div>
+						<div class="col-md-12">
+							<label>
+								<input type="checkbox" name="wpsg_mod_coverletter_logo_del" value="1" />&nbsp;'.__('LÃ¶schen', 'wpsg').'
+							</label>	
+						</div>
+					</div>';
+					echo __($strSuffix);
+				} ?>
+						
+					
+				<button class="button wpsg_coverletter_preview" style="float:right; margin-right:10px;" name="wpsg_coverletter_preview" type="button">
+					<?php echo __("Vorschau", "wpsg"); ?>
+				</button>
+
+			</div>
+			
+			<?php echo wpsg_drawForm_TextEnd(__('Logo (JPG)', 'wpsg'), array('noP' => true, 'helps' => 'wpsg_mod_coverletter_logo')); ?>
+
+			<hr /><br />
+
+			<table class="table table-body-striped wpsg_mod_coverletter_fieldtable">
+				<thead>
+				<tr>
+					<th class="col_bezeichnung"><?php echo __('Bezeichnung', 'wpsg'); ?></th>
+					<th class="col_freitext"><?php echo __('Freitext', 'wpsg'); ?></th>
+					<th class="col_x"><?php echo __('X', 'wpsg'); ?></th>
+					<th class="col_y"><?php echo __('Y', 'wpsg'); ?></th>
+					<th class="col_color"><?php echo __('Farbe', 'wpsg'); ?></th>
+					<th class="col_groesse"><?php echo __('GrÃ¶Ãe', 'wpsg'); ?></th>
+					<th class="col_action"></th>
+				</tr>
+				</thead>
+				<tbody>
+				<?php foreach ($this->view['wpsg_mod_coverletter']['fields'] as $f => $field_name) { ?>
+					<tr>
+						<td><?php echo wpsg_hspc($field_name); ?></td>
+						<td>
+							<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][text]" value="<?php echo wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['text']); ?>" />
+						</td>
+						<td>
+							<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][x]" value="<?php echo wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['x']); ?>" />
+						</td>
+						<td>
+							<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][y]" value="<?php echo wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['y']); ?>" />
+						</td>
+						<td>
+							<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][color]" value="<?php echo wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['color']); ?>" />
+						</td>
+						<td>
+							<select name="text[<?php echo $f; ?>][fontsize]" style="width:100%;">
+								<option <?php echo ((wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['fontsize']) == "8")?'selected="selected"':''); ?> value="8">8</option>
+								<option <?php echo ((wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['fontsize']) == "9")?'selected="selected"':''); ?> value="9">9</option>
+								<option <?php echo ((wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['fontsize']) == "10")?'selected="selected"':''); ?> value="10">10</option>
+								<option <?php echo ((wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['fontsize']) == "11")?'selected="selected"':''); ?> value="11">11</option>
+								<option <?php echo ((wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['fontsize']) == "12")?'selected="selected"':''); ?> value="12">12</option>
+								<option <?php echo ((wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['fontsize']) == "13")?'selected="selected"':''); ?> value="13">13</option>
+								<option <?php echo ((wpsg_getStr($this->view['wpsg_mod_coverletter']['arTexts'][$f]['fontsize']) == "14")?'selected="selected"':''); ?> value="14">14</option>
+							</select>
+						</td>
+						<td>
+							<input type="checkbox" title="<?php echo __('Diese Checkbox aktivieren, damit die Textzeile verwendet wird.', 'wpsg'); ?>" value="1" name="text[<?php echo $f; ?>][aktiv]" <?php echo ((wpsg_isSizedInt($this->view['wpsg_mod_coverletter']['arTexts'][$f]['aktiv']))?'checked="checked"':''); ?> />
+						</td>
+					</tr>
+				<?php } ?>
+				</tbody>
+			</table>
+
+			<input class="button" onclick="if (!confirm('<?php echo __('Sind Sie sich sicher? Ihre bisherigen Einstellungen gehen verloren!', 'wpsg'); ?>')) return false; else location.href = '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&amp;action=module&amp;modul=<?php echo $_REQUEST['modul']; ?>&amp;do=reset&amp;noheader=1';" type="button" value="<?php echo __('Standardeinstellungen laden', 'wpsg'); ?>" />
+
+			<br /><br />
+
+			<div class="info">
+				<p>
+					<?php echo __('Die Angaben fÃŒr X (Abstand von Links) und Y (Abstand von Oben) werden in mm eingetragen.', 'wpsg'); ?><br />
+					<?php echo __('Die Farbe wird im Hexadezimalformat angegeben (#FFFFFF fÃŒr weiÃ, #000000 fÃŒr schwarz).', 'wpsg'); ?>
+				</p>
+			</div>
+
+			<br />
+
+		</div>
+	</div>
+</div>
+
+<script type="text/javascript">/* <![CDATA[ */
+
+	/**
+	 * Stellt sicher, dass immer nur ein Button der align-buttons die highlight Klasse hat
+	 */
+	function handleLogoAlignClick(pressedEl)
+	{
+
+		if(pressedEl.hasClass("align-buttons-active")) return;
+		else
+		{
+
+			pressedEl.addClass("align-buttons-active");
+			pressedEl[0].value = pressedEl[0].value + " selected";
+
+			jQuery.each($(".logo-align-button"), function(index, element) {
+				if(element.classList.contains("align-buttons-active") && element !== pressedEl[0]){
+
+					var values = element.value.split(" ");
+					element.value = values[0];
+
+					element.classList.remove("align-buttons-active");
+
+					return false;
+
+				}
+			});
+
+		}
+
+	} // function handleLogoAlignClick()
+
+	/**
+	 * Wird beim Klicken auf den Vorschau Button ausgelÃ¶st
+	 */
+	function wpsg_coverletter_preview()
+	{
+
+		var url = "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_coverletter&do=orderAjax&noheader=1&wpsg_coverletter_preview=1";
+
+		window.open(url, '_blank');
+
+		return false;
+
+	} // function wpsg_coverletter_preview()
+
+
+
+	jQuery(document).ready(function() {
+
+		jQuery('#wpsg_tab').wpsg_tab( {
+			'cookiename': 'wpsg_mod_coverletter_tab',
+			'tab2': function() {
+				jQuery('.tablink').show();
+			}
+		} );
+
+		jQuery(".wpsg_coverletter_preview").click(function(){ wpsg_coverletter_preview(); });
+
+	} );
+
+	/* ]]> */</script>
