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 26-37 Link Here
26
<body id="circ_printslip" class="circ">
26
<body id="circ_printslip" class="circ">
27
<div id="receipt">
27
<div id="receipt">
28
28
29
[% IF plain %]
29
[% UNLESS slips && slips.size %]
30
    [% SET slips = [{content => slip, is_html => !plain}] %]
31
[% END %]
32
[% FOR slip IN slips %]
33
[% UNLESS slip.is_html %]
30
<pre>
34
<pre>
31
[% IF ( slip ) %][% slip | html %][% ELSE %]No slip template found[% END %]
35
[% IF ( slip.content ) %][% slip.content | html %][% ELSE %]No slip template found[% END %]
32
</pre>
36
</pre>
33
[% ELSE %]
37
[% ELSE %]
34
[% IF ( slip ) %][% slip | $raw %][% ELSE %]No slip template found[% END %]
38
[% IF ( slip.content ) %][% slip.content | $raw %][% ELSE %]No slip template found[% END %]
39
[% END %]
40
[% IF slips.size > 1 && !loop.last%]<div class="pagebreak"></div>[% END %]
35
[% END %]
41
[% END %]
36
42
37
[% INCLUDE 'intranet-bottom.inc' %]
43
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/TrainsShow.vue (-5 / +90 lines)
Lines 147-152 Link Here
147
            </fieldset>
147
            </fieldset>
148
            <fieldset v-if="train.items.length" class="rows">
148
            <fieldset v-if="train.items.length" class="rows">
149
                <legend>{{ $__("Items") }}</legend>
149
                <legend>{{ $__("Items") }}</legend>
150
                <span class="action_links">
151
                    <a
152
                        role="link"
153
                        @click="selectAll()"
154
                        :title="$__('Select all')"
155
                        ><i class="fa fa-check"></i>{{ $__("Select all") }}</a
156
                    >
157
                    <a @click="clearAll()" :title="$__('Clear all')"
158
                        ><i class="fa fa-remove"></i>{{ $__("Clear all") }}</a
159
                    >
160
                    {{ $__("Actions: ") }}
161
                    <a
162
                        v-if="selected_items.length > 0"
163
                        @click="printSelected()"
164
                        :title="$__('Print slips')"
165
                        ><i class="fa fa-print"></i>{{ $__("Print slips") }}</a
166
                    >
167
                    <a v-else class="disabled" :title="$__('Print slips')"
168
                        ><i class="fa fa-print"></i>{{ $__("Print slips") }}</a
169
                    >
170
                </span>
150
                <table v-if="item_table.display" :id="table_id"></table>
171
                <table v-if="item_table.display" :id="table_id"></table>
151
                <ol v-else>
172
                <ol v-else>
152
                    <li
173
                    <li
Lines 260-265 export default { Link Here
260
            train_list: [],
281
            train_list: [],
261
            train_id_selected_for_copy: null,
282
            train_id_selected_for_copy: null,
262
            train_item_id_to_copy: null,
283
            train_item_id_to_copy: null,
284
            selected_items: [],
263
            av_options: {},
285
            av_options: {},
264
        }
286
        }
265
    },
287
    },
Lines 301-311 export default { Link Here
301
                            this.item_table.data.push(item_row)
323
                            this.item_table.data.push(item_row)
302
                        })
324
                        })
303
                        this.item_table.columns = []
325
                        this.item_table.columns = []
304
                        this.item_table.columns.push({
326
                        this.item_table.columns.push(
305
                            name: "",
327
                            {
306
                            title: this.$__("ID"),
328
                                name: "checkboxes",
307
                            data: "item.user_train_item_id",
329
                                className: "checkboxes",
308
                        })
330
                                width: "5%",
331
                                render: (data, type, row) => {
332
                                    return ""
333
                                },
334
                            },
335
                            {
336
                                name: "",
337
                                title: this.$__("ID"),
338
                                data: "item.user_train_item_id",
339
                            }
340
                        )
309
                        train.default_processing.attributes.forEach(a =>
341
                        train.default_processing.attributes.forEach(a =>
310
                            this.item_table.columns.push({
342
                            this.item_table.columns.push({
311
                                name: a.name,
343
                                name: a.name,
Lines 468-473 export default { Link Here
468
                    }
500
                    }
469
                )
501
                )
470
        },
502
        },
503
        clearAll() {
504
            this.selected_items = []
505
            $("#" + this.table_id)
506
                .find("input[name='user_train_item_id'][type='checkbox']")
507
                .prop("checked", false)
508
        },
509
        selectAll() {
510
            $("#" + this.table_id)
511
                .find("input[name='user_train_item_id'][type='checkbox']")
512
                .each((i, input) => {
513
                    this.selected_items.push($(input).val())
514
                    $(input).prop("checked", true)
515
                })
516
        },
517
        printSelected() {
518
            window.open(
519
                "/cgi-bin/koha/preservation/print_slip.pl?%s_blank".format(
520
                    this.selected_items
521
                        .map(id => "train_item_id=" + id)
522
                        .join("&")
523
                )
524
            )
525
        },
526
        updateSelectedItems(checked, train_item_id) {
527
            if (checked) {
528
                this.selected_items.push(train_item_id)
529
            } else {
530
                this.selected_items = this.selected_items.filter(
531
                    id => id != train_item_id
532
                )
533
            }
534
        },
471
        build_datatable: function () {
535
        build_datatable: function () {
472
            let table_id = this.table_id
536
            let table_id = this.table_id
473
            let item_table = this.item_table
537
            let item_table = this.item_table
Lines 476-481 export default { Link Here
476
            let printSlip = this.printSlip
540
            let printSlip = this.printSlip
477
            let selectTrainForCopy = this.selectTrainForCopy
541
            let selectTrainForCopy = this.selectTrainForCopy
478
            let train = this.train
542
            let train = this.train
543
            let updateSelectedItems = this.updateSelectedItems
479
544
480
            let table = KohaTable(table_id, {
545
            let table = KohaTable(table_id, {
481
                data: item_table.data,
546
                data: item_table.data,
Lines 484-489 export default { Link Here
484
                columns: item_table.columns,
549
                columns: item_table.columns,
485
                drawCallback: function (settings) {
550
                drawCallback: function (settings) {
486
                    var api = new $.fn.dataTable.Api(settings)
551
                    var api = new $.fn.dataTable.Api(settings)
552
                    $.each($(this).find("td.checkboxes"), function (index, e) {
553
                        let tr = $(this).parent()
554
                        let train_item = api.row(tr).data().item
555
                        let train_item_id = train_item.train_item_id
556
557
                        let checkbox = createVNode("input", {
558
                            type: "checkbox",
559
                            name: "user_train_item_id",
560
                            value: train_item_id,
561
                            onChange: e => {
562
                                updateSelectedItems(
563
                                    e.target.checked,
564
                                    train_item_id
565
                                )
566
                            },
567
                        })
568
569
                        render(checkbox, e)
570
                    })
487
                    $.each($(this).find("td.actions"), function (index, e) {
571
                    $.each($(this).find("td.actions"), function (index, e) {
488
                        let tr = $(this).parent()
572
                        let tr = $(this).parent()
489
                        let train_item = api.row(tr).data().item
573
                        let train_item = api.row(tr).data().item
Lines 588-593 export default { Link Here
588
.action_links a {
672
.action_links a {
589
    padding-left: 0.2em;
673
    padding-left: 0.2em;
590
    font-size: 11px;
674
    font-size: 11px;
675
    cursor: pointer;
591
}
676
}
592
.attributes_values {
677
.attributes_values {
593
    float: left;
678
    float: left;
(-)a/preservation/print_slip.pl (-25 / +19 lines)
Lines 26-32 use Koha::Patrons; Link Here
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_ids = $input->multi_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
    {
Lines 40-71 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
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 @slips;
44
44
for my $train_item_id ( @train_item_ids ) {
45
unless ($train_item){
45
    my $train_item = Koha::Preservation::Train::Items->find($train_item_id);
46
    print $input->redirect("/cgi-bin/koha/errors/404.pl");
46
    my $letter = C4::Letters::GetPreparedLetter(
47
    exit;
47
        module      => 'preservation',
48
        letter_code => $train_item->processing->letter_code,
49
        branchcode  => $branch,
50
        lang        => $logged_in_user->lang,
51
        tables      => {
52
            preservation_train_items => $train_item_id,
53
        },
54
        message_transport_type => 'print'
55
    );
56
    push @slips, {
57
        content => $letter->{content},
58
        is_html => $letter->{is_html},
59
    };
48
}
60
}
49
61
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(
62
$template->param(
67
    slip => $slip,
63
    slips => \@slips,
68
    plain => !$is_html,
69
    caller => 'preservation',
64
    caller => 'preservation',
70
    stylesheet => C4::Context->preference("SlipCSS"),
65
    stylesheet => C4::Context->preference("SlipCSS"),
71
);
66
);
72
- 

Return to bug 34030