Bug 5770 - Email librarian when purchase suggestion made
Summary: Email librarian when purchase suggestion made
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature
Assignee: Devinim
QA Contact: Martin Renvoize (ashimema)
URL: http://devs.bywatersolutions.com/proj...
Keywords:
: 7322 19459 (view as bug list)
Depends on:
Blocks: 22843
  Show dependency treegraph
 
Reported: 2011-02-16 21:02 UTC by Nicole C. Engard
Modified: 2020-11-17 20:06 UTC (History)
11 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Sponsored by Northeast Kansas Library System, NEKLS (http://nekls.org/) This new feature adds the ability to send a notice to the library, branch or a specific email address whenever a purchase suggestion is created.
Version(s) released in:
19.05.00
Circulation function:


Attachments
Bug 5770: New system pref for new suggestion email (3.68 KB, patch)
2018-12-19 11:35 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Notify for new suggestion (3.60 KB, patch)
2018-12-19 12:01 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Notify for new suggestion - sample notices (25.27 KB, patch)
2018-12-19 12:19 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: (follow-up) New system pref for new suggestion email (1.59 KB, patch)
2018-12-19 12:38 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Email librarian when purchase suggestion made (1.99 KB, patch)
2018-12-19 13:38 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: New system pref and notice for new suggestion email (4.87 KB, patch)
2018-12-19 13:47 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Notify for new suggestion - sample notices (25.30 KB, patch)
2019-01-03 13:46 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 5770: Email librarian when purchase suggestion made (2.04 KB, patch)
2019-01-03 13:46 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 5770: New system pref for new suggestion email (4.92 KB, patch)
2019-01-03 13:46 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 5770: (QA follow-up) Minor formatting fixes (106.92 KB, patch)
2019-01-27 12:56 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5770: Unit test and skeleton perl (11.51 KB, patch)
2019-02-06 12:03 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Email librarian when purchase suggestion made (2.05 KB, patch)
2019-04-30 15:51 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: New system pref for new suggestion email (5.84 KB, patch)
2019-04-30 15:54 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Unit test (6.08 KB, patch)
2019-04-30 15:57 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Notify for new suggestion - sample notices (25.57 KB, patch)
2019-04-30 16:18 UTC, Devinim
Details | Diff | Splinter Review
Bug 5770: Email librarian when purchase suggestion made (2.09 KB, patch)
2019-04-30 17:19 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 5770: New system pref for new suggestion email (5.88 KB, patch)
2019-04-30 17:20 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 5770: Unit test (6.12 KB, patch)
2019-04-30 17:20 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 5770: Notify for new suggestion - sample notices (25.60 KB, patch)
2019-04-30 17:20 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 5770: Email librarian when purchase suggestion made (2.16 KB, patch)
2019-05-01 18:03 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 5770: New system pref for new suggestion email (5.93 KB, patch)
2019-05-01 18:03 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 5770: Unit test (6.18 KB, patch)
2019-05-01 18:03 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 5770: Notify for new suggestion - sample notices (26.58 KB, patch)
2019-05-01 18:03 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 5770: (QA follow-up) Allow feature to be disable (8.25 KB, patch)
2019-05-01 18:04 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 5770: (QA follow-up) Revert change to GetQueuedMessages (6.08 KB, patch)
2019-05-01 18:04 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 5770: (QA follow-up) Move system preference to appropriate section (3.18 KB, patch)
2019-05-01 18:04 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 5770: (QA follow-up) Adapt for replyto handling (9.41 KB, patch)
2019-05-01 18:04 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2011-02-16 21:02:09 UTC
Right now there are a series of notices that get sent to patrons when actions happen to their suggestions, but I think we also need a preference or a setting to have new purchase suggestions go via email to the librarian.

This would be handy for the libraries that don't use acquisitions for anything but purchase suggestions.
Comment 1 Mathieu Saby 2013-10-13 09:11:24 UTC
Very very needed!
As the patron does not know which librarian will manage its suggestion, new suggestions notices could be sent either to the Acq manager for the library system, or to the Acq manager for each branch of the system, if a branch is specified by the patron.

M. Saby
Comment 2 Katrin Fischer 2014-02-21 12:17:59 UTC
*** Bug 7322 has been marked as a duplicate of this bug. ***
Comment 3 Nicole C. Engard 2016-01-06 16:30:21 UTC
Seeking co-sponsors: http://devs.bywatersolutions.com/projects/new-suggestions-sent-via-email/
Comment 4 Katrin Fischer 2018-06-10 11:20:43 UTC
*** Bug 19459 has been marked as a duplicate of this bug. ***
Comment 5 Devinim 2018-12-19 11:35:46 UTC Comment hidden (obsolete)
Comment 6 Devinim 2018-12-19 12:01:41 UTC Comment hidden (obsolete)
Comment 7 Devinim 2018-12-19 12:19:34 UTC
Created attachment 83386 [details] [review]
Bug 5770: Notify for new suggestion - sample notices

This patch adds the new notice for all languages.
Comment 8 Devinim 2018-12-19 12:38:34 UTC Comment hidden (obsolete)
Comment 9 Devinim 2018-12-19 13:38:17 UTC
Created attachment 83388 [details] [review]
Bug 5770: Email librarian when purchase suggestion made

Test plan:
1 - Make sure create a new notice suggestions >  NEW_SUGGESTION
2 - Change EmailPurchaseSuggestions and  EmailAddressForSuggestions system preferences.
3 - Create a suggestion
4 - Verify the notice is generated in the message_queue table.
6 - Verify that the e-mail will be sent to the address specified in the EmailPurchaseSuggestions system preferences.
7 - And then return to 2.
8 - Repeat steps.
Comment 10 Devinim 2018-12-19 13:47:48 UTC
Created attachment 83390 [details] [review]
Bug 5770: New system pref and notice for new suggestion email
Comment 11 Katrin Fischer 2018-12-20 21:32:58 UTC
Hi, please don't forget to assign the bug to yourself when providing a patch!
Comment 12 Nick Clemens (kidclamp) 2019-01-03 13:46:43 UTC
Created attachment 83615 [details] [review]
Bug 5770: Notify for new suggestion - sample notices

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 13 Nick Clemens (kidclamp) 2019-01-03 13:46:47 UTC
Created attachment 83616 [details] [review]
Bug 5770: Email librarian when purchase suggestion made

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 14 Nick Clemens (kidclamp) 2019-01-03 13:46:50 UTC
Created attachment 83617 [details] [review]
Bug 5770: New system pref for new suggestion email

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 15 Nick Clemens (kidclamp) 2019-01-03 13:49:34 UTC
Works as advertised, a few notes:
1 - I encourage everyone to use skeleton.perl as a base for update statements :-) - perl ones are easier to push
2 - I would like to see the new notice use TT syntax instead of our legacy syntax
Comment 16 Katrin Fischer 2019-01-27 12:56:01 UTC
Created attachment 84463 [details] [review]
Bug 5770: (QA follow-up) Minor formatting fixes

- Rewords system preference slightly
- Minor changes to the sample template like
  " : " to ": "
- Alphabetizes sysprefs.sql
Comment 17 Katrin Fischer 2019-01-27 13:00:40 UTC
I'd like TT syntax, but I think we could deal with it separately as not all notices are TT yet. If we do TT we might want to do not just a conversion, but also do a nice one, using [% IF (....) %] to avoid empty labels and the like.

I've added a follow-up doing some minor changes - plz have a look at those.

Failing for missing tests for the change on NewSuggestion. Please add tests!
Comment 18 Devinim 2019-02-06 12:03:58 UTC
Created attachment 84812 [details] [review]
Bug 5770: Unit test and skeleton perl
Comment 19 Katrin Fischer 2019-02-06 12:09:15 UTC
Hi Devinim, most of the time if something is failed by the QA team it's ok to switch directly back "Signed off". Tests are such a case :)
Comment 20 Devinim 2019-04-30 15:51:46 UTC
Created attachment 89139 [details] [review]
Bug 5770: Email librarian when purchase suggestion made
Comment 21 Devinim 2019-04-30 15:54:44 UTC
Created attachment 89140 [details] [review]
Bug 5770: New system pref for new suggestion email
Comment 22 Devinim 2019-04-30 15:57:17 UTC
Created attachment 89141 [details] [review]
Bug 5770: Unit test
Comment 23 Devinim 2019-04-30 16:18:44 UTC
Created attachment 89142 [details] [review]
Bug 5770: Notify for new suggestion - sample notices
Comment 24 Liz Rea 2019-04-30 17:19:56 UTC
Created attachment 89144 [details] [review]
Bug 5770: Email librarian when purchase suggestion made

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 25 Liz Rea 2019-04-30 17:20:06 UTC
Created attachment 89145 [details] [review]
Bug 5770: New system pref for new suggestion email

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 26 Liz Rea 2019-04-30 17:20:10 UTC
Created attachment 89146 [details] [review]
Bug 5770: Unit test

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 27 Liz Rea 2019-04-30 17:20:14 UTC
Created attachment 89147 [details] [review]
Bug 5770: Notify for new suggestion - sample notices

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 28 Martin Renvoize (ashimema) 2019-05-01 11:38:57 UTC
Couple of QA points here... not sure if Josef
Comment 29 Martin Renvoize (ashimema) 2019-05-01 11:41:35 UTC
Oops.. lets start that again.

1) I think we should allow for the feature to be disabled and so I'd like to see the syspref allow for that option - I'll work on a QA followup for that
2) We should perhaps take account of the reply-to handling built into branch addresses and admin email address -  I can also look at doing a followup
3) I'm not a fan of us introducing the letter_code option to C4::Letter::GetMessagesQueue just for use in the tests - I'll do a followup for that too.

Otherwise, I really like the feature so please bear with me whilst I code up the followups for QA
Comment 30 Martin Renvoize (ashimema) 2019-05-01 18:03:46 UTC
Created attachment 89188 [details] [review]
Bug 5770: Email librarian when purchase suggestion made

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 31 Martin Renvoize (ashimema) 2019-05-01 18:03:50 UTC
Created attachment 89189 [details] [review]
Bug 5770: New system pref for new suggestion email

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 32 Martin Renvoize (ashimema) 2019-05-01 18:03:54 UTC
Created attachment 89190 [details] [review]
Bug 5770: Unit test

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 33 Martin Renvoize (ashimema) 2019-05-01 18:03:58 UTC
Created attachment 89191 [details] [review]
Bug 5770: Notify for new suggestion - sample notices

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 34 Martin Renvoize (ashimema) 2019-05-01 18:04:01 UTC
Created attachment 89192 [details] [review]
Bug 5770: (QA follow-up) Allow feature to be disable

This patch adds 'None' to the available options for the feature so it
may be disabled entirely (and sets that as default)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 35 Martin Renvoize (ashimema) 2019-05-01 18:04:05 UTC
Created attachment 89193 [details] [review]
Bug 5770: (QA follow-up) Revert change to GetQueuedMessages

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 36 Martin Renvoize (ashimema) 2019-05-01 18:04:09 UTC
Created attachment 89194 [details] [review]
Bug 5770: (QA follow-up) Move system preference to appropriate section

The new sysprefs wher in the general admin section. I believe they are
better placed within the acquisitions area.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 37 Martin Renvoize (ashimema) 2019-05-01 18:04:12 UTC
Created attachment 89195 [details] [review]
Bug 5770: (QA follow-up) Adapt for replyto handling

The ReplyTo preferences allwo for libraries to setup various
combinations of addresses for email headers to ensure correct mail
delivery. This patch accounts for their configuration and use in the
suggestions notifications

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 38 Martin Renvoize (ashimema) 2019-05-01 18:05:10 UTC
Right, I'm not confident in this bug.. Passing QA
Comment 39 Katrin Fischer 2019-05-01 18:47:31 UTC
no(In reply to Martin Renvoize from comment #38)
> Right, I'm not confident in this bug.. Passing QA

not = now?
Comment 40 Martin Renvoize (ashimema) 2019-05-01 21:06:30 UTC
Grr, silly typo.. Now! :)
Comment 41 Nick Clemens (kidclamp) 2019-05-10 17:44:09 UTC
Awesome work all!

Pushed to master for 19.05
Comment 42 Jonathan Druart 2019-05-14 15:39:11 UTC
When approving a pending suggestion, nothing happens. In the logs there are two errors:

DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha_kohadev`.`suggestions`, CONSTRAINT `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE) [for Statement "UPDATE `suggestions` SET `STATUS` = ?, `acceptedby` = ?, `accepteddate` = ?, `branchcode` = ?, `managedby` = ?, `manageddate` = ? WHERE ( `suggestionid` = ? )" with ParamValues: 0="ACCEPTED", 1="51", 2='2019-05-14T15:34:15', 3="__ANY__", 4="51", 5='2019-05-14T15:34:15', 6="3"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.

No suggestions ASKED letter transported by email at /home/vagrant/kohaclone/C4/Letters.pm line 608.
Comment 43 Jonathan Druart 2019-05-14 15:39:59 UTC
Note the branchcode=__ANY__
Comment 44 Jonathan Druart 2019-05-14 15:41:17 UTC
Hum, maybe not related to this patchset actually.
Comment 45 Jonathan Druart 2019-05-14 16:02:19 UTC
(In reply to Jonathan Druart from comment #42)
> When approving a pending suggestion, nothing happens. In the logs there are
> two errors:
> 
> DBD::mysql::st execute failed: Cannot add or update a child row: a foreign
> key constraint fails (`koha_kohadev`.`suggestions`, CONSTRAINT
> `suggestions_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES
> `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE) [for
> Statement "UPDATE `suggestions` SET `STATUS` = ?, `acceptedby` = ?,
> `accepteddate` = ?, `branchcode` = ?, `managedby` = ?, `manageddate` = ?
> WHERE ( `suggestionid` = ? )" with ParamValues: 0="ACCEPTED", 1="51",
> 2='2019-05-14T15:34:15', 3="__ANY__", 4="51", 5='2019-05-14T15:34:15',
> 6="3"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.

See bug 22905, not related to this patchset.

> No suggestions ASKED letter transported by email at
> /home/vagrant/kohaclone/C4/Letters.pm line 608.

Not sure what is that (need to do something?), but IIRC it already happened before this patchset as well.
Comment 46 Martin Renvoize (ashimema) 2019-05-24 13:21:47 UTC
New feature will not be backported to 18.11.x series.