Bugzilla – Attachment 165729 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.
Bug-32392-Enable-skipping-forward-issues-when-rece.patch (text/plain), 13.33 KB, created by
Kevin Carnes
on 2024-04-29 11:43:16 UTC
(
hide
)
Description:
Bug 32392: Enable skipping forward issues when receiving serials.
Filename:
MIME Type:
Creator:
Kevin Carnes
Created:
2024-04-29 11:43:16 UTC
Size:
13.33 KB
patch
obsolete
>From 4689e7c16491cbae1e33cce79ffca92298b64625 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] 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> > >Signed-off-by: Marie Hedbom <marie.hedbom@musikverket.se> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Serials.pm | 15 +++++---- > .../includes/modals/serials_skip_issues.inc | 29 +++++++++++++++++ > .../en/modules/serials/serials-collection.tt | 5 +++ > .../prog/en/modules/serials/serials-edit.tt | 31 +++++++++++++++++++ > serials/serials-collection.pl | 8 +++-- > serials/serials-edit.pl | 7 ++++- > 6 files changed, 85 insertions(+), 10 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 ec88b0f3e6..b8dcbb8f15 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -814,7 +814,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'. >@@ -822,18 +822,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'}; >@@ -1058,7 +1059,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 >@@ -1067,10 +1068,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; >@@ -1139,7 +1142,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..86700511a8 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/serials_skip_issues.inc >@@ -0,0 +1,29 @@ >+<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"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <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="cud-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 ea9775f66a..d28b403f60 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 >@@ -37,6 +37,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 b20db8cba4..5b25284910 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> >@@ -327,6 +355,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 4a6c8ba2f4..a5ca8b7154 100755 >--- a/serials/serials-collection.pl >+++ b/serials/serials-collection.pl >@@ -46,13 +46,15 @@ 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; > my $subscriptiondescs; > my $subscriptions; > >-if($op eq 'gennext' && @subscriptionid){ >+if($op eq 'cud-gennext' && @subscriptionid){ > my $subscriptionid = $subscriptionid[0]; > my $sth = $dbh->prepare(" > SELECT publisheddate, publisheddatetext, serialid, serialseq, >@@ -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 6acefa5918..ef30c4eae8 100755 >--- a/serials/serials-edit.pl >+++ b/serials/serials-edit.pl >@@ -90,6 +90,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] ); > } >@@ -241,7 +245,8 @@ if ( $op and $op eq 'cud-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