Просмотр исходного кода

Ticket #5313 - Context roles: Reset cache after role's actions were changed.

AntonLV 10 месяцев назад
Родитель
Сommit
552dbd5996
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      studio/template/scripts/BxBaseStudioFormsGroupsRoles.php

+ 12 - 1
studio/template/scripts/BxBaseStudioFormsGroupsRoles.php

@@ -117,8 +117,11 @@ class BxBaseStudioFormsGroupsRoles extends BxDolStudioFormsGroupsRoles
                 if (!isset($aData[$sModule])) $aData[$sModule] = [];
 
             $mixedResult = $oForm->update($iId, ['Data' => serialize($aData)]);
-            if(is_numeric($mixedResult))
+            if(is_numeric($mixedResult))  {
+                $this->onRoleChanged($aItem);
+
                 $aRes = array('grid' => $this->getCode(false), 'blink' => $mixedResult);
+            }
             else
                 $aRes = array('msg' => $mixedResult);
             echoJson($aRes);
@@ -451,6 +454,14 @@ class BxBaseStudioFormsGroupsRoles extends BxDolStudioFormsGroupsRoles
             'params_divider' => $this->sParamsDivider
         ));
     }
+
+    protected function onRoleChanged($aRole)
+    {
+        if(!empty($aRole) && isset($aRole['key']) && ($sKey = $aRole['key'])) {
+            $this->oDb->cleanCache('sys_form_pre_values_with_key_' . $sKey);
+            $this->oDb->cleanCache('sys_form_pre_values_' . $sKey);
+        }
+    }
 }
 
 /** @} */