View | Details | Raw Unified | Return to bug 6305
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc (-2 / +2 lines)
Lines 18-24 Link Here
18
    [% IF ( subscriptionid ) %]
18
    [% IF ( subscriptionid ) %]
19
	    var editmenu = [
19
	    var editmenu = [
20
	        [% IF ( CAN_user_serials_edit_subscription ) %]
20
	        [% IF ( CAN_user_serials_edit_subscription ) %]
21
		    { text: _("Edit Subscription"),  [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=mod&subscriptionid=[% subscriptionid %]" },
21
		    { text: _("Edit Subscription"),  [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=[% subscriptionid %]" },
22
		[% END %]
22
		[% END %]
23
	        [% IF ( CAN_user_serials_create_subscription ) %]
23
	        [% IF ( CAN_user_serials_create_subscription ) %]
24
		    { text: _("Edit as New (Duplicate)"), [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=[% subscriptionid %]" },
24
		    { text: _("Edit as New (Duplicate)"), [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=dup&subscriptionid=[% subscriptionid %]" },
Lines 69-75 onclick: {fn:function(){popup([% subscriptionid %])}} Link Here
69
69
70
	    [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
70
	    [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
71
		[% UNLESS ( cannotedit ) %]
71
		[% UNLESS ( cannotedit ) %]
72
		    <li id="editmenuc"><a id="edit" href="/cgi-bin/koha/serials/subscription-add.pl?op=mod&amp;subscriptionid=[% subscriptionid %]">Edit</a></li>
72
		    <li id="editmenuc"><a id="edit" href="/cgi-bin/koha/serials/subscription-add.pl?op=modify&amp;subscriptionid=[% subscriptionid %]">Edit</a></li>
73
		[% END %]
73
		[% END %]
74
	    [% END %]
74
	    [% END %]
75
75
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-14 / +14 lines)
Lines 1-5 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Serials &rsaquo; [% IF ( modname ) %][% bibliotitle |html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
2
<title>Koha &rsaquo; Serials &rsaquo; [% IF ( modify ) %][% bibliotitle |html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'calendar.inc' %]
4
[% INCLUDE 'calendar.inc' %]
5
5
Lines 931-937 $(document).ready(function() { Link Here
931
	}
931
	}
932
	);
932
	);
933
   //  $(".widelabel").attr("width", "300px");  // labels stay skinny in IE7 anyway.
933
   //  $(".widelabel").attr("width", "300px");  // labels stay skinny in IE7 anyway.
934
[% IF ( modname ) %]
934
[% IF ( modify ) %]
935
    set_num_pattern_from_template_vars();
935
    set_num_pattern_from_template_vars();
936
    [% IF ( hemisphere ) %]
936
    [% IF ( hemisphere ) %]
937
	is_hemisphere = [% hemisphere %] ;
937
	is_hemisphere = [% hemisphere %] ;
Lines 952-966 $(document).ready(function() { Link Here
952
[% INCLUDE 'header.inc' %]
952
[% INCLUDE 'header.inc' %]
953
[% INCLUDE 'serials-search.inc' %]
953
[% INCLUDE 'serials-search.inc' %]
954
954
955
<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 ( modname ) %]<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscriptionid %]"><i>[% bibliotitle |html %]</i></a> &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</div>
955
<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>
956
956
957
<div id="doc3" class="yui-t7">
957
<div id="doc3" class="yui-t7">
958
   
958
   
959
   <div id="bd">
959
   <div id="bd">
960
<h1>[% IF ( modname ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %]</h1>
960
<h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %]</h1>
961
   <div class="yui-g">
961
   <div class="yui-g">
962
    <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
962
    <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
963
[% IF ( modname ) %]
963
[% IF ( modify ) %]
964
        <input type="hidden" name="op" value="modsubscription" />
964
        <input type="hidden" name="op" value="modsubscription" />
965
        <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
965
        <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
966
[% ELSE %]
966
[% ELSE %]
Lines 988-994 $(document).ready(function() { Link Here
988
                (<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>
988
                (<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>
989
               <div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for Biblio</a>
989
               <div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for Biblio</a>
990
		    [% IF ( CAN_user_editcatalogue ) %] 
990
		    [% IF ( CAN_user_editcatalogue ) %] 
991
		       [% IF ( modname ) %]
991
		       [% IF ( modify ) %]
992
		       | <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit biblio</a>
992
		       | <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit biblio</a>
993
		       [% ELSE %]
993
		       [% ELSE %]
994
		       | <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a>
994
		       | <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a>
Lines 1107-1116 $(document).ready(function() { Link Here
1107
    <ol>
1107
    <ol>
1108
        <li>
1108
        <li>
1109
           <label for="acqui_date"> First issue publication date:</label>
1109
           <label for="acqui_date"> First issue publication date:</label>
1110
                [% UNLESS ( modname ) %]<img src="[% themelang %]/lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />[% END %]
1110
                [% UNLESS ( modify ) %]<img src="[% themelang %]/lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />[% END %]
1111
                <input type="text" name="firstacquidate" value="[% firstacquidate %]"  size="13" maxlength="10" id="acqui_date" [% IF ( modname ) %]disabled="disabled"[% END %] style="border-width: 0px;"  />
1111
                <input type="text" name="firstacquidate" value="[% firstacquidate %]"  size="13" maxlength="10" id="acqui_date" [% IF ( modify ) %]disabled="disabled"[% END %] style="border-width: 0px;"  />
1112
        </li>
1112
        </li>
1113
           [% IF ( modname ) %]<li><label for="next_acqui_date"> Next issue publication date:</label>
1113
           [% IF ( modify ) %]<li><label for="next_acqui_date"> Next issue publication date:</label>
1114
                <img src="[% themelang %]/lib/calendar/cal.gif" id="next_acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
1114
                <img src="[% themelang %]/lib/calendar/cal.gif" id="next_acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
1115
                <input type="text" name="nextacquidate" value="[% nextacquidate %]" size="13" maxlength="10" id="next_acqui_date" style="border-width: 0px;"  />
1115
                <input type="text" name="nextacquidate" value="[% nextacquidate %]" size="13" maxlength="10" id="next_acqui_date" style="border-width: 0px;"  />
1116
                </li>[% END %]
1116
                </li>[% END %]
Lines 1118-1126 $(document).ready(function() { Link Here
1118
        <li><!-- both scripts for calendar must follow the input field --> 
1118
        <li><!-- both scripts for calendar must follow the input field --> 
1119
                <script type="text/javascript">
1119
                <script type="text/javascript">
1120
                    Calendar.setup({
1120
                    Calendar.setup({
1121
                        inputField      :   "[% IF ( modname ) %]next_[% END %]acqui_date",
1121
                        inputField      :   "[% IF ( modify ) %]next_[% END %]acqui_date",
1122
                        ifFormat       :   "[% DHTMLcalendar_dateformat %]",
1122
                        ifFormat       :   "[% DHTMLcalendar_dateformat %]",
1123
                        button         :   "[% IF ( modname ) %]next_[% END %]acqui_button",
1123
                        button         :   "[% IF ( modify ) %]next_[% END %]acqui_button",
1124
                        align          :   "Tl",
1124
                        align          :   "Tl",
1125
                        onUpdate        :    function(cal) { 
1125
                        onUpdate        :    function(cal) { 
1126
                                                             irregular_issues.weeks = getWeeksArray(cal.date);
1126
                                                             irregular_issues.weeks = getWeeksArray(cal.date);
Lines 1134-1142 $(document).ready(function() { Link Here
1134
                                                        } 
1134
                                                        } 
1135
                        });
1135
                        });
1136
                    Calendar.setup({
1136
                    Calendar.setup({
1137
                        inputField      :   "[% IF ( modname ) %]next_[% END %]acqui_date",
1137
                        inputField      :   "[% IF ( modify ) %]next_[% END %]acqui_date",
1138
                        ifFormat       :   "[% DHTMLcalendar_dateformat %]",
1138
                        ifFormat       :   "[% DHTMLcalendar_dateformat %]",
1139
                        button         :   "[% IF ( modname ) %]next_[% END %]acqui_date",
1139
                        button         :   "[% IF ( modify ) %]next_[% END %]acqui_date",
1140
                        align          :   "Tl",
1140
                        align          :   "Tl",
1141
                        onUpdate        :    function(cal) { irregular_issues.weeks = getWeeksArray(cal.date);
1141
                        onUpdate        :    function(cal) { irregular_issues.weeks = getWeeksArray(cal.date);
1142
                                                            irregular_issues.firstissue = cal.date;
1142
                                                            irregular_issues.firstissue = cal.date;
Lines 1404-1410 $(document).ready(function() { Link Here
1404
                </tr>
1404
                </tr>
1405
                <tr>
1405
                <tr>
1406
                    <td>
1406
                    <td>
1407
                        [% IF ( modname ) %]
1407
                        [% IF ( modify ) %]
1408
                            Last value
1408
                            Last value
1409
                        [% ELSE %]
1409
                        [% ELSE %]
1410
                            Begins with
1410
                            Begins with
(-)a/serials/subscription-add.pl (-7 / +6 lines)
Lines 43-49 my @budgets; Link Here
43
43
44
# Permission needed if it is a modification : edit_subscription
44
# Permission needed if it is a modification : edit_subscription
45
# Permission needed otherwise (nothing or dup) : create_subscription
45
# Permission needed otherwise (nothing or dup) : create_subscription
46
my $permission = ($op eq "mod") ? "edit_subscription" : "create_subscription";
46
my $permission = ($op eq "modify") ? "edit_subscription" : "create_subscription";
47
47
48
my ($template, $loggedinuser, $cookie)
48
my ($template, $loggedinuser, $cookie)
49
= get_template_and_user({template_name => "serials/subscription-add.tmpl",
49
= get_template_and_user({template_name => "serials/subscription-add.tmpl",
Lines 66-77 my $subs; Link Here
66
my $firstissuedate;
66
my $firstissuedate;
67
my $nextexpected;
67
my $nextexpected;
68
68
69
if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
69
if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
70
70
71
    my $subscriptionid = $query->param('subscriptionid');
71
    my $subscriptionid = $query->param('subscriptionid');
72
    $subs = GetSubscription($subscriptionid);
72
    $subs = GetSubscription($subscriptionid);
73
## FIXME : Check rights to edit if mod. Could/Should display an error message.
73
## FIXME : Check rights to edit if mod. Could/Should display an error message.
74
    if ($subs->{'cannotedit'} && $op eq 'mod'){
74
    if ($subs->{'cannotedit'} && $op eq 'modify'){
75
      carp "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
75
      carp "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
76
      print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
76
      print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
77
    }
77
    }
Lines 91-97 if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') { Link Here
91
    letter_loop($subs->{'letter'}, $template);
91
    letter_loop($subs->{'letter'}, $template);
92
    $nextexpected = GetNextExpected($subscriptionid);
92
    $nextexpected = GetNextExpected($subscriptionid);
93
    $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate}->output('iso') eq $firstissuedate ;
93
    $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate}->output('iso') eq $firstissuedate ;
94
    $subs->{nextacquidate} = $nextexpected->{planneddate}->output()  if($op eq 'mod');
94
    $subs->{nextacquidate} = $nextexpected->{planneddate}->output()  if($op eq 'modify');
95
    unless($op eq 'modsubscription') {
95
    unless($op eq 'modsubscription') {
96
		foreach my $length_unit qw(numberlength weeklength monthlength){
96
		foreach my $length_unit qw(numberlength weeklength monthlength){
97
			if ($subs->{$length_unit}){
97
			if ($subs->{$length_unit}){
Lines 107-113 if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') { Link Here
107
                    $op => 1,
107
                    $op => 1,
108
                    "subtype_$sub_on" => 1,
108
                    "subtype_$sub_on" => 1,
109
                    sublength =>$sub_length,
109
                    sublength =>$sub_length,
110
                    history => ($op eq 'mod'),
110
                    history => ($op eq 'modify'),
111
                    "periodicity".$subs->{'periodicity'} => 1,
111
                    "periodicity".$subs->{'periodicity'} => 1,
112
                    "numberpattern".$subs->{'numberpattern'} => 1,
112
                    "numberpattern".$subs->{'numberpattern'} => 1,
113
                    firstacquiyear => substr($firstissuedate,0,4),
113
                    firstacquiyear => substr($firstissuedate,0,4),
Lines 160-166 if ($op eq 'addsubscription') { Link Here
160
        }
160
        }
161
    $template->param(subtype => \@sub_type_data);
161
    $template->param(subtype => \@sub_type_data);
162
162
163
    letter_loop( '', $template ) if ($op ne 'modsubscription' && $op ne 'dup' && $op ne 'mod');
163
    letter_loop( '', $template ) if ($op ne 'modsubscription' && $op ne 'dup' && $op ne 'modify');
164
164
165
    my $new_biblionumber = $query->param('biblionumber_for_new_subscription');
165
    my $new_biblionumber = $query->param('biblionumber_for_new_subscription');
166
    if (defined $new_biblionumber) {
166
    if (defined $new_biblionumber) {
167
- 

Return to bug 6305