diff --git a/CHANGELOG.md b/CHANGELOG.md index 35605b0c..ceee84dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2.9.1] - Unreleased ### Fixed +- Fixed business processes and rules not being added to source control automatically (#676) - Embedded Git commits settings when cloning empty repo to avert any issues ## [2.9.0] - 2025-01-09 diff --git a/cls/SourceControl/Git/Extension.cls b/cls/SourceControl/Git/Extension.cls index 69fdaaa4..932760a6 100644 --- a/cls/SourceControl/Git/Extension.cls +++ b/cls/SourceControl/Git/Extension.cls @@ -59,6 +59,13 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName) do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction) do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut) + + // Deal with Business Processes and Rules + // Note: Business Processes and Rules do not have a 'new document' User Action, and thus must be added like this + if (('isInSourceControl)) { + do ..CheckBusinessProcessesAndRules(InternalName) + } + if '$data(tAction) { set user = "", inNamespace = "" if 'isEditable || ##class(SourceControl.Git.Utils).Locked() { @@ -371,6 +378,8 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU $$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0)) } } + } else { + do ..CheckBusinessProcessesAndRules(InternalName) } } } catch e { @@ -535,4 +544,18 @@ Method CheckCommitterIdentity(Settings As SourceControl.Git.Settings, ByRef Acti return 0 } +/// Deal with Business Processes and Rules +Method CheckBusinessProcessesAndRules(InternalName As %String) As %Status +{ + // Note: Business Processes and Rules are not added through normal user action processes because of upstream hook issues, + // so we have to add them like this + if (##class(SourceControl.Git.Utils).Type(InternalName) = "cls") { + set name = $piece(InternalName,".CLS",1) + set exists = ##class(%Dictionary.CompiledClass).%ExistsId(name) + if (exists && ($classmethod(name,"%Extends","Ens.BusinessProcess") || $classmethod(name,"%Extends","Ens.Rule.Definition"))) { + do ..AddToSourceControl(InternalName) + } + } +} + }