[Rt-commit] rt branch, 4.0/apply-scrips-to-multiple-queues, updated. rt-4.0.4-155-ged876e0
Ruslan Zakirov
ruz at bestpractical.com
Fri Dec 23 10:05:46 EST 2011
The branch, 4.0/apply-scrips-to-multiple-queues has been updated
via ed876e07b69176edd313b68255892d7eb1889c22 (commit)
via a29d175666384dc77d802c39fcfe2a6af5ae9529 (commit)
via d6dd86969358e4c4213702f21481f8c89e7cd02e (commit)
via 1d00b7a0fd4eb4f8770640e53de7b30275d5a784 (commit)
via d496349b9a03d94326c79a95575c66a145acfa3b (commit)
from 30b9062ee0adf9c8eccc23a83b02a3f2e5283df4 (commit)
Summary of changes:
lib/RT/ObjectScrip.pm | 3 ++-
lib/RT/Record/ApplyAndSort.pm | 4 ++--
lib/RT/Scrip.pm | 4 ++--
share/html/Admin/Elements/EditScrips | 28 +++++++++++++++++++++++++++-
share/html/Admin/Elements/SelectStage | 1 +
share/html/Elements/RT__Scrip/ColumnMap | 2 +-
6 files changed, 35 insertions(+), 7 deletions(-)
- Log -----------------------------------------------------------------
commit d496349b9a03d94326c79a95575c66a145acfa3b
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Dec 23 18:17:13 2011 +0400
pass all arguments for tables with additional columns
like Stage column in ObjectScrips table
diff --git a/lib/RT/Record/ApplyAndSort.pm b/lib/RT/Record/ApplyAndSort.pm
index 367b1b2..ed3298b 100644
--- a/lib/RT/Record/ApplyAndSort.pm
+++ b/lib/RT/Record/ApplyAndSort.pm
@@ -41,8 +41,8 @@ sub Create {
unless ( defined $args{'SortOrder'} ) {
$args{'SortOrder'} = $self->NextSortOrder(
+ %args,
$tfield => $target,
- ObjectId => $args{'ObjectId'},
);
}
$args{'Disabled'} ||= 0;
@@ -81,7 +81,7 @@ sub Apply {
}
return $self->Create(
- $field => $tid, ObjectId => $oid,
+ %args, $field => $tid, ObjectId => $oid,
);
}
commit 1d00b7a0fd4eb4f8770640e53de7b30275d5a784
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Dec 23 18:18:21 2011 +0400
missing closing tag (</select>)
diff --git a/share/html/Admin/Elements/SelectStage b/share/html/Admin/Elements/SelectStage
index 0d459a0..e20ee3d 100644
--- a/share/html/Admin/Elements/SelectStage
+++ b/share/html/Admin/Elements/SelectStage
@@ -57,6 +57,7 @@
</option>
% }
+</select>
<%INIT>
if ( !defined $Default || $Default eq '') {
$Default = 'TransactionCreate';
commit d6dd86969358e4c4213702f21481f8c89e7cd02e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Dec 23 18:19:04 2011 +0400
pass Stage argument when ObjectScrip created
diff --git a/lib/RT/ObjectScrip.pm b/lib/RT/ObjectScrip.pm
index 58bdb35..5059819 100644
--- a/lib/RT/ObjectScrip.pm
+++ b/lib/RT/ObjectScrip.pm
@@ -15,7 +15,7 @@ sub Create {
my %args = (@_);
return $self->SUPER::Create(
map { $_ => $args{ $_ } } qw(
- Scrip ObjectId
+ Scrip Stage ObjectId
SortOrder Disabled
Created Creator
LastUpdated LastUpdatedBy
@@ -42,6 +42,7 @@ sub Neighbors {
my %args = @_;
my $res = $self->CollectionClass->new( $self->CurrentUser );
+ $res->Limit( FIELD => 'Stage', VALUE => $args{'Stage'} || $self->Stage );
return $res;
}
commit a29d175666384dc77d802c39fcfe2a6af5ae9529
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Dec 23 18:19:42 2011 +0400
process stage when we apply scrips to queues
now stage is property of a link between queue and scrip
diff --git a/lib/RT/Scrip.pm b/lib/RT/Scrip.pm
index ceda18d..8ae46b4 100644
--- a/lib/RT/Scrip.pm
+++ b/lib/RT/Scrip.pm
@@ -239,10 +239,10 @@ sub NotAddedTo {
sub AddToObject {
my $self = shift;
- my $object = shift;
+ my %args = @_%2? (ObjectId => @_) : (@_);
my $rec = RT::ObjectScrip->new( $self->CurrentUser );
- return $rec->Apply( Scrip => $self, ObjectId => $object );
+ return $rec->Apply( %args, Scrip => $self );
}
sub RemoveFromObject {
diff --git a/share/html/Admin/Elements/EditScrips b/share/html/Admin/Elements/EditScrips
index d920dd1..720f958 100755
--- a/share/html/Admin/Elements/EditScrips
+++ b/share/html/Admin/Elements/EditScrips
@@ -86,6 +86,10 @@
<p><i><&|/l&>(No scrips)</&></i></p>
% }
+<div style="text-align:right">
+<% loc('Select stage for scrips you add') %>: <& SelectStage &>
+</div>
+
<& /Elements/Submit,
Name => 'AddScrips',
Caption => loc("Apply selected scrips"),
@@ -151,7 +155,7 @@ if ( $AddScrips ) {
$scrip->Load( $sid );
next unless $scrip->id;
- my ($status, $msg) = $scrip->AddToObject( $id );
+ my ($status, $msg) = $scrip->AddToObject( $id, Stage => $Stage );
push @actions, $msg;
}
}
@@ -168,5 +172,6 @@ $RemoveScrips => undef
@AddScrip => ()
$AddScrips => undef
+$Stage => 'TransactionCreate'
</%ARGS>
commit ed876e07b69176edd313b68255892d7eb1889c22
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Fri Dec 23 19:05:08 2011 +0400
move scrips up and down
diff --git a/share/html/Admin/Elements/EditScrips b/share/html/Admin/Elements/EditScrips
index 720f958..d9ed8b6 100755
--- a/share/html/Admin/Elements/EditScrips
+++ b/share/html/Admin/Elements/EditScrips
@@ -160,6 +160,24 @@ if ( $AddScrips ) {
}
}
+if ( $MoveScripUp ) {
+ my $scrip = RT::ObjectScrip->new( $session{'CurrentUser'} );
+ $scrip->LoadByCols( Scrip => $MoveScripUp, ObjectId => $id );
+ if ( $scrip->id ) {
+ my ($status, $msg) = $scrip->MoveUp;
+ push @actions, $msg;
+ }
+}
+
+if ( $MoveScripDown ) {
+ my $scrip = RT::ObjectScrip->new( $session{'CurrentUser'} );
+ $scrip->LoadByCols( Scrip => $MoveScripDown, ObjectId => $id );
+ if ( $scrip->id ) {
+ my ($status, $msg) = $scrip->MoveDown;
+ push @actions, $msg;
+ }
+}
+
</%init>
<%ARGS>
@@ -174,4 +192,7 @@ $RemoveScrips => undef
$AddScrips => undef
$Stage => 'TransactionCreate'
+$MoveScripUp => undef
+$MoveScripDown => undef
+
</%ARGS>
diff --git a/share/html/Elements/RT__Scrip/ColumnMap b/share/html/Elements/RT__Scrip/ColumnMap
index 63d23b9..a1c2a05 100644
--- a/share/html/Elements/RT__Scrip/ColumnMap
+++ b/share/html/Elements/RT__Scrip/ColumnMap
@@ -140,7 +140,7 @@ my $COLUMN_MAP = {
my $context = $_[2] || 0;
return '' unless $_[0]->IsAdded( $context );
- my $name = 'MoveCustomField';
+ my $name = 'MoveScrip';
my $args = $m->caller_args( 1 );
my @pass = ref $args->{'PassArguments'}
? @{$args->{'PassArguments'}}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list