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

(-)a/installer/data/mysql/atomicupdate/bug_12104.pl (+19 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "12104",
6
    description => "Add SerialLabelFormat system preference",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        $dbh->do(
12
            q{
13
                INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
14
                ('SerialLabelFormat', '[% biblio.title %]<br />\n[% serial.serialseq %]<br />\n[% serial.publisheddate %]', '', 'Define the format for printing labels from the serials receive page.', 'Textarea');
15
            }
16
        );
17
        say_success( $out, "SerialLabelFormat system preference added" );
18
    },
19
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 739-744 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
739
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
739
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
740
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
740
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
741
('SeparateHoldingsByGroup','0',NULL,'Separate current branch holdings and holdings from libraries in the same library groups','YesNo'),
741
('SeparateHoldingsByGroup','0',NULL,'Separate current branch holdings and holdings from libraries in the same library groups','YesNo'),
742
('SerialLabelFormat', '[% biblio.title %]<br />\n[% serial.serialseq %]<br />\n[% serial.publisheddate %]', '', 'Define the format for printing labels from the serials receive page.', 'Textarea'),
742
('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'),
743
('SerialsDefaultEmailAddress', '', NULL, 'Default email address used as reply-to for notices sent by the serials module.', 'Free'),
743
('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'),
744
('SerialsDefaultReplyTo', '', NULL, 'Default email address that serials notices are sent from.', 'Free'),
744
('SerialsSearchResultsLimit', '', NULL, 'Serials search results limit', 'integer'),
745
('SerialsSearchResultsLimit', '', NULL, 'Serials search results limit', 'integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref (+5 lines)
Lines 70-75 Serials: Link Here
70
        - pref: SerialsSearchResultsLimit
70
        - pref: SerialsSearchResultsLimit
71
          class: integer
71
          class: integer
72
        - first serials when performing an advanced serials search.
72
        - first serials when performing an advanced serials search.
73
    -
74
        - "Include the following fields on a serial label:"
75
        - pref: SerialLabelFormat
76
          type: textarea
77
        - "Use Template Toolkit syntax with fields from the <code>biblio</code>, <code>serial</code>, and <code>subscription</code> tables."
73
78
74
    Notifications:
79
    Notifications:
75
    -
80
    -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/seriallabel-print.tt (+38 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Koha %]
3
[% PROCESS 'i18n.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title
6
    >[% FILTER collapse %]
7
        [% t("Print serial label") | html %]
8
        &rsaquo; [% t("Koha") | html %]
9
    [% END %]</title
10
>
11
[% INCLUDE 'doc-head-close.inc' popup => 1 %]
12
[% Asset.css("css/spinelabel.css") | $raw %]
13
<style>
14
    @media print {
15
        .noprint {
16
            display: none;
17
        }
18
    }
19
</style>
20
</head>
21
<body id="labels_seriallabel_print" class="labels">
22
23
[% IF no_serial %]
24
    <div class="error">Serial not found</div>
25
[% ELSE %]
26
    <div class="serial-label"> [% content | $raw %] </div>
27
[% END %]
28
[% Asset.js( "lib/jquery/jquery-3.6.0.min.js" ) | $raw %]
29
[% Asset.js( "lib/jquery/jquery-migrate-3.3.2.min.js" ) | $raw %]
30
<script>
31
    function autoPrintAndClose() {
32
        window.print();
33
        window.close();
34
    }
35
36
    window.addEventListener("load", autoPrintAndClose);
37
</script>
38
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+4 lines)
Lines 236-241 Link Here
236
                                        [% IF ( routing ) %]
236
                                        [% IF ( routing ) %]
237
                                            <th class="no-sort">Routing</th>
237
                                            <th class="no-sort">Routing</th>
238
                                        [% END %]
238
                                        [% END %]
239
                                        <th>Print label</th>
239
                                    </tr>
240
                                    </tr>
240
                                </thead>
241
                                </thead>
241
                                <tbody>
242
                                <tbody>
Lines 321-326 Link Here
321
                                                    >
322
                                                    >
322
                                                </td>
323
                                                </td>
323
                                            [% END %]
324
                                            [% END %]
325
                                            <td class="actions">
326
                                                <a href="/cgi-bin/koha/labels/seriallabel-print.pl?serialid=[% serial.serialid | uri %]" class="btn btn-default btn-xs print_list"><i class="fa fa-print"></i> Print label</a>
327
                                            </td>
324
                                        </tr>
328
                                        </tr>
325
                                    [% END %]
329
                                    [% END %]
326
                                </tbody>
330
                                </tbody>
(-)a/labels/seriallabel-print.pl (-1 / +67 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
use CGI        qw ( -utf8 );
20
use C4::Auth   qw( get_template_and_user );
21
use C4::Output qw( output_html_with_http_headers );
22
use C4::Context;
23
use C4::Serials;
24
use Koha::Biblios;
25
use Koha::Serials;
26
use Koha::TemplateUtils qw( process_tt );
27
28
my $query = CGI->new;
29
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
    {
32
        template_name => "serials/seriallabel-print.tt",
33
        query         => $query,
34
        type          => "intranet",
35
        flagsrequired => { serials => '*' },
36
    }
37
);
38
39
my $serialid = $query->param('serialid');
40
41
my $serial = Koha::Serials->find($serialid);
42
43
unless ( defined $serial ) {
44
    $template->param( no_serial => 1 );
45
    output_html_with_http_headers $query, $cookie, $template->output;
46
    exit;
47
}
48
49
my $subscription = C4::Serials::GetSubscription( $serial->subscriptionid );
50
my $biblio       = Koha::Biblios->find( $subscription->{biblionumber} );
51
52
my $format = C4::Context->preference('SerialLabelFormat') || '';
53
54
my $content = process_tt(
55
    $format,
56
    {
57
        serial       => $serial,
58
        subscription => $subscription,
59
        biblio       => $biblio,
60
    }
61
);
62
63
$template->param(
64
    content => $content,
65
);
66
67
output_html_with_http_headers $query, $cookie, $template->output;

Return to bug 12104