Bug 9016: Create a message for each transport type.

This patch adds:
- a new jquery plugin : insertatcaret.
- the ability to define a notice template for each transport type.
- a new routine C4::Letters::GetMessageTransportTypes.

Test plan:
- Go on tools/letter.pl and check that all existing notices are still
  there.
- Modify one. A new empty message is present for sms, print, etc. The
  email message is filled with the existant value.
- Add a message for sms for example (don't forget the subject) and save.
- edit again and verify the sms message has been saved.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: Define different transport types for overdues

This patch adds:
- a new routine C4::Overdues::GetOverdueMessageTransportTypes.
- the ability to define one or more transport types for an overdue
  level.

Test plan:
- go on tools/overduerules.pl.
- verify that previous rules still exist and that the 'email' checkboxes
  is checked if a rule is defined.
- redefined rules at different levels and check the transport type
  needed. Currently, only email, sms and print are relevant
- Save the changes.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) GetMessageTransportTypes returns an arrayref, not hashref

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: DB changes: new table overduerules_transport_types

This patch adds:
- a new table overduerules_transport_types.
- a new column letter.message_transport_type.
- a new primary key for letter.
- fill the new table with existing values.

Test plan:
After applying this patch and executing the updatedatabase entry, verify
that the overduerules_transport_types table contains a row for each
entry in the overduerules table.
The message_transport_type column should contain 'email'.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) fix unit tests

The unit tests should insert overdue rules.
+ Fix the doc for GetOverdueMessageTransportTypes

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) fix tab characters and POD.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) fix some translate issues

On tools/letter.pl and tools/overduerules.pl, some strings were not
translatable. This patch should fix that.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) add insertAtCaret library to about page

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) various fixes

* Fixes POD of GetMessageTransportTypes.
* Removes the useless map in GetMessageTransportTypes.
* Textual: "You must specify a title and a content" ->
           "Please specify title and content".
* Reintroduces << and >> around the field name.
* Change message for the update DB entry.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) make GetLetters return all letters

GetLetters only returns letters with a mtt = email. It should return all
letter codes in the DB.

The message_transport_type parameter is never used.

To reproduce the issue:
Create a notice with a sms template and no email template.
Go on the overdue rules configucation page.
The notice does not appear in the notice list.

Signed-off-by: Olli-Antti Kivilahti <kivilahtio@ProBook6570b>

---------------
Testing report:
---------------
Testing this subroutine from a test stub. Calling the method without arguments
and with argument 'circulation' and 'circulat'.
Works as supposed to.
Related Bug 11931 discovered but not within the scope of this featureset.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) additional mtt's name should be displayed in header

If you insert a new line in your message_transport_types table, the
overdues configuration table did not displayed an header.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) letter name is not displayed on editing a letter

On editing a letter, the letter name is not displayed. So if you save
it, the letter name is erased with an empty string.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Tested by setting the "Name"-field in letter.pl, saving, re-editing and verifying
that the email is present in the letter's "Name"-field.
The letter "Name" is replicated for each template in the DB, but that doesn't
incur any performance penalty.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) FIX letter name is not displayed on editing a letter

If the name is not in email, the name is not correctly retrieved.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) Add some validation on the letter form

1/ Code and Name are mandatory.
2/ At least 1 template should be filled on saving.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) Improve number of characters display when mtt=sms

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (QA Follow-up) Remove warning from content.length test

If the letter.content is undef, the content.length test in the letter
template will trigger warning:

    Argument "" isn't numeric in numeric gt (>).

This patch eliminates that warning.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: DBRev 3.15.00.039

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 9016: (follow-up) update DBIC schema classes

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11868: MTT: disable SMS and phone if not in use

On both pages "Notices and slips" and "Overdue rules", it would be great
to disable SMS and phone if there are not in use.  This patch implements
this.

Test plan:
1/ Edit a notice
2/ Enable/disable the SMSSendDriver pref and verify the sms block is
enabled/disabled.
3/ Enable/disable the TalkingTechItivaPhoneNotification pref and verify
the phone block is enabled/disabled.

4/ Go on tools/overdues.pl
5/ Enable/disable the SMSSendDriver pref and verify the sms checkboxes
are enabled/disabled.
6/ Enable/disable the TalkingTechItivaPhoneNotification pref and verify
the phone checkboxes are enabled/disabled.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>

---------------
Testing report:
---------------
Followed the test plan. Reviewed the code modifications.
Feature works as expected.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11868: (follow-up) correct case of "SMS"

Signed-off-by: Galen Charlton <gmc@esilibrary.com>