Bugzilla – Attachment 44763 Details for
Bug 14969
Remove C4::Dates from serials/*.pl files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14969: Remove C4::Dates from serials/*.pl files
Bug-14969-Remove-C4Dates-from-serialspl-files.patch (text/plain), 27.69 KB, created by
Jonathan Druart
on 2015-11-11 14:21:17 UTC
(
hide
)
Description:
Bug 14969: Remove C4::Dates from serials/*.pl files
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-11-11 14:21:17 UTC
Size:
27.69 KB
patch
obsolete
>From 5fe8f0216c8e5d8a145604f958466932529367d3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 11 Nov 2015 10:48:36 +0000 >Subject: [PATCH] Bug 14969: Remove C4::Dates from serials/*.pl files > >Warning: This area is a mess, especially with date management. > >For the same reasons as other "Remove C4::Dates from*" patches, this one >will deal with the serials module. > >Note that this patch add the datepicker on 3 input fields (on >serials/subscription-detail.tt and serials/subscription-renew.tt). >There was also weird behavior when the dates were invalid. Now default >to undefined. But with the datepicker it will reduce the number of >cases even if the user is still allowed to fill invalid dates. > >Test plan: >1/ Create a subscription, fill the first issue pub date and the >subscription start date. >You can fill or not the end date. >Play with the numbering pattern and confirm that there are generated as >before this patch. >2/ On the check expiration page, confirm that the dates are correctly >displayed. >3/ Renew the subscription and confirm that the behavior is correct. >4/ Go on the subscription history page and confirm you have now the >datepicker plugin set on the 2 date fields. > >QA notes: The startdate, histstartdate and enddate are not used in >the serials-collection template, this patch removes them from the pl >script. >--- > C4/Serials.pm | 24 ++++++++--------- > .../prog/en/modules/serials/checkexpiration.tt | 7 ++--- > .../en/modules/serials/subscription-history.tt | 11 ++++++-- > .../prog/en/modules/serials/subscription-renew.tt | 8 +++++- > serials/checkexpiration.pl | 22 ++++++++++------ > serials/routing-preview.pl | 1 - > serials/routing.pl | 1 - > serials/serial-issues.pl | 1 - > serials/serials-collection.pl | 11 ++------ > serials/serials-edit.pl | 15 ++++++----- > serials/showpredictionpattern.pl | 15 ++++------- > serials/subscription-add.pl | 30 +++++++++++++--------- > serials/subscription-detail.pl | 5 ++-- > serials/subscription-history.pl | 9 ++++--- > serials/subscription-renew.pl | 15 ++++++----- > 15 files changed, 95 insertions(+), 80 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 5f348ce..37e7c16 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -22,7 +22,6 @@ use Modern::Perl; > > use C4::Auth qw(haspermission); > use C4::Context; >-use C4::Dates qw(format_date format_date_in_iso); > use DateTime; > use Date::Calc qw(:all); > use POSIX qw(strftime); >@@ -32,6 +31,7 @@ use C4::Debug; > use C4::Serials::Frequency; > use C4::Serials::Numberpattern; > use Koha::AdditionalField; >+use Koha::DateUtils; > > use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); > >@@ -467,9 +467,9 @@ sub GetSubscriptionsFromBiblionumber { > $sth->execute($biblionumber); > my @res; > while ( my $subs = $sth->fetchrow_hashref ) { >- $subs->{startdate} = format_date( $subs->{startdate} ); >- $subs->{histstartdate} = format_date( $subs->{histstartdate} ); >- $subs->{histenddate} = format_date( $subs->{histenddate} ); >+ $subs->{startdate} = output_pref( { dt => dt_from_string( $subs->{startdate} ), dateonly => 1 } ); >+ $subs->{histstartdate} = output_pref( { dt => dt_from_string( $subs->{histstartdate} ), dateonly => 1 } ); >+ $subs->{histenddate} = output_pref( { dt => dt_from_string( $subs->{histenddate} ), dateonly => 1 } ); > $subs->{opacnote} =~ s/\n/\<br\/\>/g; > $subs->{missinglist} =~ s/\n/\<br\/\>/g; > $subs->{recievedlist} =~ s/\n/\<br\/\>/g; >@@ -480,7 +480,7 @@ sub GetSubscriptionsFromBiblionumber { > if ( $subs->{enddate} eq '0000-00-00' ) { > $subs->{enddate} = ''; > } else { >- $subs->{enddate} = format_date( $subs->{enddate} ); >+ $subs->{enddate} = output_pref( { dt => dt_from_string( $subs->{enddate}), dateonly => 1 } ); > } > $subs->{'abouttoexpire'} = abouttoexpire( $subs->{'subscriptionid'} ); > $subs->{'subscriptionexpired'} = HasSubscriptionExpired( $subs->{'subscriptionid'} ); >@@ -710,7 +710,7 @@ sub GetSerials { > $line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list > for my $datefield ( qw( planneddate publisheddate) ) { > if ($line->{$datefield} && $line->{$datefield}!~m/^00/) { >- $line->{$datefield} = format_date( $line->{$datefield}); >+ $line->{$datefield} = output_pref( { dt => dt_from_string( $line->{$datefield} ), dateonly => 1 } ); > } else { > $line->{$datefield} = q{}; > } >@@ -733,7 +733,7 @@ sub GetSerials { > $line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list > for my $datefield ( qw( planneddate publisheddate) ) { > if ($line->{$datefield} && $line->{$datefield}!~m/^00/) { >- $line->{$datefield} = format_date( $line->{$datefield}); >+ $line->{$datefield} = output_pref( { dt => dt_from_string( $line->{$datefield} ), dateonly => 1 } ); > } else { > $line->{$datefield} = q{}; > } >@@ -788,7 +788,7 @@ sub GetSerials2 { > $line->{$datefield} = q{}; > } > else { >- $line->{$datefield} = format_date( $line->{$datefield} ); >+ $line->{$datefield} = output_pref( { dt => dt_from_string( $line->{$datefield} ), dateonly => 1 } ); > } > } > push @serials, $line; >@@ -824,8 +824,8 @@ sub GetLatestSerials { > my @serials; > while ( my $line = $sth->fetchrow_hashref ) { > $line->{ "status" . $line->{status} } = 1; # fills a "statusX" value, used for template status select list >- $line->{"planneddate"} = format_date( $line->{"planneddate"} ); >- $line->{"publisheddate"} = format_date( $line->{"publisheddate"} ); >+ $line->{planneddate} = output_pref( { dt => dt_from_string( $line->{planneddate} ), dateonly => 1 } ); >+ $line->{publisheddate} = output_pref( { dt => dt_from_string( $line->{publisheddate} ), dateonly => 1 } ); > push @serials, $line; > } > >@@ -1848,11 +1848,11 @@ sub GetLateOrMissingIssues { > > if ($line->{planneddate} && $line->{planneddate} !~/^0+\-/) { > $line->{planneddateISO} = $line->{planneddate}; >- $line->{planneddate} = format_date( $line->{planneddate} ); >+ $line->{planneddate} = output_pref( { dt => dt_from_string( $line->{"planneddate"} ), dateonly => 1 } ); > } > if ($line->{claimdate} && $line->{claimdate} !~/^0+\-/) { > $line->{claimdateISO} = $line->{claimdate}; >- $line->{claimdate} = format_date( $line->{claimdate} ); >+ $line->{claimdate} = output_pref( { dt => dt_from_string( $line->{"claimdate"} ), dateonly => 1 } ); > } > $line->{"status".$line->{status}} = 1; > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >index e41d5c3..657f91d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >@@ -1,3 +1,4 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Check expiration</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -70,7 +71,7 @@ > [% END %] > > <li><label for="date" class="required" title="Required field">Expiring before:</label> >- <input id="date" type="text" name="date" size="10" value="[% date %]" class="focus datepicker" /> >+ <input id="date" type="text" name="date" size="10" value="[% date | $KohaDates %]" class="focus datepicker" /> > <span class="required">Required</span> > <div class="hint">[% INCLUDE 'date-format.inc' %]</div></li> > </ol> >@@ -89,7 +90,7 @@ > [% IF ( issn ) %] > with ISSN matching <b>[% issn %]</b> > [% END %] >- will expire before <b>[% date %]</b> >+ will expire before <b>[% date | $KohaDates %]</b> > </p> > <table> > <tr> >@@ -127,7 +128,7 @@ > [% subscriptions_loo.internalnotes %] > </td> > <td> >- [% subscriptions_loo.expirationdate %] >+ [% subscriptions_loo.expirationdate | $KohaDates %] > </td> > <td><a href="/cgi-bin/koha/serials/subscription-add.pl?op=modify&subscriptionid=[% subscriptions_loo.subscriptionid %]">Edit</a></td> > <td><a href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscriptions_loo.subscriptionid %]" onclick="popup([% subscriptions_loo.subscriptionid %]); return false;">Renew</a></td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt >index 5213b3d..cbfb0a5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-history.tt >@@ -3,6 +3,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Subscription history</title> > [% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] > </head> > > <body id="ser_subscription_history" class="ser"> >@@ -25,11 +26,17 @@ > <table> > <tr> > <td>Subscription start date</td> >- <td><input type="text" name="histstartdate" value="[% histstartdate | $KohaDates %]" /> (start date of the 1st subscription)</td> >+ <td> >+ <input type="text" size="10" name="histstartdate" value="[% histstartdate | $KohaDates %]" class="datepickerfrom" /> (start date of the 1st subscription) >+ <div class="hint">[% INCLUDE 'date-format.inc' %]</div> >+ </td> > </tr> > <tr> > <td>Subscription end date</td> >- <td><input type="text" name="histenddate" value="[% histenddate | $KohaDates %]" />(if empty, subscription is still active)</td> >+ <td> >+ <input type="text" size="10" name="histenddate" value="[% histenddate | $KohaDates %]" class="datepickerto" />(if empty, subscription is still active) >+ <div class="hint">[% INCLUDE 'date-format.inc' %]</div> >+ </td> > </tr> > <tr> > <td>Received issues</td> >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 a38f7917..e7eb83d 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 >@@ -1,6 +1,7 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials subscription renew #[% subscriptionid %]</title> > [% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] > <style type="text/css"> > #custom-doc { width:39.85em;*width:38.86em;min-width:531px; margin:auto; text-align:left; } > </style> >@@ -23,7 +24,12 @@ > <input type="hidden" name="op" value="renew" /> > <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" /> > <fieldset class="rows"><legend>Subscription renewal for [% bibliotitle %]</legend> >- <ol><li><label for="startdate">Start date: </label><input type="text" id="startdate" name="startdate" value="[% startdate %]" /></li> >+ <ol> >+ <li> >+ <label for="startdate">Start date: </label> >+ <input type="text" size="10" id="startdate" name="startdate" value="[% startdate %]" class="datepicker"/> >+ <div class="hint">[% INCLUDE 'date-format.inc' %]</div> >+ </li> > <li><fieldset> > <legend>Subscription length:</legend> > <ol><li><label for="numberlength">Number of num:</label><input type="text" id="numberlength" name="numberlength" value="[% numberlength %]" /></li> >diff --git a/serials/checkexpiration.pl b/serials/checkexpiration.pl >index 11d1714..3222e22 100755 >--- a/serials/checkexpiration.pl >+++ b/serials/checkexpiration.pl >@@ -50,8 +50,9 @@ use C4::Serials; # GetExpirationDate > use C4::Branch; > use C4::Output; > use C4::Context; >-use C4::Dates qw/format_date format_date_in_iso/; >-use Date::Calc qw/Date_to_Days/; >+use Koha::DateUtils; >+ >+use DateTime; > > my $query = new CGI; > >@@ -69,7 +70,8 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user ( > my $title = $query->param('title'); > my $issn = $query->param('issn'); > my $branch = $query->param('branch'); >-my $date = format_date_in_iso($query->param('date')); >+my $date = $query->param('date'); >+$date = eval { dt_from_string( $query->param('date') ) } if $date; > > if ($date) { > my @subscriptions = SearchSubscriptions({ title => $title, issn => $issn, orderby => 'title' }); >@@ -78,8 +80,11 @@ if ($date) { > foreach my $subscription ( @subscriptions ) { > my $subscriptionid = $subscription->{'subscriptionid'}; > my $expirationdate = GetExpirationDate($subscriptionid); >+ > $subscription->{expirationdate} = $expirationdate; >+ > next if $expirationdate !~ /\d{4}-\d{2}-\d{2}/; # next if not in ISO format. >+ > next if $subscription->{closed}; > if ( !C4::Context->preference("IndependentBranches") > or C4::Context->IsSuperLibrarian() >@@ -89,10 +94,11 @@ if ($date) { > $subscription->{cannotedit} = 0; > } > next if $subscription->{cannotedit}; >- if ( Date_to_Days(split "-",$expirationdate) < Date_to_Days(split "-",$date) && >- ( !$branch || ($subscription->{'branchcode'} eq $branch) ) ) { >- $subscription->{expirationdate}=format_date($subscription->{expirationdate}); >- push @subscriptions_loop,$subscription; >+ >+ my $expirationdate_dt = dt_from_string( $expirationdate, 'iso' ); >+ if ( DateTime->compare( $date, $expirationdate_dt ) == 1 >+ && ( !$branch || ( $subscription->{'branchcode'} eq $branch ) ) ) { >+ push @subscriptions_loop, $subscription; > } > } > >@@ -100,7 +106,7 @@ if ($date) { > title => $title, > issn => $issn, > numsubscription => scalar @subscriptions_loop, >- date => format_date($date), >+ date => $date, > subscriptions_loop => \@subscriptions_loop, > "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, > searched => 1, >diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl >index 13bca6c..bed5091 100755 >--- a/serials/routing-preview.pl >+++ b/serials/routing-preview.pl >@@ -23,7 +23,6 @@ use warnings; > use CGI qw ( -utf8 ); > use C4::Koha; > use C4::Auth; >-use C4::Dates; > use C4::Output; > use C4::Acquisition; > use C4::Reserves; >diff --git a/serials/routing.pl b/serials/routing.pl >index 8f9cb6b..32f42e5 100755 >--- a/serials/routing.pl >+++ b/serials/routing.pl >@@ -30,7 +30,6 @@ use warnings; > use CGI qw ( -utf8 ); > use C4::Koha; > use C4::Auth; >-use C4::Dates; > use C4::Output; > use C4::Acquisition; > use C4::Output; >diff --git a/serials/serial-issues.pl b/serials/serial-issues.pl >index 12d7f90..c5bfbca 100755 >--- a/serials/serial-issues.pl >+++ b/serials/serial-issues.pl >@@ -46,7 +46,6 @@ use warnings; > use CGI qw ( -utf8 ); > use C4::Auth; > use C4::Koha; >-use C4::Dates; > use C4::Serials; > use C4::Output; > use C4::Context; >diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl >index aef4604..0ee32de 100755 >--- a/serials/serials-collection.pl >+++ b/serials/serials-collection.pl >@@ -24,11 +24,11 @@ use warnings; > use CGI qw ( -utf8 ); > use C4::Auth; > use C4::Koha; >-use C4::Dates qw/format_date/; > use C4::Serials; > use C4::Letters; > use C4::Output; > use C4::Context; >+ > use List::MoreUtils qw/uniq/; > > >@@ -114,15 +114,8 @@ if (@subscriptionid){ > $subs->{opacnote} =~ s/\n/\<br\/\>/g; > $subs->{missinglist} =~ s/\n/\<br\/\>/g; > $subs->{recievedlist} =~ s/\n/\<br\/\>/g; >+ > ##these are display information >- $subs->{startdate} = format_date( $subs->{startdate} ); >- $subs->{histstartdate} = format_date( $subs->{histstartdate} ); >- if ( !defined $subs->{enddate} || $subs->{enddate} eq '0000-00-00' ) { >- $subs->{enddate} = ''; >- } >- else { >- $subs->{enddate} = format_date( $subs->{enddate} ); >- } > $subs->{'abouttoexpire'}=abouttoexpire($subs->{'subscriptionid'}); > $subs->{'subscriptionexpired'}=HasSubscriptionExpired($subs->{'subscriptionid'}); > $subs->{'subscriptionid'} = $subscriptionid; # FIXME - why was this lost ? >diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl >index 9b6f5d0..efd9c78 100755 >--- a/serials/serials-edit.pl >+++ b/serials/serials-edit.pl >@@ -66,7 +66,6 @@ use warnings; > use CGI qw ( -utf8 ); > use Encode qw( decode is_utf8 ); > use C4::Auth; >-use C4::Dates qw/format_date format_date_in_iso/; > use C4::Biblio; > use C4::Items; > use C4::Koha; >@@ -74,6 +73,8 @@ use C4::Output; > use C4::Context; > use C4::Serials; > use C4::Search qw/enabled_staff_search_views/; >+use Koha::DateUtils; >+ > use List::MoreUtils qw/uniq/; > > my $query = CGI->new(); >@@ -127,7 +128,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my @serialdatalist; > my %processedserialid; > >-my $today = C4::Dates->new(); >+my $today = output_pref( dt_from_string ); > foreach my $serialid (@serialids) { > > #filtering serialid for duplication >@@ -143,10 +144,10 @@ foreach my $serialid (@serialids) { > $serinfo->{$d} = q{}; > } > else { >- $serinfo->{$d} = format_date( $serinfo->{$d} ); >+ $serinfo->{$d} = output_pref( { dt => dt_from_string( $serinfo->{$d} ), dateonly => 1 } ); > } > } >- $serinfo->{arriveddate}=$today->output('syspref'); >+ $serinfo->{arriveddate} = $today; > > $serinfo->{'editdisable'} = ( > ( >@@ -187,7 +188,7 @@ foreach my $subscriptionid (@subscriptionids) { > $cell->{'itemid'} = 'NNEW'; > $cell->{'serialid'} = 'NEW'; > $cell->{'issuesatonce'} = 1; >- $cell->{arriveddate}=$today->output('syspref'); >+ $cell->{arriveddate} = $today; > > push @newserialloop, $cell; > push @subscriptionloop, >@@ -214,10 +215,10 @@ if ( $op and $op eq 'serialchangestatus' ) { > my ($plan_date, $pub_date); > > if (defined $planneddates[$i] && $planneddates[$i] ne 'XXX') { >- $plan_date = format_date_in_iso( $planneddates[$i] ); >+ $plan_date = eval { output_pref( { dt => dt_from_string( $planneddates[$i] ), dateonly => 1, dateformat => 'iso' } ); }; > } > if (defined $publisheddates[$i] && $publisheddates[$i] ne 'XXX') { >- $pub_date = format_date_in_iso( $publisheddates[$i] ); >+ $pub_date = eval { output_pref( { dt => dt_from_string( $publisheddates[$i] ), dateonly => 1, dateformat => 'iso' } ); }; > } > > if ( $serialids[$i] && $serialids[$i] eq 'NEW' ) { >diff --git a/serials/showpredictionpattern.pl b/serials/showpredictionpattern.pl >index 6945a36..add9f06 100755 >--- a/serials/showpredictionpattern.pl >+++ b/serials/showpredictionpattern.pl >@@ -36,6 +36,7 @@ use C4::Auth; > use C4::Output; > use C4::Serials; > use C4::Serials::Frequency; >+use Koha::DateUtils; > > my $input = new CGI; > my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { >@@ -76,19 +77,13 @@ my %pattern = ( > every3 => $input->param('every3') // '', > ); > >-if(!defined $firstacquidate || $firstacquidate eq ''){ >- my ($year, $month, $day) = Today(); >- $firstacquidate = sprintf "%04d-%02d-%02d", $year, $month, $day; >-} else { >- $firstacquidate = C4::Dates->new($firstacquidate)->output('iso'); >-} >+$firstacquidate = eval { output_pref( { str => $firstacquidate, dateonly => 1, dateformat => 'iso' } ); } >+ or output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); > >-if($enddate){ >- $enddate = C4::Dates->new($enddate)->output('iso'); >-} >+$enddate = eval { output_pref( { str => $enddate, dateonly => 1, dateformat => 'iso' } ); }; > > if($nextacquidate) { >- $nextacquidate = C4::Dates->new($nextacquidate)->output('iso'); >+ $nextacquidate = eval { output_pref( { str => $nextacquidate, dateonly => 1, dateformat => 'iso' } ); }; > } else { > $nextacquidate = $firstacquidate; > } >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index fedb7da..1790866 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -23,7 +23,6 @@ use Date::Calc qw(Today Day_of_Year Week_of_Year Add_Delta_Days Add_Delta_YM); > use C4::Koha; > use C4::Biblio; > use C4::Auth; >-use C4::Dates qw/format_date format_date_in_iso/; > use C4::Acquisition; > use C4::Output; > use C4::Context; >@@ -33,6 +32,7 @@ use C4::Serials::Frequency; > use C4::Serials::Numberpattern; > use C4::Letters; > use Koha::AdditionalField; >+use Koha::DateUtils; > use Carp; > > #use Smart::Comments; >@@ -322,14 +322,16 @@ sub redirect_add_subscription { > my $opacdisplaycount = $query->param('opacdisplaycount'); > my $location = $query->param('location'); > my $skip_serialseq = $query->param('skip_serialseq'); >- my $startdate = format_date_in_iso( $query->param('startdate') ); >- my $enddate = format_date_in_iso( $query->param('enddate') ); >- my $firstacquidate = format_date_in_iso($query->param('firstacquidate')); >+ >+ my $startdate = output_pref( { str => $query->param('startdate'), dateonly => 1, dateformat => 'iso' } ); >+ my $enddate = output_pref( { str => $query->param('enddate'), dateonly => 1, dateformat => 'iso' } ); >+ my $firstacquidate = output_pref( { str => $query->param('firstacquidate'), dateonly => 1, dateformat => 'iso' } ); >+ > if(!defined $enddate || $enddate eq '') { > if($subtype eq "issues") { >- $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength); >+ $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength) > } else { >- $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength); >+ $enddate = _guess_enddate($startdate, $periodicity, $numberlength, $weeklength, $monthlength) > } > } > >@@ -361,12 +363,16 @@ sub redirect_mod_subscription { > my $aqbooksellerid = $query->param('aqbooksellerid'); > my $biblionumber = $query->param('biblionumber'); > my $aqbudgetid = $query->param('aqbudgetid'); >- my $startdate = format_date_in_iso($query->param('startdate')); >- my $firstacquidate = format_date_in_iso( $query->param('firstacquidate') ); >- my $nextacquidate = $query->param('nextacquidate') ? >- format_date_in_iso($query->param('nextacquidate')): >- $firstacquidate; >- my $enddate = format_date_in_iso($query->param('enddate')); >+ >+ my $startdate = output_pref( { str => $query->param('startdate'), dateonly => 1, dateformat => 'iso' } ); >+ my $enddate = output_pref( { str => $query->param('enddate'), dateonly => 1, dateformat => 'iso' } ); >+ my $firstacquidate = output_pref( { str => $query->param('firstacquidate'), dateonly => 1, dateformat => 'iso' } ); >+ >+ my $nextacquidate = $query->param('nextacquidate'); >+ $nextacquidate = $nextacquidate >+ ? output_pref( { str => $nextacquidate, dateonly => 1, dateformat => 'iso' } ) >+ : $firstacquidate; >+ > my $periodicity = $query->param('frequency'); > > my $subtype = $query->param('subtype'); >diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl >index 45ce5b0..824ffc2 100755 >--- a/serials/subscription-detail.pl >+++ b/serials/subscription-detail.pl >@@ -21,11 +21,11 @@ use C4::Acquisition; > use C4::Auth; > use C4::Budgets; > use C4::Koha; >-use C4::Dates qw/format_date/; > use C4::Serials; > use C4::Output; > use C4::Context; > use C4::Search qw/enabled_staff_search_views/; >+use Koha::DateUtils; > > use Koha::Acquisition::Bookseller; > >@@ -100,7 +100,8 @@ my $hasRouting = check_routing($subscriptionid); > # COMMENT hdl : IMHO, we should think about passing more and more data hash to template->param rather than duplicating code a new coding Guideline ? > > for my $date ( qw(startdate enddate firstacquidate histstartdate histenddate) ) { >- $$subs{$date} = format_date($$subs{$date}) if $date && $$subs{$date}; >+ $subs->{$date} = output_pref( { str => $subs->{$date}, dateonly => 1 } ) >+ if $subs->{$date}; > } > $subs->{location} = GetKohaAuthorisedValueLib("LOC",$subs->{location}); > $subs->{abouttoexpire} = abouttoexpire($subs->{subscriptionid}); >diff --git a/serials/subscription-history.pl b/serials/subscription-history.pl >index 267afcb..8b7dd3d 100755 >--- a/serials/subscription-history.pl >+++ b/serials/subscription-history.pl >@@ -34,8 +34,8 @@ use C4::Auth; > use C4::Output; > > use C4::Biblio; >-use C4::Dates qw(format_date_in_iso); > use C4::Serials; >+use Koha::DateUtils; > > my $input = new CGI; > my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { >@@ -63,9 +63,10 @@ if($op && $op eq 'mod') { > my $opacnote = $input->param('opacnote'); > my $librariannote = $input->param('librariannote'); > >- ModSubscriptionHistory( $subscriptionid, format_date_in_iso($histstartdate), >- format_date_in_iso($histenddate), $receivedlist, $missinglist, $opacnote, >- $librariannote ); >+ $histstartdate = output_pref( { str => $histstartdate, dateonly => 1, dateformat => 'iso' } ); >+ $histenddate = output_pref( { str => $histenddate, dateonly => 1, dateformat => 'iso' } ); >+ >+ ModSubscriptionHistory( $subscriptionid, $histstartdate, $histenddate, $receivedlist, $missinglist, $opacnote, $librariannote ); > > print $input->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); > exit; >diff --git a/serials/subscription-renew.pl b/serials/subscription-renew.pl >index 9f3b934..226a387 100755 >--- a/serials/subscription-renew.pl >+++ b/serials/subscription-renew.pl >@@ -50,11 +50,11 @@ use CGI qw ( -utf8 ); > use Carp; > use C4::Koha; > use C4::Auth; >-use C4::Dates qw/format_date/; > use C4::Context; > use C4::Auth; > use C4::Output; > use C4::Serials; >+use Koha::DateUtils; > > my $query = new CGI; > my $dbh = C4::Context->dbh; >@@ -74,9 +74,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > if ( $op eq "renew" ) { >+ my $startdate = output_pref( { str => $query->param('startdate'), dateonly => 1, dateformat => 'iso' } ); > ReNewSubscription( >- $subscriptionid, $loggedinuser, >- C4::Dates->new($query->param('startdate'))->output('iso'), $query->param('numberlength'), >+ $subscriptionid, $loggedinuser, >+ $startdate, $query->param('numberlength'), > $query->param('weeklength'), $query->param('monthlength'), > $query->param('note') > ); >@@ -88,11 +89,11 @@ if ($subscription->{'cannotedit'}){ > print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); > } > >+my $newstartdate = output_pref( { str => $subscription->{enddate}, dateonly => 1 } ) >+ or output_pref( { dt => dt_from_string, dateonly => 1 } ); >+ > $template->param( >- startdate => format_date( >- $subscription->{enddate} >- || POSIX::strftime( "%Y-%m-%d", localtime ) >- ), >+ startdate => $newstartdate, > numberlength => $subscription->{numberlength}, > weeklength => $subscription->{weeklength}, > monthlength => $subscription->{monthlength}, >-- >2.1.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 14969
:
43182
|
44441
|
44526
|
44527
|
44528
|
44549
|
44550
|
44617
|
44618
|
44694
|
44735
|
44763
|
44775
|
44794
|
44799
|
44930
|
44931