Index: /changelog
===================================================================
--- /changelog	(revision 7606)
+++ /changelog	(revision 7607)
@@ -298,4 +298,5 @@
 - Bugfix: Speichern des Fonts in DownloadPlus wieder mÃ¶glich / Ticket #698
 - Bugfix: Warnungen reduziert / Ticket #702
+- Bugfix: Produkte mit gleichen Originaldokumenten (DownloadPLUS) kÃ¶nnen jetzt zusammen bestellt und direkt individualisiert werden
 - Bugfix: Paketverfolgungslink wird direkt beim wechsel auf "Ware versendet" versendet.
 - Feature: Beim kopieren/speichern von Produkten kann der Bestand innerhalb einer Produktgruppe automatisch ermittelt werden (Optional)
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 7606)
+++ /model/wpsg_product.class.php	(revision 7607)
@@ -334,11 +334,11 @@
 				
 			}
-
+			
 			// Kauf nur fÃŒr angemeldete Benutzer?
 			if (!$this->shop->canDisplayPrice()) return false;
 			
-			// Module Checken
+						// Module Checken
 			$bOK = $this->shop->callMods('canOrder', array($product_key));
-
+			
 			return $bOK;
 
Index: /mods/wpsg_mod_downloadplus.class.php
===================================================================
--- /mods/wpsg_mod_downloadplus.class.php	(revision 7606)
+++ /mods/wpsg_mod_downloadplus.class.php	(revision 7607)
@@ -341,9 +341,7 @@
     } //public function product_addedit_content(&$product_content, &$product_data)
 
-    public function setOrderStatus($order_id, $status_id, $inform)
-    {
-
-        if ($this->shop->get_option('wpsg_mod_downloadplus_indiv_mode') == '1' && $status_id == 100) // Nach Zahlung planen
-        {
+    public function setOrderStatus($order_id, $status_id, $inform) {
+
+        if ($this->shop->get_option('wpsg_mod_downloadplus_indiv_mode') === '1' && $status_id == 100) { // Nach Zahlung planen 
 
             $this->indivOrder($order_id);
@@ -1441,6 +1439,5 @@
      * Individualisiert die PDFs fÃŒr eine Bestellung
      */
-    public function indivOrder($order_id)
-    {
+    public function indivOrder($order_id) {
 
         $arBasket = $this->shop->cache->loadBasketArray($order_id);
@@ -1449,9 +1446,7 @@
         $arPDF = array();
 
-        foreach ($arBasket['produkte'] as $p)
-        {
-
-            if ($this->isPDFProdukt($p['id']))
-            {
+        foreach ($arBasket['produkte'] as $p) {
+			
+            if ($this->isPDFProdukt($p['id'])) {
 
                 $bPDFProdukt = true;
@@ -1464,6 +1459,5 @@
                 $product_files = $this->getFiles($p['id']);
 
-                foreach ($product_files as $file)
-                {
+                foreach ($product_files as $file) {
 
                     $arPDF[] = array(
@@ -1483,5 +1477,5 @@
             {
 
-                $this->db->Query("DELETE FROM `".WPSG_TBL_PDFINDIV."` WHERE `file` = '".wpsg_q($v[1])."' AND `o_id` = '".wpsg_q($order_id)."'");
+                $this->db->Query("DELETE FROM `".WPSG_TBL_PDFINDIV."` WHERE `file` = '".wpsg_q($v[1])."' AND `o_id` = '".wpsg_q($order_id)."' AND `p_key` = '".wpsg_q($v[0])."' AND `product_index` = '".wpsg_q($v[2])."' ");
 
                 $download_nr = $this->getDownloadNr($order_id, $v[0], $v[2]);
@@ -1718,3 +1712,2 @@
 } // class wpsg_mod_downloadplus extends wpsg_mod_basic
 
-?>
Index: /mods/wpsg_mod_downloadprodukte.class.php
===================================================================
--- /mods/wpsg_mod_downloadprodukte.class.php	(revision 7606)
+++ /mods/wpsg_mod_downloadprodukte.class.php	(revision 7607)
@@ -384,34 +384,34 @@
 													WHERE `id` = '".$order_id."'
 												");
-				
-
-				foreach ($arrBasket['produkte'] as $produkt)
-				{
-					
-					$arProductFiles = $this->getProdFiles($this->shop->getProduktID($produkt['id']));
-
-					if (wpsg_isSizedArray($arProductFiles))
-					{
-					
-						foreach ($arProductFiles as $p_id => $f)
-						{	
-					
-							$chash = md5($orderValues['cdate'].basename($f[0]));
+				 
+				foreach ($arrBasket['produkte'] as $produkt) {
+					
+					for ($i = 1; $i <= intval($produkt['menge']); $i ++) {
+											
+						$arProductFiles = $this->getProdFiles($this->shop->getProduktID($produkt['id']));
+	
+						if (wpsg_isSizedArray($arProductFiles)) {
+						
+							foreach ($arProductFiles as $p_id => $f) {	
+						
+								$chash = md5($orderValues['cdate'].basename($f[0]));
+								
+								if (strpos(get_permalink($this->shop->get_option('wpsg_page_basket')), "?") > -1)	
+								{			
+									
+									$strLinks .= get_permalink($this->shop->get_option('wpsg_page_basket'))."&plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash."\r\n\r\n";
+									$arLinks[] = get_permalink($this->shop->get_option('wpsg_page_basket'))."&plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash;
+									
+								}
+								else
+								{
+	
+									$strLinks .= get_permalink($this->shop->get_option('wpsg_page_basket'))."?plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash."\r\n\r\n";
+									$arLinks[] = get_permalink($this->shop->get_option('wpsg_page_basket'))."?plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash; 
+									
+								}
+		
+							}
 							
-							if (strpos(get_permalink($this->shop->get_option('wpsg_page_basket')), "?") > -1)	
-							{			
-								
-								$strLinks .= get_permalink($this->shop->get_option('wpsg_page_basket'))."&plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash."\r\n\r\n";
-								$arLinks[] = get_permalink($this->shop->get_option('wpsg_page_basket'))."&plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash;
-								
-							}
-							else
-							{
-
-								$strLinks .= get_permalink($this->shop->get_option('wpsg_page_basket'))."?plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash."\r\n\r\n";
-								$arLinks[] = get_permalink($this->shop->get_option('wpsg_page_basket'))."?plugin=1&noheader=1&m_id=".$this->id."&order=".$order_id."&file=".base64_encode(basename($f[0]))."&produkt=".$this->shop->getProduktID($produkt['id'])."&chash=".$chash; 
-								
-							}
-	
 						}
 						
@@ -653,3 +653,2 @@
 	} // class wpsg_mod_downloadprodukte extends wpsg_mod_basic 
 
-?>
Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 7606)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 7607)
@@ -674,7 +674,9 @@
 		 * @throws Exception
 		 */
-		public function webHookRedirect()
-		{
-						
+		public function webHookRedirect() {
+			
+			//  
+			$this->shop->addShipPay();
+			
 			$bodyReceived = file_get_contents('php://input');
 						
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 7606)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 7607)
@@ -797,11 +797,9 @@
 		 * Darf das Produkt gekauft werden?
 		 */
-		public function canOrder($product_key)
-		{
+		public function canOrder($product_key) {
 
 			$product_id = $this->shop->getProduktID($product_key);
 
-			if ($this->isVariantsProduct($product_id))
-			{
+			if ($this->isVariantsProduct($product_id)) {
 
 				$nActive = 0;
@@ -1110,16 +1108,18 @@
 
 			$strQuery = "
-					SELECT
-						COUNT(*)
-					FROM
-						`".WPSG_TBL_VARIANTS_VARI."` AS VI
-							LEFT JOIN `".WPSG_TBL_PRODUCTS_VARIATION."` AS PVI ON (PVI.`variation_id` = VI.`id`)
-					WHERE
-						PVI.`product_id` = '".wpsg_q($product_id)."' AND
-						PVI.`active` = '1' AND
-						VI.`deleted` != '1'
+				SELECT
+					COUNT(*)
+				FROM
+					`".WPSG_TBL_VARIANTS_VARI."` AS VI
+						LEFT JOIN `".WPSG_TBL_PRODUCTS_VARIATION."` AS PVI ON (PVI.`variation_id` = VI.`id`)
+						LEFT JOIN `".WPSG_TBL_VARIANTS."` AS V ON (V.`id` = VI.`variant_id`)
+				WHERE
+					PVI.`product_id` = '".wpsg_q($product_id)."' AND
+					PVI.`active` = '1' AND
+					V.`deleted` != '1' AND
+					VI.`deleted` != '1'
 			";
 
-			$nActiveVariants = $this->db->fetchOne($strQuery);
+			$nActiveVariants = intval($this->db->fetchOne($strQuery));
 
 			if ($nActiveVariants > 0) return true; else return false;
Index: /mods/wpsg_mod_voucherproduct.class.php
===================================================================
--- /mods/wpsg_mod_voucherproduct.class.php	(revision 7606)
+++ /mods/wpsg_mod_voucherproduct.class.php	(revision 7607)
@@ -365,5 +365,5 @@
 			$oProduct = wpsg_product::getInstance($product_id);
 			
-			if ($oProduct->__get('wpsg_mod_voucherproduct_flexprice') === '1') {
+			if ($oProduct->__get('wpsg_mod_voucherproduct_flexprice') === '1' && $oProduct->__get('wpsg_mod_voucherproduct_gs') === '1') {
 			
 				$this->shop->view['oProduct'] = $oProduct;
@@ -392,53 +392,57 @@
 		
 		public function basket_produkttosession($produkt_key, &$menge, &$ses_data) {
-			 
+						
 			$oProduct = wpsg_product::getInstance($produkt_key);
 			
-			$flex = intval($oProduct->__get('wpsg_mod_voucherproduct_flexprice'));
-			$flex_min = wpsg_tf($oProduct->__get('wpsg_mod_voucherproduct_flexprice_min'));
-			$flex_max = wpsg_tf($oProduct->__get('wpsg_mod_voucherproduct_flexprice_max'));
-			
-			if ($flex === 1) {
-			
-				if (wpsg_checkInput($_REQUEST['wpsg_mod_voucherproduct_value'], WPSG_SANITIZE_FLOAT)) {
-					
-					$value = wpsg_tf($_REQUEST['wpsg_mod_voucherproduct_value']);
-					
-					if ($flex_min > 0 && $value < $flex_min) {
-						
-						$this->shop->addFrontendError(wpsg_translate(
-							__('Der Gutscheinwert muss mindestens #1# #2# betragen.', 'wpsg'),
-							wpsg_ff($flex_min),
-							$this->shop->get_option('wpsg_currency')
-						));
-						
-						return -2;
-						
-					} else if ($flex_max > 0 && $value > $flex_max) {
-						
-						$this->shop->addFrontendError(wpsg_translate(
-							__('Der Gutscheinwert darf nicht mehr als #1# #2# betragen.', 'wpsg'),
-							wpsg_ff($flex_max),
-							$this->shop->get_option('wpsg_currency')
-						));
-						
-						return -2;
+			if ($oProduct->__get('wpsg_mod_voucherproduct_flexprice') === '1' && $oProduct->__get('wpsg_mod_voucherproduct_gs') === '1') {
+			
+				$flex = intval($oProduct->__get('wpsg_mod_voucherproduct_flexprice'));
+				$flex_min = wpsg_tf($oProduct->__get('wpsg_mod_voucherproduct_flexprice_min'));
+				$flex_max = wpsg_tf($oProduct->__get('wpsg_mod_voucherproduct_flexprice_max'));
+				
+				if ($flex === 1) {
+				
+					if (wpsg_checkInput($_REQUEST['wpsg_mod_voucherproduct_value'], WPSG_SANITIZE_FLOAT)) {
+						
+						$value = wpsg_tf($_REQUEST['wpsg_mod_voucherproduct_value']);
+						
+						if ($flex_min > 0 && $value < $flex_min) {
+							
+							$this->shop->addFrontendError(wpsg_translate(
+								__('Der Gutscheinwert muss mindestens #1# #2# betragen.', 'wpsg'),
+								wpsg_ff($flex_min),
+								$this->shop->get_option('wpsg_currency')
+							));
+							
+							return -2;
+							
+						} else if ($flex_max > 0 && $value > $flex_max) {
+							
+							$this->shop->addFrontendError(wpsg_translate(
+								__('Der Gutscheinwert darf nicht mehr als #1# #2# betragen.', 'wpsg'),
+								wpsg_ff($flex_max),
+								$this->shop->get_option('wpsg_currency')
+							));
+							
+							return -2;
+							
+						}
+						
+					} else {
+						
+						$this->shop->addFrontendError(__('UngÃŒltige Eingabe im Feld "Gutscheinwert".', 'wpsg'));
+						
+						return -2;					
 						
 					}
 					
-				} else {
-					
-					$this->shop->addFrontendError(__('UngÃŒltige Eingabe im Feld "Gutscheinwert".', 'wpsg'));
-					
-					return -2;					
-					
-				}
-				
-				$code = openssl_encrypt(json_encode([
-					'price' => wpsg_tf($value),					
-				]),'AES128', $this->shop->get_option('wpsg_salt'), 0, $this->iv);
-				
-				$ses_data['price_code'] = $code;
-				
+					$code = openssl_encrypt(json_encode([
+						'price' => wpsg_tf($value),					
+					]),'AES128', $this->shop->get_option('wpsg_salt'), 0, $this->iv);
+					
+					$ses_data['price_code'] = $code;
+					
+				}
+			
 			}
 			
