Template.pm 27.7 KB
Newer Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
=cut


=head2 Created

Returns the current value of Created.
(In the database, Created is stored as datetime.)


=cut



sub _CoreAccessible {
    {

        id =>
1018
                {read => 1, sql_type => 4, length => 11,  is_blob => 0,  is_numeric => 1,  type => 'int(11)', default => ''},
1019
        Queue =>
1020
                {read => 1, write => 1, sql_type => 4, length => 11,  is_blob => 0,  is_numeric => 1,  type => 'int(11)', default => '0'},
1021
        Name =>
1022
                {read => 1, write => 1, sql_type => 12, length => 200,  is_blob => 0,  is_numeric => 0,  type => 'varchar(200)', default => ''},
1023
        Description =>
1024
                {read => 1, write => 1, sql_type => 12, length => 255,  is_blob => 0,  is_numeric => 0,  type => 'varchar(255)', default => ''},
1025
        Type =>
1026
                {read => 1, write => 1, sql_type => 12, length => 16,  is_blob => 0,  is_numeric => 0,  type => 'varchar(16)', default => ''},
1027
        Content =>
1028
                {read => 1, write => 1, sql_type => -4, length => 0,  is_blob => 1,  is_numeric => 0,  type => 'text', default => ''},
1029
        LastUpdated =>
1030
                {read => 1, auto => 1, sql_type => 11, length => 0,  is_blob => 0,  is_numeric => 0,  type => 'datetime', default => ''},
1031
        LastUpdatedBy =>
1032
                {read => 1, auto => 1, sql_type => 4, length => 11,  is_blob => 0,  is_numeric => 1,  type => 'int(11)', default => '0'},
1033
        Creator =>
1034
                {read => 1, auto => 1, sql_type => 4, length => 11,  is_blob => 0,  is_numeric => 1,  type => 'int(11)', default => '0'},
1035
        Created =>
1036
                {read => 1, auto => 1, sql_type => 11, length => 0,  is_blob => 0,  is_numeric => 0,  type => 'datetime', default => ''},
1037
1038
1039
1040

 }
};

1041
sub FindDependencies {
Alex Vandiver's avatar
Alex Vandiver committed
1042
1043
1044
    my $self = shift;
    my ($walker, $deps) = @_;

1045
    $self->SUPER::FindDependencies($walker, $deps);
Alex Vandiver's avatar
Alex Vandiver committed
1046

1047
    $deps->Add( out => $self->QueueObj ) if $self->QueueObj->Id;
Alex Vandiver's avatar
Alex Vandiver committed
1048
1049
}

1050
1051
1052
1053
1054
1055
sub PreInflate {
    my $class = shift;
    my ($importer, $uid, $data) = @_;

    $class->SUPER::PreInflate( $importer, $uid, $data );

1056
    my $obj = RT::Template->new( RT->SystemUser );
1057
1058
    if ($data->{Queue} == 0) {
        $obj->LoadGlobalTemplate( $data->{Name} );
1059
1060
1061
1062
1063
1064
1065
    } else {
        $obj->LoadQueueTemplate( Queue => $data->{Queue}, Name => $data->{Name} );
    }

    if ($obj->Id) {
        $importer->Resolve( $uid => ref($obj) => $obj->Id );
        return;
1066
1067
1068
1069
1070
    }

    return 1;
}

1071
1072
1073
RT::Base->_ImportOverlays();

1;