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

(-)a/circ/batch_holding.pl (-3 / +3 lines)
Lines 28-38 use List::MoreUtils qw/uniq/; Link Here
28
28
29
29
30
my $input = new CGI;
30
my $input = new CGI;
31
my $op           = $input->param('op');
31
my $op = $input->param('op') // '';
32
my @itemnumbers;
32
my @itemnumbers;
33
33
34
my @errors;
35
36
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
34
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
    {
35
    {
38
        template_name   => "circ/batch_holding.tt",
36
        template_name   => "circ/batch_holding.tt",
Lines 104-109 if ($op eq "show"){ Link Here
104
        borrowernumber => $borrowernumber,
102
        borrowernumber => $borrowernumber,
105
        branch => $branch,
103
        branch => $branch,
106
        action => $action,
104
        action => $action,
105
        op => $op
107
    );
106
    );
108
}
107
}
109
108
Lines 146-151 elsif ($op eq "result") { Link Here
146
        holdloop => \@holdloop,
145
        holdloop => \@holdloop,
147
        cancel => $action eq "cancel" ? 1 : 0,
146
        cancel => $action eq "cancel" ? 1 : 0,
148
        place => $action eq "place" ? 1 : 0,
147
        place => $action eq "place" ? 1 : 0,
148
        op => $op
149
    );
149
    );
150
150
151
}
151
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/batch_holding.tt (-151 / +257 lines)
Lines 1-165 Link Here
1
[% USE Koha %]
1
[% USE Branches %]
2
[% USE Branches %]
3
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Circulation &rsaquo; Batch holding</title>
5
<title>
6
    Koha &rsaquo;
7
    Circulation &rsaquo;
8
    [% IF ( op == "show" ) %]
9
        Batch place or cancel holds &rsaquo;
10
        Confirm selection
11
    [% ELSIF ( op == "result") %]
12
        Batch place or cancel holds &rsaquo;
13
        Results
14
    [% ELSE %]
15
        Batch place or cancel holds
16
    [% END %]
17
</title>
4
[% INCLUDE 'doc-head-close.inc' %]
18
[% INCLUDE 'doc-head-close.inc' %]
5
<script>
6
        // <![CDATA[
7
        $(document).ready(function() {
8
          $("#batchholdform").submit(function() {
9
            if (!$("#borrowernumber").val()) {
10
                alert(_("Please select a valid borrower."));
11
                return false;
12
            }
13
          });
14
          $("#findborrowerhold").autocomplete({
15
            source: "/cgi-bin/koha/circ/ysearch.pl",
16
            minLength: 3,
17
            select: function( event, ui ) {
18
                $( "#findborrowerhold" ).val( ui.item.surname + ', ' + ui.item.firstname + ' (' + ui.item.cardnumber + ')' );
19
                $( "#borrowernumber").val( ui.item.borrowernumber );
20
                return false;
21
           }
22
          })
23
          .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
24
            return $( "<li></li>" )
25
            .data( "ui-autocomplete-item", item )
26
            .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
27
            .appendTo( ul );
28
          };
29
        });
30
      // ]]>
31
</script>
32
</head>
19
</head>
33
<body id="batch_holding">
20
<body id="batch_holding">
34
21
35
[% INCLUDE 'header.inc' %]
22
[% INCLUDE 'header.inc' %]
36
[% INCLUDE 'cataloging-search.inc' %]
23
[% INCLUDE 'cataloging-search.inc' %]
37
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Batch holding</div>
24
<div id="breadcrumbs">
38
25
    <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
39
<div id="doc" class="yui-t7">
26
    <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo;
40
27
    [% IF ( op == "show" ) %]
41
<div id="bd">
28
        <a href="/cgi-bin/koha/circ/batch_holding.pl">Batch place or cancel holds</a> &rsaquo;
42
        <div id="yui-main">
29
        Confirm selection
43
[% IF show %]
30
    [% ELSIF ( op == "result") %]
44
    [% IF ( notfoundbarcodes ) %]
31
        <a href="/cgi-bin/koha/circ/batch_holding.pl">Batch place or cancel holds</a> &rsaquo;
45
      <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div>
32
        Results
46
      <table style="margin:auto;">
33
    [% ELSE %]
47
    <thead>
34
        Batch place or cancel holds
48
        <tr><th>Barcodes not found</th></tr>
49
    </thead>
50
    <tbody>
51
        [% FOREACH notfoundbarcode IN notfoundbarcodes %]
52
      <tr><td>[% notfoundbarcode.barcode %]</td></td>
53
        [% END %]
54
    </tbody>
55
      </table>
56
  [% END %] <!-- /notfoundbarcodes -->
57
58
  [% IF (holdloop) %]
59
    <h1>[% action %] holds on the following barcodes</h1>
60
    <form action="batch_holding.pl" method="POST">
61
    <ul>
62
    [% FOREACH hold IN holdloop %]
63
        <li>
64
        [% IF hold.holdable %]
65
        <input type="checkbox" name="holdable" checked="checked" value="[% hold.itemnumber %]" />
66
        [% hold.barcode %]
67
        [% ELSE %]
68
        [% hold.barcode %] (This item cannot be reserved)
69
        [% END %]
70
        </li>
71
    [% END %]
35
    [% END %]
72
    </ul>
36
</div>
73
    <input type="hidden" name="op" value="result" />
37
74
    <input type="hidden" name="action" value="[% action %]" />
38
<div class="main container-fluid">
75
    <input type="hidden" name="branch" value="[% branch %]" />
39
    <div class="row">
76
    <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
40
        [% IF Koha.Preference('CircSidebar') %]
77
        <input type="submit" />
41
            <div class="col-sm-10 col-sm-push-2">
78
    </form>
42
        [% ELSE %]
79
  [% ELSE %]
43
            <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
80
    <p>No reservation can be placed or cancelled.</p>
81
    <a href="batch_holding.pl">Batch place or cancel other items</a>
82
  [% END %]
83
84
[% ELSIF result %]
85
  [% IF (holdloop) %]
86
    <h1>Results</h1>
87
    <ul>
88
    [% IF place %]
89
        The following items have been reserved:
90
        <ul>
91
        [% FOREACH hold IN holdloop %]
92
            <li>itemnumber [% hold.itemnumber %], reserve_id [% hold.reserve_id %]</li>
93
        [% END %]
44
        [% END %]
94
        </ul>
45
            <main>
95
    [% END %]
46
96
    [% IF cancel %]
47
                [% IF show %]
97
        The following reservations were cancelled:
48
                    [% IF ( notfoundbarcodes ) %]
98
        <ul>
49
                        <div class="dialog alert"><p>Warning, the following barcodes were not found:</p></div>
99
        [% FOREACH hold IN holdloop %]
50
100
            <li>itemnumber [% hold.itemnumber %]</li>
51
                        <table>
52
                            <thead>
53
                                <tr><th>Barcodes not found</th></tr>
54
                            </thead>
55
                            <tbody>
56
                                [% FOREACH notfoundbarcode IN notfoundbarcodes %]
57
                                    <tr><td>[% notfoundbarcode.barcode | html %]</td></td>
58
                                [% END %]
59
                            </tbody>
60
                        </table>
61
                    [% END #/IF notfoundbarcodes %]
62
63
                    [% IF (holdloop) %]
64
                        [% IF ( action == "place" ) %]
65
                            <h1>Place holds on the following barcodes</h1>
66
                        [% ELSE %]
67
                            <h1>Cancel holds on the following barcodes</h1>
68
                        [% END %]
69
70
                        <div id="toolbar">
71
                            <a id="SelectAll" href="#"><i class="fa fa-check"></i> Select all</a> |
72
                            <a id="ClearAll" href="#"><i class="fa fa-remove"></i> Clear all</a>
73
                        </div>
74
75
                        <form action="batch_holding.pl" id="hold_selections" method="POST">
76
                            <table>
77
                                <tbody>
78
                                [% FOREACH hold IN holdloop %]
79
                                    <tr>
80
                                        <td>
81
                                            [% IF hold.holdable %]
82
                                                <label>
83
                                                    <input type="checkbox" name="holdable" checked="checked" value="[% hold.itemnumber | html %]" />
84
                                                    [% hold.barcode | html %]
85
                                                </label>
86
                                            [% ELSE %]
87
                                                <i class="fa fa-warning"></i>
88
                                                [% hold.barcode | html %] (This item cannot be placed on hold)
89
                                            [% END %]
90
                                        </td>
91
                                    </tr>
92
                                [% END %]
93
                                </tbody>
94
                            </table>
95
                            <input type="hidden" name="op" value="result" />
96
                            <input type="hidden" name="action" value="[% action | html %]" />
97
                            <input type="hidden" name="branch" value="[% branch | html %]" />
98
                            <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
99
                            <fieldset class="action">
100
                                <input type="submit" class="submit" value="Submit" />
101
                                <a href="/cgi-bin/koha/circ/circulation-home.pl" class="cancel">Cancel</a>
102
                            </fieldset>
103
                        </form>
104
                    [% ELSE %]
105
                        <p>No holds can be placed or cancelled.</p>
106
                        <a href="batch_holding.pl">Batch place or cancel other holds</a>
107
                    [% END # /IF holdloop %]
108
109
                [% ELSIF result %]
110
111
                    [% IF (holdloop) %]
112
                        <h1>Results</h1>
113
                        [% IF place %]
114
                            The following items have been placed on hold:
115
                            <ul>
116
                                [% FOREACH hold IN holdloop %]
117
                                    <li>itemnumber [% hold.itemnumber | html %], reserve_id [% hold.reserve_id | html %]</li>
118
                                [% END %]
119
                            </ul>
120
                        [% END %]
121
                        [% IF cancel %]
122
                            The following holds were cancelled:
123
                            <ul>
124
                                [% FOREACH hold IN holdloop %]
125
                                    <li>itemnumber [% hold.itemnumber | html %]</li>
126
                                [% END %]
127
                            </ul>
128
                        [% END %]
129
                    [% ELSE %]
130
                        <p>No holds could be placed or cancelled.</p>
131
                    [% END %]
132
                    <a href="batch_holding.pl">Batch place or cancel other holds</a>
133
134
                [% ELSE %]
135
136
                    <h1>Batch place or cancel holds</h1>
137
                    <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/batch_holding.pl" id="batchholdform">
138
                        <fieldset class="rows">
139
                            <legend>Use a barcode file</legend>
140
                            <label for="uploadfile">File: </label>
141
                            <input type="file" id="uploadfile" name="uploadfile" />
142
                        </fieldset>
143
144
                        <fieldset class="rows">
145
                            <legend>Or scan items one by one</legend>
146
                            <ol>
147
                                <li>
148
                                    <label for="barcodelist">Barcode list (one barcode per line): </label>
149
                                    <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
150
                                </li>
151
                            </ol>
152
                        </fieldset>
153
154
                        <fieldset class="rows">
155
                            <legend>Place hold for</legend>
156
                            <ol>
157
                                <li>
158
                                    <label class="required" for="findborrowerhold">Patron:</label>
159
                                    <input type="hidden" id="borrowernumber" name="borrowernumber" />
160
                                    <div class="autocomplete">
161
                                        <input autocomplete="on" id="findborrowerhold" name="findborrowerhold" size="40" class="required" type="text" required="required" />
162
                                        <span class="required">Required</span>
163
                                    </div>
164
                                    <div class="hint">
165
                                        Enter patron card number or partial name
166
                                    </div>
167
                                </li>
168
                                <li>
169
                                    <label for="branch">Pickup at:</label>
170
                                    <select name="branch" id="branch">
171
                                        [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
172
                                    </select>
173
                                </li>
174
                            </ol>
175
                        </fieldset>
176
177
                        <fieldset class="rows">
178
                            <legend>Action</legend>
179
                            <ol>
180
                                <li>
181
                                    <input type="radio" name="action" id="action_place_holds" value="place" checked="checked">
182
                                    <label for="action_place_holds">Place holds</label>
183
                                </li>
184
                                <li>
185
                                    <input type="radio" name="action" id="action_cancel_holds" value="cancel">
186
                                    <label for="action_cancel_holds">Cancel holds</label>
187
                                </li>
188
                            </ol>
189
                        </fieldset>
190
191
                        <fieldset class="action">
192
                            <input type="hidden" name="op" value="show" />
193
                            <input type="submit" value="Continue" class="submit" />
194
                        </fieldset>
195
                    </form> <!-- /#batchholdform -->
196
                [% END # /IF show %]
197
198
            </main>
199
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
200
        [% IF Koha.Preference('CircSidebar') %]
201
            <div class="col-sm-2 col-sm-pull-10">
202
                <aside>
203
                    [% INCLUDE 'circ-nav.inc' %]
204
                </aside>
205
            </div> <!-- /.col-sm-2.col-sm-pull-10 -->
101
        [% END %]
206
        [% END %]
102
        </ul>
207
    </div> <!-- /.row -->
103
    [% END %]
208
104
    </ul>
209
[% MACRO jsinclude BLOCK %]
105
  [% ELSE %]
210
    <script>
106
    <p>No reservation could be placed or cancelled.</p>
211
        $(document).ready(function() {
107
  [% END %]
212
            if( $("#findborrowerhold").length > 0 ){
108
  <a href="batch_holding.pl">Batch place or cancel other items</a>
213
                $("#findborrowerhold").autocomplete({
109
[% ELSE %]
214
                    source: "/cgi-bin/koha/circ/ysearch.pl",
110
            <h1>Batch holding</h1>
215
                    minLength: 3,
111
            <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/batch_holding.pl" id="batchholdform">
216
                    select: function( event, ui ) {
112
                <fieldset class="rows">
217
                        $( "#findborrowerhold" ).val( ui.item.surname + ', ' + ui.item.firstname + ' (' + ui.item.cardnumber + ')' );
113
                    <legend>Use a barcode file</legend>
218
                        $( "#borrowernumber").val( ui.item.borrowernumber );
114
                        <label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
219
                        return false;
115
                </fieldset>
220
                    }
116
                <fieldset class="rows">
221
                })
117
                    <legend>Or scan items one by one</legend>
222
                    .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
118
                    <ol>
223
                        return $( "<li></li>" )
119
                        <li>
224
                        .data( "ui-autocomplete-item", item )
120
                          <label for="barcodelist">Barcode list (one barcode per line): </label>
225
                    .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
121
                          <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
226
                    .appendTo( ul );
122
                        </li>
227
                };
123
                    </ol>
228
            }
124
                </fieldset>
229
125
                <fieldset class="rows">
230
            $("#batchholdform").validate({
126
                    <legend>Holding informations</legend>
231
                rules: {
127
                    <ol>
232
                    uploadfile: {
128
                        <li>
233
                        required: function(element){
129
                            <label for="findborrowerhold">Borrower:</label>
234
                            return $("#barcodelist").val() === "";
130
                            <input type="hidden" id="borrowernumber" name="borrowernumber" />
235
                        }
131
                            <div class="autocomplete">
236
                    },
132
                                <input autocomplete="on" id="findborrowerhold" name="findborrowerhold" size="40" class="focus" type="text" />
237
                    barcodelist: {
133
                            </div>
238
                        required: function(element){
134
                        </li>
239
                            return $("#uploadfile").val() === "";
135
                        <li>
240
                        }
136
                        <label for="branch">Holding branch:</label>
241
                    },
137
                        <select name="branch" id="branch" style="width:10em;">
242
                },
138
                            [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
243
                messages: {
139
                        </select>
244
                    uploadfile: {
140
245
                        required: _("Submit barcodes in a file or by entering them below")
141
                        </li>
246
                    },
142
                    </ol>
247
                    barcodelist: {
143
                </fieldset>
248
                        required: _("Submit barcodes by entering them here or by submitting a file above")
144
                <fieldset class="rows">
249
                    }
145
                    <legend>Action</legend>
250
                },
146
                    <ol>
251
                findborrowerhold: {
147
                        <li>
252
                    required: true
148
                            <input type="radio" name="action" id="action_place_holds" value="place" checked="checked">
253
                }
149
                            <label for="action_place_holds">Place holds</label>
254
150
                        </li>
255
            });
151
                        <li>
256
152
                            <input type="radio" name="action" id="action_cancel_holds" value="cancel">
257
            $("#SelectAll").on("click",function(e){
153
                            <label for="action_cancel_holds">Cancel holds</label>
258
                e.preventDefault();
154
                        </li>
259
                $("#hold_selections input[type='checkbox']").prop('checked', true);
155
                    </ol>
260
            });
156
                </fieldset>
261
157
                <input type="hidden" name="op" value="show" />
262
            $("#ClearAll").on("click",function(e){
158
                <input type="submit" value="Continue" class="button" />
263
                e.preventDefault();
159
            </form>
264
                $("#hold_selections input[type='checkbox']").prop('checked', false);
265
            });
266
267
        });
268
    </script>
160
[% END %]
269
[% END %]
161
</div>
162
</div>
163
</div>
164
270
165
[% INCLUDE 'intranet-bottom.inc' %]
271
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt (-3 / +3 lines)
Lines 9-15 Link Here
9
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'circ-search.inc' %]
10
[% INCLUDE 'circ-search.inc' %]
11
11
12
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Circulation</div>
12
<div id="breadcrumbs">
13
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Circulation</div>
13
14
14
    <div class="main container-fluid">
15
    <div class="main container-fluid">
15
16
Lines 70-76 Link Here
70
                        <a class="circ-button" href="/cgi-bin/koha/circ/reserveratios.pl"><i class="fa fa-line-chart"></i> Hold ratios</a>
71
                        <a class="circ-button" href="/cgi-bin/koha/circ/reserveratios.pl"><i class="fa fa-line-chart"></i> Hold ratios</a>
71
                    </li>
72
                    </li>
72
                    <li>
73
                    <li>
73
                        <a class="circ-button" href="/cgi-bin/koha/circ/batch_holding.pl"><i class="fa fa-tasks"></i> Batch holding</a>
74
                        <a class="circ-button" href="/cgi-bin/koha/circ/batch_holding.pl"><i class="fa fa-bookmark"></i> Batch place or cancel holds</a>
74
                    </li>
75
                    </li>
75
                </ul>
76
                </ul>
76
            </div>
77
            </div>
77
- 

Return to bug 23258