Index: /changelog
===================================================================
--- /changelog	(revision 7899)
+++ /changelog	(revision 7900)
@@ -456,4 +456,6 @@
 - Bugfix: Gutscheinprodukt mit variablen Preis repariert
 - Bugfix: GebÃŒhren fÃŒr Rechnungskorrekturen wieder mÃ¶glich
+- Bugfix: Backend Kundenvariablen zeigt Auswahl direkt nach Wechsel des Variablentypes an
+- Bugfix: Weitere Kundendaten werden in Admin- und Kundenmail und Bestellverwaltung angezeigt
 - Change: Mit Rechnunskorrektur Statuswechsel optional mÃ¶glich
 - Change: Im Produkt im Backend werden jetzt alle Produktvariablen angezeigt nicht nur die beim bestellen gesetzen
Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 7899)
+++ /controller/wpsg_OrderController.class.php	(revision 7900)
@@ -1362,4 +1362,5 @@
 
             $this->shop->view['oCalculation'] = $oCalculation;
+            $this->shop->view['oCustomer'] = wpsg_customer::getInstance(intval($this->shop->view['data']['k_id']));
 
             $this->shop->view['country'] = $this->db->fetchRow("
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 7899)
+++ /lib/wpsg_basket.class.php	(revision 7900)
@@ -661,7 +661,6 @@
 				
 				$this->shop->sendMail($mail_text, $empfaenger, 'kundenmail', $arAttachments, $order_id, $oOrder->k_id, $mail_html);
-				
-				if ($bDebug === false)
-				{
+
+				if ($bDebug === false) {
 					
 					$this->db->ImportQuery(WPSG_TBL_OL, array(
Index: /model/wpsg_customer.class.php
===================================================================
--- /model/wpsg_customer.class.php	(revision 7899)
+++ /model/wpsg_customer.class.php	(revision 7900)
@@ -4,6 +4,5 @@
 	 * Model fÃŒr einen Kunden
 	 */
-	class wpsg_customer extends wpsg_model
-	{
+	class wpsg_customer extends wpsg_model {
 		
 		private $adress_data;
@@ -13,6 +12,5 @@
 		 * LÃ€dt die Kundendaten aus der Datenbank
 		 */
-		public function load($customer_id)
-		{
+		public function load($customer_id) {
 			
 			parent::load($customer_id);
@@ -26,4 +24,42 @@
 			
 		} // public function load($id)
+
+		public function getCustomerVariables() {
+
+			$return = [];
+
+			$custom = @unserialize($this->data['custom']);
+
+			if ($custom !== false) {
+
+				$arRequired = $this->shop->loadPflichtFeldDaten();
+
+				foreach ($custom as $i => $value) {
+
+					$return[$i] = [
+						'label' => $arRequired['custom'][$i]['name']??'Unbekannte Kundenvariable',
+						'typ' => intval($arRequired['custom'][$i]['typ']??0),
+						'value' => $value
+					];
+
+					if ($return[$i]['typ'] === 2) {
+
+						if (intval($return[$i]['value']) === 1) $return[$i]['value'] = __('Ja', 'wpsg');
+						else if (intval($return[$i]['value']) === 0) $return[$i]['value'] = __('Nein', 'wpsg');
+						else $return[$i]['value'] = __('Keine Angabe', 'wpsg');
+
+					} else if ($return[$i]['typ'] === 1) {
+
+						if (intval($return[$i]['value']) === -1) $return[$i]['value'] = __('Keine Auswahl', 'wpsg');
+
+					}
+
+				}
+
+			}
+
+			return $return;
+
+		}
 
         public function anonymize() {
Index: /model/wpsg_model.class.php
===================================================================
--- /model/wpsg_model.class.php	(revision 7899)
+++ /model/wpsg_model.class.php	(revision 7900)
@@ -68,9 +68,7 @@
 		 * Etwas im Datenarray ablegen
 		 */
-		public function __get($name)
-		{
-
-			if (array_key_exists($name, (array)$this->data))
-			{
+		public function __get($name) {
+
+			if (array_key_exists($name, (array)$this->data)) {
 				
 				return $this->data[$name];
Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 7899)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 7900)
@@ -889,4 +889,6 @@
 
             }
+
+            wpsg_debug($json_data);
 
 			$order_id = $this->db->fetchOne("SELECT `target_id` FROM `".WPSG_TBL_META."` WHERE `meta_table` = 'WPSG_TBL_ORDER' AND `meta_key` = 'wpsg_mod_paypalapi_paymentid' AND `meta_value` = '".wpsg_q($_REQUEST['paymentId'])."' ");
Index: /views/admin/kundendaten_tab2.phtml
===================================================================
--- /views/admin/kundendaten_tab2.phtml	(revision 7899)
+++ /views/admin/kundendaten_tab2.phtml	(revision 7900)
@@ -91,12 +91,15 @@
 	                        tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
 	                        callback: function(el) {
-	                            if (el == '<?php echo __('Auswahl', 'wpsg'); ?>')
-	                            {
+
+	                            if (el == '1') {
+
 	                                jQuery('#row_auswahl_<?php echo $c_id; ?>').show();
+
+	                            } else {
+
+	                                jQuery('#row_auswahl_<?php echo $c_id; ?>').hide();
+
 	                            }
-	                            else
-	                            {
-	                                jQuery('#row_auswahl_<?php echo $c_id; ?>').hide();
-	                            }
+
 	                        }
 	                    });
Index: /views/mailtemplates/html/order.phtml
===================================================================
--- /views/mailtemplates/html/order.phtml	(revision 7899)
+++ /views/mailtemplates/html/order.phtml	(revision 7900)
@@ -1,4 +1,7 @@
 <?php
-	
+
+    /** @var wpsg_order $oOrder */
+    $oOrder = $this->view['oOrder'];
+
 	if ($this->getFrontendTaxView() === WPSG_BRUTTO) $display_brutto_netto = 'brutto';
 	else $display_brutto_netto = 'netto';
@@ -202,4 +205,28 @@
 		<?php $this->callMods('mail_order_end', [&$this->view['basket']['arCalculation'], true]); ?>	
 	</table>
+
+    <?php
+
+        $arCV = $oOrder->getCustomer()->getCustomerVariables();
+
+        if (wpsg_isSizedArray($arCV)) { ?>
+
+            <strong><?php echo __('Weitere Kundendaten', 'wpsg'); ?>:</strong><br />
+
+            <table>
+
+                <?php foreach ($arCV as $cv) { ?>
+                    <tr>
+                        <th><?php echo $cv['label']; ?></th>
+                        <td><?php echo $cv['value']; ?></td>
+                    </tr>
+                <?php } ?>
+
+            </table>
+
+        <?php }
+
+    ?>
+
 </div>
 	
Index: /views/mailtemplates/order.phtml
===================================================================
--- /views/mailtemplates/order.phtml	(revision 7899)
+++ /views/mailtemplates/order.phtml	(revision 7900)
@@ -1,4 +1,7 @@
 <?php
-	
+
+    /** @var wpsg_order $oOrder */
+    $oOrder = $this->view['oOrder'];
+
 	if ($this->getFrontendTaxView() === WPSG_BRUTTO) $display_brutto_netto = 'brutto';
 	else $display_brutto_netto = 'netto';
@@ -123,2 +126,13 @@
 
 <?php $this->callMods('mail_aftercalculation', array(&$this->view['order']['id'])); ?>
+<?php
+
+    $arCV = $oOrder->getCustomer()->getCustomerVariables();
+
+    if (wpsg_isSizedArray($arCV)) { ?>
+<?php echo __('Weitere Kundendaten', 'wpsg'); ?>:
+
+<?php foreach ($arCV as $cv) { ?>
+<?php echo $cv['label']; ?>: <?php echo $cv['value']."\r\n"; ?>
+<?php } ?>
+<?php } ?>
Index: /views/order/view_customerdata.phtml
===================================================================
--- /views/order/view_customerdata.phtml	(revision 7899)
+++ /views/order/view_customerdata.phtml	(revision 7900)
@@ -6,4 +6,7 @@
      * Time: 10:40
      */
+
+    /** @var wpsg_customer $Customer */
+    $Customer = $this->view['oCustomer'];
 
 ?>
@@ -170,5 +173,5 @@
     <?php echo wpsg_drawForm_TextEnd(__('E-Mail', 'wpsg')); ?>
 	
-    <script type="text/javascript">/* <![CDATA[ */
+    <script>
 
         function wpsg_saveInvoiceAdress()
@@ -205,5 +208,17 @@
             
 
-    /* ]]> */</script>
+    </script>
+
+    <?php $arCV = $Customer->getCustomerVariables(); ?>
+    <?php if (wpsg_isSizedArray($arCV)) { ?>
+
+        <br />
+        <?php foreach ($Customer->getCustomerVariables() as $cv) { ?>
+
+            <?php echo wpsg_drawForm_Text($cv['label'], $cv['value']); ?>
+
+        <?php } ?>
+
+    <?php } ?>
 
 <?php echo wpsg_drawForm_AdminboxEnd(); ?>
