Bug 12100: ensure that messaging preferences displays saved Days in Advance

If you have enhanced messaging preference, the Days in Advance combo
value (in Patron Messaging Preferences) is saved in the database but
not retrieved when you have not enabled the Email checkbox (or checkbox
for any other transport) next to it.

This patch does the following:
[1] It replaces a JOIN by a LEFT JOIN that is the actual reason of the
    problem described.
[2] Removes a FIXME by saving a hardcoded 30 into a constant.
[3] Fixes a typo in the neighborhood.
[4] Removes a superfluous comma in the map statement.
[5] Simplifies code for the selected field of the days combo. It should
    just be a boolean. The text selected="selected" is in the template.

Test plan:
[1] Enable enhanced messaging preferences.
[2] Fill in Days in advance for Advance notice but uncheck Email.
[3] Save the preferences.
[4] The member home screen does not display the number of days (until you
    decide to apply this patch :)

Followed test plan. Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 12100: (follow-up) fix regression

This patch fixes a regression on bug 5603 introduced by
the previous patch by ensuring that if no preferred transports are
active for a given message, GetMessagingPreferences()
won't try to populate the transports hash with an undef hash
key.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11518: Add new method to K::S::R::Item that will always return the correct itemtype

There are many disparate areas of Koha that deal with item level
itemtypes vs record level itemtypes. We can take advantage of
DBIx::Class to make smarter objects that automatically return the
correct value depending on the system preference.

Test Plan:
1) Apply this patch
2) Run t/db_dependent/Items.t

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11518: (follow-up) Change method name from 'itemtype' to 'effective_itemtype' for clarity

Test runs without errors.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11518: (follow-up) retrieve syspref value using DBIC

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11518: (follow-up) Make unit tests pass

This works around a problem where the database handle
returned by C4::Context->dbh() is not the same as the one
used by Koha::Database.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>