Bug 7688 follow-up: Small fixes for QA
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / subscription-add.tt
1 [% USE KohaDates %]
2
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Serials &rsaquo; [% IF ( modify ) %][% bibliotitle |html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 [% INCLUDE 'calendar.inc' %]
7 <style type="text/css">
8 fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
9 .yui-u li p label.widelabel {
10     width: 300px;  /* not enough for IE7 apparently */
11 }
12 </style>
13 <script type="text/javascript">
14 //<![CDATA[
15
16 var globalnumpatterndata;
17 var globalfreqdata;
18 var advancedpatternlocked;
19 var patternneedtobetested = 0;
20
21 function check_issues(){
22     if (globalfreqdata.unit.length >0) {
23         if (document.f.subtype.value == globalfreqdata.unit){
24             document.f.issuelengthcount.value=(document.f.sublength.value*globalfreqdata.issuesperunit)/globalfreqdata.unitsperissue;
25         } else if (document.f.subtype.value != "issues"){
26             alert(_("Frequency and subscription length provided doesn't combine well. Please consider entering an issue count rather than a time period."));
27         }
28     }
29 }
30
31 function addbiblioPopup(biblionumber) {
32     var destination = "/cgi-bin/koha/cataloguing/addbiblio.pl?mode=popup";
33     if(biblionumber){
34         destination += "&biblionumber="+biblionumber;
35     }
36     window.open(destination,'AddBiblioPopup','width=1024,height=768,toolbar=no,scrollbars=yes');
37 }
38
39 function Plugin(f)
40 {
41     window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
42 }
43
44 function FindAcqui(f)
45 {
46     window.open('acqui-search.pl','FindASupplier','width=800,height=400,toolbar=no,scrollbars=yes');
47 }
48
49 function Find_ISSN(f)
50 {
51     window.open('issn-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
52 }
53
54 function Clear(id) {
55     $("#"+id).val('');
56 }
57
58 function Check_page1() {
59     if ( $("#aqbooksellerid").val().length == 0) {
60         input_box = confirm(_("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor"));
61         if (input_box==false) {
62             return false;
63         }
64     }
65     if ($("#biblionumber").val().length == 0) {
66         alert(_("You must choose or create a biblio"));
67         return false;
68     }
69
70     return true;
71 }
72
73 function Check_page2(){
74     [% UNLESS (more_than_one_serial) %]
75       if($("#acqui_date").val().length == 0){
76           alert(_("You must choose a first publication date"));
77           return false;
78       }
79     [% END %]
80     if($("#frequency").val().length == 0){
81         alert(_("You must choose a frequency"));
82         return false;
83     }
84     if($("input[name='startdate']").val().length == 0){
85         alert(_("You must choose a start date"));
86         return false;
87     }
88     if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){
89         alert(_("You must choose a subscription length or an end date."));
90         return false;
91     }
92     if($("#numberpattern").val().length == 0){
93         alert(_("You must choose a numbering pattern"));
94         return false;
95     }
96     if(advancedpatternlocked == 0){
97         alert(_("You have modified the advanced prediction pattern. Please save your work or cancel modifications."));
98         return false;
99     }
100     if(patternneedtobetested){
101         alert(_("Please click on 'Test prediction pattern' before saving subscription."));
102         return false;
103     }
104
105     return true;
106 }
107
108 function frequencyload(){
109     $.getJSON("subscription-frequency.pl",{"frequency_id":document.f.frequency.value,ajax:'true'},
110         function(freqdata){
111             globalfreqdata=freqdata;
112             if ( globalfreqdata.unit.length == 0 ) {
113                 var option = $("#subtype option[value='issues']");
114                 $(option).attr('selected', 'selected');
115                 $("#subtype option[value!='issues']").attr('disabled', 'disabled')
116             } else {
117                 $("#subtype option").attr('disabled', false)
118             }
119         }
120     )
121 }
122
123 function numberpatternload(){
124     $.getJSON("subscription-numberpattern.pl",{"numberpattern_id":document.f.numbering_pattern.value,ajax:'true'},
125         function(numpatterndata){
126             globalnumpatterndata=numpatterndata;
127             if (globalnumpatterndata==undefined){
128                 return false;
129             }
130             displaymoreoptions();
131             restoreAdvancedPattern();
132         }
133     );
134 }
135
136 function displaymoreoptions() {
137     if(globalnumpatterndata == undefined){
138         $("#moreoptionst").hide();
139         return false;
140     }
141
142     var X = 0, Y = 0, Z = 0;
143     var numberingmethod = unescape(globalnumpatterndata.numberingmethod);
144     if(numberingmethod.match(/{X}/)) X = 1;
145     if(numberingmethod.match(/{Y}/)) Y = 1;
146     if(numberingmethod.match(/{Z}/)) Z = 1;
147
148     if(X || Y || Z) {
149         $("#moreoptionst").show();
150     } else {
151         $("#moreoptionst").hide();
152     }
153
154     if(X) {
155         if(globalnumpatterndata.label1) {
156             $("#headerX").html(unescape(globalnumpatterndata.label1));
157         } else {
158             $("#headerX").html("X");
159         }
160         $("#headerX").show();
161         $("#beginsX").show();
162         $("#innerX").show();
163     } else {
164         $("#headerX").hide();
165         $("#beginsX").hide();
166         $("#innerX").hide();
167         $("#lastvaluetemp1").val('');
168         $("#innerlooptemp1").val('');
169     }
170     if(Y) {
171         if(globalnumpatterndata.label2) {
172             $("#headerY").html(unescape(globalnumpatterndata.label2));
173         } else {
174             $("#headerY").html("Y");
175         }
176         $("#headerY").show();
177         $("#beginsY").show();
178         $("#innerY").show();
179     } else {
180         $("#headerY").hide();
181         $("#beginsY").hide();
182         $("#innerY").hide();
183         $("#lastvaluetemp2").val('');
184         $("#innerlooptemp2").val('');
185     }
186     if(Z) {
187         if(globalnumpatterndata.label3) {
188             $("#headerZ").html(unescape(globalnumpatterndata.label3));
189         } else {
190             $("#headerZ").html("Z");
191         }
192         $("#headerZ").show();
193         $("#beginsZ").show();
194         $("#innerZ").show();
195     } else {
196         $("#headerZ").hide();
197         $("#beginsZ").hide();
198         $("#innerZ").hide();
199         $("#lastvaluetemp3").val('');
200         $("#innerlooptemp3").val('');
201     }
202 }
203
204 function toggleAdvancedPattern() {
205     $("#advancedpredictionpattern").toggle();
206 }
207
208 function modifyAdvancedPattern() {
209     $("#patternname").attr("readonly", false).val('');
210     $("#numberingmethod").attr("readonly", false);
211
212     $("#advancedpredictionpatternt input").each(function() {
213         $(this).attr("readonly", false);
214     });
215     $("#advancedpredictionpatternt select").each(function() {
216         $(this).attr("disabled", false);
217     });
218
219     $("#restoreadvancedpatternbutton").show();
220     $("#saveadvancedpatternbutton").show();
221     $("#modifyadvancedpatternbutton").hide();
222
223     advancedpatternlocked = 0;
224 }
225
226 function restoreAdvancedPattern() {
227     $("#patternname").attr("readonly", true).val(unescape(globalnumpatterndata.label));
228     $("#numberingmethod").attr("readonly", true).val(unescape(globalnumpatterndata.numberingmethod));
229
230     $("#advancedpredictionpatternt input").each(function() {
231         $(this).attr("readonly", true);
232         var id = $(this).attr('id');
233         if(id.match(/lastvalue/) || id.match(/innerloop/)) {
234             var tempid = id.replace(/(\d)/, "temp$1");
235             $(this).val($("#"+tempid).val());
236         } else {
237             $(this).val(unescape(globalnumpatterndata[id]));
238         }
239     });
240     $("#advancedpredictionpatternt select").each(function() {
241         $(this).attr("disabled", true);
242         var id = $(this).attr('id');
243         $(this).val(unescape(globalnumpatterndata[id]));
244     });
245
246     $("#restoreadvancedpatternbutton").hide();
247     $("#saveadvancedpatternbutton").hide();
248     $("#modifyadvancedpatternbutton").show();
249
250     advancedpatternlocked = 1;
251 }
252
253 function testPredictionPattern() {
254     var frequencyid = $("#frequency").val();
255     var acquidate;
256     var error = 0;
257     var error_msg = "";
258     if(frequencyid == undefined || frequencyid == ""){
259         error_msg += _("- Frequency is not defined\n");
260         error ++;
261     }
262     acquidate = $("#acqui_date").val();
263     if(acquidate == undefined || acquidate == ""){
264         error_msg += _("- First publication date is not defined\n");
265         error ++;
266     }
267     [% IF (more_than_one_serial) %]
268       var nextacquidate = $("#nextacquidate").val();
269       if(nextacquidate == undefined || nextacquidate == ""){
270         error_msg += _("- Next issue publication date is not defined\n");
271         error ++;
272       }
273     [% END %]
274
275     if(error){
276         alert(_("Cannot test prediction pattern for the following reason(s):\n\n")
277             + error_msg);
278         return false;
279     }
280
281     var custompattern = 0;
282     if(advancedpatternlocked == 0) {
283         custompattern = 1;
284     }
285
286     var ajaxData = {
287         'custompattern': custompattern,
288         [% IF (subscriptionid) %]
289             'subscriptionid': [% subscriptionid %],
290         [% END %]
291         [% IF (more_than_one_serial) %]
292           'nextacquidate': nextacquidate,
293         [% END %]
294         'firstacquidate': acquidate
295     };
296     var ajaxParams = [
297         'to', 'subtype', 'sublength', 'frequency', 'numberingmethod',
298         'lastvalue1', 'lastvalue2', 'lastvalue3', 'add1', 'add2', 'add3',
299         'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3',
300         'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
301         'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
302     ];
303     for(i in ajaxParams) {
304         var param = ajaxParams[i];
305         var value = $("#"+param).val();
306         if(value.length > 0)
307             ajaxData[param] = value;
308     }
309
310     $.ajax({
311         url:"/cgi-bin/koha/serials/showpredictionpattern.pl",
312         data: ajaxData,
313         success: function(data) {
314             $("#displayexample").html(data);
315             patternneedtobetested = 0;
316         }
317     });
318 }
319
320 function saveAdvancedPattern() {
321     if ($("#patternname").val().length == 0) {
322         alert(_("Please enter a name for this pattern"));
323         return false;
324     }
325
326     // Check if patternname already exists, and modify pattern
327     // instead of creating it if so
328     var found = 0;
329     $("#numberpattern option").each(function(){
330         if($(this).text() == $("#patternname").val()){
331             found = 1;
332             return false;
333         }
334     });
335     var cnfrm = 1;
336     if(found){
337         var msg = _("This pattern name already exists. Do you want to modify it?")
338             + "\n" + _("Warning: it will modify the pattern for all subscriptions")
339             + _("that are using it.");
340         cnfrm = confirm(msg);
341     }
342
343     if(cnfrm) {
344         var ajaxData = {};
345         var ajaxParams = [
346             'patternname', 'numberingmethod', 'label1', 'label2', 'label3',
347             'add1', 'add2', 'add3', 'every1', 'every2', 'every3',
348             'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
349             'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
350         ];
351         for(i in ajaxParams) {
352             var param = ajaxParams[i];
353             var value = $("#"+param).val();
354             if(value.length > 0)
355                 ajaxData[param] = value;
356         }
357
358         $.getJSON(
359             "/cgi-bin/koha/serials/create-numberpattern.pl",
360             ajaxData,
361             function(data){
362                 if (data.numberpatternid) {
363                     if(found == 0){
364                         $("#numberpattern").append("<option value=\""+data.numberpatternid+"\">"+$("#patternname").val()+"</option>");
365                     }
366                     $("#numberpattern").val(data.numberpatternid);
367                     numberpatternload();
368                 } else {
369                     alert(_("Something went wrong. Unable to create a new numbering pattern."));
370                 }
371             }
372         );
373     }
374 }
375
376 function show_page_1() {
377     $("#page_1").show();
378     $("#page_2").hide();
379     $("#page_number").text("1/2");
380 }
381
382 function show_page_2() {
383     $("#page_1").hide();
384     $("#page_2").show();
385     $("#page_number").text("2/2");
386     displaymoreoptions();
387 }
388
389
390 $(document).ready(function() {
391     $("select#frequency").change(function(){
392         patternneedtobetested = 1;
393         $("input[name='enddate']").val('');
394         frequencyload();
395     });
396     $("select#numberpattern").change(function(){
397         patternneedtobetested = 1;
398         numberpatternload();
399     });
400     $("#subtype").change(function(){
401         $("input[name='enddate']").val('');
402     });
403     $("#sublength").change(function(){
404         $("input[name='enddate']").val('');
405     });
406     $("#lastvaluetemp1").keyup(function(){
407         $("#lastvalue1").val($(this).val());
408     });
409     $("#lastvaluetemp2").keyup(function(){
410         $("#lastvalue2").val($(this).val());
411     });
412     $("#lastvaluetemp3").keyup(function(){
413         $("#lastvalue3").val($(this).val());
414     });
415     $("#lastvalue1").keyup(function(){
416         $("#lastvaluetemp1").val($(this).val());
417     });
418     $("#lastvalue2").keyup(function(){
419         $("#lastvaluetemp2").val($(this).val());
420     });
421     $("#lastvalue3").keyup(function(){
422         $("#lastvaluetemp3").val($(this).val());
423     });
424
425     $("#innerlooptemp1").keyup(function(){
426         $("#innerloop1").val($(this).val());
427     });
428     $("#innerlooptemp2").keyup(function(){
429         $("#innerloop2").val($(this).val());
430     });
431     $("#innerlooptemp3").keyup(function(){
432         $("#innerloop3").val($(this).val());
433     });
434     $("#innerloop1").keyup(function(){
435         $("#innerlooptemp1").val($(this).val());
436     });
437     $("#innerloop2").keyup(function(){
438         $("#innerlooptemp2").val($(this).val());
439     });
440     $("#innerloop3").keyup(function(){
441         $("#innerlooptemp3").val($(this).val());
442     });
443
444     if($("#frequency").val() != ""){
445         frequencyload();
446     }
447     if($("#numberpattern").val() != ""){
448         numberpatternload();
449     }
450
451     var node;
452     [% FOREACH field IN dont_export_field_loop %]
453         node = $("#[% field.fieldid %]");
454         if ( $(node).is('input') || $(node).is('textarea') ) {
455             $(node).val("");
456         } else if ( $(node).is('select') ) {
457             $(node).find("option:first").attr('selected','selected');
458         }
459     [% END %]
460
461     show_page_1();
462 });
463 //]]>
464 </script>
465 </head>
466 <body id="ser_subscription-add" class="ser">
467 [% INCLUDE 'header.inc' %]
468 [% INCLUDE 'serials-search.inc' %]
469
470 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; [% IF ( modify ) %]<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscriptionid %]"><i>[% bibliotitle |html %]</i></a> &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</div>
471
472 <div id="doc3" class="yui-t7">
473     <div id="bd">
474         <div class="yui-g">
475             <h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %] (<span id="page_number">1/2</span>)</h1>
476             <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
477                 [% IF ( modify ) %]
478                     <input type="hidden" name="op" value="modsubscription" />
479                     <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
480                 [% ELSE %]
481                         <input type="hidden" name="op" value="addsubscription" />
482                 [% END %]
483                 <input type="hidden" name="user" value="[% loggedinusername %]" />
484                 <input type="hidden" name="irreg_check" value="0" />
485
486                 <div id="page_1">
487                     <div class="yui-u first">
488                         <fieldset id="subscription_add_information" class="rows">
489                             <legend>Subscription details</legend>
490                             <ol>
491                                 [% IF ( subscriptionid ) %]
492                                     <li><span class="label">Subscription #</span> [% subscriptionid %]</li>
493                                 [% END %]
494                                 <li>
495                                     <label for="aqbooksellerid">Vendor: </label>
496                                     <input type="text" name="aqbooksellerid" id="aqbooksellerid" value="[% aqbooksellerid %]" size="8" /> (<input type="text" name="aqbooksellername" value="[% aqbooksellername %]" disabled="disabled" readonly="readonly" />) <a href="#" onclick="FindAcqui(f)">Search for a vendor</a>
497                                 </li>
498                                 <li>
499                                     <label for="biblionumber" class="required" title="Subscriptions must be associated with a bibliographic record">Biblio:</label>
500                                     <input type="text" name="biblionumber" id="biblionumber" value="[% bibnum %]" size="8" />
501                                     (<input type="text" name="title" value="[% bibliotitle %]" disabled="disabled" readonly="readonly" />) <span class="required" title="Subscriptions must be associated with a bibliographic record">Required</span>
502                                     <div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for Biblio</a>
503                                         [% IF ( CAN_user_editcatalogue ) %]
504                                             [% IF ( modify ) %]
505                                             | <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit biblio</a>
506                                             [% ELSE %]
507                                             | <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a>
508                                             [% END %]
509                                         [% END %]
510                                     </div>
511                                 </li>
512                                 <li class="radio">
513                                     [% IF ( serialsadditems ) %]
514                                         <p><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1" checked="checked" /><label class="widelabel" for="serialsadditems-yes">create an item record when receiving this serial</label></p>
515                                         <p><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" /><label class="widelabel" for="serialsadditems-no">do not create an item record when receiving this serial </label></p>
516                                     [% ELSE %]
517                                         <p><input type="radio" id="serialsadditems-yes" name="serialsadditems" value="1"/><label class="widelabel" for="serialsadditems-yes">create an item record when receiving this serial</label></p>
518                                         <p><input type="radio" id="serialsadditems-no" name="serialsadditems" value="0" checked="checked" /><label class="widelabel" for="serialsadditems-no">do not create an item record when receiving this serial</label></p>
519                                     [% END %]
520                                 </li>
521                                 <li class="radio">
522                                   <p>When there is an irregular issue:</p>
523                                   [% IF (skip_serialseq) %]
524                                     <p>
525                                       <input type="radio" id="skip_serialseq_yes" name="skip_serialseq" value="1" checked="checked" />
526                                       <label for="skip_serialseq_yes">Skip issue number</label>
527                                     </p>
528                                     <p>
529                                       <input type="radio" id="skip_serialseq_no" name="skip_serialseq" value="0" />
530                                       <label for="skip_serialseq_no">Keep issue number</label>
531                                     </p>
532                                   [% ELSE %]
533                                     <p>
534                                       <input type="radio" id="skip_serialseq_yes" name="skip_serialseq" value="1" />
535                                       <label for="skip_serialseq_yes">Skip issue number</label>
536                                     </p>
537                                     <p>
538                                       <input type="radio" id="skip_serialseq_no" name="skip_serialseq" value="0" checked="checked" />
539                                       <label for="skip_serialseq_no">Keep issue number</label>
540                                     </p>
541                                   [% END %]
542                                 </li>
543                                 <li>
544                                     <label for="manualhistory">Manual history</label>
545                                     [% IF (manualhistory) %]
546                                         <input type="checkbox" id="manualhistory" name="manualhist" checked="checked" />
547                                     [% ELSE %]
548                                         <input type="checkbox" id="manualhistory" name="manualhist" />
549                                     [% END %]
550                                 </li>
551                                 <li>
552                                     <label for="callnumber">Call number</label>
553                                     <input type="text" name="callnumber" id="callnumber" value="[% callnumber %]" size="20" />
554                                 </li>
555                                 <li>
556                                     <label for="branchcode">Library:</label>
557                                     <select name="branchcode" id="branchcode" style="width: 20em;">
558                                         [% UNLESS ( Independantbranches ) %]
559                                             <option value="">None</option>
560                                         [% END %]
561                                         [% FOREACH branchloo IN branchloop %]
562                                             [% IF ( branchloo.selected ) %]
563                                                 <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
564                                             [% ELSE %]
565                                                 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
566                                             [% END %]
567                                         [% END %]
568                                     </select> (select a library)
569                                 </li>
570                                 <li>
571                                     <label for="notes">Public note:</label>
572                                     <textarea name="notes" id="notes" cols="30" rows="2">[% notes %]</textarea>
573                                 </li>
574                                 <li>
575                                     <label for="internalnotes">Nonpublic note:</label>
576                                     <textarea name="internalnotes" id="internalnotes" cols="30" rows="2">[% internalnotes %]</textarea>
577                                 </li>
578                                 <li>
579                                     [% IF ( letterloop ) %]
580                                         <label for="letter">Patron notification: </label>
581                                         <select name="letter" id="letter">
582                                             <option value="">None</option>
583                                             [% FOREACH letterloo IN letterloop %]
584                                                 [% IF ( letterloo.selected ) %]
585                                                     <option value="[% letterloo.value %]" selected="selected">[% letterloo.lettername %]</option>
586                                                 [% ELSE %]
587                                                     <option value="[% letterloo.value %]">[% letterloo.lettername %]</option>
588                                                 [% END %]
589                                             [% END %]
590                                         </select>
591                                         <div class="hint">Select a notice and patrons on the routing list will be notified when new issues are received.</div>
592                                     [% ELSE %]
593                                         <span class="label">Patron notification: </span>
594                                         <div class="hint">To notify patrons of new serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
595                                     [% END %]
596                                 </li>
597                                 <li>
598                                     <label for="location">Location:</label>
599                                     <select name="location" id="location">
600                                         <option value="">None</option>
601                                         [% FOREACH locations_loo IN locations_loop %]
602                                             [% IF ( locations_loo.selected ) %]
603                                                 <option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>
604                                             [% ELSE %]
605                                                 <option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>
606                                             [% END %]
607                                         [% END %]
608                                     </select>
609                                 </li>
610                                 <li>
611                                     <label for="graceperiod">Grace period:</label>
612                                     <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod %]" size="5"/> day(s)
613                                 </li>
614                                 <li>
615                                      <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
616                                      <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount %]" size="4"/>
617                                  </li>
618                                  <li>
619                                     <label class="widelabel" for="opacdisplaycount">Number of issues to display to the public: </label>
620                                     <input type="text" name="opacdisplaycount" id="opacdisplaycount" value="[% opacdisplaycount %]" size="4"/>
621                                 </li>
622                             </ol>
623                         </fieldset>
624                         <fieldset class="action">
625                             <input type="button" value="Next >>" onclick="if ( Check_page1() ) show_page_2();" style="float:right;" />
626                         </fieldset>
627                     </div>
628                 </div>
629
630                 <div id="page_2">
631                     <div class="yui-u first">
632                         <div id="subscription_form_planning">
633                             <fieldset class="rows">
634                                 <legend>Serials planning</legend>
635                                 <ol>
636                                     <li>
637                                         <label for="firstacquidate">First issue publication date: (*)</label>
638                                         [% UNLESS (more_than_one_serial) %]
639                                           <input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]" class="datepicker" readonly="readonly"/>
640                                         [% ELSE %]
641                                           [% firstacquidate | $KohaDates %]
642                                           <input type="hidden" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]"/>
643                                         [% END %]
644                                     </li>
645                                     [% IF (more_than_one_serial) %]
646                                       <li>
647                                         <label for="nextacquidate">Next issue publication date:</label>
648                                         <input type="text" size="10" id="nextacquidate" name="nextacquidate" value="[% nextacquidate | $KohaDates %]" class="datepicker" readonly="readonly"/>
649                                       </li>
650                                     [% END %]
651                                     <li>
652                                         <label for="frequency">Frequency: (*)</label>
653                                         <select name="frequency" size="1" id="frequency">
654                                             <option value="">-- please choose --</option>
655                                             [% FOREACH frequency IN frequencies %]
656                                                 [% IF (frequency.selected) %]
657                                                     <option value="[% frequency.id %]" selected="selected">
658                                                 [% ELSE %]
659                                                     <option value="[% frequency.id %]">
660                                                 [% END %]
661                                                     [% frequency.label %]
662                                                 </option>
663                                             [% END %]
664                                         </select>
665                                     </li>
666                                     <li>
667                                         <label for="subtype">Subscription length:</label>
668                                         <select name="subtype" id="subtype">
669                                             [% FOREACH subt IN subtype %]
670                                                 [% IF (subt.selected) %]
671                                                     <option value="[% subt.name %]" selected="selected">
672                                                 [% ELSE %]
673                                                     <option value="[% subt.name %]">
674                                                 [% END %]
675                                                     [% subt.name %]
676                                                 </option>
677                                             [% END %]
678                                         </select>
679                                         <input type="text" name="sublength" id="sublength" value="[% sublength %]" size="3" /> (enter amount in numerals)
680                                         <input type="hidden" name="issuelengthcount">
681                                     </li>
682                                     <li>
683                                         <label for="startdate"> Subscription start date: (*)</label>
684                                         <input type="text" size="10" id="from" name="startdate" value="[% startdate | $KohaDates %]" class="datepickerfrom" readonly="readonly"/>
685                                     </li>
686                                     <li>
687                                         <label for="enddate">Subscription end date:</label>
688                                         <input type="text" size="10" id="to" name="enddate" value="[% enddate | $KohaDates %]" class="datepickerto" readonly="readonly"/>
689                                     </li>
690                                     <li>
691                                         <label for="numberpattern">Numbering pattern:</label>
692                                         <select name="numbering_pattern" size="1" id="numberpattern">
693                                             <option value="">-- please choose --</option>
694                                             [% FOREACH numberpattern IN numberpatterns %]
695                                                 [% IF (numberpattern.selected) %]
696                                                     <option value="[% numberpattern.id %]">
697                                                 [% ELSE %]
698                                                     <option value="[% numberpattern.id %]">
699                                                 [% END %]
700                                                     [% numberpattern.label %]
701                                                 </option>
702                                             [% END %]
703                                         </select>
704                                     </li>
705                                     <li>
706                                         <label for="locale">Locale</label>
707                                         <select id="locale" name="locale">
708                                             <option value=""></option>
709                                             [% FOREACH locale IN locales %]
710                                                 <option value="[% locale %]">
711                                                     [% locale %]
712                                                 </option>
713                                             [% END %]
714                                         </select>
715                                         <span class="hint">If empty, system locale is used</span>
716                                     </li>
717                                     <li id="more_options">
718                                         <table id="moreoptionst">
719                                             <thead>
720                                                 <tr>
721                                                     <th>&nbsp;</th>
722                                                     <th id="headerX">&nbsp;</th>
723                                                     <th id="headerY">&nbsp;</th>
724                                                     <th id="headerZ">&nbsp;</th>
725                                                 </tr>
726                                             </thead>
727                                             <tbody>
728                                                 <tr>
729                                                     <td>
730                                                       [% IF (more_than_one_serial) %]
731                                                         Last value
732                                                       [% ELSE %]
733                                                         Begins with
734                                                       [% END %]
735                                                     </td>
736                                                     <td id="beginsX"><input type="text" id="lastvaluetemp1" name="lastvaluetemp1" value="[% lastvalue1 %]" /></td>
737                                                     <td id="beginsY"><input type="text" id="lastvaluetemp2" name="lastvaluetemp2" value="[% lastvalue2 %]" /></td>
738                                                     <td id="beginsZ"><input type="text" id="lastvaluetemp3" name="lastvaluetemp3" value="[% lastvalue3 %]" /></td>
739                                                 </tr>
740                                                 <tr>
741                                                     <td>Inner counter</td>
742                                                     <td id="innerX"><input type="text" id="innerlooptemp1" name="innerlooptemp1" value="[% innerloop1 %]" /></td>
743                                                     <td id="innerY"><input type="text" id="innerlooptemp2" name="innerlooptemp2" value="[% innerloop2 %]" /></td>
744                                                     <td id="innerZ"><input type="text" id="innerlooptemp3" name="innerlooptemp3" value="[% innerloop3 %]" /></td>
745                                                 </tr>
746                                             </tbody>
747                                         </table>
748                                     </li>
749                                     <li><a style="cursor:pointer" onclick="toggleAdvancedPattern();">Show/Hide advanced pattern</a></li>
750                                     <div id="advancedpredictionpattern" style="display:none">
751                                       <li>
752                                         <label for="patternname">Pattern name: (*)</label>
753                                         <input id="patternname" name="patternname" type="text" readonly="readonly" />
754                                       </li>
755                                       <li>
756                                         <label for="numberingmethod">Numbering formula:</label>
757                                         <input readonly="readonly" type="text" name="numberingmethod" id="numberingmethod" size="50" value="[% numberingmethod %]" />
758                                       </li>
759                                         <table id="advancedpredictionpatternt">
760                                             <thead>
761                                                 <tr>
762                                                     <th colspan="4">Advanced prediction pattern</td>
763                                                 </tr>
764                                                 <tr>
765                                                     <th>&nbsp;</th>
766                                                     <th>X</th>
767                                                     <th>Y</th>
768                                                     <th>Z</th>
769                                                 </tr>
770                                             </thead>
771                                             <tbody>
772                                                 <tr>
773                                                     <td>Label</td>
774                                                     <td><input type="text" readonly="readonly" id="label1" name="label1" /></td>
775                                                     <td><input type="text" readonly="readonly" id="label2" name="label2" /></td>
776                                                     <td><input type="text" readonly="readonly" id="label3" name="label3" /></td>
777                                                 </tr>
778                                                 <tr>
779                                                     <td>Begins with</td>
780                                                     <td><input type="text" readonly="readonly" id="lastvalue1" name="lastvalue1" /></td>
781                                                     <td><input type="text" readonly="readonly" id="lastvalue2" name="lastvalue2" /></td>
782                                                     <td><input type="text" readonly="readonly" id="lastvalue3" name="lastvalue3" /></td>
783                                                 </tr>
784                                                 <tr>
785                                                     <td>Add</td>
786                                                     <td><input type="text" readonly="readonly" id="add1" name="add1" /></td>
787                                                     <td><input type="text" readonly="readonly" id="add2" name="add2" /></td>
788                                                     <td><input type="text" readonly="readonly" id="add3" name="add3" /></td>
789                                                 </tr>
790                                                 <tr>
791                                                     <td>Every</td>
792                                                     <td><input type="text" readonly="readonly" id="every1" name="every1" /></td>
793                                                     <td><input type="text" readonly="readonly" id="every2" name="every2" /></td>
794                                                     <td><input type="text" readonly="readonly" id="every3" name="every3" /></td>
795                                                 </tr>
796                                                 <tr>
797                                                     <td>Set back to</td>
798                                                     <td><input type="text" readonly="readonly" id="setto1" name="setto1" /></td>
799                                                     <td><input type="text" readonly="readonly" id="setto2" name="setto2" /></td>
800                                                     <td><input type="text" readonly="readonly" id="setto3" name="setto3" /></td>
801                                                 </tr>
802                                                 <tr>
803                                                     <td>When more than</td>
804                                                     <td><input type="text" readonly="readonly" id="whenmorethan1" name="whenmorethan1" /></td>
805                                                     <td><input type="text" readonly="readonly" id="whenmorethan2" name="whenmorethan2" /></td>
806                                                     <td><input type="text" readonly="readonly" id="whenmorethan3" name="whenmorethan3" /></td>
807                                                 </tr>
808                                                 <tr>
809                                                     <td>Inner counter</td>
810                                                     <td><input type="text" readonly="readonly" id="innerloop1" name="innerloop1" /></td>
811                                                     <td><input type="text" readonly="readonly" id="innerloop2" name="innerloop2" /></td>
812                                                     <td><input type="text" readonly="readonly" id="innerloop3" name="innerloop3" /></td>
813                                                 </tr>
814                                                 <tr>
815                                                     [% BLOCK numbering_select %]
816                                                         <select disabled="disabled" id="[% name %]" name="[% name %]" />
817                                                             <option value=""></option>
818                                                             <option value="dayname">Name of day</option>
819                                                             <option value="monthname">Name of month</option>
820                                                             <option value="season">Name of season</option>
821                                                         </select>
822                                                     [% END %]
823                                                     <td>Formatting</td>
824                                                     <td>[% PROCESS numbering_select name="numbering1" %]</td>
825                                                     <td>[% PROCESS numbering_select name="numbering2" %]</td>
826                                                     <td>[% PROCESS numbering_select name="numbering3" %]</td>
827                                                 </tr>
828                                             </tbody>
829                                         </table>
830                                         <input id="modifyadvancedpatternbutton" type="button" value="Modify pattern" onclick="modifyAdvancedPattern();" />
831                                         <input id="restoreadvancedpatternbutton" type="button" value="Cancel modifications" onclick="restoreAdvancedPattern();" style="display:none" />
832                                         <input id="saveadvancedpatternbutton" type="button" value="Save as new pattern" onclick="saveAdvancedPattern();" style="display:none" />
833                                     </div>
834                                 </ol>
835                             </fieldset>
836                             <fieldset class="action">
837                                 <input type="button" value="<< Previous" onclick="show_page_1();" style="float:left;"/>
838                                 <input id="testpatternbutton" type="button" value="Test prediction pattern" onclick="testPredictionPattern();" />
839                                 <input type="button" value="Save subscription" onclick="if (Check_page2()) submit();" style="float:right;" accesskey="w" />
840                             </fieldset>
841                         </div>
842                     </div>
843                     <div class="yui-u">
844                         <li id="displayexample"></li>
845                     </div>
846                 </div>
847             </form>
848         </div>
849     </div>
850 </div>
851
852 [% INCLUDE 'intranet-bottom.inc' %]