Bug 7180: Order from staged file improvements
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Acquisitions &rsaquo; Order staged MARC records
4 [% IF ( batch_details ) %]
5  &rsaquo; Batch [% import_batch_id %]
6 [% ELSE %]
7  &rsaquo; Batch list
8 [% END %]
9 </title>
10 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% INCLUDE 'datatables.inc' %]
13 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
14 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
15 <script type="text/JavaScript">
16 //<![CDATA[
17     $(document).ready(function() {
18         $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
19             "aoColumnDefs": [
20                 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
21                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
22                 { "sType": "title-string", "aTargets" : [ "title-string" ] }
23             ],
24             "sPaginationType": "four_button",
25             "aaSorting": []
26         } ) );
27
28         $("select[name='budget_id']").change(function(){
29             var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
30             var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
31             var destination_sort1 = $(this).siblings('span.sort1').find('input[name="sort1"]');
32             var sort1 = $(destination_sort1).val();
33             if ( destination_sort1.length < 1 ) {
34                 destination_sort1 = $(this).siblings('span.sort1').find('select[name="sort1"]');
35             }
36             var destination_sort2 = $(this).siblings('span.sort2').find('input[name="sort2"]');
37             var sort2 = $(destination_sort2).val();
38             if ( destination_sort2.length < 1 ) {
39                 destination_sort2 = $(this).siblings('span.sort2').find('select[name="sort2"]');
40             }
41             getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
42
43             getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
44         } );
45
46         $("select[name='budget_id']").change();
47
48         $("select[name='all_budget_id']").change(function(){
49             var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
50             var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
51             var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
52             if ( destination_sort1.length < 1 ) {
53                 destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
54             }
55             var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
56             if ( destination_sort2.length < 1 ) {
57                 destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
58             }
59             getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
60             getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
61             $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
62             $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
63             $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
64             $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
65         } );
66
67         $('input:checkbox[name="import_record_id"]').change(function(){
68             if ( $(this).is(':checked') ) {
69                 $(this).parent().addClass("selected");
70                 $(this).parent().removeClass("unselected");
71             } else {
72                 $(this).parent().addClass("unselected");
73                 $(this).parent().removeClass("selected");
74             }
75         } );
76
77         $("input:checkbox").attr("checked", false);
78         $("div.biblio.unselected select").attr("disabled", false);
79         $("div.biblio.unselected input").attr("disabled", false);
80
81         $("#checkAll").click(function(){
82             $("#Aform").checkCheckboxes();
83             $("input:checkbox[name='import_record_id']").change();
84             return false;
85         });
86         $("#unCheckAll").click(function(){
87             $("#Aform").unCheckCheckboxes();
88             $("input:checkbox[name='import_record_id']").change();
89             return false;
90         });
91
92     });
93
94     function disableUnchecked(form){
95         $("div.biblio.unselected").each(function(){
96             $(this).find('select').attr('disabled', 'disabled');
97             $(this).find('input').attr('disabled', 'disabled');
98         });
99         form.submit();
100     }
101 //]]>
102 </script>
103 </head>
104 <body id="acq_addorderiso2709" class="acq">
105 [% INCLUDE 'header.inc' %]
106 [% INCLUDE 'acquisitions-search.inc' %]
107 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketno %]</a> &rsaquo;  Add orders from iso2709 file</div>
108 <div id="doc3" class="yui-t2">
109    <div id="bd">
110        <div id="yui-main">
111            <div class="yui-b">
112              [% IF ( batch_details ) %]
113                 <h1>Add orders from [% comments %]
114                     ([% file_name %] staged on [% upload_timestamp | $KohaDates with_hours => 1 %])
115                 </h1>
116                 <div>
117                     <span class="checkall"><a id="checkAll" href="#">Check All</a></span>
118                     <span class="uncheckall"><a id="unCheckAll" href="#">Uncheck All</a></span>
119                     <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform" onsubmit="disableUnchecked(this); return false;">
120                         <input type="hidden" name="op" value="import_records"/>
121                         <input type="hidden" name="basketno" value="[% basketno %]" />
122                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
123                         <input type="hidden" name="import_batch_id" value="[%import_batch_id %]" />
124                         <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
125
126                         [% FOREACH cur IN loop_currencies %]
127                             <input type="hidden" name="[% cur.currency %]" value="[% cur.rate %]" />
128                         [% END %]
129
130                         [% FOREACH biblio IN biblio_list %]
131                         <div class="biblio unselected" style="border-radius: 5px 5px; -moz-border-radius: 5px; padding: 5px; margin:5px; border-style : solid; border-color : grey; border-width:1px;">
132                             <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id %]" value="[% biblio.import_record_id %]" />
133                             <input type="hidden" value="[% biblio.rrp %]" name="rrp" />
134                             <label for="record_[% biblio.import_record_id %]"><span class="citation" style="font-weight:bold;">[% biblio.citation %]</span></label>
135                             <span class="match" style="display:block;">
136                                 [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
137                                     No match
138                                 [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
139                                     Match applied
140                                 [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
141                                     Match found
142                                 [% ELSE %]
143                                     [% biblio_lis.overlay_status %]
144                                 [% END %]
145                             </span>
146                             [% IF ( biblio.match_biblionumber ) %]
147                                 Matches biblio [% biblio.match_biblionumber %] (score = [% biblio.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber %]">[% biblio.match_citation %]</a>
148                             [% END %]
149                             <span class="quantity" style="display:block;">
150                                 Quantity: <input type="text" value="[% biblio.quantity %]" name="quantity" />
151                             </span>
152                             <span class="price" style="display:block;">
153                                 Price: <input type="text" value="[% biblio.price %]" name="price" />
154                             </span>
155                             <span class="discount" style="display:block;">
156                                 Discount: <input type="text" value="[% biblio.discount %]" name="discount" />
157                             </span>
158                             <span class="budget" style="display:block;">
159                                 [% IF ( close ) %]
160                                 <span class="label">Budget: </span>
161                                     <input type="hidden" size="20" name="budget_id" value="[% budget_id %]" />[% Budget_name %]
162                                 [% ELSE %]
163                                 <label for="budget_id">Budget: </label>
164                                 <select size="1" name="budget_id">
165                                     <option value=""></option>
166                                     [% FOREACH budget IN budget_loop %]
167                                         [% IF ( budget.b_id == biblio.budget_id ) %]
168                                             <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]" selected="selected">[% budget.b_txt %]</option>
169                                         [% ELSE %]
170                                             <option value="[% budget.b_id %]" data-sort1-authcat="[% budget.b_sort1_authcat %]" data-sort2-authcat="[% budget.b_sort2_authcat %]">[% budget.b_txt %]</option>
171                                         [% END %]
172                                     [% END %]
173                                 </select>
174                                 [% END %]
175                                 <span class="sort1">
176                                     <label for="sort1">Planning value1: </label>
177                                     <input type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 %]" />
178                                 </span>
179                                 <span class="sort2">
180                                     <label for="sort2">Planning value2: </label>
181                                     <input type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" />
182                                 </span>
183                             </span>
184                         </div>
185                         [% END %]
186                         <div>
187                         <h2>Import all</h2>
188                         <p>Import all the lines in the basket with the following parameters:</p>
189
190                         [% IF ( items ) %]
191                         <fieldset class="rows">
192                             <legend>Item</legend>
193                             [% IF ( NoACQframework ) %]
194                                 <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
195                             [% END %]
196                             [% FOREACH item IN items %]
197                             <div id="outeritemblock">
198                             <div id="itemblock">
199                                 <ol>
200                                 [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
201                                     <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
202                                         [% IF (iteminformatio.mandatory) %]
203                                             <label class="required">[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
204                                         [% ELSE %]
205                                             <label>[% iteminformatio.subfield %] - [% iteminformatio.marc_lib %]</label>
206                                         [% END %]
207
208                                         [% iteminformatio.marc_value %]
209                                         <input type="hidden" name="itemid" value="1" />
210                                         <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
211                                         <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
212                                         <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
213                                         <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
214                                         [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
215                                     </div></li>
216                                 [% END %]
217                                 </ol>
218                             </div><!-- /iteminformation -->
219                             </div>
220                             [% END %] <!-- /items -->
221                         </fieldset>
222                         [% END %] <!-- items -->
223
224                         <fieldset class="rows">
225                             <legend>Accounting details</legend>
226                             <ol>
227                                 <li>
228                                     <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
229                                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
230                                 </li>
231                                 <li>
232                                     [% IF ( close ) %]
233                                         <span class="label">Budget: </span>
234                                         <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
235                                     [% ELSE %]
236                                         <li>
237                                             <label for="all_currency">Currency:</label>
238                                             <select name="all_currency" id="all_currency">
239                                             [% FOREACH loop_currencie IN loop_currencies %]
240                                                 [% IF ( loop_currencie.selected ) %]
241                                                     <option value="[% loop_currencie.currcode %]" selected="selected">[% loop_currencie.currcode %]</option>
242                                                 [% ELSE %]
243                                                     <option value="[% loop_currencie.currcode %]">[% loop_currencie.currcode %]</option>
244                                                 [% END %]
245                                             [% END %]
246                                             </select>
247                                         </li>
248                                         <li>
249                                             <label for="all_budget_id">Budget: </label>
250                                             <select id="all_budget_id" size="1" name="all_budget_id">
251                                             [% FOREACH budget_loo IN budget_loop %]
252                                                 [% IF ( budget_loo.b_sel ) %]
253                                                     <option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]" selected="selected">[% budget_loo.b_txt %]</option>
254                                                 [% ELSE %]
255                                                     <option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option>
256                                                 [% END %]
257                                             [% END %]
258                                             </select>
259                                         </li>
260                                     [% END %]
261                                 </li>
262                                 <li>
263                                     <label for="all_order_internalnote">Internal note: </label>
264                                     <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
265                                 </li>
266                                 <li>
267                                     <label for="all_order_vendornote">Vendor note: </label>
268                                     <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
269                                 </li>
270                                 <li>
271                                     <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
272                                     <label for="sort1">Planning value1: </label>
273                                     [% IF CGIsort1 %]
274                                         <select id="all_sort1" size="1" name="all_sort1">
275                                         [% FOREACH sort_opt IN CGIsort1 %]
276                                             [% IF sort_opt.default %]
277                                                 <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
278                                             [% ELSE %]
279                                                 <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
280                                             [% END %]
281                                         [% END %]
282                                         </select>
283                                     [% ELSE %]
284                                         <input type="text" id="all_sort1" size="20" name="all_sort1" value="[% sort1 %]" />
285                                     [% END %]
286                                 </li>
287                                 <li>
288                                   <span id="sort2_zone">
289                                     <label for="sort2">Planning value2: </label>
290                                     [% IF CGIsort2 %]
291                                         <select id="all_sort2" size="1" name="all_sort1">
292                                         [% FOREACH sort_opt IN CGIsort2 %]
293                                             [% IF sort_opt.default %]
294                                                 <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
295                                             [% ELSE %]
296                                                 <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
297                                             [% END %]
298                                         [% END %]
299                                         </select>
300                                     [% ELSE %]
301                                          <input type="text" id="all_sort2" size="20" name="all_sort2" value="[% sort2 %]" />
302                                     [% END %]
303                                   </span>
304                                 </li>
305                             </ol>
306                         </fieldset>
307                         <fieldset class="action">
308                             <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
309                         </fieldset>
310
311                         </div>
312                     </form>
313                 [% ELSE %]
314                 <div>
315                   <h1>Choose the file to add to the basket</h1>
316                   <table id="files">
317                     <thead>
318                       <tr>
319                         <th>File name</th>
320                         <th>Comments</th>
321                         <th>Status</th>
322                         <th class="title-string">Staged</th>
323                         <th># Bibs</th>
324                         <th class="NoSort">&nbsp;</th>
325                       </tr>
326                     </thead>
327                     <tbody>
328                       [% FOREACH batch_lis IN batch_list %]
329                       <tr>
330                         <td>[% batch_lis.file_name %]</td>
331                         <td>[% batch_lis.comments %]</td>
332                         <td>
333                           [% IF ( batch_lis.import_status == 'cleaned' ) %]
334                             Cleaned
335                           [% ELSIF ( batch_lis.import_status == 'imported' ) %]
336                             Imported
337                           [% ELSIF ( batch_lis.import_status == 'importing' ) %]
338                             Importing
339                           [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
340                             Reverted
341                           [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
342                             Reverting
343                           [% ELSIF ( batch_lis.import_status == 'staged' ) %]
344                             Staged
345                           [% ELSE %]
346                             [% batch_lis.import_status %]
347                           [% END %]
348                         </td>
349                         <td><span title="[% batch_lis.staged_date %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 %]</span></td>
350                         <td>[% batch_lis.num_biblios %]</td>
351                         <td><a href="[% batch_lis.scriptname %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]">Add orders</a></td>
352                       </tr>
353                       [% END %]
354                     </tbody>
355                   </table>
356                 </div>
357                 [% END %]
358            </div>
359        </div>
360    </div>
361 </div>
362 </body>
363 </html>