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 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 (-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