View | Details | Raw Unified | Return to bug 33547
Collapse All | Expand All

(-)a/Koha/Preservation/Train/Item.pm (-1 / +2 lines)
Lines 62-67 sub catalogue_item { Link Here
62
    return Koha::Item->_new_from_dbic($item_rs);
62
    return Koha::Item->_new_from_dbic($item_rs);
63
}
63
}
64
64
65
65
=head3 train
66
=head3 train
66
67
67
Return the train object for this item
68
Return the train object for this item
Lines 69-75 Return the train object for this item Link Here
69
=cut
70
=cut
70
71
71
sub train {
72
sub train {
72
    my ( $self ) = @_;
73
    my ($self) = @_;
73
    my $rs = $self->_result->train;
74
    my $rs = $self->_result->train;
74
    return Koha::Preservation::Train->_new_from_dbic($rs);
75
    return Koha::Preservation::Train->_new_from_dbic($rs);
75
}
76
}
(-)a/preservation/home.pl (-7 / +7 lines)
Lines 40-57 $template->param( Link Here
40
        map {
40
        map {
41
            my $table = $_;
41
            my $table = $_;
42
            map { ( $table . '.' . $_ => $columns->{$table}->{$_} ) }
42
            map { ( $table . '.' . $_ => $columns->{$table}->{$_} ) }
43
              keys %{ $columns->{$table} }
43
                keys %{ $columns->{$table} }
44
        } qw( biblio biblioitems items )
44
        } qw( biblio biblioitems items )
45
    },
45
    },
46
    api_mappings => {
46
    api_mappings => {
47
        items => Koha::Item->to_api_mapping,
47
        items       => Koha::Item->to_api_mapping,
48
        biblioitems => Koha::Biblioitem->to_api_mapping,
48
        biblioitems => Koha::Biblioitem->to_api_mapping,
49
        biblio => Koha::Biblio->to_api_mapping,
49
        biblio      => Koha::Biblio->to_api_mapping,
50
    },
50
    },
51
    notice_templates =>
51
    notice_templates => [
52
      [ map { { id => $_->id, code => $_->code, name => $_->name } }
52
        map { { id => $_->id, code => $_->code, name => $_->name } }
53
          Koha::Notice::Templates->search( { module => 'preservation' } )
53
            Koha::Notice::Templates->search( { module => 'preservation' } )->as_list
54
          ->as_list ],
54
    ],
55
);
55
);
56
56
57
output_html_with_http_headers $query, $cookie, $template->output;
57
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/preservation/print_slip.pl (-11 / +11 lines)
Lines 25-48 use C4::Letters; Link Here
25
use Koha::Patrons;
25
use Koha::Patrons;
26
use Koha::Preservation::Train::Items;
26
use Koha::Preservation::Train::Items;
27
27
28
my $input = CGI->new;
28
my $input         = CGI->new;
29
my $train_item_id = $input->param('train_item_id');
29
my $train_item_id = $input->param('train_item_id');
30
30
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32
    {
32
    {
33
        template_name   => "circ/printslip.tt",
33
        template_name => "circ/printslip.tt",
34
        query           => $input,
34
        query         => $input,
35
        type            => "intranet",
35
        type          => "intranet",
36
        flagsrequired   => { preservation => '*' },
36
        flagsrequired => { preservation => '*' },
37
    }
37
    }
38
);
38
);
39
39
40
my $logged_in_user = Koha::Patrons->find($loggedinuser);
40
my $logged_in_user = Koha::Patrons->find($loggedinuser);
41
my $branch = C4::Context->userenv->{'branch'};
41
my $branch         = C4::Context->userenv->{'branch'};
42
42
43
my $train_item = Koha::Preservation::Train::Items->find($train_item_id);
43
my $train_item = Koha::Preservation::Train::Items->find($train_item_id);
44
44
45
unless ($train_item){
45
unless ($train_item) {
46
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
46
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
47
    exit;
47
    exit;
48
}
48
}
Lines 64-75 my $slip = $letter->{content}; Link Here
64
my $is_html = $letter->{is_html};
64
my $is_html = $letter->{is_html};
65
65
66
$template->param(
66
$template->param(
67
    slip => $slip,
67
    slip       => $slip,
68
    plain => !$is_html,
68
    plain      => !$is_html,
69
    caller => 'preservation',
69
    caller     => 'preservation',
70
    stylesheet => C4::Context->preference("SlipCSS"),
70
    stylesheet => C4::Context->preference("SlipCSS"),
71
);
71
);
72
72
73
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS' ) );
73
$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS') );
74
74
75
output_html_with_http_headers $input, $cookie, $template->output;
75
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/t/db_dependent/Koha/Preservation/Trains.t (-3 / +4 lines)
Lines 99-107 subtest 'add_items & items' => sub { Link Here
99
    is( $item_2->get_from_storage->notforloan, 0 );
99
    is( $item_2->get_from_storage->notforloan, 0 );
100
    is( $item_3->get_from_storage->notforloan, $not_for_loan_train_in );
100
    is( $item_3->get_from_storage->notforloan, $not_for_loan_train_in );
101
101
102
    is( ref( $item_train_1->train ),
102
    is(
103
        ref( $item_train_1->train ),
103
        'Koha::Preservation::Train',
104
        'Koha::Preservation::Train',
104
        'Train::Item->train returns a Koha::Preservation::Train object' );
105
        'Train::Item->train returns a Koha::Preservation::Train object'
106
    );
105
107
106
    warning_is {
108
    warning_is {
107
        $train->add_item( { item_id => $item_2->itemnumber }, { skip_waiting_list_check => 1 } );
109
        $train->add_item( { item_id => $item_2->itemnumber }, { skip_waiting_list_check => 1 } );
108
- 

Return to bug 33547