Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 6446)
+++ /mods/wpsg_mod_export.class.php	(revision 6447)
@@ -30,4 +30,5 @@
 		const TYPE_ORDER = '1';
 		const TYPE_PRODUCT = '2';
+		const TYPE_CUSTOMER = '3';
 		
 		const ENCODING_UTF8 = '1';
@@ -116,4 +117,5 @@
 		   	  	xml_productroottag TEXT NOT NULL COMMENT 'Tagname des XML Produkt Rootelements',
 		   	  	xml_producttag TEXT NOT NULL COMMENT 'Tagname des Produkt Elements',
+		   	  	xml_customertag TEXT NOT NULL COMMENT 'Tagname des Kunden Elements (Kundenexport)',
 		   	  	file_encoding INT(1) NOT NULL COMMENT 'Encoding der Datei',		   	  	
 		   	  	PRIMARY KEY  (id)
@@ -198,4 +200,11 @@
 						if ($profil['format'] == self::FORMAT_CSV) $file = $this->handleExportProductCSV($profil_id, $filter['filter']);
 						else if ($profil['format'] == self::FORMAT_XML) $file = $this->handleExportProductXML($profil_id, $filter['filter']);
+						
+					}
+					else if ($profil['export_type'] === self::TYPE_CUSTOMER)
+					{
+						
+						if ($profil['format'] == self::FORMAT_CSV) $file = $this->handleExportCustomerCSV($profil_id, $filter['filter']);
+						else if ($profil['format'] == self::FORMAT_XML) $file = $this->handleExportCustomerXML($profil_id, $filter['filter']);
 						
 					}
@@ -506,4 +515,5 @@
 					case 'xml_ordertag': $col = 'xml_ordertag'; break;
 					case 'xml_productroottag': $col = 'xml_productroottag'; break;
+					case 'xml_customertag': $col = 'xml_customertag'; break;
 					case 'xml_producttag': $col = 'xml_producttag'; break;
 															
@@ -654,4 +664,11 @@
 						
 					}
+					else if ($profil['export_type'] == self::TYPE_CUSTOMER)
+					{
+						
+						if ($profil['format'] == self::FORMAT_CSV) $file = $this->handleExportCustomerCSV($profil['id'], $arFilter);
+                    	else if ($profil['format'] == self::FORMAT_XML) $file = $this->handleExportCustomerXML($profil['id'], $arFilter);
+						
+					}
                     
                     if (wpsg_remoteconnection::handleConenctionString($profil['cron_path'], $profil['filename'], $file) !== true)
@@ -879,4 +896,77 @@
 		} // private function handleExportCSV($arProfile, $arOrderFilter = array(), $cron = false)
 
+		/**
+		 * Erstellt die CSV und gibt den Pfad zur erstellten Datei zurÃŒck (FÃŒr einen Kundenexport)
+		 * 
+		 * @param $profil_id
+		 * @param array $arOrderFilter
+		 */
+		private function handleExportCustomerCSV($profil_id, $arCustomerFilter = array())
+		{
+			
+			$this->loadFields(); 
+			
+			$arData = wpsg_customer::find($arCustomerFilter); 
+
+            $tmpfname = tempnam($this->getTmpFilePath(), "wpsg");
+            $filehandler = fopen($tmpfname, 'w');
+            
+            $profil = $this->loadProfil($profil_id);
+            
+            $arExportData = array();
+            
+            if ($profil['csv_fieldnames'] == '1')
+            {
+                
+                $row = array();
+                
+                foreach ($profil['fields'] as $f)
+                {
+                    
+                    $row[] = $f['name'];
+                    
+                }
+                
+                $arExportData[] = $row;
+                
+            }
+            
+            foreach ($arData as $oCustomer) 
+            {
+                
+				$row = array();
+				                        
+				foreach ($profil['fields'] as $f)
+				{
+
+					$row[] = $this->getValue($f, $profil['field_delimiter'], false, false, 1, false, false, $oCustomer->id);
+														
+				}
+
+                $arExportData[] = $row; 
+                                
+            } // foreach arData
+             
+            foreach ($arExportData as $row)
+            {
+                
+                fputcsv($filehandler, $row, $profil['field_delimiter'], $profil['field_enclosure'], $profil['field_escape']);
+                                    
+            }
+            
+            fclose($filehandler);
+            
+            // In ISO wandeln
+            if ($profil['file_encoding'] == self::ENCODING_ISO88591)
+            {
+                
+                file_put_contents($tmpfname, utf8_decode(file_get_contents($tmpfname)));
+                                        
+            }
+                        
+            return $tmpfname;
+			
+		} // private function handleExportCustomerCSV($profil_id, $arOrderFilter = array())
+		
 		/**
 		 * Erstellt die XML und gibt den Pfad zur erstellten Datei zurÃŒck (FÃŒr einen Produktexport)
@@ -1100,4 +1190,78 @@
 		} // private function handleExportXML($arProfile, $arOrderFilter = array(), $cron = false)
 
+		/**
+		 * Erstellt die XML und gibt den Pfad zur erstellten Datei zurÃŒck (FÃŒr einen Kundenexport)
+		 * 
+		 * @param $profil_id
+		 * @param array $arOrderFilter
+		 */
+		private function handleExportCustomerXML($profil_id, $arCustomerFilter = array()) 
+		{
+			
+			$this->loadFields();
+			
+			$arData = wpsg_customer::find($arCustomerFilter);
+			$profil = $this->loadProfil($profil_id);
+			
+			if (!wpsg_isSizedString($profil['xml_roottag'])) throw new \Exception(wpsg_translate(__('Kein XML Root Tagname fÃŒr Profil "#1#" gesetzt!', 'wpsg'), $profil['name']));
+			if (!wpsg_isSizedString($profil['xml_producttag'])) throw new \Exception(wpsg_translate(__('Kein XML Kunden Tagname fÃŒr Profil "#1#" gesetzt!', 'wpsg'), $profil['name']));
+			
+			$doc = new DOMDocument('1.0');
+            $doc->formatOutput = true;
+            
+            $root = $doc->createElement($this->clearXML($profil['xml_roottag']));					
+            $root = $doc->appendChild($root);
+			
+			foreach ($arData as $oCustomer)
+            {
+                
+                $tag_product = $doc->createElement($this->clearXML($profil['xml_customertag']));
+                $tag_product = $root->appendChild($tag_product);
+			
+				foreach ($profil['fields'] as $f)
+                {
+                    
+                    $value = $this->getValue($f, $profil['field_delimiter'], false, false, 1, false, false, $oCustomer->id);
+                                                    
+					if (wpsg_isSizedInt($f['xml_att']))
+					{
+						
+						$att = $doc->createAttribute($this->clearXML($f['name']));
+						$att->value = htmlspecialchars($value);
+						
+						$tag_product->appendChild($att);
+
+						
+					}
+					else
+					{
+						
+						$tag = $doc->createElement($this->clearXML($f['name']));
+						$tag = $tag_product->appendChild($tag);
+						
+						$tag_value = $doc->createTextNode(htmlspecialchars($value));
+						$tag->appendChild($tag_value);
+						
+					}
+                                         
+                }
+				
+			}
+			
+			$tmpfname = tempnam($this->getTmpFilePath(), "wpsg");
+            file_put_contents($tmpfname, $doc->saveXML());
+            
+            // In ISO wandeln
+            if ($profil['file_encoding'] == self::ENCODING_ISO88591)
+            {
+                
+                file_put_contents($tmpfname, utf8_decode(file_get_contents($tmpfname)));
+                                        
+            }
+            
+            return $tmpfname;
+			
+		} // private function handleExportCustomerXML($profil_id, $arOrderFilter = array())
+						
 		/**
 		 * Bereinigt Daten an XML fÃŒr Tagname / Attributname
@@ -1447,10 +1611,10 @@
 		}
 		
-		public function getValue($f, $profil_separator, $o_id, $p_id = false, $product_index = 1, $productkey = false, $order_product_id = false)
+		public function getValue($f, $profil_separator, $o_id, $p_id = false, $product_index = 1, $productkey = false, $order_product_id = false, $customer_id = false)
 		{
 			
 			$field_value = $f['value_key'];
 			
-			$cache_key = $o_id.'_'.$p_id.'_'.$product_index.'_'.$productkey.'_'.$order_product_id;
+			$cache_key = $o_id.'_'.$p_id.'_'.$product_index.'_'.$productkey.'_'.$order_product_id.'_'.$customer_id;
 			
 			// Hier werden die Ergebnisse gespeichert
@@ -1532,8 +1696,10 @@
 					
 				}
+				
+				if ($customer_id !== false) $order['k_id'] = $customer_id;
 								
 				$kunde = $this->db->fetchRow("
 					SELECT
-						K.*
+						K.*							
 					FROM
 						`".WPSG_TBL_KU."` AS K
@@ -1666,6 +1832,8 @@
 			 
 			/** @var wpsg_order $oOrder */
-			$oOrder = wpsg_order::getInstance($order['id']);			 
-			$oCustomer = $oOrder->getCustomer();
+			$oOrder = wpsg_order::getInstance($order['id']);
+			
+			if ($customer_id !== false) $oCustomer = wpsg_customer::getInstance($customer_id);
+			else $oCustomer = $oOrder->getCustomer();
 			
 			switch ($field_value)
Index: /views/mods/mod_export/profil.phtml
===================================================================
--- /views/mods/mod_export/profil.phtml	(revision 6446)
+++ /views/mods/mod_export/profil.phtml	(revision 6447)
@@ -46,5 +46,9 @@
                 <?php } ?>
                 
-                <?php echo wpsg_drawForm_Text('Produkt-Tagname', $this->view['profil']['xml_producttag'], 'xml_producttag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                <?php if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_CUSTOMER) { ?>
+                    <?php echo wpsg_drawForm_Text('Kunden-Tagname', $this->view['profil']['xml_customertag'], 'xml_customertag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                <?php } else { ?>
+                    <?php echo wpsg_drawForm_Text('Produkt-Tagname', $this->view['profil']['xml_producttag'], 'xml_producttag', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                <?php } ?>
                 
             </div>
@@ -205,4 +209,16 @@
                     
                 </fieldset>
+                <?php } else if ($this->view['profil']['export_type'] === wpsg_mod_export::TYPE_CUSTOMER) { ?>
+                <fieldset id="wpsg_mod_export_productfilter">
+                    
+                    <legend><div class="col-sm-offset-6"><?php echo __('Kundenfilter', 'wpsg'); ?></div></legend>
+                    
+                    <form id="wpsg_mod_export_searchfilter">
+                        
+                        <?php echo wpsg_drawForm_Text(__('Suchfeld', 'wpsg'), wpsg_getStr($this->view['profil']['orderfilter']['s']), 'orderfilter_s', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                        
+                    </form>
+                    
+                </fieldset>
                 <?php } ?>
                 
Index: /views/mods/mod_export/profillist.phtml
===================================================================
--- /views/mods/mod_export/profillist.phtml	(revision 6446)
+++ /views/mods/mod_export/profillist.phtml	(revision 6447)
@@ -14,4 +14,5 @@
 		if ($p['export_type'] === wpsg_mod_export::TYPE_ORDER) $arProfilSelect[$p['id']] .= ' ('.__('Bestellexport', 'wpsg').')';
 		else if ($p['export_type'] === wpsg_mod_export::TYPE_PRODUCT) $arProfilSelect[$p['id']] .= ' ('.__('Produktexport', 'wpsg').')';
+		else if ($p['export_type'] === wpsg_mod_export::TYPE_CUSTOMER) $arProfilSelect[$p['id']] .= ' ('.__('Kundenexport', 'wpsg').')';
 		
 	}
Index: /views/mods/mod_export/settings_edit.phtml
===================================================================
--- /views/mods/mod_export/settings_edit.phtml	(revision 6446)
+++ /views/mods/mod_export/settings_edit.phtml	(revision 6447)
@@ -148,5 +148,6 @@
 
 <a title="<?php echo __('Neuens Exportprofil anlegen', 'wpsg'); ?>" href="#" class="" onclick="return wpsg_mod_export_addProfil(<?php echo wpsg_mod_export::TYPE_ORDER; ?>);"><span class="wpsg-glyphicon glyphicon glyphicon-plus"></span><?php echo __('Neues Exportprofil fÃŒr Bestellungen anlegen', 'wpsg'); ?></a><br />
-<a title="<?php echo __('Neuens Exportprofil anlegen', 'wpsg'); ?>" href="#" class="" onclick="return wpsg_mod_export_addProfil(<?php echo wpsg_mod_export::TYPE_PRODUCT; ?>);"><span class="wpsg-glyphicon glyphicon glyphicon-plus"></span><?php echo __('Neues Exportprofil fÃŒr Produkte anlegen', 'wpsg'); ?></a>
+<a title="<?php echo __('Neuens Exportprofil anlegen', 'wpsg'); ?>" href="#" class="" onclick="return wpsg_mod_export_addProfil(<?php echo wpsg_mod_export::TYPE_PRODUCT; ?>);"><span class="wpsg-glyphicon glyphicon glyphicon-plus"></span><?php echo __('Neues Exportprofil fÃŒr Produkte anlegen', 'wpsg'); ?></a><br />
+<a title="<?php echo __('Neuens Exportprofil anlegen', 'wpsg'); ?>" href="#" class="" onclick="return wpsg_mod_export_addProfil(<?php echo wpsg_mod_export::TYPE_CUSTOMER; ?>);"><span class="wpsg-glyphicon glyphicon glyphicon-plus"></span><?php echo __('Neues Exportprofil fÃŒr Kunden anlegen', 'wpsg'); ?></a>
 
 <br /><br />
Index: /views/mods/mod_kundenverwaltung/index.phtml
===================================================================
--- /views/mods/mod_kundenverwaltung/index.phtml	(revision 6446)
+++ /views/mods/mod_kundenverwaltung/index.phtml	(revision 6447)
@@ -19,9 +19,17 @@
 					<li role="presentation" class="wpsg-customer-tab-a wpsg_showhide_filter <?php echo ((wpsg_isTrue($this->view['hasFilter']))?'activexxxx':''); ?>" id="wpsg-customer-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
                     <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'add'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("HinzufÃŒgen", "wpsg"); ?></a></li>
+                    
+                    <?php /* Integration Exportprofile */ ?>
+                    <?php if ($this->hasMod('wpsg_mod_export')) { $arProfile = $this->callMod('wpsg_mod_export', 'getProfile', array(wpsg_mod_export::TYPE_CUSTOMER)); ?>
+                    <?php if (wpsg_isSizedArray($arProfile)) { ?>
+                    <li role="presentation" class="wpsg_showhide_export"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-export"></span><?php echo __('Kundenexport (Exportprofile)', 'wpsg'); ?></a></li>
+                    <?php } ?>
+                    <?php } ?>
+                        
 				</ul>
 				<ul class="nav navbar-nav navbar-right">
-                    <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'import'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=import&noheader=1"><span class="glyphicon glyphicon-import"></span><?php echo __("Import", "wpsg"); ?></a></li>
+                    <li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'import'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=import&noheader=1"><span class="glyphicon glyphicon-import"></span><?php echo __("Daten-Import", "wpsg"); ?></a></li>
 					<?php if (wpsg_isSizedArray($this->view['arData'])) { ?>
-					<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'export'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=export&noheader=1"><span class="glyphicon glyphicon-export"></span><?php echo __("Export", "wpsg"); ?></a></li>
+					<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'export'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?age=wpsg-Customer&action=export&noheader=1"><span class="glyphicon glyphicon-export"></span><?php echo __("Daten-Export", "wpsg"); ?></a></li>
 					<?php } ?>
 				</ul>
@@ -48,4 +56,55 @@
         </div>
 
+        <?php /* Integration Exportprofile */ ?>
+        <?php if ($this->hasMod('wpsg_mod_export')) { $arProfile = $this->callMod('wpsg_mod_export', 'getProfile', array(wpsg_mod_export::TYPE_CUSTOMER)); ?>
+        <?php if (wpsg_isSizedArray($arProfile)) { ?>
+        <div class="wpsg-export container-fluid form-horizontal" style="display:none;">
+            
+            <form class="container-fluid form-horizontal" target="_blank" method="post" action="<?php echo WPSG_URL_WP ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=handleExport&noheader=1" onsubmit="wpsg_mod_export_serializefilter();">
+        
+                <div class="row">
+                    <div class="col-lg-4">
+            
+                        <?php foreach ($arProfile as $p) { ?>
+                            <?php echo wpsg_drawForm_Checkbox('wpsg_mod_export_profile[]', $p['name'], false, array('value' => $p['id'], 'noHidden' => true)); ?>
+                        <?php } ?>
+            
+                        <br /><?php echo wpsg_drawForm_SubmitButton(__('Export starten')); ?>
+            
+                    </div>
+                </div>
+            
+                <input type="hidden" name="filter" id="wpsg_mod_export_filter" value="" />
+            
+            </form>
+       
+            <script type="text/javascript">/* <![CDATA[ */
+                   
+                function wpsg_mod_export_serializefilter()
+                {
+            
+                    jQuery('#wpsg_mod_export_filter').val(jQuery('#filter_form').serialize());
+            
+                }
+                
+                jQuery(document).ready(function() {
+                    
+                    jQuery('.wpsg_showhide_export').off('click').on('click', function() {
+                        
+                        jQuery(this).toggleClass('active');
+                        jQuery('.wpsg-export').toggle(250);
+                        
+                        return false;
+                        
+                    } );
+                    
+                } );
+            
+            /* ]]> */</script>
+            
+        </div>       
+        <?php } ?>
+        <?php } ?>
+        
     </nav>
 
