When adding a new subscription pattern from the edit subscription page, nothing happens when clicking on the bug. But we can see the following error from the API request: XHRGEThttp://localhost:8081/cgi-bin/koha/serials/create-numberpattern.pl?patternname=Test season with month&numberingmethod={X} {Y} {Z}&label1=Season&label2=Year&label3=Month&add1=1&add2=1&add3=1&every1=1&every2=4&every3=4&setto1=0&setto2=1&setto3=0&numbering1=season&numbering3=monthname&whenmorethan1=3&whenmorethan2=99999&whenmorethan3=11&locale=spa [HTTP/1.1 500 Internal Server Error 27ms] C4::Serials::Numberpattern::AddSubscriptionNumberpattern(): DBI Exception: DBD::mysql::st execute failed: Field 'description' doesn't have a default value at /kohadevbox/koha/serials/create-numberpattern.pl line 58 description is a field in the database, that can only be filled from the administration page for numbering patterns, but not from this screen. This has always been the case. Could this by a strict SQL error?
Looks like a duplicate of bug 28012.
(In reply to Jonathan Druart from comment #1) > Looks like a duplicate of bug 28012. Hum not really, related but not exactly the same.
Created attachment 138892 [details] [review] Bug 31297: Fix creation of new subscription pattern from edit subscription When editing a subscription there is the possibility to create a new subscription pattern. But this form does not have a "description" for this pattern, and the DBMS does not allow description to be NULLed. Error is: DBI Exception: DBD::mysql::st execute failed: Field 'description' doesn't have a default value This patch takes the shortest path to fix the 500 error (with no feedback sent to the end user), but there are other better ways to fix it: 1. Allow subscription_numberpatterns.description to be NULL, or 2. Add a description field on the form Test plan: Create a new subscription, on the second page click "show advanced pattern", then "Modify pattern", enter a name and click "Save as new pattern"
Please let's go directly with the proper solution, number 1 or 2 that Jonathan suggested? Reviewing, merging and reverting this and then going for solution 1 or 2 is extra work.
(In reply to Joonas Kylmälä from comment #4) > Please let's go directly with the proper solution, number 1 or 2 that > Jonathan suggested? Reviewing, merging and reverting this and then going for > solution 1 or 2 is extra work. I personally prefer number 1, the user might not care about the description at all so having to fill fields that are not useful is not something we should force the users to do.
It's definitely 1) 1. Allow subscription_numberpatterns.description to be NULL The description and hasn't even been shown in the past, so we should not make it mandatory suddenly. It could be nice to have on the form, but as an optional field. Please keep in mind that we will probably want to backport (and that Jonathan is gone right now)
Created attachment 160244 [details] [review] Bug 31297: Allow null value for description in subscription_numberpatterns To test: 1 - Go to Serials 2 - Add a enw subscription 3 - Select Vendor and record, click next 4 - Select Numbring pattern: Number, or any to populate forms 4 - Click 'show advanced pattern' 5 - 'Modify pattern' 6 - Add a new name 7 - 'Save as new pattern' 8 - Nothin happens 9 - Check logs: C4::Serials::Numberpattern::AddSubscriptionNumberpattern(): DBI Exception: DBD::mysql::st execute failed: Field 'description' doesn't have a default value at /kohadevbox/koha/serials/create-numberpattern.pl line 58 10 - Apply patch 11 - Update database 12 - Restart all 13 - Click save again 14 - Success!
Created attachment 160263 [details] [review] Bug 31297: Allow null value for description in subscription_numberpatterns To test: 1 - Go to Serials 2 - Add a enw subscription 3 - Select Vendor and record, click next 4 - Select Numbring pattern: Number, or any to populate forms 4 - Click 'show advanced pattern' 5 - 'Modify pattern' 6 - Add a new name 7 - 'Save as new pattern' 8 - Nothin happens 9 - Check logs: C4::Serials::Numberpattern::AddSubscriptionNumberpattern(): DBI Exception: DBD::mysql::st execute failed: Field 'description' doesn't have a default value at /kohadevbox/koha/serials/create-numberpattern.pl line 58 10 - Apply patch 11 - Update database 12 - Restart all 13 - Click save again 14 - Success! Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Trivial QA, no regressions introduced. Passed
Created attachment 160307 [details] [review] Bug 31297: Allow null value for description in subscription_numberpatterns To test: 1 - Go to Serials 2 - Add a enw subscription 3 - Select Vendor and record, click next 4 - Select Numbring pattern: Number, or any to populate forms 4 - Click 'show advanced pattern' 5 - 'Modify pattern' 6 - Add a new name 7 - 'Save as new pattern' 8 - Nothin happens 9 - Check logs: C4::Serials::Numberpattern::AddSubscriptionNumberpattern(): DBI Exception: DBD::mysql::st execute failed: Field 'description' doesn't have a default value at /kohadevbox/koha/serials/create-numberpattern.pl line 58 10 - Apply patch 11 - Update database 12 - Restart all 13 - Click save again 14 - Success! Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Pushed for 24.05! Well done everyone, thank you!
Pushed to 23.11.x for 23.11.02
Backported to 23.05.x for upcoming 23.05.08