Commit 03ccbb48 authored by Ruslan Zakirov's avatar Ruslan Zakirov
Browse files

Revert to version 0.03

parent e2bd1d9e
Changes
etc/initialdata
html/Callbacks/RT-Extension-SLA/Ticket/Elements/Tabs/Default
html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements/Tabs/Default
html/Ticket/SLA.html
html/Tools/Reports/SLA.html
inc/Module/AutoInstall.pm
inc/Module/Install.pm
inc/Module/Install/AutoInstall.pm
......@@ -27,8 +23,6 @@ lib/RT/Condition/SLA_RequireDefault.pm
lib/RT/Condition/SLA_RequireDueSet.pm
lib/RT/Condition/SLA_RequireStartsSet.pm
lib/RT/Extension/SLA.pm
lib/RT/Extension/SLA/Report.pm
lib/RT/Extension/SLA/Summary.pm
lib/RT/Queue_SLA.pm
Makefile.PL
MANIFEST This list of files
......@@ -37,6 +31,5 @@ t/basics.t
t/business_hours.t
t/due.t
t/queue.t
t/reporting/basic.t
t/starts.t
t/utils.pl
......@@ -8,7 +8,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
generated_by: 'Module::Install version 0.88'
generated_by: 'Module::Install version 0.85'
license: gpl2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -17,7 +17,6 @@ name: RT-Extension-SLA
no_index:
directory:
- etc
- html
- inc
- t
requires:
......@@ -25,4 +24,4 @@ requires:
perl: 5.8.0
resources:
license: http://opensource.org/licenses/gpl-2.0.php
version: 0.03_02
version: 0.03
<%ARGS>
$Query => undef
$tabs => {}
$Ticket => undef
</%ARGS>
<%INIT>
return unless $session{'CurrentUser'}->PrincipalObj->HasRight(
Object => $RT::System, Right => 'SeeSLAReports',
);
if ( $Ticket ) {
$tabs->{'this'}->{"subtabs"}->{'_DA'} = {
path => "Ticket/SLA.html?id=". $Ticket->id,
title => loc('Report SLA'),
};
}
elsif ( $Query ||= $session{'CurrentSearchHash'}->{'Query'} ) {
$tabs->{"m"} = {
path => "Tools/Reports/SLA.html?". $m->comp( '/Elements/QueryString', Query => $Query ),
title => loc('Report SLA'),
};
}
</%INIT>
<%ARGS>
$tabs => {}
</%ARGS>
<%INIT>
return unless $session{'CurrentUser'}->PrincipalObj->HasRight(
Object => $RT::System, Right => 'SeeSLAReports',
);
$tabs->{'s'} = {
title => loc('Service Level Aggreements'),
path => 'Tools/Reports/SLA.html',
};
</%INIT>
<& /Elements/Header, Title => $title &>
<& /Ticket/Elements/Tabs,
Ticket => $ticket,
current_tab => "Ticket/SLA.html?id=$id",
Title => $title,
&>
<table>
<tr><th>#</th><th>Description</th><th>Type</th><th>Owner</th><th>Failed</th><th>Shift</th></tr>
% foreach my $stat ( @{ $report->Stats } ) {
<tr>
<td><% $stat->{transaction}->id %></td>
<td><% $stat->{transaction}->Description %></td>
<td><% $stat->{owner_act}? 'yes' : 'no' %></td>
<td><% $stat->{failed}? 'yes' : 'no' %></td>
<td><% $stat->{shift} %></td>
</tr>
% }
</table>
<%ARGS>
$id => undef
</%ARGS>
<%INIT>
unless (
$session{'CurrentUser'}->PrincipalObj->HasRight(
Object => $RT::System, Right => 'SeeSLAReports',
)
) {
Abort("You're not allowed to see SLA reports.");
}
my $ticket = LoadTicket($id);
unless ($ticket->CurrentUserHasRight('ShowTicket')) {
Abort("No permission to view ticket");
}
$id = $ARGS{'id'} = $ticket->id;
my $title = loc("SLA performance on ticket #[_1]", $id);
use RT::Extension::SLA;
my $report = RT::Extension::SLA->Report( $ticket );
use Data::Dumper;
$RT::Logger->crit( Dumper $report );
</%INIT>
<& /Elements/Header, Title => $title &>
<& /Tools/Reports/Elements/Tabs, current_tab => 'Tools/Reports/SLA.html', Title => $title &>
<table>
<tr>
<th><% loc('Owner') %></th>
% my @columns = $summary->Labels;
% my $i = 0;
% foreach ( map $_->[0], grep $i++%2, @columns ) {
<th><% loc($_) %></th>
% }
</tr>
% while ( my ($owner, $stats) = each %$result ) {
% my $user = RT::User->new( $session{'CurrentUser'} );
% $user->Load( $owner );
<tr>
<td><& /Elements/ShowUser, User => $user &></td>
% my $i = 1;
% foreach ( map $stats->{ $_ }, grep $i++%2, @columns ) {
<td><% $_ || 0 %></td>
% }
</tr>
% }
</table>
<form method="post" action="SLA.html">
<&|/l&>Query</&>:<textarea cols="60" rows="20" name="Query"><% $Query %></textarea>
<& /Elements/Submit, Label => loc('Update report') &>
</form>
<%ARGS>
$Query => undef
</%ARGS>
<%INIT>
unless (
$session{'CurrentUser'}->PrincipalObj->HasRight(
Object => $RT::System, Right => 'SeeSLAReports',
)
) {
Abort("You're not allowed to see SLA reports.");
}
my $title = loc("Report on Service Level Agreements");
use RT::Extension::SLA::Summary;
my $summary = new RT::Extension::SLA::Summary;
my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
$tickets->FromSQL( $Query );
$tickets->OrderByCols( {FIELD => 'id', ORDER => 'ASC'} );
while ( my $ticket = $tickets->Next ) {
my $report = RT::Extension::SLA->Report( $ticket );
$summary->AddReport( $report );
}
my $result = $summary->Result;
</%INIT>
......@@ -18,9 +18,7 @@ my %FeatureMap = (
# various lexical flags
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
my (
$Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
);
my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly );
my ( $PostambleActions, $PostambleUsed );
# See if it's a testing or non-interactive session
......@@ -75,9 +73,6 @@ sub _init {
elsif ( $arg =~ /^--test(?:only)?$/ ) {
$TestOnly = 1;
}
elsif ( $arg =~ /^--all(?:deps)?$/ ) {
$AllDeps = 1;
}
}
}
......@@ -120,12 +115,7 @@ sub import {
)[0]
);
# We want to know if we're under CPAN early to avoid prompting, but
# if we aren't going to try and install anything anyway then skip the
# check entirely since we don't want to have to load (and configure)
# an old CPAN just for a cosmetic message
$UnderCPAN = _check_lock(1) unless $SkipInstall;
$UnderCPAN = _check_lock(1); # check for $UnderCPAN
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests );
......@@ -175,24 +165,15 @@ sub import {
}
# XXX: check for conflicts and uninstalls(!) them.
my $cur = _load($mod);
if (_version_cmp ($cur, $arg) >= 0)
if (
defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) )
{
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
else {
if (not defined $cur) # indeed missing
{
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
}
else
{
# no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above
print "too old. ($cur < $arg)\n";
}
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
push @required, $mod => $arg;
}
}
......@@ -206,7 +187,6 @@ sub import {
and (
$CheckOnly
or ($mandatory and $UnderCPAN)
or $AllDeps
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
......@@ -255,38 +235,21 @@ sub import {
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
}
sub _running_under {
my $thing = shift;
print <<"END_MESSAGE";
*** Since we're running under ${thing}, I'll just let it take care
of the dependency's installation later.
END_MESSAGE
return 1;
}
# Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
# if we are, then we simply let it taking care of our dependencies
sub _check_lock {
return unless @Missing or @_;
my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS');
}
require CPAN;
print <<'END_MESSAGE';
if ($CPAN::VERSION > '1.89') {
if ($cpan_env) {
return _running_under('CPAN');
}
return; # CPAN.pm new enough, don't need to check further
*** Since we're running under CPANPLUS, I'll just let it take care
of the dependency's installation later.
END_MESSAGE
return 1;
}
# last ditch attempt, this -will- configure CPAN, very sorry
_load_cpan(1); # force initialize even though it's already loaded
_load_cpan();
# Find the CPAN lock-file
my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
......@@ -322,7 +285,7 @@ sub install {
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
# grep out those already installed
if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
if ( defined( _version_check( _load($pkg), $ver ) ) ) {
push @installed, $pkg;
}
else {
......@@ -361,7 +324,7 @@ sub install {
# see if we have successfully installed them
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
if ( defined( _version_check( _load($pkg), $ver ) ) ) {
push @installed, $pkg;
}
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
......@@ -416,7 +379,7 @@ sub _install_cpanplus {
my $success;
my $obj = $modtree->{$pkg};
if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) {
if ( $obj and defined( _version_check( $obj->{version}, $ver ) ) ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
......@@ -509,7 +472,7 @@ sub _install_cpan {
my $obj = CPAN::Shell->expand( Module => $pkg );
my $success = 0;
if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) {
if ( $obj and defined( _version_check( $obj->cpan_version, $ver ) ) ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
......@@ -573,7 +536,7 @@ sub _update_to {
my $ver = shift;
return
if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
if defined( _version_check( _load($class), $ver ) ); # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
......@@ -670,7 +633,7 @@ sub _load {
# Load CPAN.pm and it's configuration
sub _load_cpan {
return if $CPAN::VERSION and not @_;
return if $CPAN::VERSION;
require CPAN;
if ( $CPAN::HandleConfig::VERSION ) {
# Newer versions of CPAN have a HandleConfig module
......@@ -682,11 +645,9 @@ sub _load_cpan {
}
# compare two versions, either use Sort::Versions or plain comparison
# return values same as <=>
sub _version_cmp {
sub _version_check {
my ( $cur, $min ) = @_;
return -1 unless defined $cur; # if 0 keep comparing
return 1 unless $min;
return unless defined $cur;
$cur =~ s/\s+$//;
......@@ -697,13 +658,16 @@ sub _version_cmp {
) {
# use version.pm if it is installed.
return version->new($cur) <=> version->new($min);
return (
( version->new($cur) >= version->new($min) ) ? $cur : undef );
}
elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
{
# use Sort::Versions as the sorting algorithm for a.b.c versions
return Sort::Versions::versioncmp( $cur, $min );
return ( ( Sort::Versions::versioncmp( $cur, $min ) != -1 )
? $cur
: undef );
}
warn "Cannot reliably compare non-decimal formatted versions.\n"
......@@ -712,7 +676,7 @@ sub _version_cmp {
# plain comparison
local $^W = 0; # shuts off 'not numeric' bugs
return $cur <=> $min;
return ( $cur >= $min ? $cur : undef );
}
# nothing; this usage is deprecated.
......@@ -802,4 +766,4 @@ END_MAKE
__END__
#line 1056
#line 1004
......@@ -28,7 +28,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
$VERSION = '0.88';
$VERSION = '0.85';
# Storage for the pseudo-singleton
$MAIN = undef;
......@@ -353,7 +353,7 @@ sub _read {
if ( $] >= 5.006 ) {
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
} else {
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
}
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
......@@ -384,7 +384,7 @@ sub _write {
if ( $] >= 5.006 ) {
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
} else {
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
}
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
......
......@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
......
......@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
}
# Suspend handler for "redefined" warnings
......
......@@ -9,7 +9,7 @@ use ExtUtils::MakeMaker ();
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
......
......@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
......
......@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
......
......@@ -7,7 +7,7 @@ use ExtUtils::MakeMaker ();
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
......
......@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
......@@ -511,7 +511,7 @@ sub requires_from {
# Also, convert double-part versions (eg, 5.8)
sub _perl_version {
my $v = $_[-1];
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
$v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
......@@ -534,7 +534,7 @@ sub WriteMyMeta {
sub write_mymeta {
my $self = shift;
# If there's no existing META.yml there is nothing we can do
return unless -f 'META.yml';
......@@ -574,7 +574,7 @@ sub write_mymeta {
# Save as the MYMETA.yml file
print "Writing MYMETA.yml\n";
YAML::Tiny::DumpFile('MYMETA.yml', $meta);
YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
1;
......@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
......
......@@ -6,7 +6,7 @@ use Module::Install::Base;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '0.88';
$VERSION = '0.85';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
......
......@@ -4,7 +4,7 @@ use warnings;
package RT::Action::SLA;
use base qw(RT::Extension::SLA RT::Action);
use base qw(RT::Extension::SLA RT::Action::Generic);
=head1 NAME
......
......@@ -3,7 +3,7 @@ use strict;
use warnings;
package RT::Condition::SLA;
use base qw(RT::Extension::SLA RT::Condition);
use base qw(RT::Extension::SLA RT::Condition::Generic);
=head1 SLAIsApplied
......
......@@ -4,7 +4,7 @@ use warnings;
package RT::Extension::SLA;
our $VERSION = '0.03_02';
our $VERSION = '0.03';
=head1 NAME
......@@ -14,14 +14,6 @@ RT::Extension::SLA - Service Level Agreements for RT
RT extension to implement automated due dates using service levels.
=head1 UPGRADING
On upgrade you shouldn't run 'make initdb'.
If you were using 0.02 or older version of this extension with
RT 3.8.1 then you have to uninstall that manually. List of files
you can find in the MANIFEST.
=head1 INSTALL
=over 4
......@@ -53,7 +45,7 @@ There is no WebUI in the current version. Almost everything is
controlled in the RT's config using option C<%RT::ServiceAgreements>
and C<%RT::ServiceBusinessHours>. For example:
Set( %ServiceAgreements,
%RT::ServiceAgreements = (
Default => '4h',
QueueDefault => {
'Incident' => '2h',
......@@ -256,7 +248,7 @@ of requests that came into the system during the last night.
In the config you can set one or more work schedules. Use the following
format:
Set( %ServiceBusinessHours,
%RT::ServiceBusinessHours = (
'Default' => {
... description ...
},
......@@ -282,7 +274,7 @@ hours.
then %RT::ServiceBusinessHours should have the corresponding definition:
Set( %ServiceBusinessHours,
%RT::ServiceBusinessHours = (
'work just in Monday' => {
1 => { Name => 'Monday', Start => '9:00', End => '18:00' },
},
......@@ -294,14 +286,14 @@ Default Business Hours setting is in $RT::ServiceBusinessHours{'Default'}.
In the config you can set per queue defaults, using:
Set( %ServiceAgreements,
%RT::ServiceAgreements = (
Default => 'global default level of service',
QueueDefault => {
'queue name' => 'default value for this queue',
...
},
...
);
};