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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt (+34 lines)
Lines 66-71 Link Here
66
                }
66
                }
67
                return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
67
                return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
68
            };
68
            };
69
70
            function XportPatronlist() {
71
                if ( patron_list_id.value.length < 1 ) {
72
                    alert(_("Please select a patron list."));
73
                    return;     // no patron list selected
74
                }
75
                getstr = 'patronlist_id='+patron_list_id.value;
76
                return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
77
            };
78
69
            function selected_layout(op) {
79
            function selected_layout(op) {
70
                var selected = new Array;
80
                var selected = new Array;
71
                if (document.layouts.action.length) {
81
                if (document.layouts.action.length) {
Lines 104-109 Link Here
104
                Xport();
114
                Xport();
105
                return false;
115
                return false;
106
            });
116
            });
117
            $("#printlist").click(function(){
118
                XportPatronlist();
119
                return false;
120
            });
107
         });
121
         });
108
//]]>
122
//]]>
109
</script>
123
</script>
Lines 165-171 Link Here
165
                            <fieldset class="action">
179
                            <fieldset class="action">
166
                                [% IF ( print ) %]<input class="btn btn-sm" type="button" id="print" value="Export selected batches" />[% END %]
180
                                [% IF ( print ) %]<input class="btn btn-sm" type="button" id="print" value="Export selected batches" />[% END %]
167
                            </fieldset>
181
                            </fieldset>
182
                            [% IF patron_lists %]
183
                            <fieldset class="rows">
184
                                <legend>Or use a patron list</legend>
185
                                <ol>
186
                                    <li>
187
                                        <label for="patron_list_id">Patron list: </label>
188
                                        <select id="patron_list_id" name="patron_list_id">
189
                                            <option value=""></option>
190
                                            [% FOREACH pl IN patron_lists %]
191
                                                <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
192
                                            [% END %]
193
                                        </select>
194
                                    </li>
195
                                </ol>
196
                            </fieldset>
197
                            <fieldset class="action">
198
                                <input type="button" id="printlist" value="Export from patron list" />
199
                            </fieldset>
200
                            [% END %]
168
                            </form>
201
                            </form>
202
169
                            [% ELSE %]
203
                            [% ELSE %]
170
                        <div class="dialog message">
204
                        <div class="dialog message">
171
                            <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
205
                            <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt (+7 lines)
Lines 41-52 Link Here
41
                    <input type="button" class="btn btn-default submit" id="done" onclick="parent.parent.GB_hide();" value="Done" />
41
                    <input type="button" class="btn btn-default submit" id="done" onclick="parent.parent.GB_hide();" value="Done" />
42
                </fieldset>
42
                </fieldset>
43
            </form>
43
            </form>
44
            [% ELSIF ( patronlist_id && template_id && layout_id ) %]
45
                <h3>Click on the link to download the patron cards from the patron list.</h3>
46
                    <p>
47
                        <a class="document pdf" href="/cgi-bin/koha/patroncards/create-pdf.pl?patronlist_id=[% patronlist_id %]&amp;template_id=[% template_id %]&amp;layout_id=[% layout_id %]&amp;start_card=[% start_card %]">label_patronlist_[% patronlist_id %].pdf</a>
48
                    </p>
44
            [% ELSE %]
49
            [% ELSE %]
45
            <h3>
50
            <h3>
46
                    [% IF ( label_ids ) %]
51
                    [% IF ( label_ids ) %]
47
                        [% IF ( card_count == 1 ) %]Exporting [% card_count %] patron card[% ELSE %]Exporting [% card_count %] patron cards[% END %]
52
                        [% IF ( card_count == 1 ) %]Exporting [% card_count %] patron card[% ELSE %]Exporting [% card_count %] patron cards[% END %]
48
                    [% ELSIF ( borrower_numbers ) %]
53
                    [% ELSIF ( borrower_numbers ) %]
49
                        [% IF ( borrower_count == 1 ) %]Exporting [% borrower_count %] patron card[% ELSE %]Exporting [% borrower_count %] patron cards[% END %]
54
                        [% IF ( borrower_count == 1 ) %]Exporting [% borrower_count %] patron card[% ELSE %]Exporting [% borrower_count %] patron cards[% END %]
55
                    [% ELSIF ( patronlist_id ) %] Exporting from patron list
50
                    [% ELSE %]
56
                    [% ELSE %]
51
                        [% IF ( multi_batch_count == 1 ) %][% multi_batch_count %] batch to export[% ELSE %][% multi_batch_count %] batches to export[% END %]
57
                        [% IF ( multi_batch_count == 1 ) %][% multi_batch_count %] batch to export[% ELSE %][% multi_batch_count %] batches to export[% END %]
52
                    [% END %]
58
                    [% END %]
Lines 63-68 Link Here
63
                [% FOREACH borrower_number IN borrower_numbers %]
69
                [% FOREACH borrower_number IN borrower_numbers %]
64
                    <input type="hidden" name="borrower_number" value="[% borrower_number.borrower_number %]" />
70
                    <input type="hidden" name="borrower_number" value="[% borrower_number.borrower_number %]" />
65
                [% END %]
71
                [% END %]
72
                [% IF (patronlist_id) %] <input type="hidden" name="patronlist_id" value="[% patronlist_id %]" /> [% END %]
66
                <fieldset class="rows">
73
                <fieldset class="rows">
67
                    <ol>
74
                    <ol>
68
                        <li>
75
                        <li>
(-)a/patroncards/create-pdf.pl (+10 lines)
Lines 32-37 use C4::Context; Link Here
32
use autouse 'C4::Members' => qw(GetPatronImage GetMember);
32
use autouse 'C4::Members' => qw(GetPatronImage GetMember);
33
use C4::Creators;
33
use C4::Creators;
34
use C4::Patroncards;
34
use C4::Patroncards;
35
use Koha::List::Patron;
35
36
36
my $cgi = new CGI;
37
my $cgi = new CGI;
37
38
Lines 51-56 my $layout_id = $cgi->param('layout_id') || undef; Link Here
51
my $start_card = $cgi->param('start_card') || 1;
52
my $start_card = $cgi->param('start_card') || 1;
52
my @label_ids   = $cgi->param('label_id') if $cgi->param('label_id');
53
my @label_ids   = $cgi->param('label_id') if $cgi->param('label_id');
53
my @borrower_numbers  = $cgi->param('borrower_number') if $cgi->param('borrower_number');
54
my @borrower_numbers  = $cgi->param('borrower_number') if $cgi->param('borrower_number');
55
my $patronlist_id = $cgi->param('patronlist_id');
54
56
55
my $items = undef; # items = cards
57
my $items = undef; # items = cards
56
my $new_page = 0;
58
my $new_page = 0;
Lines 92-97 elsif (@borrower_numbers) { Link Here
92
        push(@{$items}, {borrower_number => $_});
94
        push(@{$items}, {borrower_number => $_});
93
    } @borrower_numbers;
95
    } @borrower_numbers;
94
}
96
}
97
elsif ( $patronlist_id  ) {
98
    my ($list) = GetPatronLists( { patron_list_id => $patronlist_id } );
99
    my @borrowerlist = $list->patron_list_patrons()->search_related('borrowernumber')
100
    ->get_column('borrowernumber')->all();
101
    grep {
102
        push(@{$items}, {borrower_number => $_});
103
    } @borrowerlist;
104
}
95
else {
105
else {
96
    $items = $batch->get_attr('items');
106
    $items = $batch->get_attr('items');
97
}
107
}
(-)a/patroncards/manage.pl (+3 lines)
Lines 30-35 use C4::Output qw(output_html_with_http_headers); Link Here
30
use C4::Creators;
30
use C4::Creators;
31
use C4::Patroncards;
31
use C4::Patroncards;
32
use C4::Labels;
32
use C4::Labels;
33
use Koha::List::Patron;
33
34
34
my $cgi = new CGI;
35
my $cgi = new CGI;
35
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
36
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 104-109 else { # trap unsupported operations here Link Here
104
my $table = html_table($display_columns->{$card_element}, $db_rows);
105
my $table = html_table($display_columns->{$card_element}, $db_rows);
105
106
106
$template->param(print => 1) if ($card_element eq 'batch');
107
$template->param(print => 1) if ($card_element eq 'batch');
108
$template->param( patron_lists => [ GetPatronLists() ] ) if ($card_element eq 'batch');
109
107
$template->param(
110
$template->param(
108
                error           => $errstr,
111
                error           => $errstr,
109
);
112
);
(-)a/patroncards/print.pl (-1 / +11 lines)
Lines 43-48 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
43
my $op = $cgi->param('op') || 'none';
43
my $op = $cgi->param('op') || 'none';
44
my @label_ids = $cgi->param('label_id') if $cgi->param('label_id');   # this will handle individual card printing; we use label_id to maintain consistency with the column names in the creator_batches table
44
my @label_ids = $cgi->param('label_id') if $cgi->param('label_id');   # this will handle individual card printing; we use label_id to maintain consistency with the column names in the creator_batches table
45
my @batch_ids = $cgi->param('batch_id') if $cgi->param('batch_id');
45
my @batch_ids = $cgi->param('batch_id') if $cgi->param('batch_id');
46
my $patronlist_id = $cgi->param('patronlist_id') || undef;
46
my $layout_id = $cgi->param('layout_id') || undef;
47
my $layout_id = $cgi->param('layout_id') || undef;
47
my $template_id = $cgi->param('template_id') || undef;
48
my $template_id = $cgi->param('template_id') || undef;
48
my $start_card = $cgi->param('start_card') || 1;
49
my $start_card = $cgi->param('start_card') || 1;
Lines 104-109 if ($op eq 'export') { Link Here
104
                        referer     => $referer,
105
                        referer     => $referer,
105
                        );
106
                        );
106
    }
107
    }
108
    elsif ($patronlist_id ) {
109
        $template->param(
110
                         patronlist_id   => $patronlist_id,
111
                         template_id     => $template_id,
112
                         layout_id       => $layout_id,
113
                         start_card      => $start_card,
114
                         referer         => $referer,
115
                        );
116
    }
107
}
117
}
108
elsif ($op eq 'none') {
118
elsif ($op eq 'none') {
109
    # setup select menus for selecting layout and template for this run...
119
    # setup select menus for selecting layout and template for this run...
Lines 119-124 elsif ($op eq 'none') { Link Here
119
                    batch_ids                   => \@batch_ids,
129
                    batch_ids                   => \@batch_ids,
120
                    label_ids                   => \@label_ids,
130
                    label_ids                   => \@label_ids,
121
                    borrower_numbers            => \@borrower_numbers,
131
                    borrower_numbers            => \@borrower_numbers,
132
                    patronlist_id               => $patronlist_id,
122
                    templates                   => $templates,
133
                    templates                   => $templates,
123
                    layouts                     => $layouts,
134
                    layouts                     => $layouts,
124
                    output_formats              => $output_formats,
135
                    output_formats              => $output_formats,
125
- 

Return to bug 14131