48b0472a63
Serials numbering pattern and frequencies are no longer hard-coded. Now it's possible to create, edit and delete numbering patterns (and frequencies). This patch adds two new sql tables (subscription_numberpatterns and subscription_frequencies) Numbering patterns behave almost as before, there are still the same values to configure (addX, everyX, settoX, whenmorethanX). lastvalueX and innerloopX remain in subscription tables. There is a new value in numbering patterns: numberingX. For each "column" (X, Y or Z) you can tell how to format the number. Actually numberingX can be set to: - 'dayname' (name of the day) (0-6 or 1-7 depending on which day is the first of the week) - 'monthname' (name of the month) (0-11) - 'season' (name of the season) (0-3) (0 is Spring) These names are localized by using POSIX::setlocale and POSIX::strftime and setting a 'locale' value to the subscription. Locale have to be installed on the system. Note that season names are not localized using POSIX::strftime (it can't do this), so names are hardcoded into the code (available languages: en, fr). This could be fixed in the future by using a Perl localization framework. Frequencies can be configured using 3 parameters: - 'unit': one of 'day', 'week', 'month', 'year' - 'issuesperunit': integer >= 1, the number of received issues per 'unit' - 'unitsperissue': integer >= 1, the number of 'unit' between two issues One of 'issuesperunit' and 'unitsperissue' must be equal to 1. Examples: unit = 'day', issuesperunit=3, unitsperissue=1 => 3 issues per day unit = 'week', issuesperunit=1, unitsperissue=3 => 1 issue each 3 weeks Prediction pattern is now computed server-side and is more consistent with what Koha will do. The publication date is displayed alongside the serial number. Irregularities can now be checked one by one, in the prediction pattern table, or if frequency is 'day-based' (unit is 'day'), there is the possibility to check all issues for a week day at once. When an irregularity is found, there is the possibility to keep the serial number unchanged, or to skip it. It is configured at subscription creation or modification. For instance, with a daily subscription you can have: skip serial number | keep serial number ----------------------+---------------------- 2012-01-01 ¦ No 1 | 2012-01-01 ¦ No 1 2012-01-03 ¦ No 3 | 2012-01-03 ¦ No 2 To lighten the subscription modification page, manual history has been moved in its own page subscription-history.pl which is accessible on subscription-detail.pl, tab 'Planning'. Important note: updatedatabase.pl script takes into account existing subscriptions and create appropriate numbering patterns for them (it tries to create as few patterns as possible). Frequency is mapped to the correct entry in subscription_frequencies table. This patch includes kohastructure.sql and updatedatabase.pl changes + sample frequencies data and sample numberpatterns data for fresh installs (sample data is included in updatedatabase.pl) === TEST PLAN: === Create a new subscription: - Go to Serials module and click "New subscription" button - On the first page, choose a biblio and click next to go to the second page - Pick a first issue publication date - Choose frequency '1/day' - Choose a subscription length of 15 issues - Choose a subscription start date - Choose numbering pattern 'Volume, Number' - A table appears, fill 'Begins with' cells with '1' - Click on 'Test prediction pattern' button The prediction pattern is displayed at the right of the page. You can see in it the serial number, the publication date and a checkbox to allow you to choose which serials will not be received (irregularities). You can see that serial number start from "Vol 1, No 1" continue to "Vol 1, No 12" and then restart with "Vol 2, No 1". Frequency is '1/day' so you can see that publication date is incremented by one day line after line. - Now you can play a little with frequencies and numbering patterns, change one of them (or both) and click again on 'Test prediction pattern' - For example, choose frequency '3/weeks' and click on 'Test prediction pattern' button'. There is a little behaviour change compared with current master. Publication date will not be guessed within the week. Koha can't know when you will receive issues. So the publication date stay the same (monday of each week) for 3 consecutive issues and then jump to the next week. - Now choose frequency '1/3 months' and numbering pattern 'Seasonal' - Fill 'Begins with' cells with '2012' for Year and '0' for Season - Click on 'Test prediction pattern' - You should have something like 'Spring 2012', 'Summer 2012', ..., 'Winter 2012', 'Spring 2013' - Note that you can have seasons for south hemisphere by entering '2' in 'Year/Inner counter' - 2nd note: if you have some locales installed on your system, you can type its name in the 'Locale' field (actually it does not work for seasons name, only for month names and day names) If you want to modify the numbering pattern you can still do it here: - Click on 'Show/Hide advanced pattern' link. The advanced pattern table is shown but all fields are readonly - Click on 'Modify pattern' button. All readonly fields are now editable. Note that 'Begins with' and 'Inner counter' line are repeated here and any modifications in the small table will be replicated in the big table, and vice versa. - Pattern name is emptied, if you type a new name, a new pattern will be created, and if you type the same name as an existing numbering pattern, this one will be modified (with a confirmation message) - There is two new lines in this table: - Label: it's what is displayed in the smaller table headers above - Numbering: used to format numbers in different ways. can be 'seasons', 'monthname' or 'dayname'. Month name and day name can be localized using the 'Locale' field. Seasons can't (values for English and french are hard-coded in Serials.pm) - You can modify what you want in the table and click on 'Test prediction pattern' button each time you want to see your modifications. (Note that checkboxes for irregularities aren't displayed in this mode, and you can't save the subscription until you have saved or cancelled your changes). - To cancel your modifications, just click on 'Cancel modifications' button. - To save them, click on 'Save as new pattern'. If the pattern name is already existing, a confirmation box will ask you if you want to modify the existing numbering pattern. Otherwise a new pattern will be created and automatically selected. Once you have finished modifying numbering pattern, you can click again on 'Test prediction pattern' to define irregularities, and then click on 'Save subscription'. Now you can check the serials module still works correctly: - Check the subscription detail page to confirm that nothing is missing. Especially the 'Frequency' and 'Number pattern' information. - Try to receive some issues. Check that the serial number is correctly generated and if irregularities you have defined are taken into account (if you have defined some). - Check that receiving is blocked once you have reached the number of issues you have defined in subscription length (or once you have reached the subscription end date) In serials menu (to the left of almost each page of serials menu) you have two new links: 'Manage frequencies' and 'Manage numbering patterns'. 'Manage numbering patterns' lead to a page which list all numbering patterns and allow you to create, edit or delete them. The interface is almost the same as numbering pattern modification in subscription-add.pl 'Manage frequencies' lead to a page which list all frequencies and allow you to create, edit or delete them. Try to create a new frequency: - Click on 'Manage frequencies' link in the serials menu and then click on 'New frequency': - Fill in the description (mandatory). - Unit is one of 'day', 'week', 'month', year' or 'None' ('None' is for an irregular subscription) - If unit is different from 'None' you have to fill the two following fields (Issues per unit, and Units per issue) - Note that at least one of those must be equal to 1 - Issues per unit is the number of received issues by 'unit' and Units per issue is the number of 'unit' between two issues - Display order is used to build the drop-down list. Leave empty and it will be set to 0 (top of the list) - Then click on 'Save' - Check that this new frequency appears in the frequencies table and in the drop-down list in subscription-add.pl Subscription history has been moved in its own page. To test if it still works, choose a subscription with manual history enabled (or modify an existing subscription to turn on manual history). - On the detail page, tab 'Planning', you should have a link 'Edit history'. - Click on it - Modify history and click on Save - In tab 'Summary' you should have the infos you just entered And finally, you can check that old subscriptions (by old I mean subscriptions that existed before the update) are correctly linked to an existing numbering pattern and an existing frequency. Numbering patterns should be named 'Backup pattern X' where X is a number. Signed-off-by: Frédéric Demians <f.demians@tamil.fr> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Great development! Work as described. No koha-qa errors (with all patches applied). Please QA this fast. Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> Squashed commits: ----------------- Bug 7688 follow-up: Small fixes for QA - # Subroutines::ProhibitExplicitReturnUndef: Got 1 violation(s) in C4::Serials::GetSubscriptionIrregularities - Bad template constructions fixed in serials/subscription-add.tt Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> ---- Bug 7688 follow-up: Small fixes for QA #2 - "return undef" -> "return" - ":utf8" -> ":encoding(UTF-8)" - TAB -> SPACES Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> ---- Bug 7688: Translate sample frequencies for french Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> ---- Bug 7688: Fix generating next serial when there is no 'Expected' issue It can happen when the Expected issue is claimed. In this case the status of the last serial is 'Claimed' This patch change the API of GetNextSeq and GetSeq Test plan: - Create a subscription which starts a long time ago so that serials automatically appear in late issues - Receive the first serial - Go to claims page and claim the 2nd serial. - Go back to the subscription page and click on 'Serial collection' - You should have 2 serials, one 'Arrived' and one 'Claimed'. - Click on Generate Next. This should fail with a software error message ("can't call method output ...") - Apply this patch and click again on Generate Next. A new issue must be created with status 'Expected'. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> ---- Bug 7688: Followup FIX perldoc Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
852 lines
44 KiB
Text
852 lines
44 KiB
Text
[% USE KohaDates %]
|
|
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Serials › [% IF ( modify ) %][% bibliotitle |html %] › Modify subscription[% ELSE %]New subscription[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
<style type="text/css">
|
|
fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
|
|
.yui-u li p label.widelabel {
|
|
width: 300px; /* not enough for IE7 apparently */
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
|
|
var globalnumpatterndata;
|
|
var globalfreqdata;
|
|
var advancedpatternlocked;
|
|
var patternneedtobetested = 0;
|
|
|
|
function check_issues(){
|
|
if (globalfreqdata.unit.length >0) {
|
|
if (document.f.subtype.value == globalfreqdata.unit){
|
|
document.f.issuelengthcount.value=(document.f.sublength.value*globalfreqdata.issuesperunit)/globalfreqdata.unitsperissue;
|
|
} else if (document.f.subtype.value != "issues"){
|
|
alert(_("Frequency and subscription length provided doesn't combine well. Please consider entering an issue count rather than a time period."));
|
|
}
|
|
}
|
|
}
|
|
|
|
function addbiblioPopup(biblionumber) {
|
|
var destination = "/cgi-bin/koha/cataloguing/addbiblio.pl?mode=popup";
|
|
if(biblionumber){
|
|
destination += "&biblionumber="+biblionumber;
|
|
}
|
|
window.open(destination,'AddBiblioPopup','width=1024,height=768,toolbar=no,scrollbars=yes');
|
|
}
|
|
|
|
function Plugin(f)
|
|
{
|
|
window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
|
|
}
|
|
|
|
function FindAcqui(f)
|
|
{
|
|
window.open('acqui-search.pl','FindASupplier','width=800,height=400,toolbar=no,scrollbars=yes');
|
|
}
|
|
|
|
function Find_ISSN(f)
|
|
{
|
|
window.open('issn-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes');
|
|
}
|
|
|
|
function Clear(id) {
|
|
$("#"+id).val('');
|
|
}
|
|
|
|
function Check_page1() {
|
|
if ( $("#aqbooksellerid").val().length == 0) {
|
|
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"));
|
|
if (input_box==false) {
|
|
return false;
|
|
}
|
|
}
|
|
if ($("#biblionumber").val().length == 0) {
|
|
alert(_("You must choose or create a biblio"));
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function Check_page2(){
|
|
[% UNLESS (more_than_one_serial) %]
|
|
if($("#acqui_date").val().length == 0){
|
|
alert(_("You must choose a first publication date"));
|
|
return false;
|
|
}
|
|
[% END %]
|
|
if($("#frequency").val().length == 0){
|
|
alert(_("You must choose a frequency"));
|
|
return false;
|
|
}
|
|
if($("input[name='startdate']").val().length == 0){
|
|
alert(_("You must choose a start date"));
|
|
return false;
|
|
}
|
|
if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){
|
|
alert(_("You must choose a subscription length or an end date."));
|
|
return false;
|
|
}
|
|
if($("#numberpattern").val().length == 0){
|
|
alert(_("You must choose a numbering pattern"));
|
|
return false;
|
|
}
|
|
if(advancedpatternlocked == 0){
|
|
alert(_("You have modified the advanced prediction pattern. Please save your work or cancel modifications."));
|
|
return false;
|
|
}
|
|
if(patternneedtobetested){
|
|
alert(_("Please click on 'Test prediction pattern' before saving subscription."));
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function frequencyload(){
|
|
$.getJSON("subscription-frequency.pl",{"frequency_id":document.f.frequency.value,ajax:'true'},
|
|
function(freqdata){
|
|
globalfreqdata=freqdata;
|
|
if ( globalfreqdata.unit.length == 0 ) {
|
|
var option = $("#subtype option[value='issues']");
|
|
$(option).attr('selected', 'selected');
|
|
$("#subtype option[value!='issues']").attr('disabled', 'disabled')
|
|
} else {
|
|
$("#subtype option").attr('disabled', false)
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
function numberpatternload(){
|
|
$.getJSON("subscription-numberpattern.pl",{"numberpattern_id":document.f.numbering_pattern.value,ajax:'true'},
|
|
function(numpatterndata){
|
|
globalnumpatterndata=numpatterndata;
|
|
if (globalnumpatterndata==undefined){
|
|
return false;
|
|
}
|
|
displaymoreoptions();
|
|
restoreAdvancedPattern();
|
|
}
|
|
);
|
|
}
|
|
|
|
function displaymoreoptions() {
|
|
if(globalnumpatterndata == undefined){
|
|
$("#moreoptionst").hide();
|
|
return false;
|
|
}
|
|
|
|
var X = 0, Y = 0, Z = 0;
|
|
var numberingmethod = unescape(globalnumpatterndata.numberingmethod);
|
|
if(numberingmethod.match(/{X}/)) X = 1;
|
|
if(numberingmethod.match(/{Y}/)) Y = 1;
|
|
if(numberingmethod.match(/{Z}/)) Z = 1;
|
|
|
|
if(X || Y || Z) {
|
|
$("#moreoptionst").show();
|
|
} else {
|
|
$("#moreoptionst").hide();
|
|
}
|
|
|
|
if(X) {
|
|
if(globalnumpatterndata.label1) {
|
|
$("#headerX").html(unescape(globalnumpatterndata.label1));
|
|
} else {
|
|
$("#headerX").html("X");
|
|
}
|
|
$("#headerX").show();
|
|
$("#beginsX").show();
|
|
$("#innerX").show();
|
|
} else {
|
|
$("#headerX").hide();
|
|
$("#beginsX").hide();
|
|
$("#innerX").hide();
|
|
$("#lastvaluetemp1").val('');
|
|
$("#innerlooptemp1").val('');
|
|
}
|
|
if(Y) {
|
|
if(globalnumpatterndata.label2) {
|
|
$("#headerY").html(unescape(globalnumpatterndata.label2));
|
|
} else {
|
|
$("#headerY").html("Y");
|
|
}
|
|
$("#headerY").show();
|
|
$("#beginsY").show();
|
|
$("#innerY").show();
|
|
} else {
|
|
$("#headerY").hide();
|
|
$("#beginsY").hide();
|
|
$("#innerY").hide();
|
|
$("#lastvaluetemp2").val('');
|
|
$("#innerlooptemp2").val('');
|
|
}
|
|
if(Z) {
|
|
if(globalnumpatterndata.label3) {
|
|
$("#headerZ").html(unescape(globalnumpatterndata.label3));
|
|
} else {
|
|
$("#headerZ").html("Z");
|
|
}
|
|
$("#headerZ").show();
|
|
$("#beginsZ").show();
|
|
$("#innerZ").show();
|
|
} else {
|
|
$("#headerZ").hide();
|
|
$("#beginsZ").hide();
|
|
$("#innerZ").hide();
|
|
$("#lastvaluetemp3").val('');
|
|
$("#innerlooptemp3").val('');
|
|
}
|
|
}
|
|
|
|
function toggleAdvancedPattern() {
|
|
$("#advancedpredictionpattern").toggle();
|
|
}
|
|
|
|
function modifyAdvancedPattern() {
|
|
$("#patternname").attr("readonly", false).val('');
|
|
$("#numberingmethod").attr("readonly", false);
|
|
|
|
$("#advancedpredictionpatternt input").each(function() {
|
|
$(this).attr("readonly", false);
|
|
});
|
|
$("#advancedpredictionpatternt select").each(function() {
|
|
$(this).attr("disabled", false);
|
|
});
|
|
|
|
$("#restoreadvancedpatternbutton").show();
|
|
$("#saveadvancedpatternbutton").show();
|
|
$("#modifyadvancedpatternbutton").hide();
|
|
|
|
advancedpatternlocked = 0;
|
|
}
|
|
|
|
function restoreAdvancedPattern() {
|
|
$("#patternname").attr("readonly", true).val(unescape(globalnumpatterndata.label));
|
|
$("#numberingmethod").attr("readonly", true).val(unescape(globalnumpatterndata.numberingmethod));
|
|
|
|
$("#advancedpredictionpatternt input").each(function() {
|
|
$(this).attr("readonly", true);
|
|
var id = $(this).attr('id');
|
|
if(id.match(/lastvalue/) || id.match(/innerloop/)) {
|
|
var tempid = id.replace(/(\d)/, "temp$1");
|
|
$(this).val($("#"+tempid).val());
|
|
} else {
|
|
$(this).val(unescape(globalnumpatterndata[id]));
|
|
}
|
|
});
|
|
$("#advancedpredictionpatternt select").each(function() {
|
|
$(this).attr("disabled", true);
|
|
var id = $(this).attr('id');
|
|
$(this).val(unescape(globalnumpatterndata[id]));
|
|
});
|
|
|
|
$("#restoreadvancedpatternbutton").hide();
|
|
$("#saveadvancedpatternbutton").hide();
|
|
$("#modifyadvancedpatternbutton").show();
|
|
|
|
advancedpatternlocked = 1;
|
|
}
|
|
|
|
function testPredictionPattern() {
|
|
var frequencyid = $("#frequency").val();
|
|
var acquidate;
|
|
var error = 0;
|
|
var error_msg = "";
|
|
if(frequencyid == undefined || frequencyid == ""){
|
|
error_msg += _("- Frequency is not defined\n");
|
|
error ++;
|
|
}
|
|
acquidate = $("#acqui_date").val();
|
|
if(acquidate == undefined || acquidate == ""){
|
|
error_msg += _("- First publication date is not defined\n");
|
|
error ++;
|
|
}
|
|
[% IF (more_than_one_serial) %]
|
|
var nextacquidate = $("#nextacquidate").val();
|
|
if(nextacquidate == undefined || nextacquidate == ""){
|
|
error_msg += _("- Next issue publication date is not defined\n");
|
|
error ++;
|
|
}
|
|
[% END %]
|
|
|
|
if(error){
|
|
alert(_("Cannot test prediction pattern for the following reason(s):\n\n")
|
|
+ error_msg);
|
|
return false;
|
|
}
|
|
|
|
var custompattern = 0;
|
|
if(advancedpatternlocked == 0) {
|
|
custompattern = 1;
|
|
}
|
|
|
|
var ajaxData = {
|
|
'custompattern': custompattern,
|
|
[% IF (subscriptionid) %]
|
|
'subscriptionid': [% subscriptionid %],
|
|
[% END %]
|
|
[% IF (more_than_one_serial) %]
|
|
'nextacquidate': nextacquidate,
|
|
[% END %]
|
|
'firstacquidate': acquidate
|
|
};
|
|
var ajaxParams = [
|
|
'to', 'subtype', 'sublength', 'frequency', 'numberingmethod',
|
|
'lastvalue1', 'lastvalue2', 'lastvalue3', 'add1', 'add2', 'add3',
|
|
'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3',
|
|
'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
|
|
'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
|
|
];
|
|
for(i in ajaxParams) {
|
|
var param = ajaxParams[i];
|
|
var value = $("#"+param).val();
|
|
if(value.length > 0)
|
|
ajaxData[param] = value;
|
|
}
|
|
|
|
$.ajax({
|
|
url:"/cgi-bin/koha/serials/showpredictionpattern.pl",
|
|
data: ajaxData,
|
|
success: function(data) {
|
|
$("#displayexample").html(data);
|
|
patternneedtobetested = 0;
|
|
}
|
|
});
|
|
}
|
|
|
|
function saveAdvancedPattern() {
|
|
if ($("#patternname").val().length == 0) {
|
|
alert(_("Please enter a name for this pattern"));
|
|
return false;
|
|
}
|
|
|
|
// Check if patternname already exists, and modify pattern
|
|
// instead of creating it if so
|
|
var found = 0;
|
|
$("#numberpattern option").each(function(){
|
|
if($(this).text() == $("#patternname").val()){
|
|
found = 1;
|
|
return false;
|
|
}
|
|
});
|
|
var cnfrm = 1;
|
|
if(found){
|
|
var msg = _("This pattern name already exists. Do you want to modify it?")
|
|
+ "\n" + _("Warning: it will modify the pattern for all subscriptions")
|
|
+ _("that are using it.");
|
|
cnfrm = confirm(msg);
|
|
}
|
|
|
|
if(cnfrm) {
|
|
var ajaxData = {};
|
|
var ajaxParams = [
|
|
'patternname', 'numberingmethod', 'label1', 'label2', 'label3',
|
|
'add1', 'add2', 'add3', 'every1', 'every2', 'every3',
|
|
'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
|
|
'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
|
|
];
|
|
for(i in ajaxParams) {
|
|
var param = ajaxParams[i];
|
|
var value = $("#"+param).val();
|
|
if(value.length > 0)
|
|
ajaxData[param] = value;
|
|
}
|
|
|
|
$.getJSON(
|
|
"/cgi-bin/koha/serials/create-numberpattern.pl",
|
|
ajaxData,
|
|
function(data){
|
|
if (data.numberpatternid) {
|
|
if(found == 0){
|
|
$("#numberpattern").append("<option value=\""+data.numberpatternid+"\">"+$("#patternname").val()+"</option>");
|
|
}
|
|
$("#numberpattern").val(data.numberpatternid);
|
|
numberpatternload();
|
|
} else {
|
|
alert(_("Something went wrong. Unable to create a new numbering pattern."));
|
|
}
|
|
}
|
|
);
|
|
}
|
|
}
|
|
|
|
function show_page_1() {
|
|
$("#page_1").show();
|
|
$("#page_2").hide();
|
|
$("#page_number").text("1/2");
|
|
}
|
|
|
|
function show_page_2() {
|
|
$("#page_1").hide();
|
|
$("#page_2").show();
|
|
$("#page_number").text("2/2");
|
|
displaymoreoptions();
|
|
}
|
|
|
|
|
|
$(document).ready(function() {
|
|
$("select#frequency").change(function(){
|
|
patternneedtobetested = 1;
|
|
$("input[name='enddate']").val('');
|
|
frequencyload();
|
|
});
|
|
$("select#numberpattern").change(function(){
|
|
patternneedtobetested = 1;
|
|
numberpatternload();
|
|
});
|
|
$("#subtype").change(function(){
|
|
$("input[name='enddate']").val('');
|
|
});
|
|
$("#sublength").change(function(){
|
|
$("input[name='enddate']").val('');
|
|
});
|
|
$("#lastvaluetemp1").keyup(function(){
|
|
$("#lastvalue1").val($(this).val());
|
|
});
|
|
$("#lastvaluetemp2").keyup(function(){
|
|
$("#lastvalue2").val($(this).val());
|
|
});
|
|
$("#lastvaluetemp3").keyup(function(){
|
|
$("#lastvalue3").val($(this).val());
|
|
});
|
|
$("#lastvalue1").keyup(function(){
|
|
$("#lastvaluetemp1").val($(this).val());
|
|
});
|
|
$("#lastvalue2").keyup(function(){
|
|
$("#lastvaluetemp2").val($(this).val());
|
|
});
|
|
$("#lastvalue3").keyup(function(){
|
|
$("#lastvaluetemp3").val($(this).val());
|
|
});
|
|
|
|
$("#innerlooptemp1").keyup(function(){
|
|
$("#innerloop1").val($(this).val());
|
|
});
|
|
$("#innerlooptemp2").keyup(function(){
|
|
$("#innerloop2").val($(this).val());
|
|
});
|
|
$("#innerlooptemp3").keyup(function(){
|
|
$("#innerloop3").val($(this).val());
|
|
});
|
|
$("#innerloop1").keyup(function(){
|
|
$("#innerlooptemp1").val($(this).val());
|
|
});
|
|
$("#innerloop2").keyup(function(){
|
|
$("#innerlooptemp2").val($(this).val());
|
|
});
|
|
$("#innerloop3").keyup(function(){
|
|
$("#innerlooptemp3").val($(this).val());
|
|
});
|
|
|
|
if($("#frequency").val() != ""){
|
|
frequencyload();
|
|
}
|
|
if($("#numberpattern").val() != ""){
|
|
numberpatternload();
|
|
}
|
|
|
|
var node;
|
|
[% FOREACH field IN dont_export_field_loop %]
|
|
node = $("#[% field.fieldid %]");
|
|
if ( $(node).is('input') || $(node).is('textarea') ) {
|
|
$(node).val("");
|
|
} else if ( $(node).is('select') ) {
|
|
$(node).find("option:first").attr('selected','selected');
|
|
}
|
|
[% END %]
|
|
|
|
show_page_1();
|
|
});
|
|
//]]>
|
|
</script>
|
|
</head>
|
|
<body id="ser_subscription-add" class="ser">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'serials-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › [% IF ( modify ) %]<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscriptionid %]"><i>[% bibliotitle |html %]</i></a> › Modify subscription[% ELSE %]New subscription[% END %]</div>
|
|
|
|
<div id="doc3" class="yui-t7">
|
|
<div id="bd">
|
|
<div class="yui-g">
|
|
<h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %] (<span id="page_number">1/2</span>)</h1>
|
|
<form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
|
|
[% IF ( modify ) %]
|
|
<input type="hidden" name="op" value="modsubscription" />
|
|
<input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
|
|
[% ELSE %]
|
|
<input type="hidden" name="op" value="addsubscription" />
|
|
[% END %]
|
|
<input type="hidden" name="user" value="[% loggedinusername %]" />
|
|
<input type="hidden" name="irreg_check" value="0" />
|
|
|
|
<div id="page_1">
|
|
<div class="yui-u first">
|
|
<fieldset id="subscription_add_information" class="rows">
|
|
<legend>Subscription details</legend>
|
|
<ol>
|
|
[% IF ( subscriptionid ) %]
|
|
<li><span class="label">Subscription #</span> [% subscriptionid %]</li>
|
|
[% END %]
|
|
<li>
|
|
<label for="aqbooksellerid">Vendor: </label>
|
|
<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>
|
|
</li>
|
|
<li>
|
|
<label for="biblionumber" class="required" title="Subscriptions must be associated with a bibliographic record">Biblio:</label>
|
|
<input type="text" name="biblionumber" id="biblionumber" value="[% bibnum %]" size="8" />
|
|
(<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>
|
|
<div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for Biblio</a>
|
|
[% IF ( CAN_user_editcatalogue ) %]
|
|
[% IF ( modify ) %]
|
|
| <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit biblio</a>
|
|
[% ELSE %]
|
|
| <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a>
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
</li>
|
|
<li class="radio">
|
|
[% IF ( serialsadditems ) %]
|
|
<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>
|
|
<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>
|
|
[% ELSE %]
|
|
<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>
|
|
<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>
|
|
[% END %]
|
|
</li>
|
|
<li class="radio">
|
|
<p>When there is an irregular issue:</p>
|
|
[% IF (skip_serialseq) %]
|
|
<p>
|
|
<input type="radio" id="skip_serialseq_yes" name="skip_serialseq" value="1" checked="checked" />
|
|
<label for="skip_serialseq_yes">Skip issue number</label>
|
|
</p>
|
|
<p>
|
|
<input type="radio" id="skip_serialseq_no" name="skip_serialseq" value="0" />
|
|
<label for="skip_serialseq_no">Keep issue number</label>
|
|
</p>
|
|
[% ELSE %]
|
|
<p>
|
|
<input type="radio" id="skip_serialseq_yes" name="skip_serialseq" value="1" />
|
|
<label for="skip_serialseq_yes">Skip issue number</label>
|
|
</p>
|
|
<p>
|
|
<input type="radio" id="skip_serialseq_no" name="skip_serialseq" value="0" checked="checked" />
|
|
<label for="skip_serialseq_no">Keep issue number</label>
|
|
</p>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<label for="manualhistory">Manual history</label>
|
|
[% IF (manualhistory) %]
|
|
<input type="checkbox" id="manualhistory" name="manualhist" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" id="manualhistory" name="manualhist" />
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<label for="callnumber">Call number</label>
|
|
<input type="text" name="callnumber" id="callnumber" value="[% callnumber %]" size="20" />
|
|
</li>
|
|
<li>
|
|
<label for="branchcode">Library:</label>
|
|
<select name="branchcode" id="branchcode" style="width: 20em;">
|
|
[% UNLESS ( Independentbranches ) %]
|
|
<option value="">None</option>
|
|
[% END %]
|
|
[% FOREACH branchloo IN branchloop %]
|
|
[% IF ( branchloo.selected ) %]
|
|
<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
|
|
[% ELSE %]
|
|
<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select> (select a library)
|
|
</li>
|
|
<li>
|
|
<label for="notes">Public note:</label>
|
|
<textarea name="notes" id="notes" cols="30" rows="2">[% notes %]</textarea>
|
|
</li>
|
|
<li>
|
|
<label for="internalnotes">Nonpublic note:</label>
|
|
<textarea name="internalnotes" id="internalnotes" cols="30" rows="2">[% internalnotes %]</textarea>
|
|
</li>
|
|
<li>
|
|
[% IF ( letterloop ) %]
|
|
<label for="letter">Patron notification: </label>
|
|
<select name="letter" id="letter">
|
|
<option value="">None</option>
|
|
[% FOREACH letterloo IN letterloop %]
|
|
[% IF ( letterloo.selected ) %]
|
|
<option value="[% letterloo.value %]" selected="selected">[% letterloo.lettername %]</option>
|
|
[% ELSE %]
|
|
<option value="[% letterloo.value %]">[% letterloo.lettername %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
<div class="hint">Select a notice and patrons on the routing list will be notified when new issues are received.</div>
|
|
[% ELSE %]
|
|
<span class="label">Patron notification: </span>
|
|
<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>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<label for="location">Location:</label>
|
|
<select name="location" id="location">
|
|
<option value="">None</option>
|
|
[% FOREACH locations_loo IN locations_loop %]
|
|
[% IF ( locations_loo.selected ) %]
|
|
<option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>
|
|
[% ELSE %]
|
|
<option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="graceperiod">Grace period:</label>
|
|
<input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod %]" size="5"/> day(s)
|
|
</li>
|
|
<li>
|
|
<label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
|
|
<input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount %]" size="4"/>
|
|
</li>
|
|
<li>
|
|
<label class="widelabel" for="opacdisplaycount">Number of issues to display to the public: </label>
|
|
<input type="text" name="opacdisplaycount" id="opacdisplaycount" value="[% opacdisplaycount %]" size="4"/>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="button" value="Next >>" onclick="if ( Check_page1() ) show_page_2();" style="float:right;" />
|
|
</fieldset>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="page_2">
|
|
<div class="yui-u first">
|
|
<div id="subscription_form_planning">
|
|
<fieldset class="rows">
|
|
<legend>Serials planning</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="firstacquidate">First issue publication date: (*)</label>
|
|
[% UNLESS (more_than_one_serial) %]
|
|
<input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]" class="datepicker" readonly="readonly"/>
|
|
[% ELSE %]
|
|
[% firstacquidate | $KohaDates %]
|
|
<input type="hidden" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]"/>
|
|
[% END %]
|
|
</li>
|
|
[% IF (more_than_one_serial) %]
|
|
<li>
|
|
<label for="nextacquidate">Next issue publication date:</label>
|
|
<input type="text" size="10" id="nextacquidate" name="nextacquidate" value="[% nextacquidate | $KohaDates %]" class="datepicker" readonly="readonly"/>
|
|
</li>
|
|
[% END %]
|
|
<li>
|
|
<label for="frequency">Frequency: (*)</label>
|
|
<select name="frequency" size="1" id="frequency">
|
|
<option value="">-- please choose --</option>
|
|
[% FOREACH frequency IN frequencies %]
|
|
[% IF (frequency.selected) %]
|
|
<option value="[% frequency.id %]" selected="selected">
|
|
[% ELSE %]
|
|
<option value="[% frequency.id %]">
|
|
[% END %]
|
|
[% frequency.label %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="subtype">Subscription length:</label>
|
|
<select name="subtype" id="subtype">
|
|
[% FOREACH subt IN subtype %]
|
|
[% IF (subt.selected) %]
|
|
<option value="[% subt.name %]" selected="selected">
|
|
[% ELSE %]
|
|
<option value="[% subt.name %]">
|
|
[% END %]
|
|
[% subt.name %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
<input type="text" name="sublength" id="sublength" value="[% sublength %]" size="3" /> (enter amount in numerals)
|
|
<input type="hidden" name="issuelengthcount">
|
|
</li>
|
|
<li>
|
|
<label for="startdate"> Subscription start date: (*)</label>
|
|
<input type="text" size="10" id="from" name="startdate" value="[% startdate | $KohaDates %]" class="datepickerfrom" readonly="readonly"/>
|
|
</li>
|
|
<li>
|
|
<label for="enddate">Subscription end date:</label>
|
|
<input type="text" size="10" id="to" name="enddate" value="[% enddate | $KohaDates %]" class="datepickerto" readonly="readonly"/>
|
|
</li>
|
|
<li>
|
|
<label for="numberpattern">Numbering pattern:</label>
|
|
<select name="numbering_pattern" size="1" id="numberpattern">
|
|
<option value="">-- please choose --</option>
|
|
[% FOREACH numberpattern IN numberpatterns %]
|
|
[% IF (numberpattern.selected) %]
|
|
<option value="[% numberpattern.id %]">
|
|
[% ELSE %]
|
|
<option value="[% numberpattern.id %]">
|
|
[% END %]
|
|
[% numberpattern.label %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="locale">Locale</label>
|
|
<select id="locale" name="locale">
|
|
<option value=""></option>
|
|
[% FOREACH locale IN locales %]
|
|
<option value="[% locale %]">
|
|
[% locale %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
<span class="hint">If empty, system locale is used</span>
|
|
</li>
|
|
<li id="more_options">
|
|
<table id="moreoptionst">
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th id="headerX"> </th>
|
|
<th id="headerY"> </th>
|
|
<th id="headerZ"> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
[% IF (more_than_one_serial) %]
|
|
Last value
|
|
[% ELSE %]
|
|
Begins with
|
|
[% END %]
|
|
</td>
|
|
<td id="beginsX"><input type="text" id="lastvaluetemp1" name="lastvaluetemp1" value="[% lastvalue1 %]" /></td>
|
|
<td id="beginsY"><input type="text" id="lastvaluetemp2" name="lastvaluetemp2" value="[% lastvalue2 %]" /></td>
|
|
<td id="beginsZ"><input type="text" id="lastvaluetemp3" name="lastvaluetemp3" value="[% lastvalue3 %]" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Inner counter</td>
|
|
<td id="innerX"><input type="text" id="innerlooptemp1" name="innerlooptemp1" value="[% innerloop1 %]" /></td>
|
|
<td id="innerY"><input type="text" id="innerlooptemp2" name="innerlooptemp2" value="[% innerloop2 %]" /></td>
|
|
<td id="innerZ"><input type="text" id="innerlooptemp3" name="innerlooptemp3" value="[% innerloop3 %]" /></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</li>
|
|
<li><a style="cursor:pointer" onclick="toggleAdvancedPattern();">Show/Hide advanced pattern</a></li>
|
|
<div id="advancedpredictionpattern" style="display:none">
|
|
<li>
|
|
<label for="patternname">Pattern name: (*)</label>
|
|
<input id="patternname" name="patternname" type="text" readonly="readonly" />
|
|
</li>
|
|
<li>
|
|
<label for="numberingmethod">Numbering formula:</label>
|
|
<input readonly="readonly" type="text" name="numberingmethod" id="numberingmethod" size="50" value="[% numberingmethod %]" />
|
|
</li>
|
|
<table id="advancedpredictionpatternt">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="4">Advanced prediction pattern</td>
|
|
</tr>
|
|
<tr>
|
|
<th> </th>
|
|
<th>X</th>
|
|
<th>Y</th>
|
|
<th>Z</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Label</td>
|
|
<td><input type="text" readonly="readonly" id="label1" name="label1" /></td>
|
|
<td><input type="text" readonly="readonly" id="label2" name="label2" /></td>
|
|
<td><input type="text" readonly="readonly" id="label3" name="label3" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Begins with</td>
|
|
<td><input type="text" readonly="readonly" id="lastvalue1" name="lastvalue1" /></td>
|
|
<td><input type="text" readonly="readonly" id="lastvalue2" name="lastvalue2" /></td>
|
|
<td><input type="text" readonly="readonly" id="lastvalue3" name="lastvalue3" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Add</td>
|
|
<td><input type="text" readonly="readonly" id="add1" name="add1" /></td>
|
|
<td><input type="text" readonly="readonly" id="add2" name="add2" /></td>
|
|
<td><input type="text" readonly="readonly" id="add3" name="add3" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Every</td>
|
|
<td><input type="text" readonly="readonly" id="every1" name="every1" /></td>
|
|
<td><input type="text" readonly="readonly" id="every2" name="every2" /></td>
|
|
<td><input type="text" readonly="readonly" id="every3" name="every3" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Set back to</td>
|
|
<td><input type="text" readonly="readonly" id="setto1" name="setto1" /></td>
|
|
<td><input type="text" readonly="readonly" id="setto2" name="setto2" /></td>
|
|
<td><input type="text" readonly="readonly" id="setto3" name="setto3" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>When more than</td>
|
|
<td><input type="text" readonly="readonly" id="whenmorethan1" name="whenmorethan1" /></td>
|
|
<td><input type="text" readonly="readonly" id="whenmorethan2" name="whenmorethan2" /></td>
|
|
<td><input type="text" readonly="readonly" id="whenmorethan3" name="whenmorethan3" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td>Inner counter</td>
|
|
<td><input type="text" readonly="readonly" id="innerloop1" name="innerloop1" /></td>
|
|
<td><input type="text" readonly="readonly" id="innerloop2" name="innerloop2" /></td>
|
|
<td><input type="text" readonly="readonly" id="innerloop3" name="innerloop3" /></td>
|
|
</tr>
|
|
<tr>
|
|
[% BLOCK numbering_select %]
|
|
<select disabled="disabled" id="[% name %]" name="[% name %]" />
|
|
<option value=""></option>
|
|
<option value="dayname">Name of day</option>
|
|
<option value="monthname">Name of month</option>
|
|
<option value="season">Name of season</option>
|
|
</select>
|
|
[% END %]
|
|
<td>Formatting</td>
|
|
<td>[% PROCESS numbering_select name="numbering1" %]</td>
|
|
<td>[% PROCESS numbering_select name="numbering2" %]</td>
|
|
<td>[% PROCESS numbering_select name="numbering3" %]</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<input id="modifyadvancedpatternbutton" type="button" value="Modify pattern" onclick="modifyAdvancedPattern();" />
|
|
<input id="restoreadvancedpatternbutton" type="button" value="Cancel modifications" onclick="restoreAdvancedPattern();" style="display:none" />
|
|
<input id="saveadvancedpatternbutton" type="button" value="Save as new pattern" onclick="saveAdvancedPattern();" style="display:none" />
|
|
</div>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="button" value="<< Previous" onclick="show_page_1();" style="float:left;"/>
|
|
<input id="testpatternbutton" type="button" value="Test prediction pattern" onclick="testPredictionPattern();" />
|
|
<input type="button" value="Save subscription" onclick="if (Check_page2()) submit();" style="float:right;" accesskey="w" />
|
|
</fieldset>
|
|
</div>
|
|
</div>
|
|
<div class="yui-u">
|
|
<li id="displayexample"></li>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|