Bug 14237: (follow-up) Make the routines exclusively take itemnumber, biblionumber...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / course_reserves / batch_add_items.tt
1 [% USE AuthorisedValues %]
2 [% USE Branches %]
3 [% USE ItemTypes %]
4
5 [% SET footerjs = 1 %]
6
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Add items &rsaquo; Course reserves &rsaquo; Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 </head>
11 <body id="courses_add_items_step1" class="course">
12
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
15
16 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
17     <ol>
18         <li>
19             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
20         </li>
21         <li>
22             <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a>
23         </li>
24         <li>
25             <a href="#" aria-current="page">
26                 Add reserves for <em>[% course.course_name | html %]</em>
27             </a>
28         </li>
29     </ol>
30 </nav>
31
32 <div class="main container-fluid">
33     <div class="row">
34         <div class="col-md-8 col-md-offset-2">
35         [% IF action == 'invalid_course' %]
36             <div id="invalid-course-error" class="dialog alert">Invalid course!</div>
37         [% END %]
38
39         [% IF action == 'display_form' %]
40             <form method="post" action="/cgi-bin/koha/course_reserves/batch_add_items.pl">
41                 <input type="hidden" name="course_id" value="[% course.course_id | html %]" />
42                 <input type="hidden" name="action" value="add" />
43
44                 <fieldset class="rows">
45                     <legend>Add items: scan barcodes</legend>
46                     <ol>
47                         <li>
48                             <label class="required" for="barcodes">Item barcodes:</label>
49                             <textarea rows="20" cols="50" id="barcodes" name="barcodes" class="focus"></textarea>
50                         </li>
51                         [% IF item_level_itypes %]
52                         <li>
53                             <label class="required" for="itype">Item type:</label>
54                             <input type="checkbox" class="field-toggle" data-pulldown="itype" value="1" name="itype_enabled" id="itype_enabled" />
55                             <select id="itype" name="itype" disabled="disabled">
56                                 <option value=""></option>
57
58                                 [% FOREACH it IN ItemTypes.Get() %]
59                                     <option value="[% it.itemtype | html %]">[% it.description | html %]</option>
60                                 [% END %]
61                             </select>
62                         </li>
63                         [% END %]
64
65                         <li>
66                             <label class="required" for="ccode">Collection:</label>
67                             <input type="checkbox" class="field-toggle" data-pulldown="ccode" value="1" name="ccode_enabled" id="ccode_enabled" />
68                             <select id="ccode" name="ccode" disabled="disabled">
69                                 <option value=""></option>
70                                 [% FOREACH c IN AuthorisedValues.Get('CCODE') %]
71                                     <option value="[% c.authorised_value | html %]">[% c.lib | html %]</option>
72                                 [% END %]
73                             </select>
74                         </li>
75
76                         <li>
77                             <label class="required" for="location">Shelving location:</label>
78                             <input type="checkbox" class="field-toggle" data-pulldown="location"  value="1" name="location_enabled" id="location_enabled" />
79                             <select id="location" name="location" disabled="disabled">
80                                 <option value=""></option>
81                                 [% FOREACH s IN AuthorisedValues.Get('LOC') %]
82                                     <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
83                                 [% END %]
84                             </select>
85                         </li>
86
87                         <li>
88                             <label class="required" for="homebranch">Home library:</label>
89                             <input type="checkbox" value="1" class="field-toggle" data-pulldown="homebranch" name="homebranch_enabled" id="homebranch_enabled" />
90                             <select id="homebranch" name="homebranch" disabled="disabled">
91                                 <option value=""></option>
92                                 [% FOREACH b IN Branches.all() %]
93                                     <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
94                                 [% END %]
95                             </select>
96                         </li>
97
98                         <li>
99                             <label class="required" for="holdingbranch">Holding library:</label>
100                             <input type="checkbox" value="1" class="field-toggle" data-pulldown="holdingbranch" name="holdingbranch_enabled" id="holdingbranch_enabled" />
101                             <select id="holdingbranch" name="holdingbranch" disabled="disabled">
102                                 <option value=""></option>
103                                 [% FOREACH b IN Branches.all() %]
104                                     <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
105                                 [% END %]
106                             </select>
107                         </li>
108
109                         <li>
110                             <label for="item_staff_note">Staff note:</label>
111                             <textarea name="item_staff_note" id="item_staff_note">[% course_reserve.staff_note | html %]</textarea>
112                         </li>
113
114                         <li>
115                             <label for="item_public_note">Public note:</label>
116                             <textarea name="item_public_note" id="item_public_note">[% course_reserve.public_note | html %]</textarea>
117                         </li>
118                     </ol>
119                 </fieldset>
120
121                 <p>
122                     Checking the box next to the field label will enable changes to that field. Leave boxes unchecked to make no change.<br>
123                     Any items with existing course reserves will have their <em>on reserve</em> values updated.
124                 </p>
125
126                 <fieldset class="rows">
127                     <legend>Or use biblionumbers of bibliographic records</legend>
128                     <ol>
129                         <li>
130                             <label class="required" for="biblionumbers">Biblionumbers:</label>
131                             <textarea rows="20" cols="50" id="biblionumbers" name="biblionumbers"></textarea>
132                         </li>
133
134                         <li>
135                             <label for="biblio_staff_note">Staff note:</label>
136                             <textarea name="biblio_staff_note" id="biblio_staff_note">[% course_reserve.staff_note | html %]</textarea>
137                         </li>
138
139                         <li>
140                             <label for="biblio_public_note">Public note:</label>
141                             <textarea name="biblio_public_note" id="biblio_public_note">[% course_reserve.public_note | html %]</textarea>
142                         </li>
143                     </ol>
144                 </fieldset>
145
146                 <fieldset class="action">
147                     <input type="submit" value="Submit" class="submit" />
148
149                     <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id | uri %]" class="cancel">Cancel</a>
150                 </fieldset>
151             </form>
152         [% END %]
153
154         [% IF action == 'display_results' %]
155             <h1>Results</h1>
156
157             [% IF barcodes %]
158                 <h3>Items added</h3>
159                 [% IF items_added.size > 0 %]
160                     <p>The following items were added or updated:</p>
161                     <ul>
162                         [% FOREACH i IN items_added %]
163                             <li>[% i.biblio.title | html %] ( [% i.barcode | html %] )</li>
164                         [% END %]
165                     </ul>
166                 [% ELSE %]
167                     No valid item barcodes found.
168                 [% END %]
169
170
171                 [% IF invalid_barcodes.size > 0 %]
172                     <h3>Invalid barcodes</h3>
173                     <p>The following invalid barcodes were skipped:</p>
174                     <ul>
175                         [% FOREACH b IN invalid_barcodes %]
176                             <li>[% b | html %]</li>
177                         [% END %]
178                     </ul>
179                 [% END %]
180             [% ELSIF biblionumbers %]
181                 <h3>Bibliographic records added</h3>
182                 [% IF biblios_added.size > 0 %]
183                     <p>The following bibliographic records were added or updated:</p>
184                     <ul>
185                         [% FOREACH b IN biblios_added %]
186                             <li>[% b.title | html %] ( [% b.biblionumber | html %] )</li>
187                         [% END %]
188                     </ul>
189                 [% ELSE %]
190                     No valid biblionumbers found.
191                 [% END %]
192
193
194                 [% IF invalid_biblionumbers.size > 0 %]
195                     <h3>Invalid biblionumbers</h3>
196                     <p>The following invalid biblionumbers were skipped:</p>
197                     <ul>
198                         [% FOREACH b IN invalid_biblionumbers %]
199                             <li>[% b | html %]</li>
200                         [% END %]
201                     </ul>
202                 [% END %]
203             [% END %]
204
205             <p>
206                 <a class='btn btn-default' href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course_id | html %]">View course</a>
207             </p>
208         [% END %]
209     </div>
210 </div>
211
212 [% MACRO jsinclude BLOCK %]
213     <script>
214     //<![CDATA[
215         $(document).ready(function(){
216             $('.field-toggle').change(function() {
217                 if( this.checked ) {
218                     $('#' + $(this).data('pulldown') ).removeAttr('disabled');
219                 } else {
220                     $('#' + $(this).data('pulldown') ).val('');
221                     $('#' + $(this).data('pulldown') ).attr('disabled', 'disabled');
222                 }
223             });
224             $("input[type='submit']").click(function(e){
225                 if ( $("#biblionumbers").val().length > 0 && $("#barcodes").val().length > 0 ) {
226                     e.preventDefault();
227                     alert(__("Please enter only barcodes, or only biblionumbers."));
228                 }
229             });
230         });
231     //]]>
232     </script>
233 [% END %]
234
235 [% INCLUDE 'intranet-bottom.inc' %]