Преглед изворни кода

Ticket #3825 - MarkerIo: JS error when 'Destination Code' is empty.

AntonLV пре 4 година
родитељ
комит
f5b9613396

+ 5 - 1
modules/boonex/markerio/classes/BxMarkerIoTemplate.php

@@ -20,6 +20,10 @@ class BxMarkerIoTemplate extends BxDolModuleTemplate
     {
         $CNF = &$this->_oConfig->CNF;
 
+        $sCode = $this->_oDb->getParam($CNF['PARAM_CODE']);
+        if(empty($sCode))
+            return '';
+
         $aTmplVarsShowForLogged = array();
         if(isLogged()) {
             $oProfile = BxDolProfile::getInstance();
@@ -33,7 +37,7 @@ class BxMarkerIoTemplate extends BxDolModuleTemplate
         }
 
         return $this->parseHtmlByName('code.html', array(
-            'code' => $this->_oDb->getParam($CNF['PARAM_CODE']),
+            'code' => $sCode,
             'bx_if:show_for_logged' => array(
                 'condition' => !empty($aTmplVarsShowForLogged),
                 'content' => $aTmplVarsShowForLogged

+ 5 - 4
modules/boonex/markerio/template/code.html

@@ -1,9 +1,10 @@
 __code__
 <script>
 <bx_if:show_for_logged>
-    Marker.on('load', function() {
-        window.Marker.setReporter({ email: '__email__', fullName: '__name__'});
-        window.Marker.setCustomData({ current_user_url: '__profile_url__', template: '__template__'});
-    });
+    if(typeof(Marker) !== 'undefined')
+        Marker.on('load', function() {
+            window.Marker.setReporter({ email: '__email__', fullName: '__name__'});
+            window.Marker.setCustomData({ current_user_url: '__profile_url__', template: '__template__'});
+        });
 </bx_if:show_for_logged>
 </script>