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 64-69 Link Here
64
                }
64
                }
65
                return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
65
                return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
66
            };
66
            };
67
68
            function XportPatronlist() {
69
                if ( patron_list_id.value.length < 1 ) {
70
                    alert(_("Please select a patron list."));
71
                    return;     // no patron list selected
72
                }
73
                getstr = 'patronlist_id='+patron_list_id.value;
74
                return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
75
            };
76
67
            function selected_layout(op) {
77
            function selected_layout(op) {
68
                var selected = new Array;
78
                var selected = new Array;
69
                if (document.layouts.action.length) {
79
                if (document.layouts.action.length) {
Lines 102-107 Link Here
102
                Xport();
112
                Xport();
103
                return false;
113
                return false;
104
            });
114
            });
115
            $("#printlist").click(function(){
116
                XportPatronlist();
117
                return false;
118
            });
105
         });
119
         });
106
//]]>
120
//]]>
107
</script>
121
</script>
Lines 153-161 Link Here
153
                            <fieldset class="action">
167
                            <fieldset class="action">
154
                                <input type="button" id="edit" value="Edit" />
168
                                <input type="button" id="edit" value="Edit" />
155
                                <input type="button" id="delete" value="Delete" />
169
                                <input type="button" id="delete" value="Delete" />
156
                                [% IF ( print ) %]<input type="button" id="print" value="Export" />[% END %]
170
                                [% IF ( print ) %]<input type="button" id="print" value="Export from batch(es)" />[% END %]
157
                            </fieldset>
171
                            </fieldset>
172
                            [% IF patron_lists %]
173
                            <fieldset class="rows">
174
                                <legend>Or use a patron list</legend>
175
                                <ol>
176
                                    <li>
177
                                        <label for="patron_list_id">Patron list: </label>
178
                                        <select id="patron_list_id" name="patron_list_id">
179
                                            <option value=""></option>
180
                                            [% FOREACH pl IN patron_lists %]
181
                                                <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
182
                                            [% END %]
183
                                        </select>
184
                                    </li>
185
                                </ol>
186
                            </fieldset>
187
                            <fieldset class="action">
188
                                <input type="button" id="printlist" value="Export from patron list" />
189
                            </fieldset>
190
                            [% END %]
158
                            </form>
191
                            </form>
192
159
                            [% ELSE %]
193
                            [% ELSE %]
160
                        <div class="dialog message">
194
                        <div class="dialog message">
161
                            <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
195
                            <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 (-1 / +8 lines)
Lines 41-52 Link Here
41
                    <input type="button" class="submit" id="done" onclick="parent.parent.GB_hide();" value="Done" />
41
                    <input type="button" class="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 %] patroncard[% ELSE %]Exporting [% card_count %] patroncards[% END %]
52
                        [% IF ( card_count == 1 ) %]Exporting [% card_count %] patroncard[% ELSE %]Exporting [% card_count %] patroncards[% END %]
48
                    [% ELSIF ( borrower_numbers ) %]
53
                    [% ELSIF ( borrower_numbers ) %]
49
                        [% IF ( borrower_count == 1 ) %]Exporting [% borrower_count %] patroncard[% ELSE %]Exporting [% borrower_count %] patroncards[% END %]
54
                        [% IF ( borrower_count == 1 ) %]Exporting [% borrower_count %] patroncard[% ELSE %]Exporting [% borrower_count %] patroncards[% END %]a
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}, {item_number => $_});
94
        push(@{$items}, {item_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 100-105 else { # trap unsupported operations here Link Here
100
my $table = html_table($display_columns->{$card_element}, $db_rows);
101
my $table = html_table($display_columns->{$card_element}, $db_rows);
101
102
102
$template->param(print => 1) if ($card_element eq 'batch');
103
$template->param(print => 1) if ($card_element eq 'batch');
104
$template->param( patron_lists => [ GetPatronLists() ] ) if ($card_element eq 'batch');
105
103
$template->param(
106
$template->param(
104
                error           => $errstr,
107
                error           => $errstr,
105
);
108
);
(-)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