[Bug 20478] New: Advance notices: send separate digest messages per branch
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Bug ID: 20478 Summary: Advance notices: send separate digest messages per branch Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Notices Assignee: koha-bugs@lists.koha-community.org Reporter: andreas.jonsson@kreablo.se QA Contact: testopia@bugs.koha-community.org Current behavior for advance_notices.pl is to send one digest message for each borrower. The sender for the message is then set to the branch where the borrower is registered, which can be different from the branch or branches on the issues in question. Desired behavior is that the sender address on the notice message is that of the branch of the issues in question. Thus, the solution is to generate digest messages per branch. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #1 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 73308 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73308&action=edit Bug 20478: Add unit test for advance_notices.pl cronjob. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #2 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 73309 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73309&action=edit Bug 20478: Refactor to remove code duplication. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #3 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 73310 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73310&action=edit Bug 20478: Have the cronjob script advance_notices.pl send digest messages per branch. Desired behavior of the script advance_notices.pl is that the sender address on the notice message is that of the branch of the issues in question. Thus, the solution is to generate digest messages per branch. To test: 1) Inspect unit test in t/db_dependent/cronjobs/advance_notices_digest.t and note that: - There are three libraries - There is a borrower - The borrower is registered at library1 - The borrower has message preference wants_digest set to 1 - The borrower has message preference days_in_advance set to 1 - The content of the letter PREDUEDGST is '<<count>> <<branches.branchname>>' - There are three items - There is one issue per item - There is one issues at library2 - There are two issues at library3 - The date_due of the issues are set to tomorrow - It is asserted that there are two messages in the message queue after running the script - It is asserted that the item count of the message corresponding to library2 is 1 - It is asserted that the item count of the message corresponding to library3 is 2 - It is asserted that the branchnames are correct. 2) Run unit test: prove t/db_dependent/cronjobs/advance_notices_digest.t Sponsored-By: The Bibliotek Mellansjö coallition consisting of: Gullspångs kommunbibliotek, Hjo stadsbibliotek, Karlsborgs bibliotek, Mariestads stadsbibliotek, Skövde stadsbibliotek, Tibro bibliotek, Tidaholms stadsbibliotek, Töreboda kommunbibliotek -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de Status|NEW |Needs Signoff --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Andreas, thx for your patches! Some things: 1) Once you submitted your patches it's important to switch the status to 'Needs Signoff' in order to get the attention of the testers, otherwise patches can get easily lost in the saved searches. 2) The QA test tools can help you to find problems with your code easily. For your patches the report is: FAIL misc/cronjobs/advance_notices.pl OK critic FAIL forbidden patterns forbidden pattern: tab char (line 367) forbidden pattern: tab char (line 479) forbidden pattern: tab char (line 366) forbidden pattern: tab char (line 374) forbidden pattern: tab char (line 357) forbidden pattern: tab char (line 373) forbidden pattern: tab char (line 372) forbidden pattern: tab char (line 348) forbidden pattern: tab char (line 356) forbidden pattern: tab char (line 350) forbidden pattern: tab char (line 368) forbidden pattern: tab char (line 358) forbidden pattern: tab char (line 347) forbidden pattern: tab char (line 349) forbidden pattern: tab char (line 355) forbidden pattern: tab char (line 365) forbidden pattern: tab char (line 353) forbidden pattern: tab char (line 369) forbidden pattern: tab char (line 371) forbidden pattern: tab char (line 352) forbidden pattern: tab char (line 354) forbidden pattern: tab char (line 364) forbidden pattern: tab char (line 351) forbidden pattern: tab char (line 370) FAIL t/db_dependent/cronjobs/advance_notices_digest.t FAIL critic Expression form of "eval" at line 167, column 1. See page 161 of PBP. Bareword file handle opened at line 158, column 1. See pages 202,204 of PBP. FAIL forbidden patterns forbidden pattern: tab char (line 67) 3) This can all be fixed, but I see another problem here: libraries are differently organized and we support a lot of different use cases with Koha. Some libraries want Koha to only send one email instead of many, others like yours don't want this behaviour. So we need to find a compromise here and a way to make this configurable. I think a system preference could work here as I don't see how to add it to the notices configuration in a good way. 4) We usually don't test .pl files yet... but not opposed to more tsts :) Tests are failing for me right now: t/db_dependent/cronjobs/advance_notices_digest.t .. 1/5 # Failed test 'There are two messages in the queue' # at t/db_dependent/cronjobs/advance_notices_digest.t line 175. # got: '0' # expected: '2' # Looks like you planned 5 tests but ran 1. # Looks like you failed 1 test of 1 run. t/db_dependent/cronjobs/advance_notices_digest.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 5/5 subtests 5) If you want, you could also add an individual Sponsord-By line for each sponsoring library. It depends on how you want the output in the release notes later on. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73308|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73309|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73310|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #5 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 73722 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73722&action=edit Bug 20478: Add unit test for advance_notices.pl cronjob. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #6 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 73723 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73723&action=edit Bug 20478: Refactor to remove code duplication. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #7 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 73724 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73724&action=edit Bug 20478: Have the cronjob script advance_notices.pl send digest messages per branch. Desired behavior of the script advance_notices.pl is that the sender address on the notice message is that of the branch of the issues in question. Thus, the solution is to generate digest messages per branch. To test: 1) Inspect unit test in t/db_dependent/cronjobs/advance_notices_digest.t and note that: - There are three libraries - There is a borrower - The borrower is registered at library1 - The borrower has message preference wants_digest set to 1 - The borrower has message preference days_in_advance set to 1 - The content of the letter PREDUEDGST is '<<count>> <<branches.branchname>>' - There are three items - There is one issue per item - There is one issues at library2 - There are two issues at library3 - The date_due of the issues are set to tomorrow - For the default case (no -digest-per-message) - It is asserted that there is one message in the message queue after running the script - It is asserted that there are three items in the message. - It is asserted that the branchname is that of the borrower's home library. - For the case where -digest-per-message is enabled - It is asserted that there are two messages in the message queue after running the script - It is asserted that the item count of the message corresponding to library2 is 1 - It is asserted that the item count of the message corresponding to library3 is 2 - It is asserted that the branchnames are correct. 2) Run unit test: prove t/db_dependent/cronjobs/advance_notices_digest.t Sponsored-By: Bibliotek Mellansjö, which is a cooperation between Sponsored-By: Gullspångs kommunbibliotek Sponsored-By: Hjo stadsbibliotek Sponsored-By: Karlsborgs bibliotek Sponsored-By: Mariestads stadsbibliotek Sponsored-By: Skövde stadsbibliotek Sponsored-By: Tibro bibliotek Sponsored-By: Tidaholms stadsbibliotek Sponsored-By: Töreboda kommunbibliotek -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff --- Comment #8 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Katrin, thank you for the feedback! I have updated the patches after running the qa tool. Also, I've added the command line parameter '-digest-per-branch' while preserving the original behavior as default. But isn't the expected behavior to receive the message from the issuing library rather from the home library? Maybe '-digest-per-branch' should be default? The unit test has been fixed. I think it failed when running on a database already containing a message attribute for Advance_Notice. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> ---
Also, I've added the command line parameter '-digest-per-branch' while preserving the original behavior as default. But isn't the expected behavior to receive the message from the issuing library rather from the home library? Maybe '-digest-per-branch' should be default?
Some libraries might prefer for the user to get only one notice instead of multiples. I think that might appply in a library system where it doesn't matter where an item is checked out or returend to - you just want to inform the user. Emails could all use the same formatting. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- QA script passes now - leaving the sign-off to someone else, so I have the option to QA later. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |andreas.jonsson@kreablo.se |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |magnus@libriotech.no --- Comment #11 from Magnus Enger <magnus@libriotech.no> --- (In reply to Andreas Jonsson from comment #8)
Also, I've added the command line parameter '-digest-per-branch' while preserving the original behavior as default. But isn't the expected behavior to receive the message from the issuing library rather from the home library? Maybe '-digest-per-branch' should be default?
Changing the default behaviour would probably come as a surprise to a lot of libraries. ;-) For cronjobs I think it is preferable to keep the old behaviour as default and make new behaviour available by adding command line options. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #12 from Magnus Enger <magnus@libriotech.no> --- I followed the test plan, and the script works as it should. But the new --digest-per-branch parameter needs to be added to the POD in the script, along witht the other options. If you provide a followup for that I will sign off! :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Andreas Jonsson <andreas.jonsson@kreablo.se> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73724|0 |1 is obsolete| | --- Comment #13 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Comment on attachment 73724 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73724 Bug 20478: Have the cronjob script advance_notices.pl send digest messages per branch. Thank you Magnus for reviewing this patch! Documentation has been added. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #14 from Andreas Jonsson <andreas.jonsson@kreablo.se> --- Created attachment 80867 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80867&action=edit Bug 20478: Have the cronjob script advance_notices.pl send digest messages per branch. Desired behavior of the script advance_notices.pl is that the sender address on the notice message is that of the branch of the issues in question. Thus, the solution is to generate digest messages per branch. To test: 1) Inspect unit test in t/db_dependent/cronjobs/advance_notices_digest.t and note that: - There are three libraries - There is a borrower - The borrower is registered at library1 - The borrower has message preference wants_digest set to 1 - The borrower has message preference days_in_advance set to 1 - The content of the letter PREDUEDGST is '<<count>> <<branches.branchname>>' - There are three items - There is one issue per item - There is one issues at library2 - There are two issues at library3 - The date_due of the issues are set to tomorrow - For the default case (no -digest-per-message) - It is asserted that there is one message in the message queue after running the script - It is asserted that there are three items in the message. - It is asserted that the branchname is that of the borrower's home library. - For the case where -digest-per-message is enabled - It is asserted that there are two messages in the message queue after running the script - It is asserted that the item count of the message corresponding to library2 is 1 - It is asserted that the item count of the message corresponding to library3 is 2 - It is asserted that the branchnames are correct. 2) Run unit test: prove t/db_dependent/cronjobs/advance_notices_digest.t Sponsored-By: Bibliotek Mellansjö, which is a cooperation between Sponsored-By: Gullspångs kommunbibliotek Sponsored-By: Hjo stadsbibliotek Sponsored-By: Karlsborgs bibliotek Sponsored-By: Mariestads stadsbibliotek Sponsored-By: Skövde stadsbibliotek Sponsored-By: Tibro bibliotek Sponsored-By: Tidaholms stadsbibliotek Sponsored-By: Töreboda kommunbibliotek Signed-off-by: Andreas Jonsson <andreas.jonsson@kreablo.se> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73722|0 |1 is obsolete| | --- Comment #15 from Magnus Enger <magnus@libriotech.no> --- Created attachment 80901 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80901&action=edit Bug 20478: Add unit test for advance_notices.pl cronjob. Signed-off-by: Magnus Enger <magnus@libriotech.no> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73723|0 |1 is obsolete| | --- Comment #16 from Magnus Enger <magnus@libriotech.no> --- Created attachment 80902 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80902&action=edit Bug 20478: Refactor to remove code duplication. Signed-off-by: Magnus Enger <magnus@libriotech.no> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80867|0 |1 is obsolete| | --- Comment #17 from Magnus Enger <magnus@libriotech.no> --- Created attachment 80903 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=80903&action=edit Bug 20478: Have the cronjob script advance_notices.pl send digest messages per branch. Desired behavior of the script advance_notices.pl is that the sender address on the notice message is that of the branch of the issues in question. Thus, the solution is to generate digest messages per branch. To test: 1) Inspect unit test in t/db_dependent/cronjobs/advance_notices_digest.t and note that: - There are three libraries - There is a borrower - The borrower is registered at library1 - The borrower has message preference wants_digest set to 1 - The borrower has message preference days_in_advance set to 1 - The content of the letter PREDUEDGST is '<<count>> <<branches.branchname>>' - There are three items - There is one issue per item - There is one issues at library2 - There are two issues at library3 - The date_due of the issues are set to tomorrow - For the default case (no -digest-per-message) - It is asserted that there is one message in the message queue after running the script - It is asserted that there are three items in the message. - It is asserted that the branchname is that of the borrower's home library. - For the case where -digest-per-message is enabled - It is asserted that there are two messages in the message queue after running the script - It is asserted that the item count of the message corresponding to library2 is 1 - It is asserted that the item count of the message corresponding to library3 is 2 - It is asserted that the branchnames are correct. 2) Run unit test: prove t/db_dependent/cronjobs/advance_notices_digest.t Sponsored-By: Bibliotek Mellansjö, which is a cooperation between Sponsored-By: Gullspångs kommunbibliotek Sponsored-By: Hjo stadsbibliotek Sponsored-By: Karlsborgs bibliotek Sponsored-By: Mariestads stadsbibliotek Sponsored-By: Skövde stadsbibliotek Sponsored-By: Tibro bibliotek Sponsored-By: Tidaholms stadsbibliotek Sponsored-By: Töreboda kommunbibliotek Signed-off-by: Andreas Jonsson <andreas.jonsson@kreablo.se> Signed-off-by: Magnus Enger <magnus@libriotech.no> Adding the --digest-per-branch switch turns the digest into one digest per library. I think it makes perfect sense to keep the default behaviour and hide this new functionality behind a command line switch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #18 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Great to see tests for this code, even if done in an unusual way. Some quick remarks: 1. Transactions must be done using txn_begin (also note that you are setting AutoCommit off in the sub and rollback at the end => no sense) 2. $ENV{"OVERRIDE_SYSPREF_dateformat"} = 'metric'; Why not set_preference? Note that for test we usually use mock_preference (from t::lib::Mocks) to avoid to mess with the cache. 3. You could use build_sample_item from bug 21971 to simplify the objects creation (not pushed yet) 4. use Koha::DateUtils instead of DateTime directly 5. You could use File::Slurp::read_file to simplify a bit the code I would have preferred to see the code moved to a module. It would have eased the write of the tests and made the code reusable. Keeping the SO status to get other QA opinions. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80901|0 |1 is obsolete| | --- Comment #19 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 86381 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86381&action=edit Bug 20478: Add unit test for advance_notices.pl cronjob. Signed-off-by: Magnus Enger <magnus@libriotech.no> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80902|0 |1 is obsolete| | --- Comment #20 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 86382 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86382&action=edit Bug 20478: Refactor to remove code duplication. Signed-off-by: Magnus Enger <magnus@libriotech.no> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #80903|0 |1 is obsolete| | --- Comment #21 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 86383 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86383&action=edit Bug 20478: Have the cronjob script advance_notices.pl send digest messages per branch. Desired behavior of the script advance_notices.pl is that the sender address on the notice message is that of the branch of the issues in question. Thus, the solution is to generate digest messages per branch. To test: 1) Inspect unit test in t/db_dependent/cronjobs/advance_notices_digest.t and note that: - There are three libraries - There is a borrower - The borrower is registered at library1 - The borrower has message preference wants_digest set to 1 - The borrower has message preference days_in_advance set to 1 - The content of the letter PREDUEDGST is '<<count>> <<branches.branchname>>' - There are three items - There is one issue per item - There is one issues at library2 - There are two issues at library3 - The date_due of the issues are set to tomorrow - For the default case (no -digest-per-message) - It is asserted that there is one message in the message queue after running the script - It is asserted that there are three items in the message. - It is asserted that the branchname is that of the borrower's home library. - For the case where -digest-per-message is enabled - It is asserted that there are two messages in the message queue after running the script - It is asserted that the item count of the message corresponding to library2 is 1 - It is asserted that the item count of the message corresponding to library3 is 2 - It is asserted that the branchnames are correct. 2) Run unit test: prove t/db_dependent/cronjobs/advance_notices_digest.t Sponsored-By: Bibliotek Mellansjö, which is a cooperation between Sponsored-By: Gullspångs kommunbibliotek Sponsored-By: Hjo stadsbibliotek Sponsored-By: Karlsborgs bibliotek Sponsored-By: Mariestads stadsbibliotek Sponsored-By: Skövde stadsbibliotek Sponsored-By: Tibro bibliotek Sponsored-By: Tidaholms stadsbibliotek Sponsored-By: Töreboda kommunbibliotek Signed-off-by: Andreas Jonsson <andreas.jonsson@kreablo.se> Signed-off-by: Magnus Enger <magnus@libriotech.no> Adding the --digest-per-branch switch turns the digest into one digest per library. I think it makes perfect sense to keep the default behaviour and hide this new functionality behind a command line switch. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #22 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 86384 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86384&action=edit Bug 20478: (QA follow-up) Make test more standard Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |martin.renvoize@ptfs-europe | |.com --- Comment #23 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- (In reply to Jonathan Druart from comment #18)
Great to see tests for this code, even if done in an unusual way.
Some quick remarks: 1. Transactions must be done using txn_begin (also note that you are setting AutoCommit off in the sub and rollback at the end => no sense)
2. $ENV{"OVERRIDE_SYSPREF_dateformat"} = 'metric'; Why not set_preference? Note that for test we usually use mock_preference (from t::lib::Mocks) to avoid to mess with the cache.
3. You could use build_sample_item from bug 21971 to simplify the objects creation (not pushed yet)
4. use Koha::DateUtils instead of DateTime directly
5. You could use File::Slurp::read_file to simplify a bit the code
I would have preferred to see the code moved to a module. It would have eased the write of the tests and made the code reusable.
Keeping the SO status to get other QA opinions.
I've cleaned up the test a little to make it a bit more 'koha', but I've not gone as far as Jonathan suggests above.. I feel these additional clean ups could be handled separately, like the factoring out of code into a module for example. Code works and passes all tests.. It's also great to see a cronscript with tests. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@ptfs-europe |y.org |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com Status|Passed QA |Pushed to Master --- Comment #24 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 19.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Master |RESOLVED Keywords| |Manual, | |release-notes-needed --- Comment #25 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Enhancement will not be backported to 18.11.x series. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This enhancement add the release notes| |`--digest-per-branch` | |option to | |advanced_notices.pl to | |allow notices to be grouped | |by branch rather than | |grouped by borrower if so | |required. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Margaret <margaret@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |19.05 released in| | CC| |margaret@bywatersolutions.c | |om -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=14837 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24064 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24064 [Bug 24064] DUEDGST typoed as DUEGST -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24268 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24268 [Bug 24268] advance_notices.pl dies on undefined letter -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #26 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- There is something terribly wrong with this test file, the cronjob script is run outside the transaction and so changes are effective. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Advance notices: send |Advance notices: send |separate digest messages |separate digest messages |per branch |per library --- Comment #27 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Jonathan Druart from comment #26)
There is something terribly wrong with this test file, the cronjob script is run outside the transaction and so changes are effective.
Should this be a separate bug? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #28 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Agreed, we should create a distinct bug for this.. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24326 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24326 [Bug 24326] Problem with advance_notices_digest.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #29 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Martin Renvoize from comment #28)
Agreed, we should create a distinct bug for this..
I've created a bug, but not sure I got it right: Bug 24326 - Problem with advance_notices_digest.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #30 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** Bug 14837 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|release-notes-needed | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #31 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- This is really ugly. my $scriptFile = "$scriptDir/../../../misc/cronjobs/advance_notices.pl"; open my $scriptfh, "<", $scriptFile or die "Failed to open $scriptFile: $!"; while (<$scriptfh>) { $scriptContent .= $_; } etc eval $script; ## no critic (StringyEval) What about moving stuff from scripts into a module, and test it properly? imho we should never pqa/push this kind of stuff. Surely, we dont need a rule for all bad coding practices? :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 --- Comment #32 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- C4::Context->set_preference('EnhancedMessagingPreferences', 1); what about mocking, friends -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |33900 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33900 [Bug 33900] advance_notices.pl cronjob hangs -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20478 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |34059 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34059 [Bug 34059] advance_notices.pl -c --digest-per-branch does not work as intended -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org