Index: /mods/mod_converter/M1_Converter_update.php
===================================================================
--- /mods/mod_converter/M1_Converter_update.php	(revision 6635)
+++ /mods/mod_converter/M1_Converter_update.php	(revision 6638)
@@ -11,4 +11,15 @@
 	
 	private $m1cpb1;
+	
+	const TYPE_ORDER = '1';
+	const TYPE_PRODUCT = '2';
+	const TYPE_CUSTOMER = '3';
+	
+	const ENCODING_UTF8 = '1';
+	const ENCODING_ISO88591 = '2';
+	
+	const FORMAT_CSV = '1';
+	const FORMAT_XML = '2';
+	
 	
 	public function __construct($m1cpb) {
@@ -1341,4 +1352,163 @@
 	}	// public function M1_Converter_allgemein()
 	
+	
+	/**
+	 * Konvertierung der Exportprofile
+	 *
+	 * Die Tabelle wp_wpsg_exportprofile wird erweitert und die
+	 * Tabelle wp_wpsg_exportprofile_fields wird neu angelegt.
+	 * Shop V3 das Feld data in der Tabelle wp_wpsg_exportprofile wird
+	 * unserialisiert und die Kopfdaten in die Tabelle 
+	 * wp_wpsg_exportprofile geschrieben.
+	 * Die Auflistung des Array fields wird in die Tabelle
+	 * wp_wpsg_exportprofile_fields geschrieben.
+	 *
+	 */
+	public function M1_Converter_export() {
+		
+		global $myprogressbar1;
+		global $GLOBALS;
+		$anz1 = 0;
+		$anz2 = 0;
+		?>
+		<link rel="stylesheet" href="<?php echo WPSG_PLUGIN_URL.WPSG_FOLDERNAME.'/mods/mod_converter/style.css'; ?>" type="text/css" media="all" />
+	
+		<div class="m1_converter_admin_content" >
+	    	<div class="panel panel-default" >
+	    		<div class="panel-heading clearfix" >
+	        		<h2 class="panel-title" >M1-Konverter</h2>
+				</div>
+				
+				<div class="panel-body" >
+		
+	<?php
+		
+		require_once(WPSG_PATH_WP.'/wp-admin/includes/upgrade.php');
+	
+		/*
+		 * Tabelle fÃŒr die Exportprofile
+		 */
+		$sql = "CREATE TABLE ".WPSG_TBL_EXPORTPROFILE." (
+		   		id mediumint(9) NOT NULL AUTO_INCREMENT,
+		   		name VARCHAR(255) NOT NULL COMMENT 'Der Name des Profils',
+		   		filename VARCHAR(255) NOT NULL COMMENT 'Dateiname fÃŒr den Export',
+		   		export_type INT(1) NOT NULL COMMENT 'Typ des Exportprofils (Produkt / Bestellung)',
+		   		format INT(1) NOT NULL COMMENT 'Format des Exportes (XML/CSV)',
+		   		field_delimiter VARCHAR(1) NOT NULL COMMENT 'Feld-Trennzeichen (CSV)',
+		   	  	field_enclosure VARCHAR(1) NOT NULL COMMENT 'Feld-Begrenzungs Zeichen (CSV)',
+		   	  	field_escape VARCHAR(1) NOT NULL COMMENT 'Maskierungs-Zeichen (CSV)',
+		   	  	order_online INT(1) NOT NULL COMMENT 'Bestellungen in einer Zeile auffÃŒhren',
+		   	  	order_onetime INT(1) NOT NULL COMMENT 'Bestellungen nur einmal exportieren',
+		   	  	csv_fieldnames INT(1) NOT NULL COMMENT 'Beim CSV Export die Feldnamen in erster Zeile auffÃŒhren',
+		   	  	cron_interval INT(1) NOT NULL DEFAULT '0' COMMENT 'Cron Einstellungen (Inaktiv/Intervall)',
+		   	  	cron_path VARCHAR(500) NOT NULL COMMENT 'Pfad in dem die automatischen Dateien abgelegt werden',
+		   	  	cron_lastrun DATE NOT NULL COMMENT 'Letzte AusfÃŒhrung des Crons',
+		   	  	orderfilter TEXT NOT NULL COMMENT 'Serialisizerter Bestellfilter',
+		   	  	xml_roottag TEXT NOT NULL COMMENT 'Tagname des XML Root Elements',
+		   	  	xml_ordertag TEXT NOT NULL COMMENT 'Tagname des XML Bestellung Elements',
+		   	  	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)
+		   	) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+	
+		dbDelta($sql);
+	
+		/**
+		 * Tabelle fÃŒr die Felder des Exportprofils
+		 */
+		$sql = "CREATE TABLE ".WPSG_TBL_EXPORTPROFILE_FIELDS." (
+				id mediumint(9) NOT NULL AUTO_INCREMENT,
+				profil_id INT(11) NOT NULL COMMENT 'Link zu WPSG_TBL_EXPORTPROFILE',
+				pos int(11) NOT NULL COMMENT 'Position im Export',
+				name VARCHAR(255) NOT NULL COMMENT 'Spaltenname / Feldname im XML',
+				value_key VARCHAR(255) NOT NULL COMMENT 'Der SchlÃŒssel, mit dem der Wert gefÃŒllt wird',
+				format INT(2) NOT NULL COMMENT 'Zellenformat',
+				xml_att INT(1) NOT NULL COMMENT 'Tag oder Attributexport',
+				userformat VARCHAR(255) NOT NULL COMMENT 'Benutzerdefiniertes Format',
+				clear_spaces INT(1) NOT NULL COMMENT 'Leerzeichen entfernen',
+				INDEX profil_id (profil_id),
+				PRIMARY KEY  (id)
+			) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+	
+		dbDelta($sql);
+	
+		$sql = "SELECT * FROM ".WPSG_TBL_EXPORTPROFILE;
+		$arep = $GLOBALS['wpsg_sc']->db->fetchAssoc($sql);
+	
+		$test = unserialize($arep[0]['data']);
+	
+		foreach ($arep as $ep)
+		{
+			$data = array();
+			if (!isset($ep['data'])) continue;	// Keine WPSG3-Version
+			if (($ep['data'] == '')) continue;
+			$us = unserialize($ep['data']);
+			
+			$data['filename'] = $us['filename']; // Dateiname fÃŒr den Export
+			$data['export_type'] = self::TYPE_ORDER; // Typ des Exportprofils (Produkt / Bestellung)
+			$data['format'] = self::FORMAT_CSV; // Format des Exportes (XML/CSV)
+			$data['field_delimiter'] = $us['separator']; // Feld-Trennzeichen (CSV)
+			$data['field_enclosure'] = '"'; // Feld-Begrenzungs Zeichen (CSV)
+			$data['field_escape'] = wpsg_q('\\'); // Maskierungs-Zeichen (CSV)
+			$data['order_online'] = $us['oneline']; // Bestellungen in einer Zeile auffÃŒhren
+			$data['order_onetime'] = 0; // Bestellungen nur einmal exportieren
+			$data['csv_fieldnames'] = $us['firstlinecolname']; // Beim CSV Export die Feldnamen in erster Zeile auffÃŒhren
+			$data['cron_interval'] = 0; // Cron Einstellungen (Inaktiv/Intervall)
+			$data['cron_path'] = ''; // Pfad in dem die automatischen Dateien abgelegt werden
+			$data['cron_lastrun'] = '0000-00-00'; // Letzte AusfÃŒhrung des Crons
+			$data['orderfilter'] = ''; // Serialisierter Bestellfilter
+			$data['xml_roottag'] = ''; // Tagname des XML Root Elements
+			$data['xml_ordertag'] = ''; // Tagname des XML Bestellung Elements
+			$data['xml_productroottag'] = ''; // Tagname des XML Produkt Rootelements
+			$data['xml_producttag'] = ''; // Tagname des Produkt Elements
+			$data['xml_customertag'] = ''; // Tagname des Kunden Elements (Kundenexport)
+			$data['file_encoding'] = $us['iso']; // Encoding der Datei
+			
+			$GLOBALS['wpsg_sc']->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE, $data, "`id` = '".wpsg_q($ep['id'])."'");
+			$anz1++;
+			
+			$i = 0;
+			foreach ($us[fields] as $epf)
+			{
+				$fdata = array();
+				$fdata['profil_id'] = $ep['id']; // Link zu WPSG_TBL_EXPORTPROFILE
+				$fdata['pos'] = $i; // Position im Export
+				$fdata['name'] = $epf['name']; // Spaltenname / Feldname im XML
+				$fdata['value_key'] = $epf['value']; // Der SchlÃŒssel, mit dem der Wert gefÃŒllt wird
+				$fdata['format'] = 0;
+				if (isset($epf['format'])) $fdata['format'] = $epf['format']; // Zellenformat
+				$fdata['xml_att'] = 0; // Tag oder Attributexport
+				$fdata['userformat'] = ''; // Benutzerdefiniertes Format
+				$fdata['clear_spaces'] = 0; // Leerzeichen entfernen
+				$i++;
+				
+				$epid = $GLOBALS['wpsg_sc']->db->ImportQuery(WPSG_TBL_EXPORTPROFILE_FIELDS, $fdata);
+				$anz2++;
+			}
+		
+		}
+		
+		echo '<br /><br />';
+		echo $anz1.' Exportprofile bearbeitet.<br /><br />';
+		echo $anz2.' Exportprofil-Felder angelegt.<br /><br />';
+		
+		unset($_REQUEST['action']);
+		if ($GLOBALS['wpsg_sc']->get_option('wpsg_mod_converter_status') == 1023 - 512) {
+			echo '<br />Konvertierung beendet<br /><br />';
+			echo '<a class="m1c_button" href="'.admin_url('').'">ZurÃŒck zum Backend</a><br />';
+		} else {
+			echo '<a class="m1c_button" href="'.admin_url('admin.php?page=M1_Converter_dispatch&action=show').'">ZurÃŒck</a><br />';
+		}
+		ini_set('max_execution_time', 30);
+		
+		?>
+		</div></div></div>
+		<?php
+		
+		
+	}
+	
 	public function M1_Converter_test() {
 		
Index: /mods/wpsg_mod_converter.class.php
===================================================================
--- /mods/wpsg_mod_converter.class.php	(revision 6635)
+++ /mods/wpsg_mod_converter.class.php	(revision 6638)
@@ -102,6 +102,6 @@
 			$this->m1cauto = $this->shop->get_option('wpsg_mod_converter_auto');
 			
-			// 11 1111 1111
-			if (($this->status == 1023) && ($this->m1cauto == 0)) {
+			// 111 1111 1111
+			if (($this->status == 2047) && ($this->m1cauto == 0)) {
 				$this->shop->update_option('wpsg_mod_converter', false);
 				//$this->shop->update_option('wpsg_mod_converter_status', 0);
@@ -255,4 +255,11 @@
 				
 			}
+			else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'export')
+			{
+				
+				$this->m1cconv->M1_Converter_export();
+				$this->checkStatus('10000000000');
+				
+			}
 			else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'zip')
 			{
@@ -279,5 +286,5 @@
 		 * Startseite
 		 *
-		 * PrÃŒfen, ob der Shop als Plugin installiert ist und eine
+		 * PrÃŒfen, ob der Shop als Modul installiert ist und eine
 		 * richtige Versionsnummer hat.
 		 *
@@ -442,5 +449,5 @@
         		<br /><br />
         		<a id="idauto" class="m1c_button" title="Auto" href="<?php echo admin_url('admin.php?page=M1_Converter_dispatch&action=auto'); ?>">Automatisch</a>
-        		AusfÃŒhren der Schritte Allgemein, Kunden, Bestellungen bis Rechnungen
+        		AusfÃŒhren der Schritte Allgemein, Kunden, Bestellungen bis Exportprofile
         		
 		        <br /><br />
@@ -530,4 +537,11 @@
  					<span id="idrech" class="glyphicon glyphicon-ok glyph_ok" title="Konvertierung erfolgt" <?php if (($status & 512) == 512) echo 'style="display:inline-block;"'; ?> ></span><br />
 
+			        <a class="m1c_button" title="Exportprofile konvertieren" href="<?php echo admin_url('admin.php?page=M1_Converter_dispatch&action=export'); ?>">Exportprofile</a>
+					<a href="#" data-wpsg-tip="M1C-Exportprofile"
+					rel="?page=wpsg-Admin&amp;subaction=loadHelp&amp;noheader=1&amp;field=Bestellung_0"
+					class="glyphicon glyphicon-question-sign" aria-hidden="true"></a>
+					Exportprofile konvertieren
+ 					<span id="idrech" class="glyphicon glyphicon-ok glyph_ok" title="Konvertierung erfolgt" <?php if (($status & 1024) == 1024) echo 'style="display:inline-block;"'; ?> ></span><br />
+
 			        <a class="m1c_button" title="LÃ¶schen der Thumbnails und Zippen der Produktbilder" href="<?php echo admin_url('admin.php?page=M1_Converter_dispatch&action=zip'); ?>">Packen</a>
 					<a href="#" data-wpsg-tip="M1C-Zip"
@@ -552,4 +566,5 @@
 			        <br /><br />
 					-->
+					
 					</div>
 					</div>
@@ -818,4 +833,7 @@
 	progress(10);
 	jQuery('#idrech').show();
+	ajaxCall('admin.php?page=M1_Converter_dispatch&action=export&noheader=1');
+	progress(11);
+	jQuery('#idexport').show();
 
 	// Buttons enable
