Bug 6305: Subscriptions can not be edited
This seems to fix the problem with editing existing subscriptions. Please test.
Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit 3b297b0e44)
Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
parent
2cea53ba4b
commit
e0ce87ebaa
|
|
@ -18,7 +18,7 @@
|
|||
[% IF ( subscriptionid ) %]
|
||||
var editmenu = [
|
||||
[% IF ( CAN_user_serials_edit_subscription ) %]
|
||||
{ text: _("Edit Subscription"), [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=mod&subscriptionid=[% subscriptionid %]" },
|
||||
{ text: _("Edit Subscription"), [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=[% subscriptionid %]" },
|
||||
[% END %]
|
||||
[% IF ( CAN_user_serials_create_subscription ) %]
|
||||
{ text: _("Edit as New (Duplicate)"), [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=[% subscriptionid %]" },
|
||||
|
|
@ -69,7 +69,7 @@ onclick: {fn:function(){popup([% subscriptionid %])}}
|
|||
|
||||
[% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
|
||||
[% UNLESS ( cannotedit ) %]
|
||||
<li id="editmenuc"><a id="edit" href="/cgi-bin/koha/serials/subscription-add.pl?op=mod&subscriptionid=[% subscriptionid %]">Edit</a></li>
|
||||
<li id="editmenuc"><a id="edit" href="/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=[% subscriptionid %]">Edit</a></li>
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
<title>Koha › Serials › [% IF ( modname ) %][% bibliotitle |html %] › Modify subscription[% ELSE %]New subscription[% END %]</title>
|
||||
<title>Koha › Serials › [% IF ( modify ) %][% bibliotitle |html %] › Modify subscription[% ELSE %]New subscription[% END %]</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
|
||||
|
|
@ -931,7 +931,7 @@ $(document).ready(function() {
|
|||
}
|
||||
);
|
||||
// $(".widelabel").attr("width", "300px"); // labels stay skinny in IE7 anyway.
|
||||
[% IF ( modname ) %]
|
||||
[% IF ( modify ) %]
|
||||
set_num_pattern_from_template_vars();
|
||||
[% IF ( hemisphere ) %]
|
||||
is_hemisphere = [% hemisphere %] ;
|
||||
|
|
@ -952,15 +952,15 @@ $(document).ready(function() {
|
|||
[% 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 ( modname ) %]<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="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">
|
||||
<h1>[% IF ( modname ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %]</h1>
|
||||
<h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %]</h1>
|
||||
<div class="yui-g">
|
||||
<form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
|
||||
[% IF ( modname ) %]
|
||||
[% IF ( modify ) %]
|
||||
<input type="hidden" name="op" value="modsubscription" />
|
||||
<input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
|
||||
[% ELSE %]
|
||||
|
|
@ -988,7 +988,7 @@ $(document).ready(function() {
|
|||
(<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 ( modname ) %]
|
||||
[% IF ( modify ) %]
|
||||
| <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit biblio</a>
|
||||
[% ELSE %]
|
||||
| <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a>
|
||||
|
|
@ -1107,10 +1107,10 @@ $(document).ready(function() {
|
|||
<ol>
|
||||
<li>
|
||||
<label for="acqui_date"> First issue publication date:</label>
|
||||
[% UNLESS ( modname ) %]<img src="[% themelang %]/lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />[% END %]
|
||||
<input type="text" name="firstacquidate" value="[% firstacquidate %]" size="13" maxlength="10" id="acqui_date" [% IF ( modname ) %]disabled="disabled"[% END %] style="border-width: 0px;" />
|
||||
[% UNLESS ( modify ) %]<img src="[% themelang %]/lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />[% END %]
|
||||
<input type="text" name="firstacquidate" value="[% firstacquidate %]" size="13" maxlength="10" id="acqui_date" [% IF ( modify ) %]disabled="disabled"[% END %] style="border-width: 0px;" />
|
||||
</li>
|
||||
[% IF ( modname ) %]<li><label for="next_acqui_date"> Next issue publication date:</label>
|
||||
[% IF ( modify ) %]<li><label for="next_acqui_date"> Next issue publication date:</label>
|
||||
<img src="[% themelang %]/lib/calendar/cal.gif" id="next_acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
|
||||
<input type="text" name="nextacquidate" value="[% nextacquidate %]" size="13" maxlength="10" id="next_acqui_date" style="border-width: 0px;" />
|
||||
</li>[% END %]
|
||||
|
|
@ -1118,9 +1118,9 @@ $(document).ready(function() {
|
|||
<li><!-- both scripts for calendar must follow the input field -->
|
||||
<script type="text/javascript">
|
||||
Calendar.setup({
|
||||
inputField : "[% IF ( modname ) %]next_[% END %]acqui_date",
|
||||
inputField : "[% IF ( modify ) %]next_[% END %]acqui_date",
|
||||
ifFormat : "[% DHTMLcalendar_dateformat %]",
|
||||
button : "[% IF ( modname ) %]next_[% END %]acqui_button",
|
||||
button : "[% IF ( modify ) %]next_[% END %]acqui_button",
|
||||
align : "Tl",
|
||||
onUpdate : function(cal) {
|
||||
irregular_issues.weeks = getWeeksArray(cal.date);
|
||||
|
|
@ -1134,9 +1134,9 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
Calendar.setup({
|
||||
inputField : "[% IF ( modname ) %]next_[% END %]acqui_date",
|
||||
inputField : "[% IF ( modify ) %]next_[% END %]acqui_date",
|
||||
ifFormat : "[% DHTMLcalendar_dateformat %]",
|
||||
button : "[% IF ( modname ) %]next_[% END %]acqui_date",
|
||||
button : "[% IF ( modify ) %]next_[% END %]acqui_date",
|
||||
align : "Tl",
|
||||
onUpdate : function(cal) { irregular_issues.weeks = getWeeksArray(cal.date);
|
||||
irregular_issues.firstissue = cal.date;
|
||||
|
|
@ -1404,7 +1404,7 @@ $(document).ready(function() {
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
[% IF ( modname ) %]
|
||||
[% IF ( modify ) %]
|
||||
Last value
|
||||
[% ELSE %]
|
||||
Begins with
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ my @budgets;
|
|||
|
||||
# Permission needed if it is a modification : edit_subscription
|
||||
# Permission needed otherwise (nothing or dup) : create_subscription
|
||||
my $permission = ($op eq "mod") ? "edit_subscription" : "create_subscription";
|
||||
my $permission = ($op eq "modify") ? "edit_subscription" : "create_subscription";
|
||||
|
||||
my ($template, $loggedinuser, $cookie)
|
||||
= get_template_and_user({template_name => "serials/subscription-add.tmpl",
|
||||
|
|
@ -66,12 +66,12 @@ my $subs;
|
|||
my $firstissuedate;
|
||||
my $nextexpected;
|
||||
|
||||
if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
|
||||
if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
|
||||
|
||||
my $subscriptionid = $query->param('subscriptionid');
|
||||
$subs = GetSubscription($subscriptionid);
|
||||
## FIXME : Check rights to edit if mod. Could/Should display an error message.
|
||||
if ($subs->{'cannotedit'} && $op eq 'mod'){
|
||||
if ($subs->{'cannotedit'} && $op eq 'modify'){
|
||||
carp "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
|
||||
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
|
|||
letter_loop($subs->{'letter'}, $template);
|
||||
$nextexpected = GetNextExpected($subscriptionid);
|
||||
$nextexpected->{'isfirstissue'} = $nextexpected->{planneddate}->output('iso') eq $firstissuedate ;
|
||||
$subs->{nextacquidate} = $nextexpected->{planneddate}->output() if($op eq 'mod');
|
||||
$subs->{nextacquidate} = $nextexpected->{planneddate}->output() if($op eq 'modify');
|
||||
unless($op eq 'modsubscription') {
|
||||
foreach my $length_unit qw(numberlength weeklength monthlength){
|
||||
if ($subs->{$length_unit}){
|
||||
|
|
@ -107,7 +107,7 @@ if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
|
|||
$op => 1,
|
||||
"subtype_$sub_on" => 1,
|
||||
sublength =>$sub_length,
|
||||
history => ($op eq 'mod'),
|
||||
history => ($op eq 'modify'),
|
||||
"periodicity".$subs->{'periodicity'} => 1,
|
||||
"numberpattern".$subs->{'numberpattern'} => 1,
|
||||
firstacquiyear => substr($firstissuedate,0,4),
|
||||
|
|
@ -160,7 +160,7 @@ if ($op eq 'addsubscription') {
|
|||
}
|
||||
$template->param(subtype => \@sub_type_data);
|
||||
|
||||
letter_loop( '', $template ) if ($op ne 'modsubscription' && $op ne 'dup' && $op ne 'mod');
|
||||
letter_loop( '', $template ) if ($op ne 'modsubscription' && $op ne 'dup' && $op ne 'modify');
|
||||
|
||||
my $new_biblionumber = $query->param('biblionumber_for_new_subscription');
|
||||
if (defined $new_biblionumber) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue