324be43352
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
215 lines
7.8 KiB
Text
215 lines
7.8 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Serials › Frequencies</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
function confirmDelete() {
|
|
return confirm(_("Are you sure you want to delete this subscription frequency?"));
|
|
}
|
|
|
|
function check_form() {
|
|
var description = $("#description").val();
|
|
var unit = $("#unit").val();
|
|
var issuesperunit = $("#issuesperunit").val();
|
|
var unitsperissue = $("#unitsperissue").val();
|
|
var alert_msg = _("Some fields are not valid:") + "\n";
|
|
var errors = 0;
|
|
|
|
if(description.length == 0) {
|
|
alert_msg += "\t - " + _("Description is required");
|
|
errors ++;
|
|
}
|
|
if(unit.length > 0) {
|
|
if(isNaN(issuesperunit) || issuesperunit == 0) {
|
|
alert_msg += "\n\t - " + _("Issues per unit is required")
|
|
+ " " + _("(must be a number greater than 0)");
|
|
errors ++;
|
|
}
|
|
if(isNaN(unitsperissue) || unitsperissue == 0) {
|
|
alert_msg += "\n\t - " + _("Units per issue is required")
|
|
+ " " + _("(must be a number greater than 0)");
|
|
errors ++;
|
|
}
|
|
if(issuesperunit > 1 && unitsperissue > 1) {
|
|
alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
|
|
errors ++;
|
|
}
|
|
}
|
|
|
|
if(errors == 0) {
|
|
return true;
|
|
}
|
|
|
|
alert(alert_msg);
|
|
return false;
|
|
}
|
|
|
|
function show_blocking_subs() {
|
|
$("#blocking_subs").show();
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
$("#issuesperunit").change(function() {
|
|
var value = $(this).val();
|
|
if(!isNaN(value) && value > 1) {
|
|
$("#unitsperissue").val(1);
|
|
}
|
|
});
|
|
$("#unitsperissue").change(function() {
|
|
var value = $(this).val();
|
|
if(!isNaN(value) && value > 1) {
|
|
$("#issuesperunit").val(1);
|
|
}
|
|
});
|
|
});
|
|
//]]>
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
[% 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> ›
|
|
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl">Frequencies</a>
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% IF (new or modify) %]
|
|
[% IF (new) %]
|
|
<h1>New frequency</h1>
|
|
[% ELSE %]
|
|
<h1>Modify frequency: [% description %]</h1>
|
|
[% END %]
|
|
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="post" onsubmit="return check_form();">
|
|
[% IF (modify) %]
|
|
<input type="hidden" name="id" value="[% id %]" />
|
|
<input type="hidden" name="op" value="savemod" />
|
|
[% ELSE %]
|
|
<input type="hidden" name="op" value="savenew" />
|
|
[% END %]
|
|
<fieldset class="rows">
|
|
<ol>
|
|
<li>
|
|
<label for="description">Description:</label>
|
|
<input type="text" id="description" name="description" value="[% description %]" />
|
|
</li>
|
|
<li>
|
|
<label for="unit">Unit</label>
|
|
<select id="unit" name="unit">
|
|
<option value="">None</option>
|
|
[% FOREACH unit IN units_loop %]
|
|
[% IF (unit.selected) %]
|
|
<option selected="selected" value="[% unit.val %]">
|
|
[% ELSE %]
|
|
<option value="[% unit.val %]">
|
|
[% END %]
|
|
[% unit.val %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li><span class="hint">Note: one of the two following fields must be equal to 1</span></li>
|
|
<li>
|
|
<label for="issuesperunit">Issues per unit</label>
|
|
[% IF (new) %]
|
|
<input type="text" id="issuesperunit" name="issuesperunit" value="1" size="3" />
|
|
[% ELSE %]
|
|
<input type="text" id="issuesperunit" name="issuesperunit" value="[% issuesperunit %]" size="3" />
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<label for="unitsperissue">Units per issue</label>
|
|
[% IF (new) %]
|
|
<input type="text" id="unitsperissue" name="unitsperissue" value="1" size="3" />
|
|
[% ELSE %]
|
|
<input type="text" id="unitsperissue" name="unitsperissue" value="[% unitsperissue %]" size="3" />
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<label for="displayorder">Display order</label>
|
|
<input type="text" id="displayorder" name="displayorder" value="[% displayorder %]" size="3" />
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" value="Save" />
|
|
<input type="button" value="Cancel" onclick="window.location='/cgi-bin/koha/serials/subscription-frequencies.pl'" />
|
|
</fieldset>
|
|
</form>
|
|
[% ELSE %]
|
|
<h1>Frequencies</h1>
|
|
[% IF still_used %]
|
|
<div class="dialog">
|
|
<p>
|
|
This frequency is still used by [% subscriptions.size %]
|
|
subscription(s). Do you still want to delete it?
|
|
</p>
|
|
<p><a href="#" onclick="show_blocking_subs(); return false;">Show subscriptions</a></p>
|
|
<ul id="blocking_subs" style="display:none">
|
|
[% FOREACH sub IN subscriptions %]
|
|
<li style="list-style-type:none">
|
|
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid %]">[% sub.title %]</a>
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
|
|
<form action="" method="get">
|
|
<input type="hidden" name="op" value="del" />
|
|
<input type="hidden" name="confirm" value="1" />
|
|
<input type="hidden" name="frequencyid" value="[% frequencyid %]" />
|
|
<input type="submit" class="approve" value="Yes, delete" />
|
|
</form>
|
|
<form action="" method="get">
|
|
<input type="submit" class="deny" value="No, don't delete" />
|
|
</form>
|
|
</div>
|
|
[% END %]
|
|
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=new">New frequency</a>
|
|
|
|
[% IF (frequencies_loop.size) %]
|
|
<table id="frequenciest">
|
|
<thead>
|
|
<tr>
|
|
<th>Description</th>
|
|
<th>Unit</th>
|
|
<th>Issues per unit</th>
|
|
<th>Units per issue</th>
|
|
<th>Display order</th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH frequency IN frequencies_loop %]
|
|
<tr>
|
|
<td>[% frequency.description %]</td>
|
|
<td>[% frequency.unit %]</td>
|
|
<td>[% frequency.issuesperunit %]</td>
|
|
<td>[% frequency.unitsperissue %]</td>
|
|
<td>[% frequency.displayorder %]</td>
|
|
<td>
|
|
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=modify&frequencyid=[% frequency.id %]">Modify</a> |
|
|
<a href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=del&frequencyid=[% frequency.id %]">Delete</a>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
<p>There is no defined frequency.</p>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'serials-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|