Skip to content

Commit ea587ed

Browse files
authored
Merge pull request #686 from intersystems/issue-676
Add Business Processess if they are not in source control
2 parents eba6df6 + ff56e81 commit ea587ed

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [2.9.1] - Unreleased
99

1010
### Fixed
11+
- Fixed business processes and rules not being added to source control automatically (#676)
1112
- Embedded Git commits settings when cloning empty repo to avert any issues
1213

1314
## [2.9.0] - 2025-01-09

cls/SourceControl/Git/Extension.cls

+23
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se
5959
set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName)
6060
do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction)
6161
do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut)
62+
63+
// Deal with Business Processes and Rules
64+
// Note: Business Processes and Rules do not have a 'new document' User Action, and thus must be added like this
65+
if (('isInSourceControl)) {
66+
do ..CheckBusinessProcessesAndRules(InternalName)
67+
}
68+
6269
if '$data(tAction) {
6370
set user = "", inNamespace = ""
6471
if 'isEditable || ##class(SourceControl.Git.Utils).Locked() {
@@ -371,6 +378,8 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
371378
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
372379
}
373380
}
381+
} else {
382+
do ..CheckBusinessProcessesAndRules(InternalName)
374383
}
375384
}
376385
} catch e {
@@ -535,4 +544,18 @@ Method CheckCommitterIdentity(Settings As SourceControl.Git.Settings, ByRef Acti
535544
return 0
536545
}
537546

547+
/// Deal with Business Processes and Rules
548+
Method CheckBusinessProcessesAndRules(InternalName As %String) As %Status
549+
{
550+
// Note: Business Processes and Rules are not added through normal user action processes because of upstream hook issues,
551+
// so we have to add them like this
552+
if (##class(SourceControl.Git.Utils).Type(InternalName) = "cls") {
553+
set name = $piece(InternalName,".CLS",1)
554+
set exists = ##class(%Dictionary.CompiledClass).%ExistsId(name)
555+
if (exists && ($classmethod(name,"%Extends","Ens.BusinessProcess") || $classmethod(name,"%Extends","Ens.Rule.Definition"))) {
556+
do ..AddToSourceControl(InternalName)
557+
}
558+
}
559+
}
560+
538561
}

0 commit comments

Comments
 (0)