[Bps-public-commit] RT-Extension-MandatoryOnTransition branch master updated. 0.20-5-g757edbe

BPS Git Server git at git.bestpractical.com
Fri Oct 29 13:24:50 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "RT-Extension-MandatoryOnTransition".

The branch, master has been updated
       via  757edbed16c5f8b90acd684f509a1b0ae2a79d59 (commit)
       via  fc2351939bf15cd6be2f67bef65bcca60df930b1 (commit)
       via  3ef7e7f9c510b036cca76ba75cab2fca479e5359 (commit)
      from  d3ea6e77dad7843be33972a23e2410e14cbc139b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 757edbed16c5f8b90acd684f509a1b0ae2a79d59
Merge: d3ea6e7 fc23519
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Oct 29 21:17:21 2021 +0800

    Merge branch 'allow-rules-only-for-ticket-creation'


commit fc2351939bf15cd6be2f67bef65bcca60df930b1
Author: Steven Burr <steve at bestpractical.com>
Date:   Tue Oct 5 09:46:40 2021 -0400

    Update docs for __CREATE__ rules

diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index b811583..f5880cc 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -128,7 +128,19 @@ config option.  This option takes the generic form of:
 
 C<from> and C<to> are expected to be valid status names.  C<from> may also be
 C<*> which will apply to any status and also tickets about to be created with
-status C<to>.
+status C<to>. If you need to express rules that apply only on ticket creation
+and not on updates, you can use the special C<from> value of C<'__CREATE__'>.
+For example,
+
+    Set( %MandatoryOnTransition,
+        'MyQueue' => {
+            '__CREATE__ -> open' => [ 'CF.MyField1' ],
+            '* -> open' => [ 'CF.MyField2', 'CF.MyField3' ],
+        },
+    );
+
+would require C<CF.MyField1> on ticket creation and C<CF.MyField2> and
+C<CF.MyField3> on any other transition to C<open>.
 
 The fallback for queues without specific rules is specified with C<'*'> where
 the queue name would normally be.
@@ -445,7 +457,8 @@ Accepts a paramhash of values:
 Works for both create, where no ticket exists yet, and update on an
 existing ticket. ARGSRef is required for both.
 
-For create, you must also pass Queue, From, and To.
+For create, you must also pass Queue, From, and To. In this case, the
+From status should be the special flag value of '__CREATE__'.
 
 Update requires only Ticket and To since From can be fetched from the
 ticket object.

commit 3ef7e7f9c510b036cca76ba75cab2fca479e5359
Author: Steven Burr <steve at bestpractical.com>
Date:   Wed Sep 29 15:37:18 2021 -0400

    Allow rules that apply only on ticket creation
    
    MandatoryOnTransition supports '* -> foo' rules which can
    apply on ticket creation. However, the '*' as the 'from' status means
    that the rule would ALSO apply to ALL transitions that end up in the 'foo'
    status.
    
    A new flag value of '__CREATE__' is added to allow for the configuration
    of rules that apply ONLY on ticket creation. The config for the example
    above would be modified to '__CREATE__ -> foo' to apply only on
    creation.

diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Create.html/BeforeCreate b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Create.html/BeforeCreate
index 661d002..65460f5 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Create.html/BeforeCreate
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Create.html/BeforeCreate
@@ -11,7 +11,7 @@ $QueueObj->Load($Queue);
 
 my $errors_ref = RT::Extension::MandatoryOnTransition->CheckMandatoryFields(
     ARGSRef => $ARGSRef,
-    From    => "*",
+    From    => "__CREATE__",
     To      => $ARGSRef->{'Status'},
     Queue   => $QueueObj,
 );
diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/create/BeforeCreate b/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/create/BeforeCreate
index 661d002..65460f5 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/create/BeforeCreate
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/create/BeforeCreate
@@ -11,7 +11,7 @@ $QueueObj->Load($Queue);
 
 my $errors_ref = RT::Extension::MandatoryOnTransition->CheckMandatoryFields(
     ARGSRef => $ARGSRef,
-    From    => "*",
+    From    => "__CREATE__",
     To      => $ARGSRef->{'Status'},
     Queue   => $QueueObj,
 );

-----------------------------------------------------------------------

Summary of changes:
 .../Ticket/Create.html/BeforeCreate                     |  2 +-
 .../m/ticket/create/BeforeCreate                        |  2 +-
 lib/RT/Extension/MandatoryOnTransition.pm               | 17 +++++++++++++++--
 3 files changed, 17 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
RT-Extension-MandatoryOnTransition


More information about the Bps-public-commit mailing list