Bugzilla – Attachment 148948 Details for
Bug 32392
Ability to skip forward serial issues when receiving double (or more) issue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32392: Enable skipping forward issues when receiving serials.
0001-Bug-32392-Enable-skipping-forward-issues-when-receiv.patch (text/plain), 12.88 KB, created by
Björn Nylén
on 2023-03-30 07:54:55 UTC
(
hide
)
Description:
Bug 32392: Enable skipping forward issues when receiving serials.
Filename:
MIME Type:
Creator:
Björn Nylén
Created:
2023-03-30 07:54:55 UTC
Size:
12.88 KB
patch
obsolete
>From 4fd61f913adc179f5533f64d9da7dff26998b6f0 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Bj=C3=B6rn=20Nyl=C3=A9n?= <bjorn.nylen@ub.lu.se> >Date: Fri, 1 Apr 2022 14:13:47 +0000 >Subject: [PATCH 1/2] Bug 32392: Enable skipping forward issues when receiving > serials. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds the ability to skip forward issues when receiving and generating the next issue >from both the serial receive page and serial collection page. > >To test: >1. Apply patch. >2. Set up a subscription for a bib record. >3. Go to Serials -> Search your subscription -> Serial receive >4. Note that below last expected issue there will be checkbox to toggle a field to > specify how many issues to skip when recieving and generating the next. >5. On serials-collection page there is also a button 'Skip issues and generate next'. > When pressed will open a modal promting how many issues to skip. >6. Generate issues with different values and make sure the correct issue is generated. > >âSponsored-by: Lund University Library >Sponsored-by: Bibliotek Mellansjö, Sweden >Co-authored-by: Johan Sahlberg <johan.sahlberg@tidaholm.se> >--- > C4/Serials.pm | 15 +++++---- > .../includes/modals/serials_skip_issues.inc | 28 +++++++++++++++++ > .../en/modules/serials/serials-collection.tt | 5 +++ > .../prog/en/modules/serials/serials-edit.tt | 31 +++++++++++++++++++ > serials/serials-collection.pl | 6 ++-- > serials/serials-edit.pl | 7 ++++- > 6 files changed, 83 insertions(+), 9 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/modals/serials_skip_issues.inc > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 75c9d7f19f..731ddd0cc3 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -799,7 +799,7 @@ sub GetPreviousSerialid { > my ( > $nextseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, > $newinnerloop1, $newinnerloop2, $newinnerloop3 >- ) = GetNextSeq( $subscription, $pattern, $frequency, $planneddate ); >+ ) = GetNextSeq( $subscription, $pattern, $frequency, $planneddate, $count_forward ); > > $subscription is a hashref containing all the attributes of the table > 'subscription'. >@@ -807,18 +807,19 @@ $pattern is a hashref containing all the attributes of the table > 'subscription_numberpatterns'. > $frequency is a hashref containing all the attributes of the table 'subscription_frequencies' > $planneddate is a date string in iso format. >+$count_forward is the number of issues to count forward, defaults to 1 if omitted > This function get the next issue for the subscription given on input arg > > =cut > > sub GetNextSeq { >- my ($subscription, $pattern, $frequency, $planneddate) = @_; >+ my ($subscription, $pattern, $frequency, $planneddate, $count_forward) = @_; > > return unless ($subscription and $pattern); > > my ( $newlastvalue1, $newlastvalue2, $newlastvalue3, > $newinnerloop1, $newinnerloop2, $newinnerloop3 ); >- my $count = 1; >+ my $count = $count_forward ? $count_forward : 1; > > if ($subscription->{'skip_serialseq'}) { > my @irreg = split /;/, $subscription->{'irregularity'}; >@@ -1042,7 +1043,7 @@ sub ModSubscriptionHistory { > =head2 ModSerialStatus > > ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate, >- $publisheddatetext, $status, $notes); >+ $publisheddatetext, $status, $notes, $count_forward); > > This function modify the serial status. Serial status is a number.(eg 2 is "arrived") > Note : if we change from "waited" to something else,then we will have to create a new "waited" entry >@@ -1051,10 +1052,12 @@ Note : if we change from "waited" to something else,then we will have to create > > sub ModSerialStatus { > my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext, >- $status, $notes) = @_; >+ $status, $notes, $count_forward) = @_; > > return unless ($serialid); > >+ my $count = $count_forward ? $count_forward : 1; >+ > #It is a usual serial > # 1st, get previous status : > my $dbh = C4::Context->dbh; >@@ -1123,7 +1126,7 @@ sub ModSerialStatus { > $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, > $newinnerloop1, $newinnerloop2, $newinnerloop3 > ) >- = GetNextSeq( $subscription, $pattern, $frequency, $publisheddate ); >+ = GetNextSeq( $subscription, $pattern, $frequency, $publisheddate, $count ); > > # next date (calculated from actual date & frequency parameters) > my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency, 1); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/serials_skip_issues.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/serials_skip_issues.inc >new file mode 100644 >index 0000000000..7a6860a781 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/serials_skip_issues.inc >@@ -0,0 +1,28 @@ >+<div id="skip_issues" class="modal" tabindex="-1" role="dialog" aria-labelledby="skip_issues_label" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <form action="/cgi-bin/koha/serials/serials-collection.pl" method="post"> >+ <div class="modal-body"> >+ <fieldset class="rows"> >+ <legend>Skip issues and generate next</legend> >+ <ol> >+ <li> >+ <label for="nbissues" class="required">How many issues do you want to skip?</label> >+ <input type="text" pattern="^\d+$" size="10" id="skip_issues" name="skip_issues" required="required" /> >+ </li> >+ </ol> >+ <input type="hidden" name="op" value="gennext" /> >+ >+ [%# subscriptionidlist is used from serials-collection, subscriptionid is used from serils-edit %] >+ <input type="hidden" name="subscriptionid" value="[% subscriptionidlist || subscriptionid | html %]" /> >+ </fieldset> >+ </div> >+ >+ <div class="modal-footer"> >+ <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a> >+ <input type="submit" class="btn btn-default approve" value="OK" /> >+ </div> >+ </form> >+ </div> >+ </div> >+</div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >index 19cc576664..2c04b46ad4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >@@ -39,6 +39,8 @@ > > [% INCLUDE 'modals/serials_multi_receiving.inc' %] > >+ [% INCLUDE 'modals/serials_skip_issues.inc' %] >+ > [% UNLESS ( popup ) %] > [% INCLUDE 'serials-toolbar.inc' %] > >@@ -182,6 +184,9 @@ > <div class="btn-group"> > <input type="button" value="Generate next" data-subscriptionid="[% subscriptionidlist | html %]" class="btn btn-default btn-sm generatenext" /> > </div> >+ <div class="btn-group"> >+ <input type="button" value="Skip issues and generate next" data-subscriptionid="[% subscriptionidlist | html %]" href="#skip_issues" class="btn btn-default btn-sm" data-toggle="modal" /> >+ </div> > [% IF ( subscriptions.size == 1 and !serialsadditems ) %] > <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >index fdea3ee1be..182694bbb0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >@@ -12,6 +12,26 @@ > $('#multi_receiving').on('show', function () { > $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML); > }); >+ >+ $("form").on("submit", function(){ >+ let issues = $('input[name="skip_issues"]').val() ? $('input[name="skip_issues"]').val() : ''; >+ let too_many = _("Choose a value between 0-10 in issues to skip!"); >+ let no_number = _("Not a number in skip issues!"); >+ >+ if ( issues == '' || ( issues.match(/^\d+$/) && issues <= 10 ) ) { >+ return true; >+ } >+ else if ( issues.match(/^\d+$/) && issues > 10 ) { >+ alert(too_many); >+ return false; >+ } else if ( !issues.match(/^\d+$/) ) { >+ alert(no_number); >+ return false; >+ } >+ else { >+ return false; >+ } >+ }); > }); > > function popup(subscriptionid) { >@@ -62,6 +82,14 @@ $(document).ready(function() { > } > return true; > }); >+ >+ $("#toggle_skip_issues").on("change", function() { >+ if (this.checked) { >+ $("#skip_issues").removeClass("collapse").prop("disabled", false); >+ } else { >+ $("#skip_issues").addClass("collapse").prop("disabled", true); >+ } >+ }); > }); > //]]> > </script> >@@ -297,6 +325,9 @@ $(document).ready(function() { > [% END %] > [% END %] > [% END %] >+ <tr> >+ <td colspan="6">Skip issues:<input type="checkbox" id="toggle_skip_issues"> <input id="skip_issues" type="text" pattern="^\d+$" name="skip_issues" class="collapse" value="1" disabled required="required"/></td> >+ </tr> > [% FOREACH newserialloo IN newserialloop %] > [% UNLESS ( newserialloo.subscriptionexpired ) %] > <tr> >diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl >index 2179b83069..34061e3ab9 100755 >--- a/serials/serials-collection.pl >+++ b/serials/serials-collection.pl >@@ -46,6 +46,8 @@ my ($template, $loggedinuser, $cookie) > }); > my $biblionumber = $query->param('biblionumber'); > my @subscriptionid = $query->multi_param('subscriptionid'); >+my $skip_issues = $query->param('skip_issues') || 0; >+my $count_forward = int $skip_issues + 1; > > @subscriptionid= uniq @subscriptionid; > @subscriptionid= sort @subscriptionid; >@@ -69,7 +71,7 @@ if($op eq 'gennext' && @subscriptionid){ > my $planneddate = $date_received_today ? dt_from_string : $issue->{planneddate}; > ModSerialStatus( $issue->{serialid}, $issue->{serialseq}, > $planneddate, $issue->{publisheddate}, >- $issue->{publisheddatetext}, $status, "" ); >+ $issue->{publisheddatetext}, $status, "", $count_forward ); > } else { > require C4::Serials::Numberpattern; > my $subscription = GetSubscription($subscriptionid); >@@ -79,7 +81,7 @@ if($op eq 'gennext' && @subscriptionid){ > my ( > $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, > $newinnerloop1, $newinnerloop2, $newinnerloop3 >- ) = GetNextSeq($subscription, $pattern, $frequency, $expected->{publisheddate}); >+ ) = GetNextSeq($subscription, $pattern, $frequency, $expected->{publisheddate}, $count_forward); > > ## We generate the next publication date > my $nextpublisheddate = GetNextDate($subscription, $expected->{publisheddate}, $frequency, 1); >diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl >index b80fa46f21..5c48599021 100755 >--- a/serials/serials-edit.pl >+++ b/serials/serials-edit.pl >@@ -89,6 +89,10 @@ my @status = $query->multi_param('status'); > my @notes = $query->multi_param('notes'); > my @subscriptionids = $query->multi_param('subscriptionid'); > my $op = $query->param('op'); >+my $skip_issues = $query->param('skip_issues') || 0; >+ >+my $count_forward = $skip_issues + 1; >+ > if ( scalar(@subscriptionids) == 1 && index( $subscriptionids[0], q|,| ) > 0 ) { > @subscriptionids = split( /,/, $subscriptionids[0] ); > } >@@ -240,7 +244,8 @@ if ( $op and $op eq 'serialchangestatus' ) { > $pub_date, > $publisheddatetexts[$i], > $status[$i], >- $notes[$i] >+ $notes[$i], >+ $count_forward > ); > } > my $makePreviousSerialAvailable = C4::Context->preference('makePreviousSerialAvailable'); >-- >2.34.1 >
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 32392
:
148948
|
148949
|
159617
|
159618
|
165083
|
165084
|
165085
|
165729
|
165730
|
165731