Bug 22188

Summary: Use publication date as numbering pattern
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: SerialsAssignee: Aleisha Amohia <aleisha>
Status: ASSIGNED --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: andrew, black23, colin.campbell, danyonsewell, koha, marjorie.barry-vila, martinom43, maryse.simard, nick, pierre-marc.thibault, severine.queune, wizzyrea, yach
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35646
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 22188: Use publication date as numbering pattern
Bug 22188: Use publication date as numbering pattern
Sceenshot 1 - Problem on step 13
Sceenshot 2 - Problem on step 18
Screenshot 3 - Numbering pattern cleared
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Bug 22188: Use publication date as numbering pattern
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Bug 22188: Tests
Bug 22188: Tests
Bug 22188: (follow-up) Ensuring publication date numbering patterns shows when receiving serials
display error on subscription
error when generating next issue
Bug 22188: Use publication date as numbering pattern
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Bug 22188: Tests
Bug 22188: (follow-up) Ensuring publication date numbering patterns shows when receiving serials
Bug 22188: updating kohastructure.sql to include creation of pubdatepatternformat field
Bug 22188: updated Subscription.pm for database update
Bug 22188: Use publication date as numbering pattern
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Bug 22188: Tests
Bug 22188: (follow-up) Ensuring publication date numbering patterns shows when receiving serials
Bug 22188: updating kohastructure.sql to include creation of pubdatepatternformat field
Bug 22188: Schema updates
Bug 22188: Additional fixes
Bug 22188: Atomic update for pubdatepatternformat
Bug 22188: Bad rebase conflict fix
Bug 22188: Add Koha::DateUtils for dt_from_string function

Description Aleisha Amohia 2019-01-23 04:48:42 UTC
Brimbank Libraries Australia would like to be able to use the publication date of a serial as the issue number.
Comment 1 Aleisha Amohia 2019-01-23 05:07:53 UTC
Created attachment 84314 [details] [review]
Bug 22188: Use publication date as numbering pattern

Brimbank were trying to make a numbering pattern that displays the
publication date, but numbering patterns are calculated mathematically,
and dates are not always consistent and don't work that way. I've
written a feature that hardcodes an option to use the publication date
instead of a numbering pattern, in a 'Y M D' format.

To test:
1) Go to Serials
2) Click New subscription
3) Fill in the necessary details for the first page and click Next
4) Fill in the necessary details for the second page. Under numbering
pattern, select Number.
5) Notice the advanced pattern table shows. Put some random data in
these fields
6) Change numbering pattern to Use publication date. Confirm that
selecting this option hides the advanced pattern table and clears its fields.
7) Click Test prediction pattern and confirm the prediction pattern shows as expected
8) Save subscription
9) You should now be on the subscription detail page for your new
subscription. Go to the Planning tab and confirm that it says 'uses
publication date' under Number pattern and that there is now table
saying 'Starting with' and 'Rollover'
10) Go to the Issues tab and confirm the first serial is there with the
correct issue number (publication date).
11) Click the Receive button
12) Confirm the publication date shows under the Numbered column, in the
Issue text field and click Save
13) Click the Generate next button and confirm the alert box
14) Confirm the publication date shows under 'Number'
15) Find/make a subscription that uses a normal numbering pattern
16) Edit this subscription to now use the publication date as numbering
pattern
17) Upon saving, confirm that previously received serials keep their old
issue numbers
18) Click Receive and Generate next again and confirm that the next
serial now has the publication date
19) Confirm that making a subscription with a normal numbering pattern
works as expected. Upon saving, the table should show under the Planning
tab with 'Starting with' and 'Rollover' and all other fields should be
filled correctly.

Sponsored-by: Brimbank Libraries Australia
Comment 2 Pierre-Marc Thibault 2019-01-25 19:35:04 UTC
The patch does not apply.
Comment 3 Aleisha Amohia 2019-02-20 23:09:17 UTC
Created attachment 85415 [details] [review]
Bug 22188: Use publication date as numbering pattern

Brimbank were trying to make a numbering pattern that displays the
publication date, but numbering patterns are calculated mathematically,
and dates are not always consistent and don't work that way. I've
written a feature that hardcodes an option to use the publication date
instead of a numbering pattern, in a 'Y M D' format.

To test:
1) Go to Serials
2) Click New subscription
3) Fill in the necessary details for the first page and click Next
4) Fill in the necessary details for the second page. Under numbering
pattern, select Number.
5) Notice the advanced pattern table shows. Put some random data in
these fields
6) Change numbering pattern to Use publication date. Confirm that
selecting this option hides the advanced pattern table and clears its fields.
7) Click Test prediction pattern and confirm the prediction pattern shows as expected
8) Save subscription
9) You should now be on the subscription detail page for your new
subscription. Go to the Planning tab and confirm that it says 'uses
publication date' under Number pattern and that there is now table
saying 'Starting with' and 'Rollover'
10) Go to the Issues tab and confirm the first serial is there with the
correct issue number (publication date).
11) Click the Receive button
12) Confirm the publication date shows under the Numbered column, in the
Issue text field and click Save
13) Click the Generate next button and confirm the alert box
14) Confirm the publication date shows under 'Number'
15) Find/make a subscription that uses a normal numbering pattern
16) Edit this subscription to now use the publication date as numbering
pattern
17) Upon saving, confirm that previously received serials keep their old
issue numbers
18) Click Receive and Generate next again and confirm that the next
serial now has the publication date
19) Confirm that making a subscription with a normal numbering pattern
works as expected. Upon saving, the table should show under the Planning
tab with 'Starting with' and 'Rollover' and all other fields should be
filled correctly.

Sponsored-by: Brimbank Libraries Australia
Comment 4 Aleisha Amohia 2019-02-20 23:09:45 UTC
Rebased, please test.
Comment 5 Séverine Queune 2019-02-22 14:46:49 UTC
Hi Aleisha,

This is a useful enhancement, but I have some questions and issues.

> 7) Click Test prediction pattern and confirm the prediction pattern shows as
> expected

The issue number is formatted as 'YYYY Month DD', is there a way to modify it using the advanced pattern ? I failed trying it.


> 9) You should now be on the subscription detail page for your new
> subscription. Go to the Planning tab and confirm that it says 'uses
> publication date' under Number pattern and that there is now table
> saying 'Starting with' and 'Rollover'

Ok for 'Number pattern: Uses publication date', but I don't see the table.


> 12) Confirm the publication date shows under the Numbered column, in the
> Issue text field and click Save

Ok for display, but each time I tried to save the receive, I get this Software error :
Can't use string ("1") as a HASH ref while "strict refs" in use at /home/koha/src/C4/Serials.pm line 2353. 
This message also occurs for 1) receipt of serial that uses other numbering patterns, 2) for multi-receiving and 3) when generating a new issue if the last one in still 'Expected'.

When I go back to /cgi-bin/koha/serials/serials-collection.pl, in case 1) serial is corectly received, case 2) only one issue is received (I wanted to receive 3) and in case 3) issue is correctly set tot 'late' and the next is 'Expected'.

[Sorry if this bug is not due to this patch]

> 13) Click the Generate next button and confirm the alert box

I created several subscriptions and I always have the same problem : when I generate the next issue, the number format changes from 'YYYY Month DD' to 'YYYY-MM-DD', and the date of the previous issue is used, which creates a gap in the number pattern (see screenshot attached)


> 16) Edit this subscription to now use the publication date as numbering
> pattern
ok
> 17) Upon saving, confirm that previously received serials keep their old
> issue numbers
ok
> 18) Click Receive and Generate next again and confirm that the next
> serial now has the publication date
Badaboum... Same problem as step 13 : the date of the previous issue is used as number (see the second screenshot attached)


I didn't see this step on your plan test, but when I edit a subscription using 'Use publication date', the 'Numbering pattern' is cleared (see the last screenshot attached).

I hope my comments are clear enough...

Very interested to see this one pushed soon !
Comment 6 Séverine Queune 2019-02-22 14:47:54 UTC
Created attachment 85540 [details]
Sceenshot 1 - Problem on step 13
Comment 7 Séverine Queune 2019-02-22 14:48:29 UTC
Created attachment 85541 [details]
Sceenshot 2 - Problem on step 18
Comment 8 Séverine Queune 2019-02-22 14:49:49 UTC
Created attachment 85542 [details]
Screenshot 3 - Numbering pattern cleared
Comment 9 Aleisha Amohia 2019-03-10 22:49:09 UTC
Created attachment 86419 [details] [review]
Bug 22188: (follow-up) Introducing dateformat field and other fixes

To test with this patch, please update the database and update the
schema.

With this patch, you can now choose the dateformat of the date pattern
by editing the subscription. This information is now saved in the DB
subscription table.

This patch also fixes previous problems with receiving and generating
the next serial.

Sponsored-by: Brimbank Libraries Australia
Comment 10 Aleisha Amohia 2019-03-10 22:50:13 UTC
(In reply to Séverine Queune from comment #5)
> > 9) You should now be on the subscription detail page for your new
> > subscription. Go to the Planning tab and confirm that it says 'uses
> > publication date' under Number pattern and that there is now table
> > saying 'Starting with' and 'Rollover'
> 
> Ok for 'Number pattern: Uses publication date', but I don't see the table.
> 

Sorry I forgot to fix my test plan - this table does not show if using publication date pattern. It will show for all other number patterns.

This should be ready to test again now!
Comment 11 Aleisha Amohia 2019-04-05 01:08:31 UTC
Created attachment 87433 [details] [review]
Bug 22188: (follow-up) Introducing dateformat field and other fixes

To test with this patch, please update the database and update the
schema.

With this patch, you can now choose the dateformat of the date pattern
by editing the subscription. This information is now saved in the DB
subscription table.

This patch also fixes previous problems with receiving and generating
the next serial.

Sponsored-by: Brimbank Libraries Australia
Comment 12 Séverine Queune 2019-04-17 09:11:16 UTC
Sorry Aleisha...

The sandbox you've requested is not ready.
Some problems occurred applying patches from bug 22188:
<h1>Something went wrong !</h1>Applying: Bug 22188: Use publication date as numbering pattern
Using index info to reconstruct a base tree...
M       C4/Serials.pm
M       koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
M       koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
M       koha-tmpl/intranet-tmpl/prog/js/subscription-add.js
M       serials/showpredictionpattern.pl
M       serials/subscription-add.pl
Falling back to patching base and 3-way merge...
Auto-merging serials/subscription-add.pl
Auto-merging serials/showpredictionpattern.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/js/subscription-add.js
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
Auto-merging C4/Serials.pm
Warning: commit message did not conform to UTF-8.
You may want to amend it after fixing the message, or set the config
variable i18n.commitencoding to the encoding your project uses.
Applying: Bug 22188: (follow-up) Introducing dateformat field and other fixes
fatal: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt).
Patch failed at 0001 Bug 22188: (follow-up) Introducing dateformat field and other fixes
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run git bz apply --continue.
If you would prefer to skip this patch, instead run git bz apply --skip.
To restore the original branch and stop patching run git bz apply --abort.
error: could not build fake ancestor
Bug 22188 - Use publication date as numbering pattern

85415 - Bug 22188: Use publication date as numbering pattern
87433 - Bug 22188: (follow-up) Introducing dateformat field and other fixes

Apply? [(y)es, (n)o, (i)nteractive] Patch left in /tmp/Bug-22188-follow-up-Introducing-dateformat-field-a-vPc2wv.patch .
Comment 13 Aleisha Amohia 2019-04-26 02:24:56 UTC
Created attachment 88830 [details] [review]
Bug 22188: (follow-up) Introducing dateformat field and other fixes

To test with this patch, please update the database and update the
schema.

With this patch, you can now choose the dateformat of the date pattern
by editing the subscription. This information is now saved in the DB
subscription table.

This patch also fixes previous problems with receiving and generating
the next serial.

Sponsored-by: Brimbank Libraries Australia
Comment 14 Maryse Simard 2019-07-19 20:48:41 UTC
Patch doesn't apply

Applying: Bug 22188: Use publication date as numbering pattern
Using index info to reconstruct a base tree...
M	C4/Serials.pm
M	koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
M	koha-tmpl/intranet-tmpl/prog/js/subscription-add.js
M	serials/serials-collection.pl
M	serials/showpredictionpattern.pl
M	serials/subscription-add.pl
Falling back to patching base and 3-way merge...
Auto-merging serials/subscription-add.pl
Auto-merging serials/showpredictionpattern.pl
Auto-merging serials/serials-collection.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/js/subscription-add.js
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
Auto-merging C4/Serials.pm
Applying: Bug 22188: (follow-up) Introducing dateformat field and other fixes
fatal: sha1 information is lacking or useless (C4/Serials.pm).
error: could not build fake ancestor
Patch failed at 0001 Bug 22188: (follow-up) Introducing dateformat field and other fixes
Comment 15 Aleisha Amohia 2019-07-24 04:24:46 UTC
Created attachment 91761 [details] [review]
Bug 22188: Use publication date as numbering pattern

Brimbank were trying to make a numbering pattern that displays the
publication date, but numbering patterns are calculated mathematically,
and dates are not always consistent and don't work that way. I've
written a feature that hardcodes an option to use the publication date
instead of a numbering pattern, in a 'Y M D' format.

To test:
1) Go to Serials
2) Click New subscription
3) Fill in the necessary details for the first page and click Next
4) Fill in the necessary details for the second page. Under numbering
pattern, select Number.
5) Notice the advanced pattern table shows. Put some random data in
these fields
6) Change numbering pattern to Use publication date. Confirm that
selecting this option hides the advanced pattern table and clears its fields.
7) Click Test prediction pattern and confirm the prediction pattern shows as expected
8) Save subscription
9) You should now be on the subscription detail page for your new
subscription. Go to the Planning tab and confirm that it says 'uses
publication date' under Number pattern and that there is now table
saying 'Starting with' and 'Rollover'
10) Go to the Issues tab and confirm the first serial is there with the
correct issue number (publication date).
11) Click the Receive button
12) Confirm the publication date shows under the Numbered column, in the
Issue text field and click Save
13) Click the Generate next button and confirm the alert box
14) Confirm the publication date shows under 'Number'
15) Find/make a subscription that uses a normal numbering pattern
16) Edit this subscription to now use the publication date as numbering
pattern
17) Upon saving, confirm that previously received serials keep their old
issue numbers
18) Click Receive and Generate next again and confirm that the next
serial now has the publication date
19) Confirm that making a subscription with a normal numbering pattern
works as expected. Upon saving, the table should show under the Planning
tab with 'Starting with' and 'Rollover' and all other fields should be
filled correctly.

Sponsored-by: Brimbank Libraries Australia
Comment 16 Aleisha Amohia 2019-07-24 04:24:53 UTC
Created attachment 91762 [details] [review]
Bug 22188: (follow-up) Introducing dateformat field and other fixes

To test with this patch, please update the database and update the
schema.

With this patch, you can now choose the dateformat of the date pattern
by editing the subscription. This information is now saved in the DB
subscription table.

This patch also fixes previous problems with receiving and generating
the next serial.

Sponsored-by: Brimbank Libraries Australia
Comment 17 Aleisha Amohia 2019-07-24 05:15:00 UTC
Rebased
Comment 18 Michal Denar 2019-07-24 20:41:33 UTC
Hi Aleisha,

I'm not able to set any dates in form for subscription.From

 caledar I get error about format, manually I can't add "/" delimiter.

Video maybe help: https://recordit.co/0IrAibfJUJ
Comment 19 Aleisha Amohia 2019-08-14 03:24:49 UTC
Created attachment 92185 [details] [review]
Bug 22188: (follow-up) Introducing dateformat field and other fixes

To test with this patch, please update the database and update the
schema.

With this patch, you can now choose the dateformat of the date pattern
by editing the subscription. This information is now saved in the DB
subscription table.

This patch also fixes previous problems with receiving and generating
the next serial.

Sponsored-by: Brimbank Libraries Australia
Comment 20 Aleisha Amohia 2019-08-14 04:07:22 UTC
Created attachment 92186 [details] [review]
Bug 22188: Tests

This patch fixes the t/db_dependent/Serials.t test which fails with this
feature (without this fix).

Ensure all other tests that use NewSubscription, ModSubscription, GetNextSeq,
GetSeq still pass.
db_dependent/Acquisition/OrderFromSubscription.t
db_dependent/Bookseller.t
db_dependent/Koha/Acquisition/Booksellers.t
db_dependent/Letters.t
db_dependent/Serials.t
db_dependent/Serials/Claims.t
db_dependent/Serials/ReNewSubscription.t
db_dependent/Serials_2.t
db_dependent/Serials/Frequency.t
db_dependent/Serials/Numberpattern.t
db_dependent/Serials/GetNextSeq.t
Serials/GetNextSeq.t

Sponsored-by: Brimbank Libraries Australia
Comment 21 Andrew Fuerste-Henry 2019-08-14 14:24:56 UTC
I'm failing on step 18 of the test plan. I created a new subscription using a Number pattern, received several issues, edited the subscription to use Pub Date instead, saved it. But when I either Generate Next Issue or receive the issue that's already expected the subscription reverts to Number pattern.

That said, this is a really great feature! Thanks for writing it!
Comment 22 Aleisha Amohia 2019-08-19 04:53:38 UTC
Created attachment 92345 [details] [review]
Bug 22188: Tests

This patch fixes the t/db_dependent/Serials.t test which fails with this
feature (without this fix).

Ensure all other tests that use NewSubscription, ModSubscription, GetNextSeq,
GetSeq still pass.
db_dependent/Acquisition/OrderFromSubscription.t
db_dependent/Bookseller.t
db_dependent/Koha/Acquisition/Booksellers.t
db_dependent/Letters.t
db_dependent/Serials.t
db_dependent/Serials/Claims.t
db_dependent/Serials/ReNewSubscription.t
db_dependent/Serials_2.t
db_dependent/Serials/Frequency.t
db_dependent/Serials/Numberpattern.t
db_dependent/Serials/GetNextSeq.t
Serials/GetNextSeq.t

This patch also adds tests to db_dependent/Serials_2.t so check these
tests pass

prove -v t/db_dependent/Serials_2.t

Sponsored-by: Brimbank Libraries Australia
Comment 23 Aleisha Amohia 2019-08-19 21:58:43 UTC
Created attachment 92364 [details] [review]
Bug 22188: (follow-up) Ensuring publication date numbering patterns shows when receiving serials

This follow-up addresses the issue in Comment 21.

To test:
1) Save a subscription with a regular number pattern and receive a few
issues
2) Edit the subscription to use publication date and save
3) Receive an issue
4) Notice the issue number under the 'Numbered' column has not updated
to reflect the publication date number pattern
5) Apply patch and refresh page
6) The issue number in the 'Numbered' column should now use the publication date
Comment 24 Andrew Fuerste-Henry 2019-10-16 12:19:19 UTC
Created attachment 94290 [details]
display error on subscription

See attached for display errors on the subscription page. Data is displayed twice, along with what looks like some comments from the code.
Comment 25 Andrew Fuerste-Henry 2019-10-16 12:21:27 UTC
Created attachment 94291 [details]
error when generating next issue

I receive the attached error when trying to generate the next issue of a subscription using date as numbering pattern. I do not receive this error when trying to generate next on a subscription using the Number numbering pattern.
Comment 26 Danyon Sewell 2023-10-12 02:33:21 UTC
Created attachment 156886 [details] [review]
Bug 22188: Use publication date as numbering pattern

Brimbank were trying to make a numbering pattern that displays the
publication date, but numbering patterns are calculated mathematically,
and dates are not always consistent and don't work that way. I've
written a feature that hardcodes an option to use the publication date
instead of a numbering pattern, in a 'Y M D' format.

To test:
1) Go to Serials
2) Click New subscription
3) Fill in the necessary details for the first page and click Next
4) Fill in the necessary details for the second page. Under numbering
pattern, select Number.
5) Notice the advanced pattern table shows. Put some random data in
these fields
6) Change numbering pattern to Use publication date. Confirm that
selecting this option hides the advanced pattern table and clears its fields.
7) Click Test prediction pattern and confirm the prediction pattern shows as expected
8) Save subscription
9) You should now be on the subscription detail page for your new
subscription. Go to the Planning tab and confirm that it says 'uses
publication date' under Number pattern and that there is now table
saying 'Starting with' and 'Rollover'
10) Go to the Issues tab and confirm the first serial is there with the
correct issue number (publication date).
11) Click the Receive button
12) Confirm the publication date shows under the Numbered column, in the
Issue text field and click Save
13) Click the Generate next button and confirm the alert box
14) Confirm the publication date shows under 'Number'
15) Find/make a subscription that uses a normal numbering pattern
16) Edit this subscription to now use the publication date as numbering
pattern
17) Upon saving, confirm that previously received serials keep their old
issue numbers
18) Click Receive and Generate next again and confirm that the next
serial now has the publication date
19) Confirm that making a subscription with a normal numbering pattern
works as expected. Upon saving, the table should show under the Planning
tab with 'Starting with' and 'Rollover' and all other fields should be
filled correctly.

Sponsored-by: Brimbank Libraries Australia
Comment 27 Danyon Sewell 2023-10-12 02:34:08 UTC
Created attachment 156887 [details] [review]
Bug 22188: (follow-up) Introducing dateformat field and other fixes

To test with this patch, please update the database and update the
schema.

With this patch, you can now choose the dateformat of the date pattern
by editing the subscription. This information is now saved in the DB
subscription table.

This patch also fixes previous problems with receiving and generating
the next serial.

Sponsored-by: Brimbank Libraries Australia
Comment 28 Danyon Sewell 2023-10-12 02:34:47 UTC
Created attachment 156888 [details] [review]
Bug 22188: Tests

This patch fixes the t/db_dependent/Serials.t test which fails with this
feature (without this fix).

Ensure all other tests that use NewSubscription, ModSubscription, GetNextSeq,
GetSeq still pass.
db_dependent/Acquisition/OrderFromSubscription.t
db_dependent/Bookseller.t
db_dependent/Koha/Acquisition/Booksellers.t
db_dependent/Letters.t
db_dependent/Serials.t
db_dependent/Serials/Claims.t
db_dependent/Serials/ReNewSubscription.t
db_dependent/Serials_2.t
db_dependent/Serials/Frequency.t
db_dependent/Serials/Numberpattern.t
db_dependent/Serials/GetNextSeq.t
Serials/GetNextSeq.t

This patch also adds tests to db_dependent/Serials_2.t so check these
tests pass

prove -v t/db_dependent/Serials_2.t

Sponsored-by: Brimbank Libraries Australia
Comment 29 Danyon Sewell 2023-10-12 02:35:19 UTC
Created attachment 156889 [details] [review]
Bug 22188: (follow-up) Ensuring publication date numbering patterns shows when receiving serials

This follow-up addresses the issue in Comment 21.

To test:
1) Save a subscription with a regular number pattern and receive a few
issues
2) Edit the subscription to use publication date and save
3) Receive an issue
4) Notice the issue number under the 'Numbered' column has not updated
to reflect the publication date number pattern
5) Apply patch and refresh page
6) The issue number in the 'Numbered' column should now use the publication date
Comment 30 Danyon Sewell 2023-10-12 02:43:06 UTC
Created attachment 156890 [details] [review]
Bug 22188: updating kohastructure.sql to include creation of pubdatepatternformat field

Sponsored-by: Auckland University of Technology
Comment 31 Danyon Sewell 2023-10-12 02:43:32 UTC
Created attachment 156891 [details] [review]
Bug 22188: updated Subscription.pm for database update

Sponsored-by: Auckland University of Technology
Comment 32 Danyon Sewell 2023-10-12 02:44:32 UTC
Have updated a few files attempting to rebase this for most recent version. I haven't finished just yet but thought I should share what I have done so far.
Comment 33 Aleisha Amohia 2023-10-13 01:53:27 UTC
Created attachment 157009 [details] [review]
Bug 22188: Use publication date as numbering pattern

Brimbank were trying to make a numbering pattern that displays the
publication date, but numbering patterns are calculated mathematically,
and dates are not always consistent and don't work that way. I've
written a feature that hardcodes an option to use the publication date
instead of a numbering pattern, in a 'Y M D' format.

To test:
1) Go to Serials
2) Click New subscription
3) Fill in the necessary details for the first page and click Next
4) Fill in the necessary details for the second page. Under numbering
pattern, select Number.
5) Notice the advanced pattern table shows. Put some random data in
these fields
6) Change numbering pattern to Use publication date. Confirm that
selecting this option hides the advanced pattern table and clears its fields.
7) Click Test prediction pattern and confirm the prediction pattern shows as expected
8) Save subscription
9) You should now be on the subscription detail page for your new
subscription. Go to the Planning tab and confirm that it says 'uses
publication date' under Number pattern and that there is now table
saying 'Starting with' and 'Rollover'
10) Go to the Issues tab and confirm the first serial is there with the
correct issue number (publication date).
11) Click the Receive button
12) Confirm the publication date shows under the Numbered column, in the
Issue text field and click Save
13) Click the Generate next button and confirm the alert box
14) Confirm the publication date shows under 'Number'
15) Find/make a subscription that uses a normal numbering pattern
16) Edit this subscription to now use the publication date as numbering
pattern
17) Upon saving, confirm that previously received serials keep their old
issue numbers
18) Click Receive and Generate next again and confirm that the next
serial now has the publication date
19) Confirm that making a subscription with a normal numbering pattern
works as expected. Upon saving, the table should show under the Planning
tab with 'Starting with' and 'Rollover' and all other fields should be
filled correctly.

Sponsored-by: Brimbank Libraries Australia
Comment 34 Aleisha Amohia 2023-10-13 01:53:31 UTC
Created attachment 157010 [details] [review]
Bug 22188: (follow-up) Introducing dateformat field and other fixes
Comment 35 Aleisha Amohia 2023-10-13 01:53:35 UTC
Created attachment 157011 [details] [review]
Bug 22188: Tests

This patch fixes the t/db_dependent/Serials.t test which fails with this
feature (without this fix).

Ensure all other tests that use NewSubscription, ModSubscription, GetNextSeq,
GetSeq still pass.
db_dependent/Acquisition/OrderFromSubscription.t
db_dependent/Bookseller.t
db_dependent/Koha/Acquisition/Booksellers.t
db_dependent/Letters.t
db_dependent/Serials.t
db_dependent/Serials/Claims.t
db_dependent/Serials/ReNewSubscription.t
db_dependent/Serials_2.t
db_dependent/Serials/Frequency.t
db_dependent/Serials/Numberpattern.t
db_dependent/Serials/GetNextSeq.t
Serials/GetNextSeq.t

This patch also adds tests to db_dependent/Serials_2.t so check these
tests pass

prove -v t/db_dependent/Serials_2.t

Sponsored-by: Brimbank Libraries Australia
Comment 36 Aleisha Amohia 2023-10-13 01:53:38 UTC
Created attachment 157012 [details] [review]
Bug 22188: (follow-up) Ensuring publication date numbering patterns shows when receiving serials

This follow-up addresses the issue in Comment 21.

To test:
1) Save a subscription with a regular number pattern and receive a few
issues
2) Edit the subscription to use publication date and save
3) Receive an issue
4) Notice the issue number under the 'Numbered' column has not updated
to reflect the publication date number pattern
5) Apply patch and refresh page
6) The issue number in the 'Numbered' column should now use the publication date
Comment 37 Aleisha Amohia 2023-10-13 01:53:42 UTC
Created attachment 157013 [details] [review]
Bug 22188: updating kohastructure.sql to include creation of pubdatepatternformat field

Sponsored-by: Auckland University of Technology
Comment 38 Aleisha Amohia 2023-10-13 01:53:45 UTC
Created attachment 157014 [details] [review]
Bug 22188: Schema updates
Comment 39 Aleisha Amohia 2023-10-13 01:54:18 UTC
Just updated to pull the schema updates into their own patch
Comment 40 Aleisha Amohia 2023-10-13 02:06:21 UTC
Created attachment 157015 [details] [review]
Bug 22188: Additional fixes
Comment 41 Aleisha Amohia 2023-10-16 00:52:52 UTC
Created attachment 157179 [details] [review]
Bug 22188: Atomic update for pubdatepatternformat

(cherry picked from commit 2277d729b9266c0f084b6489d52f0c4e230fe121)
Comment 42 Alex Buckley 2023-11-07 22:57:59 UTC
Created attachment 158638 [details] [review]
Bug 22188: Bad rebase conflict fix
Comment 43 Alex Buckley 2023-11-08 11:00:34 UTC
Created attachment 158659 [details] [review]
Bug 22188: Add Koha::DateUtils for dt_from_string function
Comment 44 Nick Clemens (kidclamp) 2023-12-22 20:25:37 UTC
Hi all, I didn't see this and ended up working on 35646 - I think it meets the same basic need, but with a slightly different implementation.
Comment 45 Koha collecto 2024-05-03 17:37:15 UTC
+1