Bugzilla – Attachment 34506 Details for
Bug 13471
When editing a subscription, the "subscription length type" disregards the stored value, also make SLT translateable.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13471 - When editing a subscription, the "subscription length type" disregards the stored value, also make SLT translateable.
Bug-13471---When-editing-a-subscription-the-subscr.patch (text/plain), 7.33 KB, created by
Olli-Antti Kivilahti
on 2014-12-18 06:32:25 UTC
(
hide
)
Description:
Bug 13471 - When editing a subscription, the "subscription length type" disregards the stored value, also make SLT translateable.
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2014-12-18 06:32:25 UTC
Size:
7.33 KB
patch
obsolete
>From c984729c0e835e4a825e77bc14a8c21622ff311e Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Tue, 16 Dec 2014 15:01:54 +0200 >Subject: [PATCH] Bug 13471 - When editing a subscription, the "subscription > length type" disregards the stored value, also make SLT > translateable. > >This issue causes loss of data when the subscription length type (SLT) is other than issues. > >TO REPLICATE: > >We make an subscription with SLT of months = 12. >Later make an arbitrary edit to the subscription, and miss out the fact that the SLT selection is set to issues. >Save the changes. >Serial subscription end date is set to 12 issues since the start date, instead of 12 months which it used to be. >This causes a myriad of issues :=) > >AFTER THIS PATCH: > >SLT defaults to the value initially saved instead of always being issues. >Now the selection can be translated! > >HOTFIX 1: Added <span> elements to showSubscriptionLengthType.inc so the translation tool can catch them. > >HOTFIX 2: Fixed serials/showpredictionpattern.pl to use the db columns instead of issues,weeks,months. >--- > .../serials/showSubscriptionLengthType.inc | 8 ++++++++ > .../prog/en/modules/serials/subscription-add.tt | 2 +- > serials/showpredictionpattern.pl | 8 ++++---- > serials/subscription-add.pl | 15 +++++++-------- > 4 files changed, 20 insertions(+), 13 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc >new file mode 100644 >index 0000000..a6795cd >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials/showSubscriptionLengthType.inc >@@ -0,0 +1,8 @@ >+[%# This template must receive a parameter stl_name, containing the name of the subscription length type, either 'monthlength', 'numberlength' or 'weeklength'.Eg. "\[% INCLUDE showSubscriptionLengthType stl_name=subt.name %\]" %] >+[% IF (stl_name) == 'numberlength' %] >+<span>issues</span> >+[% ELSIF (stl_name) == 'weeklength' %] >+<span>weeks</span> >+[% ELSIF (stl_name) == 'monthlength' %] >+<span>months</span> >+[% END %] >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index e69649c..45f3c98 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -658,7 +658,7 @@ $(document).ready(function() { > [% ELSE %] > <option value="[% subt.name %]"> > [% END %] >- [% subt.name %] >+ [% INCLUDE serials/showSubscriptionLengthType.inc stl_name=subt.name %] > </option> > [% END %] > </select> >diff --git a/serials/showpredictionpattern.pl b/serials/showpredictionpattern.pl >index 82cf8af..21b41e7 100755 >--- a/serials/showpredictionpattern.pl >+++ b/serials/showpredictionpattern.pl >@@ -149,11 +149,11 @@ while( $i < 1000 ) { > > # Check if we don't have exceed end date > if($sublength){ >- if($subtype eq "issues" && $i >= $sublength){ >+ if($subtype eq "numberlength" && $i >= $sublength){ > last; >- } elsif($subtype eq "weeks" && $date && Delta_Days( split(/-/, $date), Add_Delta_Days( split(/-/, $firstacquidate), 7*$sublength - 1 ) ) < 0) { >+ } elsif($subtype eq "weeklength" && $date && Delta_Days( split(/-/, $date), Add_Delta_Days( split(/-/, $firstacquidate), 7*$sublength - 1 ) ) < 0) { > last; >- } elsif($subtype eq "months" && $date && (Delta_Days( split(/-/, $date), Add_Delta_YM( split(/-/, $firstacquidate), 0, $sublength) ) - 1) < 0 ) { >+ } elsif($subtype eq "monthlength" && $date && (Delta_Days( split(/-/, $date), Add_Delta_YM( split(/-/, $firstacquidate), 0, $sublength) ) - 1) < 0 ) { > last; > } > } >@@ -186,7 +186,7 @@ if ( $frequency->{unit} and not $custompattern ) { > } > > if ( ( $date && $enddate && $date ne $enddate ) >- or ( $subtype eq 'issues' && $i < $sublength ) ) >+ or ( $subtype eq 'numberlength' && $i < $sublength ) ) > { > $template->param( not_consistent_end_date => 1 ); > } >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index b17fc60..22819df 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -59,7 +59,7 @@ my ($template, $loggedinuser, $cookie) > > > my $sub_on; >-my @subscription_types = (qw(issues weeks months)); >+my @subscription_types = (qw(numberlength weeklength monthlength)); #These are the same as the koha.subscription-columns > my @sub_type_data; > > my $subs; >@@ -92,7 +92,7 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { > $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate} eq $firstissuedate ; > $subs->{nextacquidate} = $nextexpected->{planneddate} if($op eq 'modify'); > unless($op eq 'modsubscription') { >- foreach my $length_unit (qw(numberlength weeklength monthlength)) { >+ foreach my $length_unit (@subscription_types) { > if ($subs->{$length_unit}) { > $sub_length=$subs->{$length_unit}; > $sub_on=$length_unit; >@@ -103,7 +103,6 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { > $template->param( %{$subs} ); > $template->param( > $op => 1, >- "subtype_$sub_on" => 1, > sublength =>$sub_length, > history => ($op eq 'modify'), > firstacquiyear => substr($firstissuedate,0,4), >@@ -250,9 +249,9 @@ sub _get_sub_length { > my ($type, $length) = @_; > return > ( >- $type eq 'issues' ? $length : 0, >- $type eq 'weeks' ? $length : 0, >- $type eq 'months' ? $length : 0, >+ $type eq 'numberlength' ? $length : 0, >+ $type eq 'weeklength' ? $length : 0, >+ $type eq 'monthlength' ? $length : 0, > ); > } > >@@ -323,7 +322,7 @@ sub redirect_add_subscription { > my $enddate = format_date_in_iso( $query->param('enddate') ); > my $firstacquidate = format_date_in_iso($query->param('firstacquidate')); > if(!defined $enddate || $enddate eq '') { >- if($subtype eq "issues") { >+ if($subtype eq "numberlength") { > $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength); > } else { > $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); >@@ -390,7 +389,7 @@ sub redirect_mod_subscription { > > # Guess end date > if(!defined $enddate || $enddate eq '') { >- if($subtype eq "issues") { >+ if($subtype eq "numberlength") { > $enddate = _guess_enddate($nextacquidate, $periodicity, $numberlength, $weeklength, $monthlength); > } else { > $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); >-- >1.7.9.5
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 13471
:
34454
|
34455
|
34506
|
34661
|
34765