Created attachment 64195 [details] [review] Bug 18783: Allow automatic claims for serials This patch adds a new script misc/cronjobs/serialsClaim.pl which send email notification to all suppliers that have late or missing issues. This is configurable per subscription and is disabled by default. Test plan: 1. Create a new bookseller B1 with a delivery time of 5 days 2. Create a new daily subscription with bookseller B1 and enable automatic claims (new checkbox on the first page of subscription-add.pl) 3. Generate some late serials with an expected date in the past (some with more than 5 days in the past, some with less) 4. Create a notice for module "Claim serial issue" CLAIMSERIAL and write something in the 'Email' template 5. Run `misc/cronjobs/serialsClaims.pl --letter-code CLAIMSERIAL` and verify that it sends an email notification only for serials that were expected more than 5 days ago
This is another of the 'missing features' that I have been asked about often. I have tried to test, but when running the script, I receive an error: kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ ./misc/cronjobs/serialsClaim.pl --letter-code RLIST The method auto_claim_enabled is not covered by tests! Possible future enh: For servers with multiple instances it would be nice if the letter code could be configured inside Koha. Either as a system preference or even better per vendor, then you could have different letters for different languages.
Hi Katrin, (In reply to Katrin Fischer from comment #2) > kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ > ./misc/cronjobs/serialsClaim.pl --letter-code RLIST > The method auto_claim_enabled is not covered by tests! Did you run updatedatabase.pl and misc/devel/update_dbix_class_files.pl ?
Hi Julian, that fixed the issue. I have tested adding and modifying subscriptions, the new option works nicely. I have also run the command without errors, but then realized that I cannot currently test emails on my installation. As they are not going through the message_queue I can't verify them being sent/generated correctly right now. Leaving this Needs Signoff for now, maybe someone else can continue testing. Note: You might want to add a test for the changes to SendAlert.
Ok, I have figured out a way to see the email: 1) Errors when running script My message template was: Das folgende Heft ist jetzt verfügbar: <<biblio.title>> <<biblio.author>> <<biblio.serial>> When I run the command, I receive some errors: kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ ./misc/cronjobs/serialsClaim.pl --letter-code RLIST Use of uninitialized value in substitution iterator at /home/vagrant/kohaclone/C4/Letters.pm line 776. Use of uninitialized value in substitution iterator at /home/vagrant/kohaclone/C4/Letters.pm line 776. Claim sent to Osiandersche Buchhandlung (3) for serials 3 The email is generated, but the placeholders are not being replaced. 2) Verbosity I wonder if the success message should only be shown if you add -v, this way it would be a bit less noisy when run as cronjob.
Would be nice to see this progressing, it's often asked for!
Needs rebase. For example serials/subscription-add.pl has been modified by Bug 20461
Created attachment 91428 [details] [review] Bug 18783: Allow automatic claims for serials This patch adds a new script misc/cronjobs/serialsClaim.pl which send email notification to all suppliers that have late or missing issues. This is configurable per subscription and is disabled by default. Test plan: 1. Create a new bookseller B1 with a delivery time of 5 days 2. Create a new daily subscription with bookseller B1 and enable automatic claims (new checkbox on the first page of subscription-add.pl) 3. Generate some late serials with an expected date in the past (some with more than 5 days in the past, some with less) 4. Create a notice for module "Claim serial issue" CLAIMSERIAL and write something in the 'Email' template 5. Run `misc/cronjobs/serialsClaims.pl --letter-code CLAIMSERIAL` and verify that it sends an email notification only for serials that were expected more than 5 days ago
Patch rebased on master
I am sorry, doesn't apply - can we get another rebase?
Created attachment 124984 [details] [review] Bug 18783: Allow automatic claims for serials This patch adds a new script misc/cronjobs/serialsClaim.pl which send email notification to all suppliers that have late or missing issues. This is configurable per subscription and is disabled by default. Test plan: 1. Create a new bookseller B1 with a delivery time of 5 days 2. Create a new daily subscription with bookseller B1 and enable automatic claims (new checkbox on the first page of subscription-add.pl) 3. Generate some late serials with an expected date in the past (some with more than 5 days in the past, some with less) 4. Create a notice for module "Claim serial issue" CLAIMSERIAL and write something in the 'Email' template 5. Run `misc/cronjobs/serialsClaims.pl --letter-code CLAIMSERIAL` and verify that it sends an email notification only for serials that were expected more than 5 days ago
When testing we got an error of DBIx::Class::Row::store_column(): No such column 'auto_claim_enabled' on Koha::Schema::Result::Subscription at /kohadevbox/koha/Koha/Object.pm line 79 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
Hi, This change looks like outside of scope : @@ -502,7 +507,8 @@ sub SendAlerts { } my $success = try { - $mail->send_or_die({ transport => $library->smtp_server->transport }); + my $smtp_server = $library ? $library->smtp_server : Koha::SMTP::Servers->get_default; + $mail->send_or_die({ transport => $smtp_server->transport }); }
(In reply to Jessie Zairo from comment #13) > When testing we got an error of DBIx::Class::Row::store_column(): No such > column 'auto_claim_enabled' on Koha::Schema::Result::Subscription at > /kohadevbox/koha/Koha/Object.pm line 79 > at /usr/share/perl5/DBIx/Class/Exception.pm line 77 If you see an error like this, make sure that the database update has run and if there is no Schema update patch, you need to 'refresh schema' in the sandbox or run the dbic command. Would love to see this back in the queues!
+ use C4::Installer qw(column_exists); Not sure this is needed in atomicupdate bug-18783.pl, I dont see it in existing DBRevs
installer/data/mysql/atomicupdate/bug-18783.pl needs exec file permission : chmod 775
@@ -1859,7 +1862,7 @@ sub GetLateOrMissingIssues { if ($supplierid) { $sth = $dbh->prepare( "SELECT - serialid, aqbooksellerid, name, + serialid, serial.aqbooksellerid, name, This is outside of scope no ? Maybe linked to Bug 18745
Created attachment 155458 [details] [review] Bug 18783: Allow automatic claims for serials This patch adds a new script misc/cronjobs/serialsClaim.pl which send email notification to all suppliers that have late or missing issues. This is configurable per subscription and is disabled by default. Test plan: 1. Create a new bookseller B1 with a delivery time of 5 days 2. Create a new daily subscription with bookseller B1 and enable automatic claims (new checkbox on the first page of subscription-add.pl) 3. Generate some late serials with an expected date in the past (some with more than 5 days in the past, some with less) 4. Create a notice for module "Claim serial issue" CLAIMSERIAL and write something in the 'Email' template 5. Run `misc/cronjobs/serialsClaims.pl --letter-code CLAIMSERIAL` and verify that it sends an email notification only for serials that were expected more than 5 days ago
Rebased ready for testing again
Taking a look at some modernising patches now to bring it closer to current guidelines/practices.
Created attachment 155462 [details] [review] Bug 18783: Allow automatic claims for serials This patch adds a new script misc/cronjobs/serialsClaim.pl which send email notification to all suppliers that have late or missing issues. This is configurable per subscription and is disabled by default. Test plan: 1. Create a new bookseller B1 with a delivery time of 5 days 2. Create a new daily subscription with bookseller B1 and enable automatic claims (new checkbox on the first page of subscription-add.pl) 3. Generate some late serials with an expected date in the past (some with more than 5 days in the past, some with less) 4. Create a notice for module "Claim serial issue" CLAIMSERIAL and write something in the 'Email' template 5. Run `misc/cronjobs/serialsClaims.pl --letter-code CLAIMSERIAL` and verify that it sends an email notification only for serials that were expected more than 5 days ago Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Patch tidied and other minor QA script issues resolved inline.
Created attachment 155463 [details] [review] Bug 18783: DBIC Build
Created attachment 168423 [details] [review] Bug 18783: Allow automatic claims for serials This patch adds a new script misc/cronjobs/serialsClaim.pl which send email notification to all suppliers that have late or missing issues. This is configurable per subscription and is disabled by default. Test plan: 1. Create a new bookseller B1 with a delivery time of 5 days 2. Create a new daily subscription with bookseller B1 and enable automatic claims (new checkbox on the first page of subscription-add.pl) 3. Generate some late serials with an expected date in the past (some with more than 5 days in the past, some with less) 4. Create a notice for module "Claim serial issue" CLAIMSERIAL and write something in the 'Email' template 5. Run `misc/cronjobs/serialsClaims.pl --letter-code CLAIMSERIAL` and verify that it sends an email notification only for serials that were expected more than 5 days ago Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 168424 [details] [review] Bug 18783: DBIC Build
Rebased again and ready for testing
Created attachment 168428 [details] [review] Bug 18783: Allow automatic claims for serials This patch adds a new script misc/cronjobs/serialsClaim.pl which send email notification to all suppliers that have late or missing issues. This is configurable per subscription and is disabled by default. Test plan: 1. Create a new bookseller B1 with a delivery time of 5 days 2. Create a new daily subscription with bookseller B1 and enable automatic claims (new checkbox on the first page of subscription-add.pl) 3. Generate some late serials with an expected date in the past (some with more than 5 days in the past, some with less) 4. Create a notice for module "Claim serial issue" CLAIMSERIAL and write something in the 'Email' template 5. Run `misc/cronjobs/serialsClaims.pl --letter-code CLAIMSERIAL` and verify that it sends an email notification only for serials that were expected more than 5 days ago Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 168429 [details] [review] Bug 18783: DBIC Build