Index: /changelog
===================================================================
--- /changelog	(revision 7024)
+++ /changelog	(revision 7025)
@@ -113,6 +113,9 @@
 #4.0.9
 - Bugfix: Produktbewertung mittels globale Kommentarfunktion aktivierbar
+- Bugfix: Gutscheinprodukte sind jetzt zu den erstellten PDFs im Backend verlinkt
 - Feature: Produktvarianten - Export von Produktname / Produktartikelnummer ÃŒber Exportprofile mÃ¶glich
 - Feature: Lagerbestand - Export vom Lagerbestand / Mindestlagerbestand ÃŒber Exportprofile mÃ¶glich
 - Feature: Aboprodukte - Export von Abo Startzeit, Abo Laufzeit, Abo Kosten VerlÃ€ngerung und Abo Dauer (Tage) ÃŒber Exportprofile mÃ¶glich
 - Feature: Kundenverwaltung - Suche nach Kundengruppen mÃ¶glich
+- Feature: Gutscheine lassen sich bearbeiten
+- Feature: Die fÃŒr die Statistik benÃ¶tigte GoogleMaps API Bibliothek kann jetzt optional deaktiviert werden
Index: /mods/wpsg_mod_gutschein.class.php
===================================================================
--- /mods/wpsg_mod_gutschein.class.php	(revision 7024)
+++ /mods/wpsg_mod_gutschein.class.php	(revision 7025)
@@ -82,5 +82,10 @@
 				$this->addAction();
 
-			}
+			} if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit')
+            {
+
+                $this->editAction();
+
+            }
 			else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'import')
 			{
@@ -117,4 +122,36 @@
 		} // public function wpsg_add_pages()
 
+        public function editAction() {
+
+            $this->shop->view['mod_gutschein'] = array();
+
+            $oVoucher = wpsg_voucher::getInstance($_REQUEST['edit_id']);
+            
+            $this->shop->view['mod_gutschein']['value'] = $oVoucher->value;;
+            $this->shop->view['mod_gutschein']['calc'] = $oVoucher->calc_typ;;
+            $this->shop->view['mod_gutschein']['start'] = date('d.m.Y H:i:s', strtotime($oVoucher->start_date));
+            $this->shop->view['mod_gutschein']['end'] = date('d.m.Y H:i:s', strtotime($oVoucher->end_date));
+            $this->shop->view['mod_gutschein']['count'] = $oVoucher->count;
+            $this->shop->view['mod_gutschein']['gen'] = $oVoucher->gen;
+            $this->shop->view['mod_gutschein']['code'] = $oVoucher->code;
+            $this->shop->view['mod_gutschein']['comment'] = $oVoucher->comment;
+            $this->shop->view['mod_gutschein']['multi'] = $oVoucher->multi;
+            $this->shop->view['mod_gutschein']['minvalue'] = $oVoucher->minvalue;
+            $this->shop->view['mod_gutschein']['products'] = explode(',', $oVoucher->products);
+            $this->shop->view['mod_gutschein']['productgroups'] = explode(',', $oVoucher->productgroups);
+            $this->shop->view['edit_id'] = $_REQUEST['edit_id'];
+
+            if ($this->shop->hasMod('wpsg_mod_productgroups')) {
+
+                $this->shop->view['wpsg_mod_gutschein']['arProductGroups'] = $this->shop->callMod('wpsg_mod_productgroups', 'getAllProductGroups');
+
+            }
+            
+            $this->shop->view['wpsg_mod_gutschein']['arProducts'] = $this->shop->getAllProductsForSelect();
+
+            $this->render(WPSG_PATH_VIEW.'/mods/mod_gutschein/add.phtml');
+            
+        }
+        
 		/**
 		 * Maske fÃŒr einen neuen Gutschein
@@ -394,5 +431,5 @@
 
 			// Validierung
-			if ($_REQUEST['wpsg_mod_gutschein_count'] <= 0)
+			if ($_REQUEST['wpsg_mod_gutschein_count'] <= 0 && !isset($_REQUEST['edit_id']))
 			{
 
@@ -400,5 +437,5 @@
 				$bError = true;
 
-			}
+			} 
 
 			if ($tStart <= 0)
@@ -432,55 +469,77 @@
 
 				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Voucher&action=add');
-
+                			
 			}
 			else
 			{
 
-				for ($i = 0; $i < $_REQUEST['wpsg_mod_gutschein_count']; $i ++)
-				{
-
-					$arProductGroups = array(); if (wpsg_isSizedArray($_REQUEST['wpsg_mod_gutschein_productgroups'])) $arProductGroups = $_REQUEST['wpsg_mod_gutschein_productgroups'];
-					$arProducts = array(); if (wpsg_isSizedArray($_REQUEST['wpsg_mod_gutschein_products'])) $arProducts = $_REQUEST['wpsg_mod_gutschein_products'];
-
-					if ($_REQUEST['wpsg_mod_gutschein_gen'] == '1')
-					{
-
-						$setCode = $_REQUEST['wpsg_mod_gutschein_code'];
-
-					}
-					else
-					{
-
-						$setCode = false;
-
-					}
-
-					$this->genGS(
-						wpsg_tf($_REQUEST['wpsg_mod_gutschein_value']),
-						$_REQUEST['wpsg_mod_gutschein_calc'],
-						$tStart,
-						$tEnd,
-						$_REQUEST['wpsg_mod_gutschein_multi'],
-						$this->shop->get_option('wpsg_mod_gutschein_size'),
-						$_REQUEST['wpsg_mod_gutschein_comment'],
-						0,
-						0,
-						0,
-						$arProductGroups,
-						$arProducts,
-						$_REQUEST['wpsg_mod_gutschein_minvalue'],
-						$setCode
-					);
-
-				}
-
-				if ($_REQUEST['wpsg_mod_gutschein_count'] > 1)
-				{
-					$this->shop->addBackendMessage(__('Gutscheine wurden erfolgreich angelegt.', 'wpsg'));
-				}
-				else
-				{
-					$this->shop->addBackendMessage(__('Gutschein wurde erfolgreich angelegt.', 'wpsg'));
-				}
+			    if (isset($_REQUEST['edit_id'])) {
+
+			        $this->db->UpdateQuery(WPSG_TBL_GUTSCHEIN, [ 
+                        'code' => wpsg_q($_REQUEST['wpsg_mod_gutschein_code']),
+                        'value' => wpsg_q(wpsg_tf($_REQUEST['wpsg_mod_gutschein_value'])),
+                        'calc_typ' => wpsg_q($_REQUEST['wpsg_mod_gutschein_calc']),
+                        'start_date' => wpsg_q(date('Y-m-d H:i:s', strtotime($_REQUEST['wpsg_mod_gutschein_start']))),
+                        'end_date' => wpsg_q(date('Y-m-d H:i:s', strtotime($_REQUEST['wpsg_mod_gutschein_end']))),
+                        'multi' => wpsg_q($_REQUEST['wpsg_mod_gutschein_multi']),
+                        'comment' => wpsg_q($_REQUEST['wpsg_mod_gutschein_comment']),
+                        'minvalue' => wpsg_q($_REQUEST['wpsg_mod_gutschein_minvalue']),
+                        'productgroups' => wpsg_q(implode(',', wpsg_getArray($_REQUEST['wpsg_mod_gutschein_productgroups']))),
+                        'products' => wpsg_q(implode(',', wpsg_getArray($_REQUEST['wpsg_mod_gutschein_products']))),
+                    ], " `id` = '".wpsg_q($_REQUEST['edit_id'])."' ");
+			        
+			        $this->shop->addBackendMessage(__('Gutschein erfolgreich gespeichert.', 'wpsg'));
+                    $this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Voucher&action=edit&edit_id='.$_REQUEST['edit_id']);
+			        
+                } else {
+
+                    $arProductGroups = array(); if (wpsg_isSizedArray($_REQUEST['wpsg_mod_gutschein_productgroups'])) $arProductGroups = $_REQUEST['wpsg_mod_gutschein_productgroups'];
+                    $arProducts = array(); if (wpsg_isSizedArray($_REQUEST['wpsg_mod_gutschein_products'])) $arProducts = $_REQUEST['wpsg_mod_gutschein_products'];
+			        
+                    for ($i = 0; $i < $_REQUEST['wpsg_mod_gutschein_count']; $i ++)
+                    {
+        
+                        if ($_REQUEST['wpsg_mod_gutschein_gen'] == '1')
+                        {
+    
+                            $setCode = $_REQUEST['wpsg_mod_gutschein_code'];
+    
+                        }
+                        else
+                        {
+    
+                            $setCode = false;
+    
+                        }
+    
+                        $this->genGS(
+                            wpsg_tf($_REQUEST['wpsg_mod_gutschein_value']),
+                            $_REQUEST['wpsg_mod_gutschein_calc'],
+                            $tStart,
+                            $tEnd,
+                            $_REQUEST['wpsg_mod_gutschein_multi'],
+                            $this->shop->get_option('wpsg_mod_gutschein_size'),
+                            $_REQUEST['wpsg_mod_gutschein_comment'],
+                            0,
+                            0,
+                            0,
+                            $arProductGroups,
+                            $arProducts,
+                            $_REQUEST['wpsg_mod_gutschein_minvalue'],
+                            $setCode
+                        );
+    
+                    }
+    
+                    if ($_REQUEST['wpsg_mod_gutschein_count'] > 1)
+                    {
+                        $this->shop->addBackendMessage(__('Gutscheine wurden erfolgreich angelegt.', 'wpsg'));
+                    }
+                    else
+                    {
+                        $this->shop->addBackendMessage(__('Gutschein wurde erfolgreich angelegt.', 'wpsg'));
+                    }
+                    
+                }
 
 				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Voucher&action=index');
Index: /mods/wpsg_mod_statistics.class.php
===================================================================
--- /mods/wpsg_mod_statistics.class.php	(revision 7024)
+++ /mods/wpsg_mod_statistics.class.php	(revision 7025)
@@ -99,29 +99,42 @@
 			if (is_admin() && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'wpsg-Statistics'))
 			{
-				$arr = [];
-				$gkey = $this->shop->get_option('wpsg_mod_statistics_googlekey');
-				$gurl = 'https://maps.googleapis.com/maps/api/js?key='.$gkey;
-				wp_register_script('wpsg-mod_statistics-gmap', $gurl, $arr, null);
-				//wp_register_script('wpsg-mod_statistics-gmap', 'https://maps.googleapis.com/maps/api/js?sensor=false');
-				wp_enqueue_script('wpsg-mod_statistics-gmap');
-
-				$gurl = $this->shop->getRessourceURL('mods/mod_statistics/js/markerclusterer.js');
-				wp_register_script('wpsg-mod_statistics-gmapmc', $gurl, $arr, null);
-				wp_enqueue_script('wpsg-mod_statistics-gmapmc');
-				
-				if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'wpsg-Statistics')
-				{
-					wp_enqueue_style('wpsg_mod_statistics_css_jqplot', WPSG_URL_CONTENT.'plugins/'.WPSG_FOLDERNAME.'/lib/jqplot/jquery.jqplot.css');
-					//$this->dispatch();
-					
-					//$gurl = WPSG_URL_CONTENT.'plugins/'.WPSG_FOLDERNAME.'/lib/jqplot/jquery.jqplot.js';
-					//wp_register_script('wpsg_mod_statistics_js_jqplot', $gurl, $arr, null);
-					//wp_enqueue_script('wpsg_mod_statistics_js_jqplot');
-				}
+			    
+			    if ($this->shop->get_option('wpsg_mod_statistics_noJS') !== '1') {
+			    
+                    $arr = [];
+                    $gkey = $this->shop->get_option('wpsg_mod_statistics_googlekey');
+                    $gurl = 'https://maps.googleapis.com/maps/api/js?key='.$gkey;
+                    wp_register_script('wpsg-mod_statistics-gmap', $gurl, $arr, null);
+                    //wp_register_script('wpsg-mod_statistics-gmap', 'https://maps.googleapis.com/maps/api/js?sensor=false');
+                    wp_enqueue_script('wpsg-mod_statistics-gmap');
+    
+                    $gurl = $this->shop->getRessourceURL('mods/mod_statistics/js/markerclusterer.js');
+                    wp_register_script('wpsg-mod_statistics-gmapmc', $gurl, $arr, null);
+                    wp_enqueue_script('wpsg-mod_statistics-gmapmc');
+                    
+                    wp_enqueue_style('wpsg_mod_statistics_css_jqplot', WPSG_URL_CONTENT.'plugins/'.WPSG_FOLDERNAME.'/lib/jqplot/jquery.jqplot.css');
+                    
+                }
 
 			}
 			 
 		} // public wpsg_enqueue_scripts()
-		
+
+        /** Wird bei der Darstellung der Bibliotheken / Includes aufgerufen */
+        public function admin_includes() {
+
+            echo wpsg_drawForm_Checkbox('wpsg_mod_statistics_noJS', __('GoogleMaps Javascript nicht einbinden (Statistikmodul)', 'wpsg'), $this->shop->get_option('wpsg_mod_statistics_noJS'), array(
+                'hint' => __('Ist diese Option aktiv, so werden die GoogleMaps Javascript Bibliotheken <u>nicht</u> eingebunden.', 'wpsg')
+            ));
+            
+        }
+ 
+        /** Wird beim speichern der Bibliothekes / Includes Seite aufgerufen */
+        public function admin_includes_save() {
+
+            $this->shop->update_option('wpsg_mod_statistics_noJS', $_REQUEST['wpsg_mod_statistics_noJS']);
+
+        }
+        
 		/**
 		 * Rechte setzen
Index: /views/mods/mod_gutschein/add.phtml
===================================================================
--- /views/mods/mod_gutschein/add.phtml	(revision 7024)
+++ /views/mods/mod_gutschein/add.phtml	(revision 7025)
@@ -43,13 +43,27 @@
                 <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_start', __('GÃŒltig ab', 'wpsg'), $this->view['mod_gutschein']['start'], array('datepicker' => true)); ?>
                 <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_end', __('GÃŒltig bis', 'wpsg'), $this->view['mod_gutschein']['end'], array('datepicker' => true)); ?>
-                <?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_gen', __('Code Generierung', 'wpsg'), array(
-                    '0' => __('Automatisch', 'wpsg'),
-                    '1' => __('Manuell', 'wpsg')
-                ), wpsg_getStr($this->view['mod_gutschein']['gen']), array('help' => 'wpsg_mod_gutschein_gen')); ?>
-                <div id="wpsg_mod_gutschein_layercode">
+
+                <?php if (!wpsg_isSizedInt($this->view['edit_id'])) { ?>
+                
+                    <?php echo wpsg_drawForm_Select('wpsg_mod_gutschein_gen', __('Code Generierung', 'wpsg'), array(
+                        '0' => __('Automatisch', 'wpsg'),
+                        '1' => __('Manuell', 'wpsg')
+                    ), wpsg_getStr($this->view['mod_gutschein']['gen']), array('help' => 'wpsg_mod_gutschein_gen')); ?>
+                    <div id="wpsg_mod_gutschein_layercode">
+                        <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_code', __('Code', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['code']), array('help' => 'wpsg_mod_gutschein_code')); ?>
+                    </div>
+            
+                <?php } else { ?>
+
                     <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_code', __('Code', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['code']), array('help' => 'wpsg_mod_gutschein_code')); ?>
-                </div>
+                    
+                <?php } ?>                
+            
                 <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_minvalue', __('Minimaler Warenwert', 'wpsg'), wpsg_getStr($this->view['mod_gutschein']['minvalue']), array('help' => 'wpsg_mod_gutschein_minvalue')); ?>
+
+                <?php if (!wpsg_isSizedInt($this->view['edit_id'])) { ?>
                 <?php echo wpsg_drawForm_Input('wpsg_mod_gutschein_count', __('Menge', 'wpsg'), $this->view['mod_gutschein']['count']); ?>
+                <?php } ?>
+                
                 <?php echo wpsg_drawForm_Checkbox('wpsg_mod_gutschein_multi', __('Mehrfach verwendbar', 'wpsg'), $this->view['mod_gutschein']['multi']); ?>
                 <?php echo wpsg_drawForm_Textarea('wpsg_mod_gutschein_comment', __('Kommentar', 'wpsg'), @$this->view['mod_gutschein']['comment']); ?>
@@ -60,5 +74,14 @@
             <?php echo wpsg_drawForm_AdminboxEnd(); ?>
 
-            <input type="submit" value="<?php echo __('Gutschein anlegen', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" />
+            <?php if (wpsg_isSizedInt($this->view['edit_id'])) { ?>
+            
+                <input type="hidden" name="edit_id" value="<?php echo $this->view['edit_id']; ?>" />
+                <input type="submit" value="<?php echo __('Gutschein speichern', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" />
+                
+            <?php } else { ?>
+            
+                <input type="submit" value="<?php echo __('Gutschein anlegen', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" />
+            
+            <?php } ?>
 
         </form>
Index: /views/mods/mod_gutschein/index.phtml
===================================================================
--- /views/mods/mod_gutschein/index.phtml	(revision 7024)
+++ /views/mods/mod_gutschein/index.phtml	(revision 7025)
@@ -88,6 +88,14 @@
 
                             </td>
-                            <?php /* <td class="col_code"><?php echo $oVoucher->code; ?></td> */ ?>
-                            <td class="col_code"><a href="<?php echo WPSG_URL_WP . 'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_voucherproduct&gs_id='.$oVoucher->id.'&order_id='.$oVoucher->autocreate_order.'&noheader=1&cmd=getVoucher'; ?>"><?php echo $oVoucher->code; ?></a></td>
+                            <?php /* <td class="col_code"><?php echo $oVoucher->code; ?></td> */ ?>                            
+                            <td class="col_code">
+
+                                <a title="<?php echo __('Gutschein bearbeiten', 'wpsg'); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=edit&edit_id=<?php echo $oVoucher->id; ?>"><?php echo $oVoucher->code; ?></a>
+                                
+                                <?php if (1||$this->hasMod('mod_voucherproduct')) { ?>
+                                &nbsp;[&nbsp;<a href="<?php echo WPSG_URL_WP . 'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_voucherproduct&gs_id='.$oVoucher->id.'&order_id='.$oVoucher->autocreate_order.'&noheader=1&cmd=getVoucher'; ?>"><?php echo __('PDF', 'wpsg'); ?></a>&nbsp;]
+                                <?php } ?>
+                                                        
+                            </td>                            
                             <td class="col_start"><?php echo wpsg_formatTimestamp($oVoucher->start_date); ?></td>
                             <td class="col_end"><?php echo wpsg_formatTimestamp($oVoucher->end_date); ?></td>
