RT-Extension-TicketAging

 view release on metacpan or  search on metacpan

inc/Module/Install/RTx/Factory.pm  view on Meta::CPAN

        eval \"require ${class}_Local\";
        if (\$@ && \$@ !~ qr{^Can't locate ${path}_Local.pm}) {
            die \$@;
        };




^head1 SEE ALSO

This class allows \"overlay\" methods to be placed
into the following files _Overlay is for a System overlay by the original author,
_Vendor is for 3rd-party vendor add-ons, while _Local is for site-local customizations.  

These overlay files can contain new subs or subs to replace existing subs in this module.

If you'll be working with perl 5.6.0 or greater, each of these files should begin with the line 

   no warnings qw(redefine);

so that perl does not kick and scream when you redefine a subroutine or variable in your overlay.

${class}_Overlay, ${class}_Vendor, ${class}_Local

^cut


1;
.

    return $content;

lib/RT/Extension/TicketAging.pm  view on Meta::CPAN

        $self->_MergeMaps( \%res, $user_map );
    }
    foreach my $age ( $self->Ages ) {
        my ($status, $msg) = $self->_CleanupAge( \%res, $age );
        return (undef, $msg) unless $status;
    }
    return (\%res);
}

sub _MergeMaps {
    my ($self, $default, $overlay) = @_;

    foreach my $age ( keys %$overlay ) {
        next unless $overlay->{ $age };
        unless ( ref $overlay->{ $age } eq 'HASH' ) {
            $RT::Logger->error( "TicketAgingMap -> $age is not a hash reference" );
            next;
        }

        my $cond = $overlay->{ $age }{'Condition'};
        if( $cond && ref $cond ne 'HASH' ) {
            $RT::Logger->error(
                "TicketAgingMap -> $age -> Condition is not a hash reference"
            );
            next;
        }

        foreach my $field ( qw(CallbackPre SQL CallbackPost Filter) ) {
            next unless defined $cond->{ $field };
            unless ( $cond->{$field} ) {

lib/RT/Extension/TicketAging.pm  view on Meta::CPAN

                delete $default->{ $age }{'Condition'}{ $field };
                next;
            }
            if ( ref $cond->{$field} eq 'CODE' || ( $field eq 'SQL' && !ref $cond->{$field} )) {
                $default->{ $age }{'Condition'}{ $field } = $cond->{$field};
                next;
            }
            $RT::Logger->info( "TicketAgingMap -> $age -> Condition -> $field has incorrect type" );
        }

        if ( defined $overlay->{ $age }{'Action'} ) {
            unless ( $overlay->{ $age }{'Action'} ) {
                $RT::Logger->info( "$age -> Action is disabled due to TicketAgingMap" );
                delete $default->{ $age }{'Action'};
            }
            elsif ( ref $overlay->{ $age }{'Action'} eq 'CODE' ) {
                $default->{ $age }{'Action'} = $overlay->{ $age }{'Action'};
            }
            else {
                $RT::Logger->error( "TicketAgingMap -> $age -> Condition is not a code reference" );
            }
        }
    }
}

sub _CleanupAge {
    my ($self, $map, $age) = @_;



( run in 1.749 second using v1.01-cache-2.11-cpan-39bf76dae61 )