Description
Julian Maurice
2022-02-01 15:21:58 UTC
Created attachment 130045 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. The automatically generated serial issue should have the status "Expected". Change it to "Late". 4. Go back to the main page. You should see an alert with a link to your subscription 5. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 6. Set your library back to its original value to make the alert reappear. 7. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. I did some simple rebasing of this, and I don't *think* I messed it up, but I'm getting this error when I hit the main page: The method Koha::Serials->subscriptionid is not covered by tests! Trace begun at /kohadevbox/koha/Koha/Objects.pm line 572 Koha::Objects::AUTOLOAD('Koha::Serials=HASH(0x5608d16fa198)') called at /kohadevbox/koha/mainpage.pl line 129 eval {...} at /kohadevbox/koha/mainpage.pl line 2 Created attachment 143631 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. The automatically generated serial issue should have the status "Expected". Change it to "Late". 4. Go back to the main page. You should see an alert with a link to your subscription 5. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 6. Set your library back to its original value to make the alert reappear. 7. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. (In reply to Owen Leonard from comment #2) > The method Koha::Serials->subscriptionid is not covered by tests! It was caused by the changes of bug 29844. I added the now required 'as_list' call and it works again :) Patch rebased on master When I reach step 7 of the test plan and save my subscription after disabling "Warn when late", I get the following error: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'warn_when_late' cannot be null at /kohadevbox/koha/Koha/Object.pm line 170 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 On another note, it would be nice to have the "Warn when late" status visible in the subscription details - either the information tab or the summary one. It would save the librarian having to edit the subscription to know whether it is already enabled or not. Created attachment 156794 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. The automatically generated serial issue should have the status "Expected". Change it to "Late". 4. Go back to the main page. You should see an alert with a link to your subscription 5. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 6. Set your library back to its original value to make the alert reappear. 7. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. Patch rebased on master. I cannot reproduce the issue mentioned in comment 5. Maybe a temporary bug on master ? Please test again. Created attachment 156795 [details] [review] Bug 29996: Show "warn when late" on subscription-detail.pl Even after database update and restart_all I'm getting this error: No property warn_when_late for Koha::Subscription at /usr/share/perl5/Exception/Class/Base.pm line 88 Did you update the DBIx::Class schema files ? (In reply to Julian Maurice from comment #10) > Did you update the DBIx::Class schema files ? I did but I neglected to restart after that! Now it's working if I save after checking the "warn when late" box but if I save a subscription with the box unchecked I get this error: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'warn_when_late' cannot be null at /kohadevbox/koha/Koha/Object.pm line 170 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 That's weird. I cannot reproduce that error... Any idea where it could come from ? Created attachment 175383 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. The automatically generated serial issue should have the status "Expected". Change it to "Late". 4. Go back to the main page. You should see an alert with a link to your subscription 5. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 6. Set your library back to its original value to make the alert reappear. 7. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. Created attachment 175384 [details] [review] Bug 29996: Show "warn when late" on subscription-detail.pl Created attachment 175385 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. Verify that you can see the value of "warn when late" setting on subscription-detail.pl 4. The automatically generated serial issue should have the status "Expected". Change it to "Late". 5. Go back to the main page. You should see an alert with a link to your subscription 6. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 7. Set your library back to its original value to make the alert reappear. 8. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. Sponsored-by: Écoles Nationales Supérieures d'Architecture Patches rebased and squashed. (In reply to Owen Leonard from comment #12) > Now it's working if I save after checking the "warn when late" box but if I > save a subscription with the box unchecked I get this error: > > DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st > execute failed: Column 'warn_when_late' cannot be null at > /kohadevbox/koha/Koha/Object.pm line 170 > at /usr/share/perl5/DBIx/Class/Exception.pm line 77 This should be fixed now Created attachment 175467 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. Verify that you can see the value of "warn when late" setting on subscription-detail.pl 4. The automatically generated serial issue should have the status "Expected". Change it to "Late". 5. Go back to the main page. You should see an alert with a link to your subscription 6. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 7. Set your library back to its original value to make the alert reappear. 8. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. Sponsored-by: Écoles Nationales Supérieures d'Architecture Signed-off-by: Owen Leonard <oleonard@myacpl.org> Created attachment 175468 [details] [review] Bug 29996: (follow-up) Show count of late issues instead of list This patch makes two changes: 1. Change the label to "The following serials have late issues:" 2. Show the count of late issues rather than a list of the issue numbers. This makes it consistent with the other types of messages shown in this area of the page. Julian I hope my follow-up works for you and your sponsor. Created attachment 175474 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. Verify that you can see the value of "warn when late" setting on subscription-detail.pl 4. The automatically generated serial issue should have the status "Expected". Change it to "Late". 5. Go back to the main page. You should see an alert with a link to your subscription 6. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 7. Set your library back to its original value to make the alert reappear. 8. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. Sponsored-by: Écoles Nationales Supérieures d'Architecture Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: David Nind <david@davidnind.com> Created attachment 175475 [details] [review] Bug 29996: (follow-up) Show count of late issues instead of list This patch makes two changes: 1. Change the label to "The following serials have late issues:" 2. Show the count of late issues rather than a list of the issue numbers. This makes it consistent with the other types of messages shown in this area of the page. Signed-off-by: David Nind <david@davidnind.com> Testing notes (using KTD): 1. Step 1: run updatedatabase, dbic, then restart_all 2. Before I could sign off, I had to do a: git checkout Koha/Schema/Result/Subscription.pm (I don't think I've had to do that in the past) One thought I had when testing, if a library has "hundreds" of late serials, then this would overwhelm the front page alert - or make it very long. I'm not sure how realistic this is, but maybe this could with academic libraries or public libraries with lots of magazines? I really like this enhancement! (In reply to Owen Leonard from comment #20) > Julian I hope my follow-up works for you and your sponsor. I think it's okay as we can have the list of late issues by clicking on the link Missing tests. Created attachment 183386 [details] [review] Bug 29996: Show an alert on main page when serial issues are late The alert is disabled by default and can be enabled for each subscription individually. Alerts are shown on the main page only for subscriptions that have this feature enabled and that are of the same library than the connection library Test plan: 1. Run `installer/data/mysql/updatedatabase.pl` and `misc/devel/update_dbix_class_files.pl --koha-conf`. Restart Koha if needed. 2. Create a subscription, set its library to your connection library and enable "Warn when late" 3. Verify that you can see the value of "warn when late" setting on subscription-detail.pl 4. The automatically generated serial issue should have the status "Expected". Change it to "Late". 5. Go back to the main page. You should see an alert with a link to your subscription 6. Change your library using the menu in the upper right corner of the screen. Now the alert should not appear. 7. Set your library back to its original value to make the alert reappear. 8. Edit your subscription and disable "Warn when late". Verify that the alert does not appear. Sponsored-by: Écoles Nationales Supérieures d'Architecture Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: David Nind <david@davidnind.com> Created attachment 183387 [details] [review] Bug 29996: (follow-up) Show count of late issues instead of list This patch makes two changes: 1. Change the label to "The following serials have late issues:" 2. Show the count of late issues rather than a list of the issue numbers. This makes it consistent with the other types of messages shown in this area of the page. Signed-off-by: David Nind <david@davidnind.com> Created attachment 183388 [details] [review] Bug 29996: Fix tests and add one for Koha::Serial::subscription |