Bugzilla – Attachment 102275 Details for
Bug 7046
subscription renewal period should be a pull down
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7046: Implemented subscription renewal dropdown sub length element
Bug-7046-Implemented-subscription-renewal-dropdown.patch (text/plain), 8.55 KB, created by
Alex Buckley
on 2020-04-02 09:18:06 UTC
(
hide
)
Description:
Bug 7046: Implemented subscription renewal dropdown sub length element
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2020-04-02 09:18:06 UTC
Size:
8.55 KB
patch
obsolete
>From 203a10d21832699cf7899127afc8657d61a73726 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 27 Nov 2017 15:31:35 +1300 >Subject: [PATCH] Bug 7046: Implemented subscription renewal dropdown sub > length element >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To make this work I moved the _get_sub_length function from >subscription-add.pl to C4/Serials.pm so that the subscription-renew.pl >script could also call it to store the sublength for the appropriate >field of the subscriptions database table. > >Test plan: >1. Create a subscription and notice that there is a dropdown box for sub >length containing the values: issues, weeks, months > >2. Renew the subscription and notice that there are 3 input text boxes: >'number of num', 'number of weeks' and 'number of months' > >3. Input a 'Number of weeks' value of 2 > >4. Query the subscription database table and notice that the value of 2 >has been stored in the weeklength field for the subscription record you >just renewed > >5. Apply the patch > >6. Renew the subscription and notice that there is now a sublength >dropdown box >containing issues, weeks and months > >7. Set the month value to 3 > >8. Query the database and notice that 3 was stored in the monthlength >field for the subscription record > >9. Create a new subscription and select the sub length values of issues >and 3 > >10. Query the database and notice that the numberlength field for the >subscription you just created is set to 3 showing that the sublength >dropbox is still working for creating a new subscription > >Sponsored-By: Catalyst IT > >Patch applies and functions as expected in line with test plan. >Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au> >--- > C4/Serials.pm | 18 +++++++ > .../prog/en/modules/serials/subscription-renew.tt | 59 ++++++++++++++++------ > serials/subscription-add.pl | 16 ++---- > serials/subscription-renew.pl | 4 ++ > 4 files changed, 69 insertions(+), 28 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index f56309e98c..9c9a5fbb5a 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1483,6 +1483,24 @@ sub NewSubscription { > return $subscriptionid; > } > >+=head2 _get_sub_length >+my ($numberlength, $weeklength, $monthlength) = _get_sub_length( $subtype, $sublength ); >+ >+this function calculates the subscription length. >+ >+=cut >+ >+sub _get_sub_length { >+ my ($type, $subtype, $length) = @_; >+ return >+ ( >+ $subtype eq 'issues' ? $length : 0, >+ $subtype eq 'weeks' ? $length : 0, >+ $subtype eq 'months' ? $length : 0, >+ ); >+} >+ >+ > =head2 ReNewSubscription > > ReNewSubscription($params); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt >index 603a0cd5c7..c57c7ac719 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-renew.tt >@@ -37,24 +37,53 @@ > </li> > <li><fieldset> > <legend>Subscription length:</legend> >- <ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% subscription.numberlength | html %]" /></li> >- <li><label for="weeklength">Number of weeks: </label><input type="text" id="weeklength" name="weeklength" value="[% subscription.weeklength | html %]" /></li> >- <li><label for="monthlength">Number of months: </label><input type="text" id="monthlength" name="monthlength" value="[% subscription.monthlength | html %]" /></li></ol></fieldset></li> >+ <select name="subtype" id="subtype"> >+ [% FOREACH st IN subtypes %] >+ [% SWITCH st %] >+ [% CASE 'numberlength'%] >+ [% IF st == subtype %] >+ <option value="issues" selected="selected"> >+ [% ELSE %] >+ <option value="issues"> >+ [% END %] >+ issues >+ [% CASE 'weeklength' %] >+ [% IF st == subtype %] >+ <option value="weeks" selected="selected"> >+ [% ELSE %] >+ <option value="weeks"> >+ [% END %] >+ weeks >+ [% CASE 'monthlength' %] >+ [% IF st == subtype %] >+ <option value="months" selected="selected"> >+ [% ELSE %] >+ <option value="months"> >+ [% END %] >+ months >+ [% CASE %][% st %] >+ [% END %] >+ </option> >+ [% END %] >+ </select> >+ <input type="text" name="sublength" id="sublength" value="[% sublength | html %]" size="3" />(enter amount in numerals) >+ <input type="hidden" name="issuelengthcount"> >+ </li> > >-<li><label for="branchcode">Library:</label> >- <select name="branchcode" id="branchcode" style="width: 20em;"> >- [% UNLESS ( Independentbranches ) %] >- <option value="">None</option> >- [% END %] >- [% IF CAN_user_serials_superserials %] >- [% FOREACH library IN libraries %] >- <option value="[% library.branchcode | html %]"> [% library.branchname | html %] </option> >+ <li><label for="branchcode">Library:</label> >+ <select name="branchcode" id="branchcode" style="width: 20em;"> >+ [% UNLESS ( Independentbranches ) %] >+ <option value="">None</option> >+ [% END %] >+ [% IF CAN_user_serials_superserials %] >+ [% FOREACH library IN libraries %] >+ <option value="[% library.branchcode | html %]"> [% library.branchname | html %] </option> >+ [% END %] > [% END %] >- [% END %] >-</select> (select a library) >-</li> >+ </select> (select a library) >+ </li> > >- <li><label for="note">Note for the librarian that will manage your renewal request: </label> >+ <li><label for="note">Note for the librarian that will manage your renewal request: </label> > <textarea name="note" id="note" rows="5" cols="50"></textarea></li></ol></fieldset> > <fieldset class="action"><input type="submit" value="Submit" class="button" /></fieldset> > </form> >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index a7b483be18..42c90f8e5a 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -265,16 +265,6 @@ sub get_letter_loop { > ]; > } > >-sub _get_sub_length { >- my ($type, $length) = @_; >- return >- ( >- $type eq 'issues' ? $length : 0, >- $type eq 'weeks' ? $length : 0, >- $type eq 'months' ? $length : 0, >- ); >-} >- > sub _guess_enddate { > my ($startdate_iso, $frequencyid, $numberlength, $weeklength, $monthlength) = @_; > my ($year, $month, $day); >@@ -330,7 +320,7 @@ sub redirect_add_subscription { > my $subtype = $query->param('subtype'); > my $sublength = $query->param('sublength'); > my ( $numberlength, $weeklength, $monthlength ) >- = _get_sub_length( $subtype, $sublength ); >+ = C4::Serials->_get_sub_length( $subtype, $sublength ); > my $add1 = $query->param('add1'); > my $lastvalue1 = $query->param('lastvalue1'); > my $innerloop1 = $query->param('innerloop1'); >@@ -443,8 +433,8 @@ sub redirect_mod_subscription { > > my $subtype = $query->param('subtype'); > my $sublength = $query->param('sublength'); >- my ($numberlength, $weeklength, $monthlength) >- = _get_sub_length( $subtype, $sublength ); >+ my ($numberlength, $weeklength, $monthlength) = C4::Serials->get_sub_length( $subtype, $sublength ); >+ my $numberpattern = $query->param('numbering_pattern'); > my $locale = $query->param('locale'); > my $lastvalue1 = $query->param('lastvalue1'); > my $innerloop1 = $query->param('innerloop1'); >diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl >index 6fc72984f8..247aca15b5 100755 >--- a/serials/subscription-renew.pl >+++ b/serials/subscription-renew.pl >@@ -62,6 +62,10 @@ my $mode = $query->param('mode') || q{}; > my $op = $query->param('op') || 'display'; > my @subscriptionids = $query->multi_param('subscriptionid'); > my $branchcode = $query->param('branchcode'); >+my $sublength = $query->param('sublength'); >+my $subtype = $query->param('subtype'); >+my ($numberlength, $weeklength, $monthlength) = C4::Serials->get_sub_length( $subtype, $sublength ); >+ > my $done = 0; # for after form has been submitted > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7046
:
5938
|
5939
|
69355
|
69356
|
69408
|
81641
|
81642
|
102275
|
102276
|
102278
|
102425
|
102427
|
102428
|
102429
|
102430
|
102535
|
102536
|
102537
|
102538
|
102564