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

(-)a/Koha/Club/Enrollment.pm (+16 lines)
Lines 24-29 use Carp; Link Here
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::Clubs;
25
use Koha::Clubs;
26
use Koha::Patrons;
26
use Koha::Patrons;
27
use Koha::DateUtils qw(dt_from_string);
28
use DateTime;
27
29
28
use base qw(Koha::Object);
30
use base qw(Koha::Object);
29
31
Lines 71-76 sub patron { Link Here
71
    return scalar Koha::Patrons->find( $self->borrowernumber() );
73
    return scalar Koha::Patrons->find( $self->borrowernumber() );
72
}
74
}
73
75
76
=head3 is_canceled
77
Determines if enrollment is canceled
78
=cut
79
80
sub is_canceled {
81
    my ( $self ) = @_;
82
83
    return 0 unless $self->date_canceled;
84
    my $today = dt_from_string;
85
    my $date_canceled = dt_from_string( $self->date_canceled );
86
87
    return DateTime->compare($date_canceled, $today) < 1;
88
}
89
74
=head3 type
90
=head3 type
75
91
76
=cut
92
=cut
(-)a/catalogue/search.pl (+8 lines)
Lines 203-208 if($cgi->cookie("holdfor")){ Link Here
203
    );
203
    );
204
}
204
}
205
205
206
if($cgi->cookie("holdforclub")){
207
    my $holdfor_club = Koha::Clubs->find( $cgi->cookie("holdforclub") );
208
    $template->param(
209
        holdforclub => $cgi->cookie("holdforclub"),
210
        holdforclub_name => $holdfor_club->name,
211
    );
212
}
213
206
# get biblionumbers stored in the cart
214
# get biblionumbers stored in the cart
207
my @cart_list;
215
my @cart_list;
208
216
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc (+111 lines)
Line 0 Link Here
1
<table id="clubs-table">
2
    <thead>
3
        <tr>
4
            <th>Name</th>
5
            <th>Template</th>
6
            <th>Description</th>
7
            [% UNLESS destination == 'holds' %]
8
                <th>Public enrollment</th>
9
                <th>Email required</th>
10
            [% END %]
11
            <th>Library</th>
12
            <th>Start date</th>
13
            <th>End date</th>
14
            <th>Enrolled patrons</th>
15
            [% UNLESS destination == 'holds' %]
16
                <th>&nbsp;</th>
17
            [% END %]
18
        </tr>
19
    </thead>
20
    <tbody>
21
        [% FOREACH c IN clubs %]
22
            [% IF destination == 'holds' %]
23
                [% IF multi_hold %]
24
                    [% SET data_url = "/cgi-bin/koha/reserve/request.pl?club=" _ c.id _ "&amp;multi_hold=1&amp;biblionumbers=" _ biblionumbers %]
25
                [% ELSE %]
26
                    [% SET data_url = "/cgi-bin/koha/reserve/request.pl?club=" _ c.id _ "&amp;biblionumber=" _ biblionumber %]
27
                [% END %]
28
                <tr class="clickable" data-url="[% data_url | html %]">
29
            [% ELSE %]
30
                <tr>
31
            [% END %]
32
                <td>[% c.name | html %]</td>
33
                <td>[% c.club_template.name | html %]</td>
34
                <td>[% c.description | html %]</td>
35
                [% UNLESS destination == 'holds' %]
36
                    <td>
37
                        [% IF c.club_template.is_enrollable_from_opac %]
38
                            Yes
39
                        [% ELSE %]
40
                            No
41
                        [% END %]
42
                    </td>
43
                    <td>
44
                        [% IF c.club_template.is_email_required %]
45
                            Yes
46
                        [% ELSE %]
47
                            No
48
                        [% END %]
49
                    </td>
50
                [% END %]
51
                <td>[% Branches.GetName( c.branchcode ) | html %]</td>
52
                <td>
53
                    [% IF c.date_start %]
54
                        [% c.date_start | $KohaDates %]
55
                    [% END %]
56
                </td>
57
                <td>
58
                    [% IF c.date_end %]
59
                        [% c.date_end | $KohaDates %]
60
                    [% END %]
61
                </td>
62
                <td>
63
                    [% c.club_enrollments.count | html %]
64
                </td>
65
                [% UNLESS destination == 'holds' %]
66
                    <td class="actions">
67
                        <div class="dropdown">
68
                            <a class="btn btn-default btn-xs dropdown-toggle" id="clubactions[% c.id | html %]" role="button" data-toggle="dropdown" href="#">
69
                                Actions <b class="caret"></b>
70
                            </a>
71
                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="clubactions[% c.id | html %]">
72
                                [% IF ( c.club_enrollments.count ) %]
73
                                    <li>
74
                                        <a href="club-enrollments.pl?id=[% c.id | uri %]">
75
                                            <i class="fa fa-list-ul"></i> Enrollments
76
                                        </a>
77
                                    </li>
78
                                [% ELSE %]
79
                                    <li class="disabled">
80
                                        <a href="club-enrollments.pl?id=[% c.id | uri %]">
81
                                            <i class="fa fa-list-ul"></i> Enrollments
82
                                        </a>
83
                                    </li>
84
                                [% END %]
85
                                [% IF CAN_user_clubs_edit_clubs %]
86
                                    <li>
87
                                        <a href="clubs-add-modify.pl?id=[% c.id | uri %]">
88
                                            <i class="fa fa-pencil"></i> Edit
89
                                        </a>
90
                                    </li>
91
                                    <li>
92
                                        <a href="#" onclick='ConfirmDeleteClub([% c.id | html %], "[% c.name | html %]", $(this) ); return false;'>
93
                                            <i class="fa fa-trash"></i> Delete
94
                                        </a>
95
                                    </li>
96
                                [% END %]
97
                                [% IF ( c.club_enrollments.count ) %]
98
                                    <li>
99
                                        <a href="#" onclick="SearchToHold([% c.id | html %])">
100
                                            <i class="fa fa-search"></i> Search to hold
101
                                        </a>
102
                                    </li>
103
                                [% END %]
104
                            </ul>
105
                        </div>
106
                    </td>
107
                [% END %]
108
            </tr>
109
        [% END %]
110
    </tbody>
111
</table> <!-- /.clubs-table -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-7 / +30 lines)
Lines 123-129 Link Here
123
                            [% END # /IF virtualshelves %]
123
                            [% END # /IF virtualshelves %]
124
124
125
                            [% IF ( CAN_user_reserveforothers_place_holds && DisplayMultiPlaceHold ) %]
125
                            [% IF ( CAN_user_reserveforothers_place_holds && DisplayMultiPlaceHold ) %]
126
                                [% IF ( holdfor ) %]
126
                                [% IF ( holdfor or holdforclub ) %]
127
                                    <div id="placeholdc" class="btn-group">
127
                                    <div id="placeholdc" class="btn-group">
128
                                        <button class="btn btn-default btn-xs placehold"><i class="fa fa-sticky-note-o"></i> Place hold</button>
128
                                        <button class="btn btn-default btn-xs placehold"><i class="fa fa-sticky-note-o"></i> Place hold</button>
129
                                        <button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
129
                                        <button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
Lines 131-139 Link Here
131
                                        </button>
131
                                        </button>
132
                                        <ul class="dropdown-menu">
132
                                        <ul class="dropdown-menu">
133
                                            <li><a href="#" class="placehold">Place hold</a></li>
133
                                            <li><a href="#" class="placehold">Place hold</a></li>
134
                                            <li><a href="#" class="placeholdfor">Place hold for [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></li>
134
                                            [% IF holdfor %]
135
                                            <li class="divider"></li>
135
                                                <li><a href="#" class="placeholdfor">Place hold for [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></li>
136
                                            <li><a href="#" id="forgetholdfor">Forget  [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></li>
136
                                                <li class="divider"></li>
137
                                                <li><a href="#" id="forgetholdfor">Forget  [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></li>
138
                                            [% END %]
139
                                            [% IF holdforclub %]
140
                                                <li><a href="#" class="placeholdforclub">Place hold for [% holdforclub_name | html %]</a></li>
141
                                                <li class="divider"></li>
142
                                                <li><a href="#" id="forgetholdforclub">Forget  [% holdforclub_name | html %]</a></li>
143
                                            [% END %]
137
                                        </ul>
144
                                        </ul>
138
                                    </div>
145
                                    </div>
139
                                [% ELSE %]
146
                                [% ELSE %]
Lines 422-427 Link Here
422
                                                        [% IF CAN_user_reserveforothers_place_holds %]
429
                                                        [% IF CAN_user_reserveforothers_place_holds %]
423
                                                            <a id="reserve_[% SEARCH_RESULT.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])</a>
430
                                                            <a id="reserve_[% SEARCH_RESULT.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])</a>
424
                                                            [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]&amp;findborrower=[% holdfor_cardnumber | uri %]">Place hold for [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></span>[% END %]
431
                                                            [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]&amp;findborrower=[% holdfor_cardnumber | uri %]">Place hold for [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></span>[% END %]
432
                                                            [% IF ( holdforclub ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]&amp;club=[% holdforclub | uri %]">Place hold for [% holdforclub_name | html %]</a></span>[% END %]
425
                                                        [% ELSE %]
433
                                                        [% ELSE %]
426
                                                            Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])
434
                                                            Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])
427
                                                        [% END %]
435
                                                        [% END %]
Lines 617-622 Link Here
617
                    <!-- Value will be set here by placeHold() -->
625
                    <!-- Value will be set here by placeHold() -->
618
                    <input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
626
                    <input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
619
                    <input type="hidden" name="findborrower" id="holdFor" value="" />
627
                    <input type="hidden" name="findborrower" id="holdFor" value="" />
628
                    <input type="hidden" name="club" id="holdForClub" value="" />
620
                    <input type="hidden" name="multi_hold" value="1"/>
629
                    <input type="hidden" name="multi_hold" value="1"/>
621
                </form>
630
                </form>
622
631
Lines 713-718 Link Here
713
722
714
            $("#searchheader").on("click",".placehold", function(){
723
            $("#searchheader").on("click",".placehold", function(){
715
                $("#holdFor").val("");
724
                $("#holdFor").val("");
725
                $("#holdForClub").val("");
716
                placeHold();
726
                placeHold();
717
                $(".btn-group").removeClass("open");
727
                $(".btn-group").removeClass("open");
718
                return false;
728
                return false;
Lines 724-731 Link Here
724
                return false;
734
                return false;
725
            });
735
            });
726
736
727
            $("#forgetholdfor").click(function(){
737
            $(".placeholdforclub").click(function(){
728
                forgetPatron();
738
                holdForClub();
739
                $(".btn-group").removeClass("open");
740
                return false;
741
            });
742
743
            $("#forgetholdfor, #forgetholdforclub").click(function(){
744
                forgetPatronAndClub();
729
                $(".btn-group").removeClass("open");
745
                $(".btn-group").removeClass("open");
730
                return false;
746
                return false;
731
            });
747
            });
Lines 884-891 Link Here
884
            return false;
900
            return false;
885
        }
901
        }
886
902
887
        function forgetPatron(){
903
        function forgetPatronAndClub(){
888
            $.removeCookie("holdfor", { path: '/' });
904
            $.removeCookie("holdfor", { path: '/' });
905
            $.removeCookie("holdforclub", { path: '/' });
889
            $(".holdforlink").remove();
906
            $(".holdforlink").remove();
890
            $("#placeholdc").html("<a class=\"btn btn-default btn-xs placehold\" href=\"#\"><i class=\"fa fa-sticky-note-o\"></i> "+_("Place hold")+"</a>");
907
            $("#placeholdc").html("<a class=\"btn btn-default btn-xs placehold\" href=\"#\"><i class=\"fa fa-sticky-note-o\"></i> "+_("Place hold")+"</a>");
891
        }
908
        }
Lines 936-941 Link Here
936
953
937
        function holdfor(){
954
        function holdfor(){
938
            $("#holdFor").val("");
955
            $("#holdFor").val("");
956
            $("#holdForClub").val("");
939
            placeHold();
957
            placeHold();
940
        }
958
        }
941
959
Lines 943-948 Link Here
943
            $("#holdFor").val("[% holdfor_cardnumber | html %]");
961
            $("#holdFor").val("[% holdfor_cardnumber | html %]");
944
            placeHold();
962
            placeHold();
945
        }
963
        }
964
965
        function holdForClub() {
966
            $("#holdForClub").val("[% holdforclub | html %]");
967
            placeHold();
968
        }
946
    </script>
969
    </script>
947
[% END %]
970
[% END %]
948
971
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt (-87 / +8 lines)
Lines 120-212 Link Here
120
                [% END %]
120
                [% END %]
121
121
122
                [% IF clubs %]
122
                [% IF clubs %]
123
                    <table id="clubs-table">
123
                    [% INCLUDE 'clubs-table.inc' %]
124
                        <thead>
125
                            <tr>
126
                                <th>Name</th>
127
                                <th>Template</th>
128
                                <th>Description</th>
129
                                <th>Public enrollment</th>
130
                                <th>Email required</th>
131
                                <th>Library</th>
132
                                <th>Start date</th>
133
                                <th>End date</th>
134
                                <th>Enrolled patrons</th>
135
                                <th>&nbsp;</th>
136
                            </tr>
137
                        </thead>
138
                        <tbody>
139
                            [% FOREACH c IN clubs %]
140
                                <tr>
141
                                    <td>[% c.name | html %]</td>
142
                                    <td>[% c.club_template.name | html %]</td>
143
                                    <td>[% c.description | html %]</td>
144
                                    <td>
145
                                        [% IF c.club_template.is_enrollable_from_opac %]
146
                                            Yes
147
                                        [% ELSE %]
148
                                            No
149
                                        [% END %]
150
                                    </td>
151
                                    <td>
152
                                        [% IF c.club_template.is_email_required %]
153
                                            Yes
154
                                        [% ELSE %]
155
                                            No
156
                                        [% END %]
157
                                    </td>
158
                                    <td>[% Branches.GetName( c.branchcode ) | html %]</td>
159
                                    <td>
160
                                        [% IF c.date_start %]
161
                                            [% c.date_start | $KohaDates %]
162
                                        [% END %]
163
                                    </td>
164
                                    <td>
165
                                        [% IF c.date_end %]
166
                                            [% c.date_end | $KohaDates %]
167
                                        [% END %]
168
                                    </td>
169
                                    <td>
170
                                        [% c.club_enrollments.count | html %]
171
                                    </td>
172
                                    <td class="actions">
173
                                        <div class="dropdown">
174
                                            <a class="btn btn-default btn-xs dropdown-toggle" id="clubactions[% c.id | html %]" role="button" data-toggle="dropdown" href="#">
175
                                                Actions <b class="caret"></b>
176
                                            </a>
177
                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="clubactions[% c.id | html %]">
178
                                                [% IF ( c.club_enrollments.count ) %]
179
                                                    <li>
180
                                                        <a href="club-enrollments.pl?id=[% c.id | uri %]">
181
                                                            <i class="fa fa-list-ul"></i> Enrollments
182
                                                        </a>
183
                                                    </li>
184
                                                [% ELSE %]
185
                                                    <li class="disabled">
186
                                                        <a href="club-enrollments.pl?id=[% c.id | uri %]">
187
                                                            <i class="fa fa-list-ul"></i> Enrollments
188
                                                        </a>
189
                                                    </li>
190
                                                [% END %]
191
                                                [% IF CAN_user_clubs_edit_clubs %]
192
                                                    <li>
193
                                                        <a href="clubs-add-modify.pl?id=[% c.id | uri %]">
194
                                                            <i class="fa fa-pencil"></i> Edit
195
                                                        </a>
196
                                                    </li>
197
                                                    <li>
198
                                                        <a href="#" onclick='ConfirmDeleteClub([% c.id | html %], "[% c.name | html %]", $(this) ); return false;'>
199
                                                            <i class="fa fa-trash"></i> Delete
200
                                                        </a>
201
                                                    </li>
202
                                                [% END %]
203
                                            </ul>
204
                                        </div>
205
                                    </td>
206
                                </tr>
207
                            [% END %]
208
                        </tbody>
209
                    </table> <!-- /.clubs-table -->
210
                [% ELSE %]
124
                [% ELSE %]
211
                    [% IF club_templates %]
125
                    [% IF club_templates %]
212
                        <div class="dialog message">No clubs defined.</div>
126
                        <div class="dialog message">No clubs defined.</div>
Lines 282-287 Link Here
282
                });
196
                });
283
            }
197
            }
284
        }
198
        }
199
200
        function SearchToHold(club_id) {
201
            var date = new Date();
202
            date.setTime(date.getTime() + (10 * 60 * 1000));
203
            $.cookie("holdforclub", club_id, { path: "/", expires: date });
204
            location.href="/cgi-bin/koha/catalogue/search.pl";
205
        }
285
    </script>
206
    </script>
286
[% END %]
207
[% END %]
287
208
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 861-867 Link Here
861
            if ( $('#clubs-tab').length ) {
861
            if ( $('#clubs-tab').length ) {
862
                $('#clubs-tab-link').on('click', function() {
862
                $('#clubs-tab-link').on('click', function() {
863
                    $('#clubs-tab').text(_("Loading..."));
863
                    $('#clubs-tab').text(_("Loading..."));
864
                    $('#clubs-tab').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
864
                    $('#clubs-tab').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% patron.borrowernumber | html %]');
865
                });
865
                });
866
            }
866
            }
867
867
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-22 / +246 lines)
Lines 73-79 Link Here
73
                <h1>Confirm holds</h1>
73
                <h1>Confirm holds</h1>
74
            [% END %]
74
            [% END %]
75
75
76
            [% UNLESS patron OR patron.borrowernumber OR noitems %]
76
            [% UNLESS club OR patron OR patron.borrowernumber OR noitems %]
77
                [% IF ( messageborrower ) %]
77
                [% IF ( messageborrower ) %]
78
                    <div class="dialog alert">
78
                    <div class="dialog alert">
79
                        <h3>Patron not found</h3>
79
                        <h3>Patron not found</h3>
Lines 81-110 Link Here
81
                    </div>
81
                    </div>
82
                [% END %]
82
                [% END %]
83
83
84
                <form  id="holds_patronsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
84
                [% IF ( messageclub ) %]
85
                    <fieldset id="circ_holds_selectborrower" class="brief">
85
                    <div class="dialog alert">
86
                        [% UNLESS borrowers %]
86
                        <h3>Club not found</h3>
87
                            <label for="patron">Patron: </label>
87
                        <p>No club with this name, please, try another</p>
88
                            <div class="hint">Enter patron card number or partial name:</div>
88
                    </div>
89
                            <input type="text" size="40" id="patron" class="focus" name="findborrower" autocomplete="off" />
89
                [% END %]
90
                            <input type="submit" value="Search" />
90
                <fieldset class="brief">
91
                            [% IF multi_hold %]
91
                    <label>Seach Patrons or clubs</label>
92
                                <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
92
                    <div id="circ_holds_select">
93
                                <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
93
                        <ul class="nav nav-tabs" role="tablist">
94
                            [% ELSE %]
94
                            <li role="presentation"><a href="#holds_patronsearch_pane" aria-controls="holds_patronsearch_pane" role="tab" data-toggle="tab">Patrons</a></li>
95
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
95
                            <li role="presentation"><a href="#holds_clubsearch_pane" aria-controls="holds_clubsearch_pane" role="tab" data-toggle="tab">Clubs</a></li>
96
                            [% END %]
96
                        </ul>
97
                        [% ELSE %]
97
                        <div class="tab-content">
98
                            <div role="tabpanel" class="tab-pane" id="holds_patronsearch_pane">
99
                                <form  id="holds_patronsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
100
                                    <div class="hint">Enter patron card number or partial name:</div>
101
                                    <input type="text" size="40" id="patron" class="focus" name="findborrower" autocomplete="off" />
102
                                    <input type="submit" value="Search" />
103
                                    [% IF multi_hold %]
104
                                        <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
105
                                        <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
106
                                    [% ELSE %]
107
                                        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
108
                                    [% END %]
109
110
                                    [% IF ( multi_hold ) %]
111
                                        <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
112
                                        <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
113
                                    [% END %]
114
                                </form> <!-- /#holds_patronsearch -->
115
                            </div>
116
                            <div role="tabpanel" class="tab-pane" id="holds_clubsearch_pane">
117
                                <form  id="holds_clubsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
118
                                    <div class="hint">Enter club id or partial name:</div>
119
                                    <input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
120
                                    <input type="submit" value="Search" />
121
                                    [% IF multi_hold %]
122
                                        <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
123
                                        <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
124
                                    [% ELSE %]
125
                                        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
126
                                    [% END %]
127
128
                                    [% IF ( multi_hold ) %]
129
                                        <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
130
                                        <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
131
                                    [% END %]
132
                                </form> <!-- /#holds_patronsearch -->
133
                            </div>
134
                        </div>
135
                    </div>
136
                    <p>
137
                        [% IF borrowers %]
98
                            [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
138
                            [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
139
                        [% ELSIF clubs %]
140
                            [% INCLUDE 'clubs-table.inc' destination = "holds" %]
99
                        [% END %]
141
                        [% END %]
100
                    </fieldset> <!-- /#circ_holds_selectborrower -->
142
                    </p>
143
                </fieldset>
144
            [% ELSIF club %]
145
                <div class="dialog alert hide clubalert">
146
                </div>
147
                <fieldset class="rows">
148
                    <legend>Hold details</legend>
149
                    <form action="/api/v1/clubs/[% club.id | html %]/holds" method="post" name="form" id="club-request-form">
101
150
102
                    [% IF ( multi_hold ) %]
151
                        [% IF ( multi_hold ) %]
103
                        <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
152
                            <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
104
                        <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
153
                            <input type="hidden" name="biblionumbers" id="multi_hold_bibs" value="[% biblionumbers | html %]"/>
105
                    [% END %]
154
                            <input type="hidden" name="bad_bibs" id="bad_bibs" value=""/>
106
                </form> <!-- /#holds_patronsearch -->
155
                            <input type="hidden" name="request" value="any"/>
156
                            [% FOREACH biblioloo IN biblioloop %]
157
                                <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
158
                                <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
159
                            [% END %]
160
                        [% ELSE %]
161
                            <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
162
                            <input type="hidden" name="title" value="[% biblio.title | html %]" />
163
                            <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
164
                        [% END # /IF multi_hold %]
165
                        <ol>
166
                            <li>
167
                                <span class="label">Club: </span> [% club.name | html %]
168
                            </li>
169
                            <li>
170
                                <span class="label">Description: </span> [% club.description | html %]
171
                            </li>
172
                            <li>
173
                                <label for="pickup">Pickup at:</label>
174
                                <select name="pickup" size="1" id="pickup">
175
                                    [% PROCESS options_for_libraries libraries => Branches.all({ selected => club.branchcode, search_params => { pickup_location => 1 } }) %]
176
                                </select>
177
                            </li>
178
                        </ol>
179
                        <h2 style="padding: 0 1em;">Members</h2>
180
                        <ol>
181
                            [% FOREACH member IN members %]
182
                                [% SET patron = member.patron %]
183
                                <li style="padding: 0.5em 1em;">
184
                                    <div><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a></div>
185
                                    [% IF member.exceeded_maxreserves %]
186
                                        <div>
187
                                            <i class="fa fa-error"></i>
188
                                            <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
189
                                        </div>
190
                                    [% END %]
191
                                    [% IF ( member.expiry ) %]
192
                                        <div>
193
                                            <i class="fa fa-warning"></i>
194
                                            <strong>Account has expired</strong>
195
                                        </div>
196
                                    [% END %]
197
                                    [% IF patron.is_debarred %]
198
                                        <div>
199
                                            <i class="fa fa-warning"></i>
200
                                            <strong>Patron has restrictions</strong>
201
                                        </div>
202
                                    [% END %]
203
                                    [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
204
                                        <div>
205
                                            <i class="fa fa-warning"></i>
206
                                            <strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
207
                                        </div>
208
                                    [% END %]
107
209
210
                                    [% IF ( member.diffbranch ) %]
211
                                        <div>
212
                                            <i class="fa fa-warning"></i>
213
                                            <strong>Pickup library is different.</strong> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )
214
                                        </div>
215
                                    [% END %]
216
                                </li>
217
                            [% END %]
218
                        </ol>
219
                        [% UNLESS ( multi_hold ) %]
220
                            <fieldset class="action">
221
                                <input type="submit" value="Place hold" />
222
                            </fieldset>
223
                        [% ELSE %]
224
                            <table id="requesttitles">
225
                                <tr>
226
                                    <th>&nbsp;</th>
227
                                    <th>Title</th>
228
                                    [% UNLESS ( item_level_itypes ) %]
229
                                        <th>Item type</th>
230
                                    [% END %]
231
                                    <th>Priority</th>
232
                                    <th>Information</th>
233
                                </tr>
234
                                [% FOREACH biblioloo IN biblioloop %]
235
                                    [% IF ( biblioloo.warn ) %]
236
                                        <tr class="onissue">
237
                                    [% ELSE %]
238
                                        <tr>
239
                                    [% END %]
240
                                        <td>
241
                                            [% UNLESS ( biblioloo.warn ) %]
242
                                                    <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
243
                                                </td>
244
                                            [% END %]
245
                                        <td>
246
                                            <ul>
247
                                                <li>
248
                                                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
249
                                                </li>
250
                                                [% IF ( biblioloo.publicationyear ) %]
251
                                                    <li>
252
                                                        <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
253
                                                    </li>
254
                                                [% END %]
255
                                            </ul>
256
                                            [% IF ( biblioloo.warn ) %]
257
                                                <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
258
                                            [% END %]
259
                                        </td>
260
                                        [% UNLESS ( item_level_itypes ) %]
261
                                            <td>
262
                                                <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" />
263
                                            </td>
264
                                        [% END %]
265
                                        <td>[% biblioloo.rank | html %]</td>
266
                                        <td>
267
                                            [% IF ( biblioloo.checked_previously ) %]
268
                                                <span>Patron has previously checked out this title</span><br/>
269
                                            [% END %]
270
                                            [% IF ( biblioloo.alreadyres ) %]
271
                                                <ul>
272
                                            [% ELSE %]
273
                                                [% IF ( biblioloo.none_avail ) %]
274
                                                    <ul>
275
                                                [% END %]
276
                                            [% END %]
277
278
                                            [% IF ( biblioloo.alreadyres ) %]
279
                                                <li>
280
                                                    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>
281
                                                    <strong>already has a hold</strong> on this item
282
                                                </li>
283
                                            [% END %]
284
                                            [% IF ( biblioloo.none_avail ) %]
285
                                                <li> <strong>No items are available</strong> to be placed on hold</li>
286
                                            [% END %]
287
288
                                            [% IF ( biblioloo.alreadyres ) %]
289
                                                </ul>
290
                                            [% ELSE %]
291
                                                [% IF ( biblioloo.none_avail ) %]
292
                                                    </ul>
293
                                                [% END %]
294
                                            [% END %]
295
                                        </td>
296
                                    </tr>
297
                                [% END # /FOREACH biblioloo %]
298
                            </table> <!-- /#requesttitles -->
299
                        [% END %]
300
                    </form>
301
                </fieldset>
108
            [% ELSIF NOT noitems # /UNLESS patron %]
302
            [% ELSIF NOT noitems # /UNLESS patron %]
109
303
110
                [% IF ( checked_previously && !multi_hold ) %]
304
                [% IF ( checked_previously && !multi_hold ) %]
Lines 183-189 Link Here
183
377
184
                <fieldset class="rows">
378
                <fieldset class="rows">
185
                    <legend>Hold details</legend>
379
                    <legend>Hold details</legend>
186
                    <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
380
                    <form action="/api/v1/holds" method="post" name="form" id="hold-request-form">
187
381
188
                        <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
382
                        <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
189
                        <input type="hidden" name="type" value="str8" />
383
                        <input type="hidden" name="type" value="str8" />
Lines 752-757 Link Here
752
        columns_settings_borrowers_table = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
946
        columns_settings_borrowers_table = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
753
947
754
        $(document).ready(function() {
948
        $(document).ready(function() {
949
            [% UNLESS clubs %]
950
                $('#circ_holds_select').tabs({active: 0});
951
            [% ELSE %]
952
                $('#circ_holds_select').tabs({active: 1});
953
            [% END %]
755
            function ToggleHoldsToPlace() {
954
            function ToggleHoldsToPlace() {
756
                if ( $("#requestany").prop('checked') ) {
955
                if ( $("#requestany").prop('checked') ) {
757
                    $("#holds_to_place_count").prop('disabled', false);
956
                    $("#holds_to_place_count").prop('disabled', false);
Lines 793-798 Link Here
793
                "margin-right":"0em"
992
                "margin-right":"0em"
794
            });
993
            });
795
994
995
            $("#club-request-form").on("submit", function() {
996
                let $t = $(this);
997
                $('.clubalert').addClass('hide');
998
                let options = {
999
                    url: $t.attr('action'),
1000
                    method: $t.attr('method').toUpperCase(),
1001
                    contentType: 'application/json',
1002
                    data: JSON.stringify({
1003
                        biblio_id: biblionumber,
1004
                        pickup_library_id: $('select[name="pickup"]').val()
1005
                    })
1006
                };
1007
                if($('input[name="checkitem"]:checked').length)
1008
                    options.data.item_id = $('input[name="checkitem"]:checked').val();
1009
                $.ajax(options)
1010
                    .then(function(result) {
1011
                        let url = 'request.pl?biblionumber='+biblionumber+($('input[name="multi_hold"]').length && $('input[name="multi_hold"]').val()?'&multi_hold=1':'');
1012
                        document.location = url;
1013
                    })
1014
                    .fail(function(err) {
1015
                        $('.clubalert').removeClass('hide').html(err.responseJSON.error);
1016
                    });
1017
                return false;
1018
            });
1019
796
            [% UNLESS ( multi_hold ) %]
1020
            [% UNLESS ( multi_hold ) %]
797
                $("#hold-request-form").on("submit", function(){
1021
                $("#hold-request-form").on("submit", function(){
798
                    return check();
1022
                    return check();
(-)a/reserve/request.pl (-2 / +72 lines)
Lines 53-58 use Koha::Items; Link Here
53
use Koha::ItemTypes;
53
use Koha::ItemTypes;
54
use Koha::Libraries;
54
use Koha::Libraries;
55
use Koha::Patrons;
55
use Koha::Patrons;
56
use Koha::Clubs;
56
57
57
my $dbh = C4::Context->dbh;
58
my $dbh = C4::Context->dbh;
58
my $input = new CGI;
59
my $input = new CGI;
Lines 75-82 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_l Link Here
75
my $findborrower = $input->param('findborrower');
76
my $findborrower = $input->param('findborrower');
76
$findborrower = '' unless defined $findborrower;
77
$findborrower = '' unless defined $findborrower;
77
$findborrower =~ s|,| |g;
78
$findborrower =~ s|,| |g;
79
my $findclub = $input->param('findclub');
80
$findclub = '' unless defined $findclub && !$findborrower;
78
my $borrowernumber_hold = $input->param('borrowernumber') || '';
81
my $borrowernumber_hold = $input->param('borrowernumber') || '';
82
my $club_hold = $input->param('club')||'';
79
my $messageborrower;
83
my $messageborrower;
84
my $messageclub;
80
my $warnings;
85
my $warnings;
81
my $messages;
86
my $messages;
82
my $exceeded_maxreserves;
87
my $exceeded_maxreserves;
Lines 135-140 if ($findborrower) { Link Here
135
    }
140
    }
136
}
141
}
137
142
143
if($findclub) {
144
    my $club = Koha::Clubs->find( { name => $findclub } );
145
    if( $club ) {
146
        $club_hold = $club->id;
147
    } else {
148
        my @clubs = Koha::Clubs->search( [
149
            { name => { like => '%'.$findclub.'%' } },
150
            { description => { like => '%'.$findclub.'%' } }
151
        ] );
152
        if( scalar @clubs == 1 ) {
153
            $club_hold = $clubs[0]->id;
154
        } elsif ( @clubs ) {
155
            $template->param( clubs => \@clubs );
156
        } else {
157
            $messageclub = "'$findclub'";
158
        }
159
    }
160
}
161
138
my @biblionumbers = ();
162
my @biblionumbers = ();
139
my $biblionumber = $input->param('biblionumber');
163
my $biblionumber = $input->param('biblionumber');
140
my $biblionumbers = $input->param('biblionumbers');
164
my $biblionumbers = $input->param('biblionumbers');
Lines 203-209 if ($borrowernumber_hold && !$action) { Link Here
203
    );
227
    );
204
}
228
}
205
229
206
$template->param( messageborrower => $messageborrower );
230
if ($club_hold && !$borrowernumber_hold && !$action) {
231
    my $club = Koha::Clubs->find($club_hold);
232
233
    my $enrollments = $club->club_enrollments;
234
235
    my $maxreserves = C4::Context->preference('maxreserves');
236
    my $new_reserves_count = scalar( @biblionumbers );
237
238
    my @members;
239
240
    while(my $enrollment = $enrollments->next) {
241
        next if $enrollment->is_canceled;
242
        my $member = { patron => $enrollment->patron->unblessed };
243
        my $reserves_count = $enrollment->patron->holds->count;
244
        if ( $maxreserves
245
            && ( $reserves_count + $new_reserves_count > $maxreserves ) )
246
        {
247
            $member->{new_reserves_allowed} = $maxreserves - $reserves_count > 0
248
                ? $maxreserves - $reserves_count
249
                : 0;
250
            $member->{exceeded_maxreserves} = 1;
251
        }
252
        my $expiry_date = $enrollment->patron->dateexpiry;
253
        $member->{expiry} = 0; # flag set if patron account has expired
254
        if ($expiry_date and $expiry_date ne '0000-00-00' and
255
            Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
256
            $member->{expiry} = 1;
257
        }
258
        $member->{amount_outstanding} = $enrollment->patron->account->balance;
259
        if ( $enrollment->patron->branchcode ne C4::Context->userenv->{'branch'} ) {
260
            $member->{diffbranch} = 1;
261
        }
262
263
        push @members, $member;
264
    }
265
266
    $template->param(
267
        club                => $club,
268
        members             => \@members,
269
        maxreserves         => $maxreserves,
270
        new_reserves_count  => $new_reserves_count
271
    );
272
}
273
274
$template->param(
275
    messageborrower => $messageborrower,
276
    messageclub     => $messageclub
277
);
207
278
208
# FIXME launch another time GetMember perhaps until (Joubu: Why?)
279
# FIXME launch another time GetMember perhaps until (Joubu: Why?)
209
my $patron = Koha::Patrons->find( $borrowernumber_hold );
280
my $patron = Koha::Patrons->find( $borrowernumber_hold );
210
- 

Return to bug 19618