[Rt-commit] [svn] r1842 - in rt/branches/PLATANO-EXPERIMENTAL-CSS:
. lib/RT
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Thu Nov 11 03:40:38 EST 2004
Author: jesse
Date: Thu Nov 11 03:40:37 2004
New Revision: 1842
Modified:
rt/branches/PLATANO-EXPERIMENTAL-CSS/ (props changed)
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrip_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrips_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm
Log:
r9104 at tinbook: jesse | 2004-11-11T03:00:21.588955Z
r6156 at tinbook: jesse | 2004-11-01T04:47:06.225531Z
r6152 at tinbook: jesse | 2004-11-01T04:43:38.864654Z
RT-Ticket: 6230
RT-Status: resolved
RT-Update: correspond
New "batch transactions" core from Ruslan. This update makes it much easier to use stock conditions for bulk updates
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrip_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrip_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrip_Overlay.pm Thu Nov 11 03:40:37 2004
@@ -417,16 +417,19 @@
$RT::Logger->error( "Unknown Scrip stage:" . $self->Stage );
return (undef);
}
-
+ my $ConditionObj = $self->ConditionObj;
foreach my $TransactionObj ( @Transactions ) {
+ # in TxnBatch stage we can select scrips that are not applicable to all txns
+ my $txn_type = $TransactionObj->Type;
+ next unless( $ConditionObj->ApplicableTransTypes =~ /(?:^|,)(?:Any|\Q$txn_type\E)(?:,|$)/i );
# Load the scrip's Condition object
- $self->ConditionObj->LoadCondition(
+ $ConditionObj->LoadCondition(
ScripObj => $self,
TicketObj => $args{'TicketObj'},
TransactionObj => $TransactionObj,
);
- if ( $self->ConditionObj->IsApplicable() ) {
+ if ( $ConditionObj->IsApplicable() ) {
# We found an application Transaction -- return it
$return = $TransactionObj;
last;
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrips_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrips_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Scrips_Overlay.pm Thu Nov 11 03:40:37 2004
@@ -328,14 +328,16 @@
);
#We only want things where the scrip applies to this sort of transaction
- $self->Limit(
- ALIAS => $ConditionsAlias,
- FIELD => 'ApplicableTransTypes',
- OPERATOR => 'LIKE',
- VALUE => $args{'Type'},
- ENTRYAGGREGATOR => 'OR',
- )
- if $args{'Type'};
+ # TransactionBatch stage can define list of transaction
+ foreach( split /\s*,\s*/, ($args{'Type'} || '') ) {
+ $self->Limit(
+ ALIAS => $ConditionsAlias,
+ FIELD => 'ApplicableTransTypes',
+ OPERATOR => 'LIKE',
+ VALUE => $_,
+ ENTRYAGGREGATOR => 'OR',
+ )
+ }
# Or where the scrip applies to any transaction
$self->Limit(
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Ticket_Overlay.pm Thu Nov 11 03:40:37 2004
@@ -3314,6 +3314,7 @@
Stage => 'TransactionBatch',
TicketObj => $self,
TransactionObj => $batch->[0],
+ Type => join(',', (map { $_->Type } @{$batch}) )
);
}
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Transaction_Overlay.pm Thu Nov 11 03:40:37 2004
@@ -148,11 +148,11 @@
#Provide a way to turn off scrips if we need to
- $RT::Logger->debug('About to think about scrips for transaction' .$self->Id);
+ $RT::Logger->debug('About to think about scrips for transaction #' .$self->Id);
if ( $args{'ActivateScrips'} and $args{'ObjectType'} eq 'RT::Ticket' ) {
$self->{'scrips'} = RT::Scrips->new($RT::SystemUser);
- $RT::Logger->debug('About to prepare scrips for transaction' .$self->Id);
+ $RT::Logger->debug('About to prepare scrips for transaction #' .$self->Id);
$self->{'scrips'}->Prepare(
Stage => 'TransactionCreate',
@@ -161,7 +161,7 @@
Transaction => $self->id,
);
if ($args{'CommitScrips'} ) {
- $RT::Logger->debug('About to commit scrips for transaction' .$self->Id);
+ $RT::Logger->debug('About to commit scrips for transaction #' .$self->Id);
$self->{'scrips'}->Commit();
}
}
More information about the Rt-commit
mailing list