Skip to content

Commit 506e942

Browse files
committed
Refactor
1 parent 32689dd commit 506e942

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

cls/SourceControl/Git/Extension.cls

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,8 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se
6262

6363
// Deal with Business Processes and Rules
6464
// Note: Business Processes and Rules do not have a 'new document' User Action, and thus must be added like this
65-
if (('isInSourceControl) && (##class(SourceControl.Git.Utils).Type(InternalName) = "cls")) {
66-
set name = $piece(InternalName,".CLS",1)
67-
set exists = ##class(%Dictionary.CompiledClass).%ExistsId(name)
68-
if (exists && ($classmethod(name,"%Extends","Ens.BusinessProcess") || $classmethod(name,"%Extends","Ens.Rule.Definition"))) {
69-
do ..AddToSourceControl(InternalName)
70-
}
65+
if (('isInSourceControl)) {
66+
do ..CheckBusinessProcessesAndRules(InternalName)
7167
}
7268

7369
if '$data(tAction) {
@@ -382,6 +378,8 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
382378
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
383379
}
384380
}
381+
} else {
382+
do ..CheckBusinessProcessesAndRules(InternalName)
385383
}
386384
}
387385
} catch e {
@@ -546,4 +544,18 @@ Method CheckCommitterIdentity(Settings As SourceControl.Git.Settings, ByRef Acti
546544
return 0
547545
}
548546

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+
549561
}

0 commit comments

Comments
 (0)