Index: /changelog
===================================================================
--- /changelog	(revision 8477)
+++ /changelog	(revision 8478)
@@ -648,2 +648,4 @@
 - Bugfix: Uploads bei Downloadprodukten korrigiert
 - Feature: eInvoice RechnungsempfÃ€nger unabhÃ€ngig von E-Mail des Kunden
+- Feature: GiroCode in Bestellabschluss, Kundenemail, Rechnung
+- Feature: Begrenzung auf einen Gutschein je Bestellung mÃ¶glich
Index: /controller/wpsg_BasketController.class.php
===================================================================
--- /controller/wpsg_BasketController.class.php	(revision 8477)
+++ /controller/wpsg_BasketController.class.php	(revision 8478)
@@ -595,4 +595,18 @@
 				
 				$gs_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_GUTSCHEIN."` WHERE `code` = '".wpsg_q($code)."' ");
+				
+				// Nur ein Gutschein im Warenkorb mÃ¶glich?
+				if ($this->shop->get_option('wpsg_mod_gutschein_one') === '1') {
+					
+					$arBasket = $this->shop->cache->getShopBasketArray();
+					
+					if (sizeof($arBasket['arCalculation']['voucher']??[]) > 0) {
+					
+						$this->addFrontendError(__('Sie haben bereits einen Gutschein im Warenkorb!', 'wpsg'));
+						$this->redirect($this->shop->getURL(wpsg_ShopController::URL_BASKET));
+						
+					}
+					
+				}
 				
 				if (!isset($gs_db['id']) || $gs_db['id'] <= 0) {
@@ -671,69 +685,29 @@
 										$arProductIDsBasket = $this->shop->basket->getProductIDs();
 										
-										$wrongProducts = array();
-										
-										// ProduktgÃŒltigkeit prÃŒfen
-										/*
-										$tarr = wpsg_explode(',', $gs_db['products']);
-										if (wpsg_isSizedArray($tarr)) {
+										try {
 											
-											if (sizeof(array_diff($arProductIDsBasket, wpsg_explode(',', $gs_db['products']))) > 0) {
+											foreach ($arProductIDsBasket as $product_id) {
 												
-												$wrongProducts = array_diff($arProductIDsBasket, wpsg_explode(',', $gs_db['products']));
+												if (!$oVoucher->isUsabel($product_id)) {
 												
+													$oProduct = wpsg_product::getInstance($product_id);
+													
+													throw new \Exception(
+														wpsg_translate(
+															__('Gutschein ist fÃŒr Produkt "#1#" nicht zulÃ€ssig.', 'wpsg'), $oProduct->getProductName()
+														)
+													);
+												
+												}
 											}
-											
-										}
-										
-										// ProduktgruppengÃŒltigkeit prÃŒfen
-										$tarr = wpsg_explode(',', $gs_db['productgroups']);
-										if (wpsg_isSizedArray($tarr)) {
-											
-											$ProductGroupIDs = wpsg_explode(',', $gs_db['productgroups']);
-											
-											$arProductIDs = $this->db->fetchAssocField("
-												SELECT P.`id` FROM `".WPSG_TBL_PRODUCTS."` AS P WHERE P.`pgruppe` IN (".wpsg_implode(',', $ProductGroupIDs).")
-											");
-											
-											if (sizeof(array_diff($arProductIDsBasket, $arProductIDs)) > 0) {
-												
-												$wrongProducts = array_merge($wrongProducts, array_diff($arProductIDsBasket, $arProductIDs));
-												
-											}
-											
-										}
-										
-										if (wpsg_isSizedArray($wrongProducts)) {
-											
-											if (sizeof($wrongProducts) === 1) {
-												
-												$product = $this->shop->loadProduktArray(array_values($wrongProducts)[0]);
-												$this->addFrontendError(wpsg_translate(__('Gutschein konnte nicht hinzugefÃŒgt werden, da er fÃŒr das Produkt #1# nicht zulÃ€ssig ist.', 'wpsg'), $product['name']));
-												
-											} else {
-												
-												$arProductNames = array();
-												
-												foreach ($wrongProducts as $product_id) {
-													
-													$product_data = $this->shop->loadProduktArray($product_id);
-													$arProductNames[] = $product_data['name'];
-													
-												}
-												
-												$this->addFrontendError(wpsg_translate(__('Gutschein konnte nicht hinzugefÃŒgt werden, da er fÃŒr die Produkte #1# nicht zulÃ€ssig ist.', 'wpsg'), wpsg_implode(', ', $arProductNames)));
-												
-											}
-											
-										} else {
 											
 											$this->addFrontendMessage(__('Gutschein wurde der Bestellung erfolgreich hinzugefÃŒgt.', 'wpsg'));
 											$this->shop->basket->addGutscheinToSession($gs_db['value'], $gs_db['calc_typ'], $gs_db['code'], $gs_db['id']);
 											
+										} catch (\Exception $e) {
+										
+											$this->addFrontendError($e->getMessage());
+										
 										}
-										*/
-
-										$this->addFrontendMessage(__('Gutschein wurde der Bestellung erfolgreich hinzugefÃŒgt.', 'wpsg'));
-										$this->shop->basket->addGutscheinToSession($gs_db['value'], $gs_db['calc_typ'], $gs_db['code'], $gs_db['id']);
 										
 									}
Index: /mods/wpsg_mod_gutschein.class.php
===================================================================
--- /mods/wpsg_mod_gutschein.class.php	(revision 8477)
+++ /mods/wpsg_mod_gutschein.class.php	(revision 8478)
@@ -1004,10 +1004,10 @@
 		} // public function settings_edit()
 
-		public function settings_save()
-		{
-
-		    $this->shop->update_option('wpsg_mod_gutschein_size', $_REQUEST['wpsg_mod_gutschein_size'], false, false, WPSG_SANITIZE_TEXTFIELD);
-		    $this->shop->update_option('wpsg_mod_gutschein_perPage', $_REQUEST['wpsg_mod_gutschein_perPage'], false, false, WPSG_SANITIZE_TEXTFIELD);
-		    			
+		public function settings_save() {
+
+			$this->shop->update_option('wpsg_mod_gutschein_size', $_REQUEST['wpsg_mod_gutschein_size'], false, false, WPSG_SANITIZE_TEXTFIELD);
+			$this->shop->update_option('wpsg_mod_gutschein_perPage', $_REQUEST['wpsg_mod_gutschein_perPage'], false, false, WPSG_SANITIZE_TEXTFIELD);
+			$this->shop->update_option('wpsg_mod_gutschein_one', $_REQUEST['wpsg_mod_gutschein_one'], false, false, WPSG_SANITIZE_CHECKBOX);
+			
 		} // public function settings_save()
  
Index: /views/mods/mod_gutschein/settings_edit.phtml
===================================================================
--- /views/mods/mod_gutschein/settings_edit.phtml	(revision 8477)
+++ /views/mods/mod_gutschein/settings_edit.phtml	(revision 8478)
@@ -8,3 +8,4 @@
 <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_size', __('LÃ€nge der Gutscheincodes', 'wpsg'), $this->get_option('wpsg_mod_gutschein_size'), array ('help' => 'wpsg_mod_gutschein_size')); ?>
 <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_perPage', __('Gutscheine pro Seite (Backend)', 'wpsg'), $this->get_option('wpsg_mod_gutschein_perPage'), array ('help' => 'wpsg_mod_gutschein_perPage')); ?>
+<?php echo wpsg_drawForm_Checkbox('wpsg_mod_gutschein_one', __('Nur ein Gutschein je Bestellung erlauben', 'wpsg'), $this->get_option('wpsg_mod_gutschein_one'), ['help' => 'wpsg_mod_gutschein_one']);
 
