X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=koha-tmpl%2Fintranet-tmpl%2Fprog%2Fen%2Fmodules%2Fserials%2Fsubscription-add.tmpl;h=25e2f993934a621bd3fc5cd85c8b02705d145704;hb=0c66ac6702e2a8841ffa002ceabef2bca07aaa87;hp=0f1aa9af00c0329ce3ab1e6d44dd880f02cb2103;hpb=6e876ab7cba3e246d4b6ae595edfd46e80f2b9a3;p=koha_fer diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl index 0f1aa9af00..25e2f99393 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl @@ -7,10 +7,49 @@ + return(d[1] + '/' + d[2] + '/' + d[0]) ; + + return(d[2] + '/' + d[1] + '/' + d[0]) ; + + return(''+d[0] + '-' + d[1] + '-' + d[2]) ; + +} + +Date.prototype.addDays = function(days) { + this.setDate(this.getDate()+days); +} + +function getWeeksArray(startDate,periodicity) { +// returns an array of syspref-formatted dates starting at the first day of startDate's year. +// This prediction method will not accurately predict irregularites beyond the first year. +// FIXME : Should replace with ajax query to get the first Monday of the year so that week numbers have correct dates. + var incr=1; + if(periodicity==3) { // 1/2 wks + incr=2; + } else if(periodicity == 4) { // 1/3 wks + incr=3; + } + var weeksArray = new Array; + startDate.setDate(1); + startDate.setMonth(0); + for(var i=0;i<52;i++) { + weeksArray[i] = formatDate(startDate) + ' ' + weekno_label + (i + 1); + startDate.addDays( 7 ); + } + return weeksArray; +} function YMDaToYWDa(S) { with (new Date(Date.UTC(S[0], S[1] - 1, S[2]))) { @@ -33,8 +72,72 @@ return ddiff+1; } +// create irregularity object. +function IrregularPattern() { + this.months = new Array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December")); + this.seasons = new Array(_("Autumn"),_("Winter"),_("Spring"),_("Summer"),_("Fall")); + this.daynames = new Array(_("Monday"),_("Tuesday"),_("Wednesday"),_("Thursday"),_("Friday"),_("Saturday"),_("Sunday")); + // create weeks irregularity selection array: + this.firstissue = new Date(); + this.firstissue.setDate(1); + this.firstissue.setMonth(0); + // it's a mod, we already have a start date. + this.firstissue.setFullYear( ); + + this.weeks = getWeeksArray(this.firstissue); + + this.numskipped = 0; + // init: + var irregular = ''; + this.skipped = irregular.split(','); +} + +IrregularPattern.prototype.update = function() { + this.skipped= new Array; + var cnt = 0; + // daily periodicity, we interpret irregular array as which days of week to skip. + // else if weekly periodicity, week numbers (starting from 01 Jan) to skip. + // else irregular array is list of issues to skip + var summary_str = ''; + this.numskipped = 0; + if(document.f.irregularity_select) { + for( var i in document.f.irregularity_select.options ) { + if( document.f.irregularity_select.options[i].selected ) { + this.skipped[cnt] = document.f.irregularity_select.options[i].value ; + summary_str += document.f.irregularity_select.options[i].text + "\n" ; + cnt++; + this.numskipped++; + } + } + var summary = document.getElementById("irregularity_summary"); + if(summary) { + summary.value = summary_str; + summary.rows= ( cnt > 6 ) ? cnt : 6 ; // textarea will bre resized, but not more than 6 lines will show. + } + } +} + +IrregularPattern.prototype.irregular = function(index) { + for( var i in this.skipped) { + if( this.skipped[i] == index) { + return true; + } + } + return false; +} + +function init_pattern() { + irregular_issues = new IrregularPattern(); +} +function reset_pattern() { + document.getElementById("numberpattern").value = ''; + document.getElementById("irregularity").innerHTML = ''; + init_pattern(); + reset_num_pattern(); + +} // common pre defined number patterns -function num_pattern() { +function reset_num_pattern() { var patternchoice = document.getElementById("numberpattern").value; switch(patternchoice){ case "2": @@ -50,10 +153,10 @@ var patternchoice = document.getElementById("numberpattern").value; document.f.setto1.value=0; document.f.setto2.value=1; document.f.setto3.value=1; -/* document.f.lastvalue1.value=1; + document.f.lastvalue1.value=1; document.f.lastvalue2.value=1; - document.f.lastvalue3.value=1;*/ - document.f.numberingmethod.value=_('Vol {X}, No {Y}, Issue {Z}'); + document.f.lastvalue3.value=1; + document.f.numberingmethod.value=_("Vol {X}, No {Y}, Issue {Z}"); moreoptions(text[1],text[0],text[2]); display_table(0); // toggle info box on (1) or off (0) break; @@ -70,10 +173,10 @@ var patternchoice = document.getElementById("numberpattern").value; document.f.setto1.value=0; document.f.setto2.value=1; document.f.setto3.value=''; -/* document.f.lastvalue1.value=1; + document.f.lastvalue1.value=1; document.f.lastvalue2.value=1; - document.f.lastvalue3.value='';*/ - document.f.numberingmethod.value=_('Vol {X}, No {Y}'); + document.f.lastvalue3.value=''; + document.f.numberingmethod.value=_("Vol {X}, No {Y}"); moreoptions(text[1],text[0]); display_table(0); break; @@ -90,13 +193,16 @@ var patternchoice = document.getElementById("numberpattern").value; document.f.setto1.value=0; document.f.setto2.value=1; document.f.setto3.value=''; - document.f.numberingmethod.value=_('Vol {X}, Issue {Y}'); + document.f.lastvalue1.value=1; + document.f.lastvalue2.value=1; + document.f.lastvalue3.value=''; + document.f.numberingmethod.value=_("Vol {X}, Issue {Y}"); moreoptions(text[1],text[2]); display_table(0); break; case "5": - var d = new Date(document.f.firstacquidate.value); - var smonth = d.getMonth(); +// var d = new Date(document.f.firstacquidate.value); +// var smonth = d.getMonth(); document.f.add1.value=1; document.f.add2.value=1; document.f.add3.value=''; @@ -109,7 +215,7 @@ var patternchoice = document.getElementById("numberpattern").value; document.f.setto1.value=0; document.f.setto2.value=1; document.f.setto3.value=''; - document.f.numberingmethod.value=_('No {X}, Issue {Y}'); + document.f.numberingmethod.value=_("No {X}, Issue {Y}"); moreoptions(text[0],text[2]); display_table(0); break; @@ -131,10 +237,10 @@ var patternchoice = document.getElementById("numberpattern").value; document.f.setto1.value=0; document.f.setto2.value='1'; document.f.setto3.value=''; - document.f.lastvaluetemp1.value=sYear; document.f.periodicity.value='8'; - document.f.numberingmethod.value=_('{Y} {X}'); + document.f.numberingmethod.value=_("{Y} {X}"); moreoptions_seasons(text[15],sYear); + document.f.lastvalue1temp.value=document.f.lastvalue1.value=sYear; display_table(0); is_season = 1; break; @@ -143,8 +249,8 @@ var patternchoice = document.getElementById("numberpattern").value; document.getElementById("more_options").innerHTML = ''; document.f.irreg_check.value=1; break; - case "8": - var d = new Date(document.f.startdate.value); + case "8": // Year/Number + var d = (document.f.firstacquidate.value) ? new Date( document.f.firstacquidate.value) : new Date() ; var sYear = d.getFullYear(); document.f.add1.value=1; document.f.add2.value=1; @@ -158,30 +264,22 @@ var patternchoice = document.getElementById("numberpattern").value; document.f.setto1.value=0; document.f.setto2.value=1; document.f.setto3.value=''; -// document.f.setto3.value=''; - if (document.f.lastvalue1.value==0){document.f.lastvalue1.value=sYear}; - if (document.f.lastvalue2.value==0 ||document.f.lastvalue2.value=='' ){ + document.f.lastvalue1.value=sYear; switch (document.f.periodicity.value){ case 1: var doy = dayofyear(d); - //var Weeknumber=YWDA[1]; document.f.lastvalue2.value=doy; + document.f.whenmorethan2.value=365; break; case 12: var doy = dayofyear(d); - //var Weeknumber=YWDA[1]; document.f.lastvalue2.value=doy*2; - break; - case 13: - var doy = dayofyear(d); - //var Weeknumber=YWDA[1]; - document.f.lastvalue2.value=doy/3; + document.f.whenmorethan2.value=730; break; case 2: case 3: case 4: var YWDa = YMDaToYWDa(d); - //var Weeknumber=YWDA[1]; document.f.lastvalue2.value=YWDA[1]/(document.f.periodicity.value-1); break; case 5: @@ -191,23 +289,26 @@ var patternchoice = document.getElementById("numberpattern").value; case 6: var smonth = d.getMonth(); document.f.lastvalue2.value=smonth/2; + document.f.whenmorethan2.value=6; break; case 7: case 8: var smonth = d.getMonth(); document.f.lastvalue2.value=smonth/3; + document.f.whenmorethan2.value=4; break; case 9: var smonth = d.getMonth(); document.f.lastvalue2.value=smonth/6; + document.f.whenmorethan2.value=2; break; default: } - } - // document.f.lastvalue2.value=document.f.lastvaluetemp2.value; document.f.lastvalue3.value=''; - document.f.numberingmethod.value=_('{X}/{Y}'); + document.f.numberingmethod.value=_("{X} / {Y}"); moreoptions(text[16],text[0]); + // document.f.lastvalue1temp.value=sYear; + // document.f.lastvalue2temp.value=document.f.lastvalue2.value; display_table(0); break; default: @@ -223,11 +324,12 @@ var patternchoice = document.getElementById("numberpattern").value; document.f.setto1.value=0; document.f.setto2.value=''; document.f.setto3.value=''; -/* document.f.lastvalue1.value=1; + document.f.lastvalue1.value=1; document.f.lastvalue2.value=''; - document.f.lastvalue3.value='';*/ + document.f.lastvalue3.value=''; document.f.numberingmethod.value='{X}'; - moreoptions_daily_check(text[0]); +// moreoptions_daily_check(text[0]); + moreoptions(text[0]); document.f.irreg_check.value=1; display_table(0); break; @@ -237,15 +339,18 @@ var patternchoice = document.getElementById("numberpattern").value; function display_table(n) { if(n==1){ document.getElementById("basetable").style.display = 'block'; - } else { + } else if(n==0){ document.getElementById("basetable").style.display = 'none'; - } + } else { + var disp_val = ( document.getElementById("basetable").style.display == 'none' ) ? 'block' : 'none' ; + document.getElementById("basetable").style.display = disp_val; + } } -function modify_num_pattern() { +function set_num_pattern_from_template_vars() { if(!document.getElementById("numberpattern")){ return false; } document.getElementById("numberpattern").value = ''; - num_pattern(); + reset_num_pattern(); document.f.add1.value=''; document.f.add2.value=''; @@ -276,28 +381,27 @@ function modify_num_pattern() { more_strZ="Z"; } - - document.f.lastvaluetemp1.value=''; + document.f.lastvalue1temp.value=''; if(more_strY){ - document.f.lastvaluetemp2.value=''; - document.f.whenmorethantemp2.value=''; + document.f.lastvalue2temp.value=''; + document.f.whenmorethan2temp.value=''; } if(more_strZ){ - document.f.lastvaluetemp3.value=''; - document.f.whenmorethantemp3.value=''; + document.f.lastvalue3temp.value=''; + document.f.whenmorethan3temp.value=''; } } // a pre check with more options to see if 'number' and '1/day' are chosen + + // to dispaly the more options section function moreoptions(x,y,z){ @@ -316,7 +422,7 @@ document.getElementById("more_options").innerHTML = ''; var textbox = ''; // alert("X: "+x+"Y: "+y+"Z: "+z); if(x){ - textbox +="\n
 <\/th>"+x+"<\/th>"; + textbox +="\n"; + textbox +=""; } textbox +="<\/table>\n"; } @@ -354,7 +460,7 @@ var selbox = document.getElementById("season1"); var selboxselected = selbox.options[selbox.selectedIndex].value; selbox.options.length = 0; - if (chosen == "1") { + if ( (chosen == "1") || ( ! (chosen) && is_hemisphere == 1 )) { selbox.options[selbox.options.length] = new Option(text[11],'1'); selbox.options[selbox.options.length] = new Option(text[12],'2'); selbox.options[selbox.options.length] = new Option(text[13],'3'); @@ -363,7 +469,7 @@ var selbox = document.getElementById("season1"); selbox.options[selboxselected-1].selected = true; } - if (chosen == "2") { + if ( (chosen == "2") || ( ! (chosen) && is_hemisphere == 2 )) { selbox.options[selbox.options.length] = new Option(text[13],'1'); selbox.options[selbox.options.length] = new Option(text[10],'2'); selbox.options[selbox.options.length] = new Option(text[11],'3'); @@ -374,8 +480,9 @@ var selbox = document.getElementById("season1"); } } -// to dispaly the more options section for seasons +// to display the more options section for seasons function moreoptions_seasons(x,y){ +// x = 'Season'. y = 'Year'. document.getElementById("irregularity").innerHTML = ''; document.getElementById("more_options").innerHTML = ''; var textbox = ''; @@ -391,21 +498,18 @@ var textbox = ''; textbox +=">"+text[i+7]+"<\/option>"; } textbox +="<\/li>\n"; - textbox +="
 <\/th>"+x+"<\/th>"; if(y){ textbox +=""+y+"<\/th>"; if(z){ @@ -324,24 +430,24 @@ var textbox = ''; } } textbox +="<\/tr>\n"; - textbox +="
"+text[5]+"<\/td><\/td>\n"; + textbox +="
"+text[5]+"<\/td><\/td>\n"; if(y){ - textbox +="<\/td>\n"; + textbox +="<\/td>\n"; if(z){ - textbox +="<\/td>\n"; + textbox +="<\/td>\n"; } } textbox +="<\/tr>\n"; if(y){ textbox +="
"+text[6]+"<\/th>"; - textbox +=""+_('Irregularity?')+"<\/a><\/td>\n"; - textbox +="<\/td>\n"; + textbox +=" <\/td>\n"; + textbox +="<\/td>\n"; if(z){ - textbox +="<\/td>\n"; + textbox +="<\/td>\n"; } textbox +="<\/tr>"; } else { - textbox +="
"+_('issues expected')+"
"+_('Irregularity?')+"
"+_("issues expected")+"
 <\/th>"+x+"<\/th>"; + textbox +="
 <\/th>"+x+"<\/th>"; textbox +=""+text[16]+"<\/th>"; textbox +="<\/tr>\n"; - textbox +="
"+text[5]+"<\/th>
"+text[5]+"<\/th>" + irregular_issues.firstissue.getFullYear() + "<\/td><\/tr>\n"; textbox +="
"+text[6]+"<\/th>"; - textbox +=""+_('Irregularity?')+"<\/a><\/td>\n"; - textbox +="<\/td>\n"; + textbox +="<\/td>\n"; textbox +="<\/tr><\/table>\n"; } @@ -415,12 +519,17 @@ var textbox = ''; function irregularity_check(){ document.f.irreg_check.value = 1; // Irregularity button now pushed var periodicity = document.f.periodicity.value; - var rollover = document.f.issuesexpected1.value; - if(document.f.whenmorethantemp2){ - rollover = document.f.whenmorethantemp2.value; + var rollover = document.f.issuesexpected1.value; + if( (document.f.whenmorethan2) && ( document.f.whenmorethan2.value > 0) ){ + rollover = document.f.whenmorethan2.value; } - if(document.f.whenmorethantemp3){ - rollover = document.f.whenmorethantemp3.value; + if((document.f.whenmorethan3) && document.f.whenmorethan3.value > 0 ){ + // FIXME: Irregularity check assumes that the full prediction pattern repeats each year. + // In cases where the outermost periodicity is > 1 year, + // e.g. where a volume spans two years, the irregularity check will be incorrect, + // but you can safely ignore the check, submit the form, and the prediction pattern should be correct. + // a way to distinguish between these two cases is needed. + rollover = document.f.whenmorethan3.value * document.f.whenmorethan2.value; } var error=''; var toobig; @@ -441,13 +550,6 @@ function irregularity_check(){ toobig=1; } break; - case "13": - if(rollover < 156) expected =156; - if(rollover > 156) { - expectedover=156; - toobig=1; - } - break; case "2": if(rollover < 52) expected =52; if(rollover > 52){ @@ -515,66 +617,58 @@ function irregularity_check(){ break; } if(expected){ - if(expected == 365 || expected==730){ - var daynames = new Array(_('Monday'),_('Tuesday'),_('Wednesday'),_('Thursday'),_('Friday'),_('Saturday'),_('Sunday')); + if(expected == 365 || expected==730){ // what about leap years ? + // FIXME: We interpret irregularity as which days per week for periodicity==1. + // We need two cases: one in which we're published n days/week, in which case irregularity should be per week, + // and a regular daily pub, where irregularity should be per year. errortext += _("Please indicate which days of the week you DO NOT<\/b> expect to receive issues.
"); - for(var j=0;j"+daynames[j]+"   "; - } - error=errortext; } else { errortext +=expected+_(" issues expected, ")+rollover+_(" were entered.
Please indicate which date(s) an issue is not expected
"); - var count=0; - for(var i=rollover;i\n"; - errortext +=irregular_options(periodicity); - errortext +="<\/select>\n"; - count++; - } - error=errortext; - } + irregular_issues.numskipped = expected - rollover; + } + errortext +="\n
  • - +
  • - + - + @@ -874,60 +1000,81 @@ window.onload = irregular_order(); -
    (select a notice and patrons on the routing list will receive notices for this subscription)
    - + +
    Select a notice and patrons on the routing list will be notified when new issues are received.
    + +
    To notify patrons of new serial issues, you must define a notice.
    +
  • -
    Note: +
    Note:
      -
    • Remember you must create a biblio
    • -
    • You must select a supplier
    • +
    • The subscription must be associated with a bibliographic record.
    • +
    • You must select a vendor if you wish to generate claims.
    - +
    - Planning + Serials planning
    1. - - - /lib/calendar/cal.gif" id="button2" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> - " size="13" maxlength="10" id="acqui_date" style="border-width: 0px;" /> + + /lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> + " size="13" maxlength="10" id="acqui_date" disabled="true" style="border-width: 0px;" /> +
    2. +
    3. + /lib/calendar/cal.gif" id="next_acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> + " size="13" maxlength="10" id="next_acqui_date" style="border-width: 0px;" /> +
    4. - - -
    5. - + - - + - + @@ -946,14 +1093,9 @@ window.onload = irregular_order(); - - - - - - + - + @@ -1007,12 +1149,12 @@ window.onload = irregular_order(); -
    6. -
    7. + Required +
    8. - + - @@ -1060,10 +1202,10 @@ window.onload = irregular_order();
    9. - + /lib/calendar/cal.gif" id="button1" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" /> - " size="13" maxlength="10" id="beginning_date" /> + " size="13" maxlength="10" id="beginning_date" style="border-width: 0px;" /> - + Required
    10. - + - " size="3" onkeypress="return check_input(event)" /> (*) (enter amount in numerals) - + " size="3" onkeypress="return check_input(event)" /> (enter amount in numerals) + Required
    11. " />
    12. -
    13. -
    +
    +
    +
    + + + +
    +
    + +
    + - - - -
    - -
    -

    History

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Starting date" /> (the date of the 1st subscription)
    Ending date" />(if empty subscription is still active)
    Received issues
    Missing issues
    OPAC notes
    Librarian notes
    -
    - - - + + +
    +

    Subscription history

    +
    + + " /> + +

    Hint : you can update the serial history manually. This can be useful for an old subscription or to clean the existing history. Modify these fields with care, as future serial receive will continue to update them automatically.

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    Subscription start date" /> (start date of the 1st subscription)
    Subscription end date" />(if empty, subscription is still active)
    Received issues
    Missing issues
    Note for OPAC
    Note for staff
    + +
    + +