Bug 5260 - Add option to send an order by e-mail to the acquisition module
Summary: Add option to send an order by e-mail to the acquisition module
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P3 new feature (vote)
Assignee: Katrin Fischer
QA Contact: Bugs List
URL:
Whiteboard:
Keywords:
Depends on: 17441
Blocks: 17455 17659
  Show dependency treegraph
 
Reported: 2010-09-28 18:59 UTC by Edgar Fuß
Modified: 2017-04-25 15:48 UTC (History)
17 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
It will be possible to send order information to the vendor by e-mail. For now this feature can be triggered manually with a button before closing the basket. The order e-mail is based on the acquisition claim feature, but uses a new notice template: ACQORDER.


Attachments
Patch to enable acquisition orders by email (11.38 KB, patch)
2010-09-28 18:59 UTC, Edgar Fuß
Details | Diff | Splinter Review
First patch of 2, changes reformatted for master (10.62 KB, patch)
2011-05-09 21:12 UTC, Chris Cormack
Details | Diff | Splinter Review
Follow up patch containing template changes (2.91 KB, patch)
2011-05-09 21:32 UTC, Chris Cormack
Details | Diff | Splinter Review
Revised patch for 3.4.3 (11.19 KB, patch)
2011-07-31 21:24 UTC, Edgar Fuß
Details | Diff | Splinter Review
[PATCH] Bug 5260 : Send basketgroup by mail to the bookseller (15.55 KB, patch)
2013-10-21 18:10 UTC, mathieu saby
Details | Diff | Splinter Review
Bug 5260 - Add option to send an order by e-mail to the acquisition module (23.73 KB, patch)
2016-10-14 07:21 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260 - Schema changes (1.58 KB, patch)
2016-10-14 07:22 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260 - Schema changes (1.58 KB, patch)
2016-10-14 08:38 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260 - Add option to send an order by e-mail to the acquisition module (23.70 KB, patch)
2016-10-14 08:39 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260 - Add option to send an order by e-mail to the acquisition module (23.29 KB, patch)
2016-10-14 14:28 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260: Unit tests for new functionality in SendAlert (2.62 KB, patch)
2016-10-14 14:29 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260 - Schema changes (1.58 KB, patch)
2016-10-14 14:30 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260 - Add option to send an order by e-mail to the acquisition module (23.36 KB, patch)
2016-10-14 16:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 5260: Unit tests for new functionality in SendAlert (2.69 KB, patch)
2016-10-14 16:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 5260 - Schema changes (1.64 KB, patch)
2016-10-14 16:25 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 5260: Follow-up - Reindenting POD of SendAlerts (1.68 KB, patch)
2016-10-16 11:00 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260: QA follow-up: Fix error when no notice template is defined (3.58 KB, patch)
2016-10-19 21:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260: QA follow-up - Add sample ACQORDER notice to sample notices (34.48 KB, patch)
2016-10-19 21:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260: make tests pass even without patron cat 'PT' (1.25 KB, patch)
2016-10-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: Insert the new letter for existing installs (1.32 KB, patch)
2016-10-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: simplify script and error handling (5.25 KB, patch)
2016-10-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: Use post params instead of get to avoid putting op=email in the browser history (1.91 KB, patch)
2016-10-20 08:09 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED OFF] Bug 5260: make tests pass even without patron cat 'PT' (1.32 KB, patch)
2016-10-20 21:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
[SIGNED OFF] Bug 5260: Insert the new letter for existing installs (1.39 KB, patch)
2016-10-20 21:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
[SIGNED OFF] Bug 5260: simplify script and error handling (5.32 KB, patch)
2016-10-20 21:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
[SIGNED OFF] Bug 5260: Use post params instead of get to avoid putting op=email in the browser history (1.98 KB, patch)
2016-10-20 21:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260: QA follow-up - Ask for confirmation before sending e-mail (1.79 KB, patch)
2016-10-20 21:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 5260 - Add option to send an order by e-mail to the acquisition module (23.42 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: Unit tests for new functionality in SendAlert (2.75 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260 - Schema changes (1.71 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: Follow-up - Reindenting POD of SendAlerts (1.74 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: QA follow-up: Fix error when no notice template is defined (3.64 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: QA follow-up - Add sample ACQORDER notice to sample notices (34.54 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: make tests pass even without patron cat 'PT' (1.37 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: Insert the new letter for existing installs (1.44 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: simplify script and error handling (5.37 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 5260: Use post params instead of get to avoid putting op=email in the browser history (2.03 KB, patch)
2016-10-24 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Edgar Fuß 2010-09-28 18:59:57 UTC
Created attachment 2653 [details] [review]
Patch to enable acquisition orders by email

I would find it useful if Koha' Acquisition module could not only generate printed PDF orders, but also order by email to the bookseller.

Attached patch is my first try at it. Comments welcome. I wrote it for my employee (Mathematisches Institut der Universität Bonn) and it's targeted towards using Koha for acquisitions at our Institute's library (Fachbibliothek Mathematik der Universität Bonn).

It introduces a new notice/letter/form orders/ORDEREMAIL which may look as follows (in german):

Guten Tag.

<item><<orders.quantity>> Stück <<orders.full_title>> von <<orders.author>>, ISBN <<orders.isbn>> zu <<orders.ecost>> (Listenpreis <<orders.listprice>>), Summe <<orders.quantity_ecost>></item>
<total>Insgesamt <<orders.total.quantity>> Poste(n), Gesamtpreis <<orders.total.ecost_gsti>> incl. <<orders.total.gstrate>>% MWSt.
Der Bestellung liegt ein Rabatt von <<orders.total.discount>>% zugrunde.
Alle Preise in <<orders.total.currency>>.</total>

Auf Wiedersehen.
Comment 1 Chris Nighswonger 2010-09-29 19:30:42 UTC Comment hidden (obsolete)
Comment 2 Zeno Tajoli 2010-10-05 13:06:22 UTC Comment hidden (obsolete)
Comment 3 Chris Cormack 2011-05-09 21:07:10 UTC Comment hidden (obsolete)
Comment 4 Chris Cormack 2011-05-09 21:12:03 UTC Comment hidden (obsolete)
Comment 5 Chris Cormack 2011-05-09 21:32:06 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2011-05-17 20:53:19 UTC Comment hidden (obsolete)
Comment 7 Edgar Fuß 2011-07-31 21:24:36 UTC Comment hidden (obsolete)
Comment 8 Christophe Croullebois 2011-08-19 10:24:31 UTC Comment hidden (obsolete)
Comment 9 Paul Poulain 2011-09-27 15:43:33 UTC Comment hidden (obsolete)
Comment 10 mathieu saby 2013-04-25 15:03:28 UTC Comment hidden (obsolete)
Comment 11 mathieu saby 2013-10-21 14:07:15 UTC Comment hidden (obsolete)
Comment 12 mathieu saby 2013-10-21 16:56:44 UTC Comment hidden (obsolete)
Comment 13 Chris Cormack 2013-10-21 17:10:56 UTC Comment hidden (obsolete)
Comment 14 mathieu saby 2013-10-21 17:16:32 UTC Comment hidden (obsolete)
Comment 15 mathieu saby 2013-10-21 18:10:00 UTC Comment hidden (obsolete)
Comment 16 mathieu saby 2013-10-21 18:12:36 UTC Comment hidden (obsolete)
Comment 17 Samuel Martin 2014-07-04 07:01:17 UTC Comment hidden (obsolete)
Comment 18 mathieu saby 2014-07-06 10:25:36 UTC
Hello
I'm not working on it anymore. If you or someone else is interested, you can maybe use the existing patch as a base or a source of inspiration.

Mathieu
Comment 19 Marc Véron 2016-01-06 09:53:21 UTC
Has anybody plans to work on this enhancement?
Comment 20 Mirko Tietgen 2016-01-06 10:07:23 UTC
I talked to Katrin about this topic recently, she said she has a proof of concept.
Comment 21 Katrin Fischer 2016-05-28 08:22:20 UTC
Working on an alternative patch for implementing this feature - will upload patches in the next few days!
Comment 22 Katrin Fischer 2016-10-13 09:44:47 UTC
Ok, back to working on this patch set... hope to be able to really upload something soon this time.
Comment 23 Katrin Fischer 2016-10-13 09:45:14 UTC Comment hidden (obsolete)
Comment 24 Katrin Fischer 2016-10-14 07:21:45 UTC Comment hidden (obsolete)
Comment 25 Katrin Fischer 2016-10-14 07:22:08 UTC Comment hidden (obsolete)
Comment 26 Katrin Fischer 2016-10-14 08:38:45 UTC
Created attachment 56483 [details] [review]
Bug 5260 - Schema changes

Schema changes for new column in the aqcontacts table.
Comment 27 Katrin Fischer 2016-10-14 08:39:07 UTC
Created attachment 56484 [details] [review]
Bug 5260 - Add option to send an order by e-mail to the acquisition module

With this patch it will be possible to send order information
to the vendor by e-mail. For now this feature can be triggered
manually with a button before closing the basket.
The order e-mail is based on the acquisition claim feature, but
uses a new notice template.

Test plan:

1) Vendors
A new checkbox "Contact when ordering?" was added to the vendor
page.
- Add a vendor and/or edit an existing vendor
- Verify the new option is saved correctly
- Verify the new option displays on the vendor summary page
  after saving

2) Notices
The feature works with a new notice template: ACQORDER
It works with the same formatting/fields etc. as the acq claim
notice.
- Add a new notice template ACQORDER in module
  'Claim/order aquisition'
- Make sure to use fields from the various offered tables
  in your notice
- Verify it is saved correctly

3) Basket
- Turn on LetterLog system preference
- Create multiple order lines
- Click the 'Send order' button in the toolbar
- Verify error or success message
- Verify you received the e-mail
- Verify there is a new entry with about the sent
  notice in your action_logs table

4) Regression testing...
- Verify order claims still work
- Verify serial claims still work
- Verify new serial issue notices still work
...
(I can provide additional test plans if needed)
Comment 28 Katrin Fischer 2016-10-14 08:42:08 UTC
Aware of missing tests - working on it, but would love some first feedback if someone would like to take a look.
Comment 29 Zeno Tajoli 2016-10-14 09:10:15 UTC
I take a look of code and for me is good.
I undeline that we need to update the description of ClaimsBccCopy sys preference.
With this patch it becames:
"[... ] blind copy (BCC) to logged in user when sending an acquisition order my mail or a claim notices for serial or acquisitions.".
Comment 30 Katrin Fischer 2016-10-14 10:00:13 UTC
Zeno, thx for the feedback. I am still working on the tests and have to rebase now on Marcel's bug. New patches coming soon.
Comment 31 Katrin Fischer 2016-10-14 13:14:56 UTC
As the name of the system preference is specific to claiming I have decided to not make it work for orders also. If there is a need for a feature like this, we could add it later on.
Comment 32 Zeno Tajoli 2016-10-14 13:42:30 UTC
Hi Katrin,
in my humble opinion the option to recieve a Bcc copy of e-mail is quite important.
If we can develop it with this patch for me is better.
Comment 33 Katrin Fischer 2016-10-14 14:28:16 UTC
Created attachment 56549 [details] [review]
Bug 5260 - Add option to send an order by e-mail to the acquisition module

With this patch it will be possible to send order information
to the vendor by e-mail. For now this feature can be triggered
manually with a button before closing the basket.
The order e-mail is based on the acquisition claim feature, but
uses a new notice template.

Test plan:

1) Vendors
A new checkbox "Contact when ordering?" was added to the vendor
page.
- Add a vendor and/or edit an existing vendor
- Verify the new option is saved correctly
- Verify the new option displays on the vendor summary page
  after saving

2) Notices
The feature works with a new notice template: ACQORDER
It works with the same formatting/fields etc. as the acq claim
notice.
- Add a new notice template ACQORDER in module
  'Claim/order aquisition'
- Make sure to use fields from the various offered tables
  in your notice
- Verify it is saved correctly

3) Basket
- Turn on LetterLog system preference
- Create multiple order lines
- Click the 'Send order' button in the toolbar
- Verify error or success message
- Verify you received the e-mail
- Verify there is a new entry with about the sent
  notice in your action_logs table

4) Regression testing...
- Verify order claims still work
- Verify serial claims still work
- Verify new serial issue notices still work
...
(I can provide additional test plans if needed)
Comment 34 Katrin Fischer 2016-10-14 14:29:06 UTC
Created attachment 56550 [details] [review]
Bug 5260: Unit tests for new functionality in SendAlert
Comment 35 Katrin Fischer 2016-10-14 14:30:30 UTC
Created attachment 56551 [details] [review]
Bug 5260 - Schema changes

Schema changes for new column in the aqcontacts table.
Comment 36 Katrin Fischer 2016-10-14 14:31:50 UTC
Ready for testing now!
Comment 37 Martin Renvoize 2016-10-14 16:24:41 UTC
Created attachment 56560 [details] [review]
Bug 5260 - Add option to send an order by e-mail to the acquisition module

With this patch it will be possible to send order information
to the vendor by e-mail. For now this feature can be triggered
manually with a button before closing the basket.
The order e-mail is based on the acquisition claim feature, but
uses a new notice template.

Test plan:

1) Vendors
A new checkbox "Contact when ordering?" was added to the vendor
page.
- Add a vendor and/or edit an existing vendor
- Verify the new option is saved correctly
- Verify the new option displays on the vendor summary page
  after saving

2) Notices
The feature works with a new notice template: ACQORDER
It works with the same formatting/fields etc. as the acq claim
notice.
- Add a new notice template ACQORDER in module
  'Claim/order aquisition'
- Make sure to use fields from the various offered tables
  in your notice
- Verify it is saved correctly

3) Basket
- Turn on LetterLog system preference
- Create multiple order lines
- Click the 'Send order' button in the toolbar
- Verify error or success message
- Verify you received the e-mail
- Verify there is a new entry with about the sent
  notice in your action_logs table

4) Regression testing...
- Verify order claims still work
- Verify serial claims still work
- Verify new serial issue notices still work
...
(I can provide additional test plans if needed)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 38 Martin Renvoize 2016-10-14 16:24:56 UTC
Created attachment 56561 [details] [review]
Bug 5260: Unit tests for new functionality in SendAlert

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 39 Martin Renvoize 2016-10-14 16:25:05 UTC
Created attachment 56562 [details] [review]
Bug 5260 - Schema changes

Schema changes for new column in the aqcontacts table.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 40 Martin Renvoize 2016-10-14 16:28:19 UTC
Comment on attachment 56560 [details] [review]
Bug 5260 - Add option to send an order by e-mail to the acquisition module

Review of attachment 56560 [details] [review]:
-----------------------------------------------------------------

Code looks generally good (given the area it's been added, it conforms to the script style), in testing I cannot find any fallout issues and the feature behaves as expected.

::: C4/Letters.pm
@@ +368,2 @@
>  
> +Parameters:

This block needs properly indenting please ;)
Comment 41 Katrin Fischer 2016-10-16 10:55:53 UTC
(In reply to Zeno Tajoli from comment #32)
> Hi Katrin,
> in my humble opinion the option to recieve a Bcc copy of e-mail is quite
> important.
> If we can develop it with this patch for me is better.

I agree that having the option to receive a BCC is good, but I think we shouldn't mix it in with the claims. I filed bug 17455 for this.
Comment 42 Katrin Fischer 2016-10-16 10:56:39 UTC
(In reply to Martin Renvoize from comment #40)
> Comment on attachment 56560 [details] [review] [review]
> Bug 5260 - Add option to send an order by e-mail to the acquisition module
> 
> Review of attachment 56560 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> Code looks generally good (given the area it's been added, it conforms to
> the script style), in testing I cannot find any fallout issues and the
> feature behaves as expected.
> 
> ::: C4/Letters.pm
> @@ +368,2 @@
> >  
> > +Parameters:
> 
> This block needs properly indenting please ;)

Adding a follow-up - was this what you were thinking about?
Comment 43 Katrin Fischer 2016-10-16 11:00:21 UTC
Created attachment 56568 [details] [review]
Bug 5260: Follow-up - Reindenting POD of SendAlerts
Comment 44 Jonathan Druart 2016-10-18 15:41:06 UTC
Is there a good reason not to add the new ACQORDER notice?
Comment 45 Jonathan Druart 2016-10-18 15:43:47 UTC
(In reply to Jonathan Druart from comment #44)
> Is there a good reason not to add the new ACQORDER notice?

Without the letter created I get
"Order e-mail was sent to the vendor." on the interface, but

No orderacquisition ACQORDER letter transported by email at /home/koha/src/C4/Letters.pm line 689.

in the logs.
Comment 46 Katrin Fischer 2016-10-19 21:27:43 UTC
Created attachment 56679 [details] [review]
Bug 5260: QA follow-up: Fix error when no notice template is defined

When no notice template ACQORDER was defined, you'r receive a false
positive "email sent" message. Now it will display a specific
error message instead.

Also includes 2 unit tests to test for the warn and new error code.
Comment 47 Katrin Fischer 2016-10-19 21:31:43 UTC
Hi Jonathan,

thx for the review and catching this! I have (hopefully) fixed the problem. Can you please take a look at the follow-up patch?

> Is there a good reason not to add the new ACQORDER notice?

No good reason really, more an oversight! I will work on another follow-up covering it.
Comment 48 Katrin Fischer 2016-10-19 21:55:00 UTC
Created attachment 56680 [details] [review]
Bug 5260: QA follow-up - Add sample ACQORDER notice to sample notices

Adds the new notice ACQORDER to all web installers.

Verify by testing the SQL contains no errors and by running:
perl xt/sample_notices.t

NOTE:
- de-DE is already translated, others are in English.
- xt/sample_notices.t doesn't check fr-CA yet. I didn't fix this here
  as the file is missing other notices as well which should be fixed
  separately.
Comment 49 Jonathan Druart 2016-10-20 08:09:08 UTC
Created attachment 56686 [details] [review]
Bug 5260: make tests pass even without patron cat 'PT'
Comment 50 Jonathan Druart 2016-10-20 08:09:14 UTC
Created attachment 56687 [details] [review]
Bug 5260: Insert the new letter for existing installs
Comment 51 Jonathan Druart 2016-10-20 08:09:19 UTC
Created attachment 56688 [details] [review]
Bug 5260: simplify script and error handling

No need to redirect, just sent the params to the template directly
Comment 52 Jonathan Druart 2016-10-20 08:09:25 UTC
Created attachment 56689 [details] [review]
Bug 5260: Use post params instead of get to avoid putting op=email in the browser history
Comment 53 Jonathan Druart 2016-10-20 08:12:57 UTC
Katrin,
Could you have a look at the 4 patches please? They should not introduce any regression.
I am wondering if we should not add a confirmation box as the button will sent an email.
I also think that the button should not be displayed if the vendor does not have any email address defined, don't you think?
Comment 54 Katrin Fischer 2016-10-20 09:28:02 UTC
(In reply to Jonathan Druart from comment #53)
> Katrin,
> Could you have a look at the 4 patches please? They should not introduce any
> regression.
> I am wondering if we should not add a confirmation box as the button will
> sent an email.
> I also think that the button should not be displayed if the vendor does not
> have any email address defined, don't you think?

Hi Jonathan, thx for the follow-ups! I will test them later, but they all look good to me and make sense.

I was modeling this from the way we send e-mails for claims. I am not against a confirmation box, I can try to take a look at how this is done on other pages. 

Arguments for showing the button: The user gets an informative message, that they need to edit a vendor contact in order to make it work. 

Also: I am not sure how to achieve hiding it correctly :( The logic here is not as simple as checking for an email address in the vendor, as there can be multiple contacts and the SendAlerts give priority to the one that is acqprimary and has the right option checked (Take a look at the SQL in SendAlerts).
Comment 55 Katrin Fischer 2016-10-20 21:27:12 UTC
Created attachment 56705 [details] [review]
[SIGNED OFF] Bug 5260: make tests pass even without patron cat 'PT'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 56 Katrin Fischer 2016-10-20 21:27:19 UTC
Created attachment 56706 [details] [review]
[SIGNED OFF] Bug 5260: Insert the new letter for existing installs

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 57 Katrin Fischer 2016-10-20 21:27:26 UTC
Created attachment 56707 [details] [review]
[SIGNED OFF] Bug 5260: simplify script and error handling

No need to redirect, just sent the params to the template directly

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 58 Katrin Fischer 2016-10-20 21:27:31 UTC
Created attachment 56708 [details] [review]
[SIGNED OFF] Bug 5260: Use post params instead of get to avoid putting op=email in the browser history

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 59 Katrin Fischer 2016-10-20 21:27:37 UTC
Created attachment 56709 [details] [review]
Bug 5260: QA follow-up - Ask for confirmation before sending e-mail

With this patch there will be a confirmation alert when clicking
on 'E-mail order'.
Comment 60 Katrin Fischer 2016-10-20 21:30:07 UTC
Hi Jonathan, I have added a patch asking for confirmation, but honestly.. I am not persuaded by it.
I think this will get annoying quite fast when you are working with the acquisition module on a daily basis. Also: we don't ask for confirmation for sending out a claim email neither in serials nor acquisitions.
Comment 61 Jonathan Druart 2016-10-24 14:02:00 UTC
Created attachment 56786 [details] [review]
Bug 5260 - Add option to send an order by e-mail to the acquisition module

With this patch it will be possible to send order information
to the vendor by e-mail. For now this feature can be triggered
manually with a button before closing the basket.
The order e-mail is based on the acquisition claim feature, but
uses a new notice template.

Test plan:

1) Vendors
A new checkbox "Contact when ordering?" was added to the vendor
page.
- Add a vendor and/or edit an existing vendor
- Verify the new option is saved correctly
- Verify the new option displays on the vendor summary page
  after saving

2) Notices
The feature works with a new notice template: ACQORDER
It works with the same formatting/fields etc. as the acq claim
notice.
- Add a new notice template ACQORDER in module
  'Claim/order aquisition'
- Make sure to use fields from the various offered tables
  in your notice
- Verify it is saved correctly

3) Basket
- Turn on LetterLog system preference
- Create multiple order lines
- Click the 'Send order' button in the toolbar
- Verify error or success message
- Verify you received the e-mail
- Verify there is a new entry with about the sent
  notice in your action_logs table

4) Regression testing...
- Verify order claims still work
- Verify serial claims still work
- Verify new serial issue notices still work
...
(I can provide additional test plans if needed)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 62 Jonathan Druart 2016-10-24 14:02:07 UTC
Created attachment 56787 [details] [review]
Bug 5260: Unit tests for new functionality in SendAlert

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 63 Jonathan Druart 2016-10-24 14:02:12 UTC
Created attachment 56788 [details] [review]
Bug 5260 - Schema changes

Schema changes for new column in the aqcontacts table.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 64 Jonathan Druart 2016-10-24 14:02:18 UTC
Created attachment 56789 [details] [review]
Bug 5260: Follow-up - Reindenting POD of SendAlerts

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 65 Jonathan Druart 2016-10-24 14:02:24 UTC
Created attachment 56790 [details] [review]
Bug 5260: QA follow-up: Fix error when no notice template is defined

When no notice template ACQORDER was defined, you'r receive a false
positive "email sent" message. Now it will display a specific
error message instead.

Also includes 2 unit tests to test for the warn and new error code.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 66 Jonathan Druart 2016-10-24 14:02:30 UTC
Created attachment 56791 [details] [review]
Bug 5260: QA follow-up - Add sample ACQORDER notice to sample notices

Adds the new notice ACQORDER to all web installers.

Verify by testing the SQL contains no errors and by running:
perl xt/sample_notices.t

NOTE:
- de-DE is already translated, others are in English.
- xt/sample_notices.t doesn't check fr-CA yet. I didn't fix this here
  as the file is missing other notices as well which should be fixed
  separately.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 67 Jonathan Druart 2016-10-24 14:02:35 UTC
Created attachment 56792 [details] [review]
Bug 5260: make tests pass even without patron cat 'PT'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 68 Jonathan Druart 2016-10-24 14:02:41 UTC
Created attachment 56793 [details] [review]
Bug 5260: Insert the new letter for existing installs

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 69 Jonathan Druart 2016-10-24 14:02:46 UTC
Created attachment 56794 [details] [review]
Bug 5260: simplify script and error handling

No need to redirect, just sent the params to the template directly

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 70 Jonathan Druart 2016-10-24 14:02:52 UTC
Created attachment 56795 [details] [review]
Bug 5260: Use post params instead of get to avoid putting op=email in the browser history

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 71 Jonathan Druart 2016-10-24 14:04:13 UTC
(In reply to Katrin Fischer from comment #60)
> Hi Jonathan, I have added a patch asking for confirmation, but honestly.. I
> am not persuaded by it.
> I think this will get annoying quite fast when you are working with the
> acquisition module on a daily basis. Also: we don't ask for confirmation for
> sending out a claim email neither in serials nor acquisitions.

Agreed, I obsoleted it.
Comment 72 Kyle M Hall 2016-10-28 11:56:18 UTC
Pushed to master for 16.11, thanks Katrin, Jonathan!
Comment 73 Jonathan Druart 2016-11-08 14:27:06 UTC
Katrin, could you have a look, it seems that the tests are failing now
Comment 74 Katrin Fischer 2016-11-08 14:48:14 UTC
Which tests does it break? t/db_dependent/Letters.t?
Comment 75 Jonathan Druart 2016-11-08 15:21:04 UTC
(In reply to Katrin Fischer from comment #74)
> Which tests does it break? t/db_dependent/Letters.t?

Yes.
Comment 76 Katrin Fischer 2016-11-08 15:25:16 UTC
Ok, I will try... :(
Comment 77 Katrin Fischer 2016-11-09 07:00:13 UTC
I think I need help to fix the tests. :(

My guess right now is that the "from" address, which for claims and orders is the email of the librarian sending it, is somehow generated and not valid - which could break the tests like that:

# found carped warning: Bad or missing From address: ''
found carped warning: Bad or missing From address: 'SSi32Vsm4u'

The tests did run nicely when I was developing this, I haven't been able to locate when and why they broke :(
Comment 78 Mason James 2016-12-14 11:21:16 UTC
New feature, skipping for 16.05.x