Callback for Modify.html

Hi.

Update.html contains nice callback for various tasks (like checking form
fields etc):
$m->callback( CallbackName => ‘BeforeUpdate’, ARGSRef => %ARGS, skip_update
=> $skip_update, …

but Modify.html doesn’t have such thing.

Was there any reason for not adding BeforeModify callback in Modify.html? It’s
logical to have the same sets of callbacks for similar actions IMO.

This patch below works (hand made, line wrapped, so likely won’t apply
directly). Please add such modification to 4.2.2. Thanks.

— html/Ticket/Modify.html~ 2013-11-25 10:25:50.000000000 +0100
+++ html/Ticket/Modify.html 2013-11-26 13:36:25.847864830 +0100
@@ -77,6 +77,9 @@
my @results;
my $skip_update = 0;

+$m->callback( CallbackName => ‘BeforeModify’, ARGSRef => %ARGS, skip_update
=> $skip_update,

  •          results => \@results, TicketObj => $TicketObj );
    

Now let callbacks have a chance at editing %ARGS

$m->callback( TicketObj => $TicketObj, CustomFields => $CustomFields, ARGSRef
=> %ARGS, skip_update => $skip_update );

Arkadiusz Miśkiewicz, arekm / maven.pl

Hi,

sorry for capturing this thread, but same request different file.
Reason is, that the callback cannot set the Privileged flag, so no
matter what happens in the callback BeforeUpdate, the user’s Privileged
flag cannot be modified. This patch fixes the problem. It’d be awesome
if you could patch it in the next version. Thank you very much.

— share/html/Admin/Users/Modify.html 2013-07-30 14:24:52.000000000
+0200
+++ local/html/Admin/Users/Modify.html 2013-11-26 15:27:27.000000000
+0100
@@ -298,7 +298,7 @@
}

-$m->callback( %ARGS, CallbackName => ‘BeforeUpdate’, User => $UserObj,
ARGSRef => %ARGS, Results => @results );
+$m->callback( %ARGS, CallbackName => ‘BeforeUpdate’, User => $UserObj,
ARGSRef => %ARGS, Results => @results, SetPrivileged =>
$SetPrivileged );

If we have a user to modify, lets try.

Cheers,
AlexAm Di 26 Nov 2013 13:58:47 CET schrieb Arkadiusz Miśkiewicz:

Hi.

Update.html contains nice callback for various tasks (like checking form
fields etc):
$m->callback( CallbackName => ‘BeforeUpdate’, ARGSRef => %ARGS, skip_update
=> $skip_update, …

but Modify.html doesn’t have such thing.

Was there any reason for not adding BeforeModify callback in Modify.html? It’s
logical to have the same sets of callbacks for similar actions IMO.

This patch below works (hand made, line wrapped, so likely won’t apply
directly). Please add such modification to 4.2.2. Thanks.

— html/Ticket/Modify.html~ 2013-11-25 10:25:50.000000000 +0100
+++ html/Ticket/Modify.html 2013-11-26 13:36:25.847864830 +0100
@@ -77,6 +77,9 @@
my @results;
my $skip_update = 0;

+$m->callback( CallbackName => ‘BeforeModify’, ARGSRef => %ARGS, skip_update
=> $skip_update,

  •          results => \@results, TicketObj => $TicketObj );
    

Now let callbacks have a chance at editing %ARGS

$m->callback( TicketObj => $TicketObj, CustomFields => $CustomFields, ARGSRef
=> %ARGS, skip_update => $skip_update );

alexander_reintzsch.vcf (387 Bytes)

signature.asc (555 Bytes)

Was there any reason for not adding BeforeModify callback in Modify.html? It’s
logical to have the same sets of callbacks for similar actions IMO.

This patch below works (hand made, line wrapped, so likely won’t apply
directly). Please add such modification to 4.2.2. Thanks.

Your patch adds a callback right before another callback which passes
more useful information and can be used to accomplish the same goals.
The existing callback is even visible in your patch.

What does your new callback do that the Default callback doesn’t?

-kevin

sorry for capturing this thread, but same request different file.
Reason is, that the callback cannot set the Privileged flag, so no
matter what happens in the callback BeforeUpdate, the user’s Privileged
flag cannot be modified. This patch fixes the problem. It’d be awesome
if you could patch it in the next version. Thank you very much.

At first glance this appears to be a reasonable change.

Please send your patch to the bug tracker or submit a pull request on
github.

-kevin

Was there any reason for not adding BeforeModify callback in Modify.html?
It’s logical to have the same sets of callbacks for similar actions IMO.

This patch below works (hand made, line wrapped, so likely won’t apply
directly). Please add such modification to 4.2.2. Thanks.

Your patch adds a callback right before another callback which passes
more useful information and can be used to accomplish the same goals.
The existing callback is even visible in your patch.

What does your new callback do that the Default callback doesn’t?

That’s a good question + #rt irc conversation explained few things for me.
It’s not needed at all. “Default” will be enough.

Arkadiusz Miśkiewicz, arekm / maven.pl

Was there any reason for not adding BeforeModify callback in
Modify.html? It’s logical to have the same sets of callbacks for
similar actions IMO.

This patch below works (hand made, line wrapped, so likely won’t apply
directly). Please add such modification to 4.2.2. Thanks.

Your patch adds a callback right before another callback which passes
more useful information and can be used to accomplish the same goals.
The existing callback is even visible in your patch.

What does your new callback do that the Default callback doesn’t?

That’s a good question + #rt irc conversation explained few things for me.
It’s not needed at all. “Default” will be enough.

One thing is missing in Default though. results array.

Now let callbacks have a chance at editing %ARGS

$m->callback( TicketObj => $TicketObj, CustomFields => $CustomFields, ARGSRef
=> %ARGS, skip_update => $skip_update );

While new BeforeModify callback allows us to change error messages for
example.

+$m->callback( CallbackName => ‘BeforeModify’, ARGSRef => %ARGS, skip_update
=> $skip_update,

  •          results => \@results, TicketObj => $TicketObj );
    

Could Default callback call be changed to allow results array modifications?
Or is there any other way to change results from Default callback?

Arkadiusz Miśkiewicz, arekm / maven.pl