Bug 32392 - Ability to skip forward serial issues when receiving double (or more) issue
Summary: Ability to skip forward serial issues when receiving double (or more) issue
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Björn Nylén
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 37925
  Show dependency treegraph
 
Reported: 2022-12-02 09:12 UTC by Björn Nylén
Modified: 2024-09-13 20:13 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This adds a new button to the serial collection page that allows to create a new issue while skipping several issues in between. The skipped issues will not be created. This can help when multiple issues need to be combined into one.
Version(s) released in:
24.05.00
Circulation function:


Attachments
Bug 32392: Enable skipping forward issues when receiving serials. (12.88 KB, patch)
2023-03-30 07:54 UTC, Björn Nylén
Details | Diff | Splinter Review
Bug 32392: Tests for changes in C4::Serials::GetNextSeq (2.17 KB, patch)
2023-03-30 07:55 UTC, Björn Nylén
Details | Diff | Splinter Review
Bug 32392: Fix QA issues (5.06 KB, patch)
2023-12-06 13:25 UTC, Kevin Carnes
Details | Diff | Splinter Review
Bug 32392: Fix QA issues (5.11 KB, patch)
2023-12-06 14:05 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 32392: Enable skipping forward issues when receiving serials. (12.98 KB, patch)
2024-04-18 12:31 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 32392: Tests for changes in C4::Serials::GetNextSeq (2.26 KB, patch)
2024-04-18 12:31 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 32392: Fix QA issues (5.20 KB, patch)
2024-04-18 12:31 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 32392: Enable skipping forward issues when receiving serials. (13.33 KB, patch)
2024-04-29 11:43 UTC, Kevin Carnes
Details | Diff | Splinter Review
Bug 32392: Tests for changes in C4::Serials::GetNextSeq (2.28 KB, patch)
2024-04-29 11:43 UTC, Kevin Carnes
Details | Diff | Splinter Review
Bug 32392: Fix QA issues (5.17 KB, patch)
2024-04-29 11:43 UTC, Kevin Carnes
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Nylén 2022-12-02 09:12:43 UTC
When an unexpected double issue is received there needs to be an easy way to skip forward to generate the next expected issue. Eg I receive no 6/7 so the next generated issue should be No 8 rather than having to generate No 7 and 8 and then delete No 7.
Comment 1 Björn Nylén 2023-03-30 07:54:55 UTC
Created attachment 148948 [details] [review]
Bug 32392: Enable skipping forward issues when receiving serials.

Bug 32392: Enable skipping forward issues when receiving serials.
    
    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>
Comment 2 Björn Nylén 2023-03-30 07:55:40 UTC
Created attachment 148949 [details] [review]
Bug 32392: Tests for changes in C4::Serials::GetNextSeq

Bug 32392: Tests for changes in C4::Serials::GetNextSeq
Comment 3 Marie 2023-03-31 13:00:11 UTC
(In reply to Björn Nylén from comment #1)
> Created attachment 148948 [details] [review] [review]
> Bug 32392: Enable skipping forward issues when receiving serials.
> 
> Bug 32392: Enable skipping forward issues when receiving serials.
>     
>     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> (first sign off, is this enough?)
Comment 4 Marcel de Rooy 2023-05-04 12:08:38 UTC
Looking here
Comment 5 Marcel de Rooy 2023-05-04 13:13:30 UTC
While testing, stumbled over byg 33678
Comment 6 Marcel de Rooy 2023-05-04 13:14:51 UTC
And bug 33679
Comment 7 Marcel de Rooy 2023-05-04 13:34:21 UTC
Do not understand why we add this to serial-EDIT here ?

+        $("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;
+                }
+            });
Comment 8 Marcel de Rooy 2023-05-04 13:34:36 UTC
And why do we cap at 10 ?
Comment 9 Marcel de Rooy 2023-05-04 13:35:08 UTC
(In reply to Marcel de Rooy from comment #8)
> And why do we cap at 10 ?

And why dont we cap on serial-collection then ?
Comment 10 Marcel de Rooy 2023-05-04 13:36:14 UTC
serials/serials-collection.pl
my $count_forward = int $skip_issues + 1;
serials/serials-edit.pl
+my $count_forward = $skip_issues + 1;

Inconsistent. Remove int ?
Comment 11 Marcel de Rooy 2023-05-04 13:36:51 UTC
Both Perl and JS allow you to write this shorter with a = b || c. Note that Perl also has a // b but this checks on defined instead of true.
+    my $count = $count_forward ? $count_forward : 1;
+                let issues = $('input[name="skip_issues"]').val() ? $('input[name="skip_issues"]').val() : '';
No blocker but less typing and errors doing so.
Comment 12 Marcel de Rooy 2023-05-04 13:37:04 UTC
koha-tmpl/intranet-tmpl/prog/en/includes/modals/serials_skip_issues.inc
TYPO serils-edit
Comment 13 Marcel de Rooy 2023-05-04 13:38:21 UTC
Just raising questions here. But I spent some time here and am not confident that this change is without bugs. The whole context of Serials is quite buggy, I am afraid. Opened two new reports too.
Comment 14 Kevin Carnes 2023-12-06 13:25:07 UTC
Created attachment 159617 [details] [review]
Bug 32392: Fix QA issues
Comment 15 PTFS Europe Sandboxes 2023-12-06 14:05:00 UTC
Created attachment 159618 [details] [review]
Bug 32392: Fix QA issues

Signed-off-by: Stina <stina.hallin@ub.lu.se>
Comment 16 Magnus Enger 2024-01-16 07:21:48 UTC
(In reply to Marie from comment #3)
> Signed-off-by: Marie Hedbom <marie.hedbom@musikverket.se> (first sign off,
> is this enough?)

Congratulations! :-) It would be nice to say at least "followed the test plan and everything works as expected". And if you tested other things than what the test plan says that would be good to mention.
Comment 17 Marcel de Rooy 2024-04-18 12:31:45 UTC
Created attachment 165083 [details] [review]
Bug 32392: Enable skipping forward issues when receiving serials.

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: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 18 Marcel de Rooy 2024-04-18 12:31:47 UTC
Created attachment 165084 [details] [review]
Bug 32392: Tests for changes in C4::Serials::GetNextSeq

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 19 Marcel de Rooy 2024-04-18 12:31:50 UTC
Created attachment 165085 [details] [review]
Bug 32392: Fix QA issues

Signed-off-by: Stina <stina.hallin@ub.lu.se>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 20 Katrin Fischer 2024-04-29 07:12:05 UTC
This needs some additional work for CSRF. 

Given our short time frame for release, maybe someone could lend a hand here?

When clicking the new button, I get:

Programming error - op 'gennext' must start with 'cud-' for POST http://localhost:8081/intranet/serials/serials-collection.pl (referer: http://localhost:8081/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=1)

NOTE: Remember to add the missing sign-off lines for Marie.
Comment 21 Kevin Carnes 2024-04-29 11:43:16 UTC
Created attachment 165729 [details] [review]
Bug 32392: Enable skipping forward issues when receiving serials.

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>
Comment 22 Kevin Carnes 2024-04-29 11:43:19 UTC
Created attachment 165730 [details] [review]
Bug 32392: Tests for changes in C4::Serials::GetNextSeq

Signed-off-by: Marie Hedbom <marie.hedbom@musikverket.se>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 23 Kevin Carnes 2024-04-29 11:43:21 UTC
Created attachment 165731 [details] [review]
Bug 32392: Fix QA issues

Signed-off-by: Stina <stina.hallin@ub.lu.se>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 24 Kevin Carnes 2024-04-29 11:46:38 UTC
Ok, I added CSRF protection to the form, added Marie to the first two patches, and changed it to Signed Off. Is that correct?

(In reply to Katrin Fischer from comment #20)
> This needs some additional work for CSRF. 
> 
> Given our short time frame for release, maybe someone could lend a hand here?
> 
> When clicking the new button, I get:
> 
> Programming error - op 'gennext' must start with 'cud-' for POST
> http://localhost:8081/intranet/serials/serials-collection.pl (referer:
> http://localhost:8081/cgi-bin/koha/serials/serials-collection.
> pl?subscriptionid=1)
> 
> NOTE: Remember to add the missing sign-off lines for Marie.
Comment 25 Katrin Fischer 2024-04-29 12:03:39 UTC
Grabbing it directly, you are a star Kevin :)
Comment 26 Katrin Fischer 2024-04-29 13:20:32 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 27 Fridolin Somers 2024-05-24 09:59:25 UTC
Not backported to 23.11.x