Bläddra i källkod

#3980 - Attendant links to non existing page

roman.lesnikov@gmail.com 4 år sedan
förälder
incheckning
3cb26c2546

+ 26 - 25
modules/boonex/attendant/classes/BxAttendantModule.php

@@ -35,43 +35,44 @@ class BxAttendantModule extends BxDolModule
                 }
             }
         }
-        $bRedirect = true; // todo setting
         
         $oSession = BxDolSession::getInstance();
         $sFirstPage = $oSession->getValue('sys_entrance_url');
         $sFirstPage = 'page.php?i=view-group-profile&id=72';
        
         if ($sFirstPage){
-            if ($bRedirect){
+            if (getParam('bx_attendant_on_profile_after_action_url')){
                 echo json_encode(['redirect' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($sFirstPage)]);  
                 exit();
             }
             else{
-                list($sPageLink, $aPageParams) = bx_get_base_url($sFirstPage);
-                if (isset($aPageParams['i']) && isset($aPageParams['id'])){
-                    $oPage = BxDolPage::getObjectInstanceByURI($aPageParams['i']);
+                if(getParam('bx_attendant_suggest_entered_page')){
+                    list($sPageLink, $aPageParams) = bx_get_base_url($sFirstPage);
+                    if (isset($aPageParams['i']) && isset($aPageParams['id'])){
+                        $oPage = BxDolPage::getObjectInstanceByURI($aPageParams['i']);
 
-                    if ($oPage){
-                        $sModuleName = $oPage->getModule();
-                        if(bx_srv('system', 'is_module_context', [$sModuleName])){
+                        if ($oPage){
+                            $sModuleName = $oPage->getModule();
+                            if(bx_srv('system', 'is_module_context', [$sModuleName])){
 
-                            $oModule = BxDolModule::getInstance($sModuleName);
-                            $aTmp = $oModule->serviceBrowse([
-                                'mode' => 'recent',
-                                'params' => [
-                                    'filter' => [
-                                        'field' => 'id',
-                                        'value' => [$aPageParams['id']],
-                                        'operator' => 'in',
-                                        'table' => 'tableSearch'
-                                    ],
-                                ]
-                            ]);
-                            
-                            if (isset($aTmp['content'])){
-                                $sTmp = $aTmp['content'];
-                                $sTmp = str_replace('bx_conn_action', 'bx_attendant_conn_action', $sTmp);
-                                $aModuleData[$sModuleName. '_initial_link'] = $sTmp;
+                                $oModule = BxDolModule::getInstance($sModuleName);
+                                $aTmp = $oModule->serviceBrowse([
+                                    'mode' => 'recent',
+                                    'params' => [
+                                        'filter' => [
+                                            'field' => 'id',
+                                            'value' => [$aPageParams['id']],
+                                            'operator' => 'in',
+                                            'table' => 'tableSearch'
+                                        ],
+                                    ]
+                                ]);
+
+                                if (isset($aTmp['content'])){
+                                    $sTmp = $aTmp['content'];
+                                    $sTmp = str_replace('bx_conn_action', 'bx_attendant_conn_action', $sTmp);
+                                    $aModuleData[$sModuleName. '_initial_link'] = $sTmp;
+                                }
                             }
                         }
                     }

+ 2 - 0
modules/boonex/attendant/install/langs/en.xml

@@ -6,6 +6,8 @@
     <string name="_bx_attendant_adm_stg_on_profile_creation_modules_list"><![CDATA[Recommend featured items from]]></string>
     <string name="_bx_attendant_adm_stg_on_profile_after_action_url"><![CDATA[Url for redirect after shows]]></string>
     <string name="_bx_attendant_adm_stg_on_profile_after_action_url_custom"><![CDATA[URL for 'Custom Page' redirect]]></string>
+    <string name="_bx_attendant_adm_stg_enable_redirect_to_entered_page"><![CDATA[Enable redirect to entered page]]></string>
+    <string name="_bx_attendant_adm_stg_enable_suggest_entered_page"><![CDATA[Enable suggest entered page]]></string>
     
     <string name="_bx_attendant_adm_stg_on_profile_creation_event_list"><![CDATA[Show popup after]]></string>
     <string name="_bx_attendant_popup_with_recommended_title_default"><![CDATA[Recommended {0}]]></string>

+ 3 - 1
modules/boonex/attendant/install/sql/enable.sql

@@ -15,7 +15,9 @@ INSERT INTO `sys_options` (`category_id`, `name`, `caption`, `value`, `type`, `e
 (@iCategoryId, 'bx_attendant_on_profile_creation_modules', '_bx_attendant_adm_stg_on_profile_creation_modules_list', '', 'list', 'a:2:{s:6:"module";s:12:"bx_attendant";s:6:"method";s:19:"get_profile_modules";}', '', '', '', 1),
 (@iCategoryId, 'bx_attendant_on_profile_event_list', '_bx_attendant_adm_stg_on_profile_creation_event_list', 'confirmation', 'select', 'a:2:{s:6:"module";s:12:"bx_attendant";s:6:"method";s:40:"get_popup_with_recommended_on_event_show";}', '', '', '', 2),
 (@iCategoryId, 'bx_attendant_on_profile_after_action_url', '_bx_attendant_adm_stg_on_profile_after_action_url', '', 'select', 'a:2:{s:6:"module";s:12:"bx_attendant";s:6:"method";s:31:"get_options_redirect_after_show";}', '', '', '', 3),
-(@iCategoryId, 'bx_attendant_on_profile_after_action_url_custom', '_bx_attendant_adm_stg_on_profile_after_action_url_custom', '', 'digit', '', '', '', '', 4);
+(@iCategoryId, 'bx_attendant_on_profile_after_action_url_custom', '_bx_attendant_adm_stg_on_profile_after_action_url_custom', '', 'digit', '', '', '', '', 4),
+(@iCategoryId, 'bx_attendant_redirect_to_entered_page', '_bx_attendant_adm_stg_enable_redirect_to_entered_page', '', 'checkbox', '', '', '', '', 5),
+(@iCategoryId, 'bx_attendant_suggest_entered_page', '_bx_attendant_adm_stg_enable_suggest_entered_page', '', 'checkbox', '', '', '', '', 6);
 
 -- INJECTION
 INSERT INTO `sys_injections`(`name`, `page_index`, `key`, `type`, `data`, `replace`, `active`) VALUES