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

(-)a/koha-tmpl/intranet-tmpl/prog/css/print.css (+4 lines)
Lines 1-3 Link Here
1
@media print {
2
    .pagebreak { break-after: page; }
3
}
4
1
a:link {
5
a:link {
2
    color: #000000;
6
    color: #000000;
3
    text-decoration: none;
7
    text-decoration: none;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt (-3 / +9 lines)
Lines 35-46 Link Here
35
<body id="circ_printslip" class="circ">
35
<body id="circ_printslip" class="circ">
36
<div id="receipt">
36
<div id="receipt">
37
37
38
[% IF plain %]
38
[% UNLESS slips && slips.size %]
39
    [% SET slips = [{content => slip, is_html => !plain}] %]
40
[% END %]
41
[% FOR slip IN slips %]
42
[% UNLESS slip.is_html %]
39
<pre>
43
<pre>
40
[% IF ( slip ) %][% slip | html %][% ELSE %]No slip template found[% END %]
44
[% IF ( slip.content ) %][% slip.content | html %][% ELSE %]No slip template found[% END %]
41
</pre>
45
</pre>
42
[% ELSE %]
46
[% ELSE %]
43
[% IF ( slip ) %][% slip | $raw %][% ELSE %]No slip template found[% END %]
47
[% IF ( slip.content ) %][% slip.content | $raw %][% ELSE %]No slip template found[% END %]
48
[% END %]
49
[% IF slips.size > 1 && !loop.last%]<div class="pagebreak"></div>[% END %]
44
[% END %]
50
[% END %]
45
51
46
[% INCLUDE 'intranet-bottom.inc' %]
52
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue (-5 / +90 lines)
Lines 153-158 Link Here
153
            </fieldset>
153
            </fieldset>
154
            <fieldset v-if="train.items.length" class="rows">
154
            <fieldset v-if="train.items.length" class="rows">
155
                <legend>{{ $__("Items") }}</legend>
155
                <legend>{{ $__("Items") }}</legend>
156
                <span class="action_links">
157
                    <a
158
                        role="link"
159
                        @click="selectAll()"
160
                        :title="$__('Select all')"
161
                        ><i class="fa fa-check"></i>{{ $__("Select all") }}</a
162
                    >
163
                    <a @click="clearAll()" :title="$__('Clear all')"
164
                        ><i class="fa fa-remove"></i>{{ $__("Clear all") }}</a
165
                    >
166
                    {{ $__("Actions: ") }}
167
                    <a
168
                        v-if="selected_items.length > 0"
169
                        @click="printSelected()"
170
                        :title="$__('Print slips')"
171
                        ><i class="fa fa-print"></i>{{ $__("Print slips") }}</a
172
                    >
173
                    <a v-else class="disabled" :title="$__('Print slips')"
174
                        ><i class="fa fa-print"></i>{{ $__("Print slips") }}</a
175
                    >
176
                </span>
156
                <table v-if="item_table.display" :id="table_id"></table>
177
                <table v-if="item_table.display" :id="table_id"></table>
157
                <ol v-else>
178
                <ol v-else>
158
                    <li
179
                    <li
Lines 268-273 export default { Link Here
268
            train_list: [],
289
            train_list: [],
269
            train_id_selected_for_copy: null,
290
            train_id_selected_for_copy: null,
270
            train_item_id_to_copy: null,
291
            train_item_id_to_copy: null,
292
            selected_items: [],
271
            av_options: {},
293
            av_options: {},
272
        }
294
        }
273
    },
295
    },
Lines 309-319 export default { Link Here
309
                            this.item_table.data.push(item_row)
331
                            this.item_table.data.push(item_row)
310
                        })
332
                        })
311
                        this.item_table.columns = []
333
                        this.item_table.columns = []
312
                        this.item_table.columns.push({
334
                        this.item_table.columns.push(
313
                            name: "",
335
                            {
314
                            title: this.$__("ID"),
336
                                name: "checkboxes",
315
                            data: "item.user_train_item_id",
337
                                className: "checkboxes",
316
                        })
338
                                width: "5%",
339
                                render: (data, type, row) => {
340
                                    return ""
341
                                },
342
                            },
343
                            {
344
                                name: "",
345
                                title: this.$__("ID"),
346
                                data: "item.user_train_item_id",
347
                            }
348
                        )
317
                        train.default_processing.attributes.forEach(a =>
349
                        train.default_processing.attributes.forEach(a =>
318
                            this.item_table.columns.push({
350
                            this.item_table.columns.push({
319
                                name: a.name,
351
                                name: a.name,
Lines 478-483 export default { Link Here
478
                    }
510
                    }
479
                )
511
                )
480
        },
512
        },
513
        clearAll() {
514
            this.selected_items = []
515
            $("#" + this.table_id)
516
                .find("input[name='user_train_item_id'][type='checkbox']")
517
                .prop("checked", false)
518
        },
519
        selectAll() {
520
            $("#" + this.table_id)
521
                .find("input[name='user_train_item_id'][type='checkbox']")
522
                .each((i, input) => {
523
                    this.selected_items.push($(input).val())
524
                    $(input).prop("checked", true)
525
                })
526
        },
527
        printSelected() {
528
            window.open(
529
                "/cgi-bin/koha/preservation/print_slip.pl?%s_blank".format(
530
                    this.selected_items
531
                        .map(id => "train_item_id=" + id)
532
                        .join("&")
533
                )
534
            )
535
        },
536
        updateSelectedItems(checked, train_item_id) {
537
            if (checked) {
538
                this.selected_items.push(train_item_id)
539
            } else {
540
                this.selected_items = this.selected_items.filter(
541
                    id => id != train_item_id
542
                )
543
            }
544
        },
481
        build_datatable: function () {
545
        build_datatable: function () {
482
            let table_id = this.table_id
546
            let table_id = this.table_id
483
            let item_table = this.item_table
547
            let item_table = this.item_table
Lines 486-491 export default { Link Here
486
            let printSlip = this.printSlip
550
            let printSlip = this.printSlip
487
            let selectTrainForCopy = this.selectTrainForCopy
551
            let selectTrainForCopy = this.selectTrainForCopy
488
            let train = this.train
552
            let train = this.train
553
            let updateSelectedItems = this.updateSelectedItems
489
554
490
            let table = KohaTable(table_id, {
555
            let table = KohaTable(table_id, {
491
                data: item_table.data,
556
                data: item_table.data,
Lines 494-499 export default { Link Here
494
                columns: item_table.columns,
559
                columns: item_table.columns,
495
                drawCallback: function (settings) {
560
                drawCallback: function (settings) {
496
                    var api = new $.fn.dataTable.Api(settings)
561
                    var api = new $.fn.dataTable.Api(settings)
562
                    $.each($(this).find("td.checkboxes"), function (index, e) {
563
                        let tr = $(this).parent()
564
                        let train_item = api.row(tr).data().item
565
                        let train_item_id = train_item.train_item_id
566
567
                        let checkbox = createVNode("input", {
568
                            type: "checkbox",
569
                            name: "user_train_item_id",
570
                            value: train_item_id,
571
                            onChange: e => {
572
                                updateSelectedItems(
573
                                    e.target.checked,
574
                                    train_item_id
575
                                )
576
                            },
577
                        })
578
579
                        render(checkbox, e)
580
                    })
497
                    $.each($(this).find("td.actions"), function (index, e) {
581
                    $.each($(this).find("td.actions"), function (index, e) {
498
                        let tr = $(this).parent()
582
                        let tr = $(this).parent()
499
                        let train_item = api.row(tr).data().item
583
                        let train_item = api.row(tr).data().item
Lines 599-604 export default { Link Here
599
.action_links a {
683
.action_links a {
600
    padding-left: 0.2em;
684
    padding-left: 0.2em;
601
    font-size: 11px;
685
    font-size: 11px;
686
    cursor: pointer;
602
}
687
}
603
.attributes_values {
688
.attributes_values {
604
    float: left;
689
    float: left;
(-)a/preservation/print_slip.pl (-27 / +20 lines)
Lines 15-21 Link Here
15
# You should have received a copy of the GNU General Public License
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
17
18
19
use Modern::Perl;
18
use Modern::Perl;
20
use CGI qw ( -utf8 );
19
use CGI qw ( -utf8 );
21
use C4::Context;
20
use C4::Context;
Lines 25-32 use C4::Letters; Link Here
25
use Koha::Patrons;
24
use Koha::Patrons;
26
use Koha::Preservation::Train::Items;
25
use Koha::Preservation::Train::Items;
27
26
28
my $input         = CGI->new;
27
my $input          = CGI->new;
29
my $train_item_id = $input->param('train_item_id');
28
my @train_item_ids = $input->multi_param('train_item_id');
30
29
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32
    {
31
    {
Lines 40-71 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
40
my $logged_in_user = Koha::Patrons->find($loggedinuser);
39
my $logged_in_user = Koha::Patrons->find($loggedinuser);
41
my $branch         = C4::Context->userenv->{'branch'};
40
my $branch         = C4::Context->userenv->{'branch'};
42
41
43
my $train_item = Koha::Preservation::Train::Items->find($train_item_id);
42
my @slips;
44
43
for my $train_item_id (@train_item_ids) {
45
unless ($train_item) {
44
    my $train_item = Koha::Preservation::Train::Items->find($train_item_id);
46
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
45
    my $letter     = C4::Letters::GetPreparedLetter(
47
    exit;
46
        module      => 'preservation',
47
        letter_code => $train_item->processing->letter_code,
48
        branchcode  => $branch,
49
        lang        => $logged_in_user->lang,
50
        tables      => {
51
            preservation_train_items => $train_item_id,
52
        },
53
        message_transport_type => 'print'
54
    );
55
    push @slips, {
56
        content => $letter->{content},
57
        is_html => $letter->{is_html},
58
    };
48
}
59
}
49
60
50
my $train = $train_item->train;
51
52
my $letter = C4::Letters::GetPreparedLetter(
53
    module      => 'preservation',
54
    letter_code => $train_item->processing->letter_code,
55
    branchcode  => $branch,
56
    lang        => $logged_in_user->lang,
57
    tables      => {
58
        preservation_train_items => $train_item_id,
59
    },
60
    message_transport_type => 'print'
61
);
62
63
my $slip    = $letter->{content};
64
my $is_html = $letter->{is_html};
65
66
$template->param(
61
$template->param(
67
    slip       => $slip,
62
    slips      => \@slips,
68
    plain      => !$is_html,
69
    caller     => 'preservation',
63
    caller     => 'preservation',
70
    stylesheet => C4::Context->preference("SlipCSS"),
64
    stylesheet => C4::Context->preference("SlipCSS"),
71
);
65
);
72
- 

Return to bug 34030