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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt (-1 / +35 lines)
Lines 88-94 Link Here
88
                }
88
                }
89
                return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
89
                return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
90
            };
90
            };
91
            function selected_layouts(op) {
91
92
            function XportPatronlist() {
93
                if ( patron_list_id.value.length < 1 ) {
94
                    alert(_("Please select a patron list."));
95
                    return;     // no patron list selected
96
                }
97
                getstr = 'patronlist_id='+patron_list_id.value;
98
                return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
99
            };
100
101
            function selected_layout(op) {
92
                if (document.layouts.action.length) {
102
                if (document.layouts.action.length) {
93
                    var selected = new Array();
103
                    var selected = new Array();
94
                    for (i=0;i<document.layouts.action.length;i++){
104
                    for (i=0;i<document.layouts.action.length;i++){
Lines 143-148 Link Here
143
                Xport();
153
                Xport();
144
                return false;
154
                return false;
145
            });
155
            });
156
            $("#printlist").click(function(){
157
                XportPatronlist();
158
                return false;
159
            });
146
         });
160
         });
147
//]]>
161
//]]>
148
</script>
162
</script>
Lines 204-210 Link Here
204
                            <fieldset class="action">
218
                            <fieldset class="action">
205
                                [% IF ( print ) %]<input class="btn btn-sm" type="button" id="print" value="Export selected batches" />[% END %]
219
                                [% IF ( print ) %]<input class="btn btn-sm" type="button" id="print" value="Export selected batches" />[% END %]
206
                            </fieldset>
220
                            </fieldset>
221
                            [% IF patron_lists %]
222
                            <fieldset class="rows">
223
                                <legend>Or use a patron list</legend>
224
                                <ol>
225
                                    <li>
226
                                        <label for="patron_list_id">Patron list: </label>
227
                                        <select id="patron_list_id" name="patron_list_id">
228
                                            <option value=""></option>
229
                                            [% FOREACH pl IN patron_lists %]
230
                                                <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
231
                                            [% END %]
232
                                        </select>
233
                                    </li>
234
                                </ol>
235
                            </fieldset>
236
                            <fieldset class="action">
237
                                <input type="button" id="printlist" value="Export from patron list" />
238
                            </fieldset>
239
                            [% END %]
207
                            </form>
240
                            </form>
241
208
                            [% ELSE %]
242
                            [% ELSE %]
209
                        <div class="dialog message">
243
                        <div class="dialog message">
210
                            <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
244
                            <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 107-112 else { # trap unsupported operations here Link Here
107
my $table = html_table($display_columns->{$card_element}, $db_rows);
108
my $table = html_table($display_columns->{$card_element}, $db_rows);
108
109
109
$template->param(print => 1) if ($card_element eq 'batch');
110
$template->param(print => 1) if ($card_element eq 'batch');
111
$template->param( patron_lists => [ GetPatronLists() ] ) if ($card_element eq 'batch');
112
110
$template->param(
113
$template->param(
111
                error           => $errstr,
114
                error           => $errstr,
112
);
115
);
(-)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