Commit graph

1745 commits

Author SHA1 Message Date
Bernardo Gonzalez Kriegel
16636c34d2 Bug 12061 - tmpl_process3.pl - Remove obsoleted strings/backups
This patch modifies the update process for PO files,
removing obsoleted strings. Currently they are removed
manually as part of the standar procedure of strings update.
Also backup files (*~) need to be removed manually.

To test:
1. Update translation files for any language, ej. fi-FI
(cd misc/translation; perl translate update fi-FI)

2. Check existence of obsoleted strings
egrep "#~ msg" misc/translator/po/fi-FI-*

3. Check existence of backup files
ls misc/translator/po/fi-FI-*~

4. Reset to HEAD and clean

5. Apply the patch

6. Update again, check there are no more obsoleted
strings nor backup files

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-01 11:00:03 -03:00
Jonathan Druart
2031c3e5ca Bug 12717: Library no longer receiving Overdue email for patrons without email address
Bug 10832 changes the fallback behavior if a patron does not have email
address: a print notice is generated into the message_queue table.
But this can cause issue for some libraries. The script should sent an
email and (generated csv, html, text file) with the list of all unsent
notices.

Test plan:
1/ Add overdue to a patron without email address (or smsalertnumber)
2/ Check email in the overdue rules configuration (or sms)
3/ Launch the overdue_notices.pl cronjob
4/ Verify the message_queue contain a print notice AND an email notice
for the library

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This works as described and restores the old behaviour for now, with
the difference that you have a print notice generated and visible
in the patron account notices tab that will say 'pending'.

We will have to figure out how we can change the workflows nicely
to have only one script deal with print notice in the future.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-26 15:08:33 -03:00
a6c278f8e0 Bug 12720: (QA followup) use API instead of plain SQL
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-24 13:19:01 -03:00
11446fcb0e Bug 12720 - Turn off Authority logging when running "bulkmarcimport.pl"
This patch turns off the AuthoritiesLogging syspref when running the
bulkmarcimport.pl script.

It also temporarily disables the syspref caching which will have
been making the CataloguingLogging handling ineffectual. (That is,
updating the CataloguingLogging syspref in the script wouldn't
have an effect as the original cached value would be used anyway.)

_TEST PLAN_

0) Turn on "AuthoritiesLogging" syspref
1) Load an authority record using bulkmarcimport.pl
2) Note a new Authorities entry in action_logs

3) Apply the patch

4) Repeat Step 1
5) Note that no new entry is made in action_logs

(Bonus points: Do the same thing with CataloguingLogging and a
bibliographic record.)

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested with biblio and auth imports.
Work as described, no koha-qa errors.

Note: If you begin to load a big file and get impatient and hit ^C,
seems that current syspref value is lost...

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests and QA script.
Patch copies what was already done for the CatalougingLog, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-24 12:49:49 -03:00
eb81090c1b Bug 12781: update_dbix_class_files.pl should use the preserve_case option
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Changes make sense, tested by confirming that a patron
modification request for B_<columns> no longer results in
an error message.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-21 09:35:30 -03:00
Chris Cormack
1cc01f1ff7 Bug 12529: Add a syspref to make overdue notices respect holidays
Test Plan

Set up some overdue triggers, for example 5,10,15
Set up some holidays
Create some items that are past due (one due 5 days, 10 days ago etc)
Run the overdue notices script (misc/cronjobs/overdue_notices.pl)

Notice holidays are ignored

Apply the patch,
Switch the OverdueNoticeCalendar syspref to Use calendar

Run the overdue notices again
Notice holidays are now taken into account

Sponsored-by: BSZ

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-15 10:56:14 -03:00
Bernardo Gonzalez Kriegel
fe0709477a Bug 9000: Followup to fix tabs & closing TT directive
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-29 16:25:56 -03:00
1e9263cb5c Bug 9000 [4] - Update to GPL v3
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-29 16:25:47 -03:00
2da15b6435 Bug 9000 [3] - Change conf key from tmpl to template
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-29 16:25:37 -03:00
f159ad9b2b Bug 9000 [2] - Update included examples
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-29 16:25:28 -03:00
80884faa22 Bug 9000 [1] - Update rss.pl to use Template Toolkit
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Tested using script with sample conf files
RSS feeds generated are 'well formed' xml
Some koha-qa errors fixed in followup

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-29 16:25:19 -03:00
Sophie Meynieux
fd90d097be Bug 12294 : Cancel replacing carriage return on notices
Cancel replacing carriage return with <br /> in printed html file as <br /> is needed in model for email notices when html format is checked

Test plan :
* define an OVERDUE notice with html activated, with <br /> at each end of line
* make sur you've got some borrowers with overdues meeting your notices triggering rules (some with valid email and others without)
* run overdue_notices.pl -html to generate html files for borrowers without email

Without patch
* email notifications are correctly formated as html content, with one <br /> at each end of line
* in html file, <br /> is duplicated at each end of line

With patch
* nothing changes for email notification
* html file is correctly formatted with only one <br /> at each end of line

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Copied test plan from comment.
No errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-26 12:15:21 -03:00
afd2418d73 Bug 11349: Change .tmpl -> .tt in scripts using templates
Since we switched to Template Toolkit we don't need to stick with the
sufix we used for HTML::Template::Pro.

This patch changes the occurences of '.tmpl' in favour of '.tt'.

To test:
- Apply the patch
- Install koha, and verify that every page can be accesed

Regards
To+

P.S. a followup will remove the glue code.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-17 11:05:49 -03:00
Olli-Antti Kivilahti
3e8607e075 Bug 12396 - MTT FIX: Due notices (DUEDGST) are multiplicated and all of them are sent to everybody who is about to receive ODUEDGST.
So the first patron receives correct letters, but the followings received
all the previous ones AND his letters.
Eventually you end up with !n letters in message_queue where n = amount of patrons
receiving due messages as digest and having something due.

Eventually we got 4 000 000 ODUEDGST-letters of which 1 100 000 were sent to our patrons :)
This is madness!

Test plan:
0/ Delete the content of the message_queue table.
1/ Pick 3 patrons and set them to receive due messages as digest.
2/ Check 1 item out for 3 separate patrons and specify a due date today.
3/ Launch the advance_notices.pl script.
4/ Before this patch, you got 6 notices (1+2+3 [!n]). Now, you get 3 notices, 1 for each patron.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Problem exis.
Patch work as described following test plan.
No koha-qa errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-06-15 11:14:45 -03:00
Jonathan Druart
35a88a5c44 Bug 12301: Remove warnings on translate scripts
Using perl v5.18, the following is warned on updating/installing
templates:
  Smartmatch is experimental at ./translate line 54.

Moreover, the following should exist with previous perl versions:

perlcritic xgettext
Subroutine prototypes used at line 29, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 44, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 60, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 72, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 89, column 1.  See page 194 of PBP.
(Severity: 5)
Variable declared in conditional statement at line 105, column 13.
Declare variables outside of the condition.  (Severity: 5)
Subroutine prototypes used at line 127, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 136, column 1.  See page 194 of PBP.
(Severity: 5)
Variable declared in conditional statement at line 190, column 7.
Declare variables outside of the condition.  (Severity: 5)
Subroutine prototypes used at line 237, column 1.  See page 194 of PBP.
(Severity: 5)
Bareword file handle opened at line 238, column 5.  See pages 202,204 of
PBP.  (Severity: 5)
Two-argument "open" used at line 238, column 5.  See page 207 of PBP.
(Severity: 5)
Subroutine prototypes used at line 277, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 311, column 1.  See page 194 of PBP.
(Severity: 5)
Bareword file handle opened at line 350, column 9.  See pages 202,204 of
PBP.  (Severity: 5)
Two-argument "open" used at line 350, column 9.  See page 207 of PBP.
(Severity: 5)
Bareword file handle opened at line 353, column 5.  See pages 202,204 of
PBP.  (Severity: 5)
Bareword file handle opened at line 359, column 5.  See pages 202,204 of
PBP.  (Severity: 5)
Two-argument "open" used at line 359, column 5.  See page 207 of PBP.
(Severity: 5)

perl -wc xgettext.pl
\1 better written as $1 at TmplTokenizer.pm line 474.
main::token_negligible_p() called too early to check prototype at
xgettext.pl line 52.
xgettext.pl syntax OK

Test plan:
Apply this patch and verify the warnings/errors does not appear anymore
and no regression is found on creating/updating/installing templates.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errros.
Tested with perl v5.18.2
No warnings, no problem detected on create/update/install i18n files

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-05-30 15:46:17 -03:00
Jonathan Druart
954017be8a Bug 12315: fix sending of duplicate advanced notices (and sending advanced notices to wrong patron)
Bug 10833 introduced a variable loop but does not reset it every
iteration.

So the first patron receives correct letters, but the following ones
received all the previous ones as well as their own notices

Test plan:
0/ Delete the content of the message_queue table.
1/ Define advanced notices sent 2 days in advance for 2 patrons.
2/ Check 1 item out for each one and specify a due date today + 2 days.
3/ Launch the advance_notices.pl script.
4/ Before this patch, you got 3 notices. Now, you get 2 notices, 1 for
   each patron.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work well, no errors.

Tested following test plan, printing on screen or saving into db,
3 messages before, 2 after (advance_notices.pl -v -n -m 2 -c)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-05-30 15:31:00 -03:00
b4f4e5a71b Bug 11856: Add confirm option to POD in advance_notices.pl
Also removes a commented line that changed the value of $confirm.
If it would default to 1, we do not need it at all.
I am not saying that we need it, but just documenting that we have it.

Signed-off-by: Marc Véron <veron@veron.ch>

Small change in documentation.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-23 13:52:05 +00:00
Galen Charlton
3c1c323de4 update release notes for 3.16.0 (human)
Manual edit of the release notes to hopefully make
them more useful.  Also added reminder about the
deprecation of the prog and CCSR public catalog
themes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-22 20:16:25 +00:00
Galen Charlton
7cfa729122 update of release notes for 3.16.0 (automatic)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-22 17:11:19 +00:00
Bernardo Gonzalez Kriegel
6b928438ce Translation updates for 3.16.00 final release
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-22 14:35:05 +00:00
Galen Charlton
fff8ae56c4 update release notes for Koha 3.16.0-rc
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 23:14:31 +00:00
Bernardo Gonzalez Kriegel
ceb017765f Translation update for 3.16.00 release
New languages:

Belarusian be-BY
Faroese fo-FO
Rwandan rw-RW
Swahili sw-KE

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 18:53:06 +00:00
Galen Charlton
6d1baba171 release notes for Koha 3.16.0-beta
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 23:26:31 +00:00
Julian Maurice
d24b24adee Bug 11848: Make Koha::I18N easier to use
Instead of writing

  use CGI;
  use Koha::I18N;
  my $cgi = new CGI;
  my $lh = Koha::I18N->get_handle_from_context($cgi, 'intranet');
  print $lh->maketext('my translatable text');

you can now write

  use Koha::I18N;
  print gettext('my translatable text');

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 04:30:02 +00:00
Julian Maurice
75bd34df7a Bug 8044: (follow-up) fix warning and error messages in translate.pl
CHARSET is now automatically replaced by UTF-8, and 'update' creates the
PO file if it does not exist.

Also do not try to create PO files if POT file creation failed (when
there is no messages to translate for example).

+ add some verbosity
+ add Locale::Maketext and Locale::Maketext::Lexicon to Koha
dependencies

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 04:26:00 +00:00
Julian Maurice
114f3dd499 Bug 8044: new module for translating strings in Perl source files
You have to use the new module Koha::I18N

Code example:
  use Koha::I18N;
  use CGI;

  my $input = new CGI;
  my $lh = Koha::I18N->get_handle_from_context($input, 'intranet');

  print $lh->maketext("Localized string!");

PO files are in misc/translator/po/LANG-messages.po.
Creation of PO files are integrated to existing workflow, so to create
PO file for a language, just run in misc/translator:
  ./translate create LANG
To update:
  ./translate update LANG
You can then translate the PO with your favorite editor. Strings will be
localized at runtime.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Works as advertised. Some details needing further attention noted on bug
report.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 04:24:53 +00:00
Jonathan Druart
b2ba10b40b Bug 11278: (follow-up) Return an exit value (1) if the module is not found.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 00:59:33 +00:00
9f45310d76 Bug 11278: Followup for customize command line parameter
The initial patch for this bug did not include a specific command line
option for customization. If a module LocalChanges.pm existed, it would
be used without asking.
This patch adds a command line option enabling the customization option
and offering the extra possibility of using another module name. If no file
name is passed, we default to LocalChanges.
Without the -custom option, behavior is as it was.
Also some POD lines are added to document the feature.

Test plan:
[1] Make a LocalChanges.pm in migration_tools. Verify that it is not used,
    if you do not enable the -cust parameter.
[2] Run the script again with -cust. Verify that it is called now.
[3] Copy LocalChanges.pm to Whatever.pm. Make some change. Run with
    -cust Whatever and verify that the new module is used.
[4] Copy Whatever.pm to another dir, make some change. Run with -cust and the
    full name. Verify that the latest change was used.
[5] Run without any option. Check the pod documentation.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 00:59:32 +00:00
8480570197 Bug 11278: Adjusting bulkmarcimport.pl for customization routine and verbose printing
This patch makes two adjustments:
[1] For the verbose option, verbose level 2 now means print the
formatted version of each record.
[2] If a module LocalChanges.pm is found in misc/migration_tools, the
routine "customize" in this module is called for each marc record.
This allows you to make local changes to these marc records before
importing them.

Test plan:
[1] Test the verbose option: a single -v for medium verbosity and two
-v to dump a human-readable version of the record to standard output.
(Do not yet copy LocalChanges.pm in the folder.)
You may used the attached example file on Bugzilla:
perl misc/migration_tools/bulkmarcimport.pl -file zztest01.xml -v -v -b -m XML -t | more
Note the option t for test; no records will be imported.
[2] Copy LocalChanges.pm in the migration_tools folder. You may use the
example provided on Bugzilla (in a patch). If you use the example module,
check the contents of 001, 005 and 590 fields. (The -v -v option allows
you to easily check that.)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 00:58:54 +00:00
Galen Charlton
f3681addc3 Bug 9016: (follow-up) treat missing transports for overdue notices as warnings
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 21:11:30 +00:00
Galen Charlton
b967a82f1c Bug 9016: (follow-up) treat missing transports for predue and item due notices as warnings, not fatal errors
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 21:01:45 +00:00
Jonathan Druart
6a06fc9b6c Bug 11867: MTT: Manage *_PHONE notices
The *_PHONE notices (HOLD_PHONE, PREDUE_PHONE and OVERDUE_PHONE) should
be "merged" into the main code (i.e. HOLD, PREDUE and OVERDUE).

Test plan:
1/ Make sure you have HOLD_PHONE, PREDUE_PHONE and OVERDUE_PHONE notices
2/ Execute the update DB entry
3/ Verify the 3 notices have been merged into "phone" template of the
HOLD, PREDUE and OVERDUE notices
4/ Verify there is no regression in the Talking Tech feature (how?)

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No koha-qa errors

Verified that notices are merged
TalkingTech_itiva_outbound.pl runs without problem... but can't produce
any output, may be not correctly configured (my setup), no warnings
nor log messages

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:20 +00:00
Jonathan Druart
76dde86fce Bug 10833: Multi transport types for advanced notices
Test plan:
- Choose 2 patrons P1 and P2
- Edit "Patron messaging preferences" and
check SMS + email with 2 days in advance for P1
check email with 5 days in advance for P2
- defined a message for the letter code PREDUE for sms and email
  (tools/letters.pl).
- select 2 barcodes (B1, B2).
    * checkout B1 to P1 with a due date = NOW - 2 days
    * checkout B2 to P2 with a due date = NOW - 5 days
- into the mysql cli, note the value of unsent message:
  select count(*) from message_queue where status != "send";
- launch the cronjob:
  perl misc/cronjobs/advance_notices.pl -c
- retry the previous sql query, you should have X + 3 unsent messages
  (depending of current checkouts in your DB!).
- view all unsent message:
  select borrowernumber, letter_code, message_transport_type, content
  from message_queue where status != "send";
  You should see:
    2 messages for P1, 1 for sms, 1 for email and the letter code PREDUE
    1 message for P2, email and the letter code PREDUE

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>
2014-05-02 20:29:20 +00:00
Jonathan Druart
04ac36aa7c Bug 10832: (follow-up) fix case where some print overdue notices were not being sent
If overdues should be sent to some patron (on the same branch), only the
first one was notified.

This patch fixes this issue.

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>
2014-05-02 20:29:20 +00:00
Jonathan Druart
9575986ed1 Bug 10832: Multi transport types for overdue notices
Test plan:
- define some complex overdue rules (tools/overduerules.pl).
For example:
First overdue from 2 to 5 days by sms and email with letter code L1
Second overdue from 5 to 15 days by email with letter code L2
Third overdue from 15 days by print with letter code L3
- define a message for each transport type selected (tools/letters.pl).
- select 3 patrons (P1, P2, P3) and 3 barcodes (B1, B2, B3).
    * checkout B1 to P1 with a due date = NOW + 3 days
    * checkout B2 to P2 with a due date = NOW + 10 days
    * checkout B3 to P3 with a due date = NOW + 20 days
- into the mysql cli, note the value of unsent message:
  select count(*) from message_queue where status != "send";
- launch the cronjob:
  perl misc/cronjobs/overdue_notices.pl
- retry the previous sql query, you should have X + 4 unsent messages
  (depending of current checkouts in your DB!).
- view all unsent message:
  select borrowernumber, letter_code, message_transport_type, content
  from message_queue where status != "send";
  You should see:
    2 messages for P1, 1 for sms, 1 for email and the letter code L1
    1 message for P2, 1 for email and the letter code L2
    1 message for P3, 1 for print and the letter code L3

- Specific case: If a user don't have a smsalertnumber and a sms is
  required or if a user don't have an email defined and an email is
  required, a print notice is generated.
  A print notice is generated only 1 time per borrower and per level.

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>
2014-05-02 20:29:20 +00:00
Jonathan Druart
abb3647d03 Bug 10845: (follow-up) fix message_transport_type parameter for Itiva cronjob
The message_transport_type param should passed to GetPreparedLetter, not
part of the "tables" parameter.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:19 +00:00
Jonathan Druart
777814a260 Bug 10845: Multi transport types for holds
The HOLD_PRINT and HOLD_PHONE notices become useless.
This patch modifies existing notices in order to group them into the
main notice type 'HOLD', with any pre-existing print and phone
templates in the appropriate places.

Test plan:
- Apply the patch and execute the update database entry.
- Verify that your previous HOLD_PHONE and HOLD_PRINT are displayed
  when editing the HOLD notice (under phone and print).
- Choose a patron and check SMS, email, phone for "Hold filled"
  (on the patron messaging preferences).
- Place a hold.
- Check the item in and confirm the hold.
- If the patron has an email *and* a SMS number, 2 new messages are put
  into the  message_queue table: 1 sms and 1 email.
  If the patron does not have 1 of them, there are 2 new messages: 1
  sms/email and 1 print.
  If the user has neither of them, there is 1 new message: 1 print.
- The generated messages should correspond with the notices defined,
  depending the message transport type.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Just noting that if email and SMS are disabled in the msg prefs, the user
will not have a print message.
And if the SMS driver fails, the record status in message_queue is 'failed',
but staff may not be aware of that.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:19 +00:00
Pasi Kallinen
c229553040 Bug 11631: Make i18n toolchain ignore useless strings
This patch removes several types of strings from the
PO files that cannot be usefully translated, including
ones that consist entirely of punctuation and/or HTML entities.

Test:
1) Update PO files of some lang, xx-YY-*po
cd misc/translator
perl translate update xx-YY
2) Do it again, just in case
3) rm po/xx-YY*po~
4) Extract all msgid's, sorted
cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-pre
5) Apply the patch
6) Repeat 1-3
7) Repeat 4 again, other file
cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-post
8) Do a diff, inspect results, only strings with %s and \s
diff xx-YY-pre xx-YY-post | less

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described, 380 strings less to 'translate'
No koha-qa errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested according to test plan, works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-27 21:06:48 +00:00
Dobrica Pavlinusic
224eab822d Bug 7844: Plack intranet tooling for developers
koha.psgi example and plackup.sh script to run any Koha site
intranet or opac interface under Plack with optional multi-process
Starman server

  plackup.sh site-name [intranet]

site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml

All configuration is specified in koha.psgi, which you are welcome to edit
and tune according to your development needs (enable memcache, enable/disable
debugging modules for plack and so on).

For deployment of opac or intranet you would probably want to take a look
in plackup.sh and enable starman as web server (which is pre-forking server
written in perl) and put some web server in front of it to serve static web
files (e.g. ngnix, apache)

When you are happy with it, rename koha.psgi and plackup.sh it to site name
and save it for safe-keeping.

This commit message is included in patch as README.plack because it includes
useful information for people using plack for first time.

Test scenario:
1. install plack and dependencies, as documented at
   http://wiki.koha-community.org/wiki/Plack

2. start ./plackup.sh sitename i[ntranet]

3. open intranet page http://localhost:5001/ and verify that it redirects
   to http://localhost:5001/cgi-bin/koha/mainpage.pl

4. start ./plackup.sh sitename

5. open OPAC http://localhost:5000/ and verify that it redirects to
   http://localhost:5000/cgi-bin/koha/opac-main.pl

6. next step is to take a look into koha.psgi and enable additional
   debug modules, save file and reload page (plackup will reload
   code automatically)

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Works as advertised. As I have explained in a comment on the bug
this looks like a very good starting point, and we can argue about
the details and add more options over time. Very happy to sign
this off! (My earlier concern about / not working has now been
taken care of, thanks Dobrica!)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 03:17:53 +00:00
Galen Charlton
9708138a86 Bug 9032: (follow-up) restore documented intepretation of virtualshelfshares.sharedate
The sharedate column is documented as having the following meaning:

"date of invitation or acceptance of invitation"

This patch adjust the new list-sharing code to stick with that
interpretation, as otherwise the column should have been renamed
to 'invite_expiration_date' or the like.

It also removes the "housekeeping" functionality from AddShare, as
otherwise the routine should have been named AddShareAndDoOtherStuff.

To prevent list shares from piling up, a new --list-invites flag
has been added to cleanup_database.pl.  The default crontabs have
been modified to use the --list-invites flag by default.

To test
-------
[1] Make some list share invites and accept some, but now all of them.
[2] Wait 14 days (or more reasonably, manually edit the sharedate
    values for the unaccepted shares to put them at least 14 days in the
    past.).
[3] Run cleanup_database.pl --list-invites
[4] Verify that accepted shares remain, as to share invites that have
    not yet reached more than 14 days of age.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 22:52:21 +00:00
Galen Charlton
9fa0649c5c Bug 9288: (follow-up) more tweaks
- add license and copyright statement
- tidy up help text

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 20:20:15 +00:00
90f1814b9e Bug 9288: (follow-up) remove function prototype
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 20:10:19 +00:00
887829613f Bug 9288: (follow-up) minor code tweaks
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 20:09:56 +00:00
8af35f89ba Bug 9288: (follow-up) use specified terminator for both input and output
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 20:09:18 +00:00
0f521663cf Bug 9288: (follow-up) add --terminator option; use Modern::Perl
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 20:08:46 +00:00
b2e8dfe816 Bug 9288 - Add a script to test SIP from the command line
This is a very basic start to a sip server testing script.
I imagine we will want to make it interactive in end,
essentially replicating what a SIP based self-checkout machine does.

Signed-off-by: Adrien Saurat <adrien.saurat@biblibre.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 20:07:56 +00:00
Jonathan Druart
836f3ce992 Bug 8258: Use patron's library's notice for DUEDGST and PREDUEDGST
If a notice is defined for the library of the patron, it should be
used.

Without this patch, the notice used is the one defined for all
libraries.

Test plan:
1/ Set the advanced notice for a patron using digest.
2/ Check one item out to this patron (backdate the return date according
the days in advance value).
3/ launch advance_notices.pl -c
4/ Verify the notice used is the default one.
5/ Define a notice for the library of the patron for PREDUEDGST
6/ launch advance_notices.pl -c
7/ Verify the notice used is the one previously defined.
8/ Check one item out to this patron (date due = today)
9/ launch advance_notices.pl -c
10/ Verify the notice used is the default one.
11/ Define a notice for the library of the patron for DUEDGST
12/ launch advance_notices.pl -c
13/ Verify the notice used is the one previously defined.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests  and QA script.
Test case: User from Library A, checked out books
- in library A from A and B
- in library B from B
Verified, that the 'all libraries' notice is still used,
when no specific notice is defined.
Verified, that the patron's home library noticed is used,
when defined.

Note: Before and after the patch we print the branch information
from the patron's home library, so also using the template from
this branch, seems logical. All items over all branches are
processed into one single reminder email, before and after the patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-20 15:23:42 +00:00
Jonathan Druart
bece83f8ed Bug 9216: make columns.def file translatable
The SQL column headers is stored into the columns.def file.
This file is not managed by the translation script.

This patch makes possible the headers translation.
Note: The translation xml tags were added to avoid all lines being put
on a single line.

Test plan:
1/ update your po file
cd misc/translate;
perl translate -f columns update LANG # Replace by another language here
2/ translate header columns (search "columns.def" in your po file).
3/ install the translated columns.def
perl translate -f columns install LANG # Replace by another language here
4/ go on the report module > create a new report > next > next
5/ change the language
on the 3rd step, you should see the column header translated.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errors

[on es-ES about a third of the strings translated!! :-) ]

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described and fixes a long standing translation
problem.
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 13:34:33 +00:00
Julian Maurice
47a9afcb7e Bug 12003: Do not calculate next pubdate for irregular subscriptions
Show 'Unknown' when planneddate and publisheddate cannot be calculated

Also fixes SQL query in misc/cronjobs/serialsUpdate.pl that was still
using "periodicity != 32" to exclude irregular subscriptions from
results

Test plan:

1) Create a subscription in the serials module. Make sure to choose:
   Frequency = Irregular
2) Test the prediction pattern, first publication date is set to
   "First issue publication date" field, others will show as
   'unknown'
3) Save the subscription
4) Check the created issue - it will show a published date and a
   planned date (same as "First issue publication date" field)
5) Receive the issue and check the next generated issue, planned
   date and published date should show as 'Unknown'
6) Generate a next issue, planned date and published date should
   also show as 'Unknown'

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described following test plan.
No koha-qa errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also tested:
- multi receiving generates mulitple issues without dates - 'unknown'
- staff detail page shows the dates empty, which is fine
- OPAC detail page shows the dates empty, which is fine
- serial collection page shows 'unknown' and those issues appear
  on the 'manage' tab, as they did in the past
- Editing the issue from the serial collection page leaves the
  date fields empty.
- Receving the issue, setting the status to 'Arrived' the Expected on
  date is set to 'today' automatically. Date published has to be
  entered manually (maybe something we could improve later
- subscription detail > issues tab shows Uknown.
- t/db_dependent/Serials/GetNextDate.t pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 20:57:51 +00:00
Galen Charlton
5492d82bc2 Bug 11484: (follow-up) standardize capitalization of "Z39.50"
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-17 15:31:33 +00:00
f796d1002a Bug 11484: Add option to cleanup_database.pl to purge Z39.50 search records from reservoir
It would be good to be able to specifically target import records from
Z39.50 for cleanup.

Test Plan:
1) Apply this patch
2) Import one or more batch record sets into Koha
3) Perform some Z39.50 searches
4) Run this command: misc/cronjobs/cleanup_database.pl -v --z3950
5) Verify that only Z39.50 records were deleted

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>
2014-04-17 15:28:29 +00:00
Bernardo Gonzalez Kriegel
de81d7abe4 Bug 12081: make tmpl_process3.pl delete ts temp files
This patch enable deletion of temp files used by
tmpl_process3.pl.
Just removed coments on existing code

To test:
1. Do a count of files on /tmp ( ls /tmp | wc -l )
2. Update preferred language
3. Count again, new files on /tmp
4. Apply the patch
5. Update again, check, no new files

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: I watched what temp files were actually in /tmp to make
      sure other processes didn't magically increase/decrease
      the number.
          $ perl translate update {lang code}
      generated 10 temporary files for me (2x5 po files). After
      removing those ten files, and applying the patch, no
      other files were generated.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
These lines has been commented by commit
a399dcefad without any apparent good
reason.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-16 15:32:52 +00:00
Galen Charlton
9834401c59 Bug 11598: (follow-up) improve help text for --html and --text options
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 16:21:14 +00:00
64e9ee3141 Bug 11598: Add --text option to overdue_notices similar to --html option
We have a number of reports of libraries that were upset by Bug 10720
being fixed! These libraries preferred this single file output, but as
text only. We should bring back this behavior, but as a feature, not a
bug.

Test Plan:
1) Apply this patch
2) Run overdue_notices.pl --html
3) Note the output is wrapped in html tags
4) Run overdue_notices.pl --text
5) Note the same output, but not wrapped in html tags

Signed-off-by: wajasu <matted-34813@mypacks.net>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
To test, add the -n parameter.
The filename generation could be refactored but not blocker.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 16:14:35 +00:00
Chris Nighswonger
4d58383ede Bug 12040: Add 3 parameters to runreport.pl for SMTP authentication
This patch adds three optional parameters to runreport.pl
to allow authentication with the SMTP server.

--username -> Username to pass to the SMTP server for
              authentication
--password -> Password to pass to the SMTP server for
              authentication
--method   -> Method is the type of authentication.
              Ie. LOGIN, DIGEST-MD5, etc.

Test Plan
---------
As for testing manually using a Gmail account:

1. Set up your sendmail as shown in
    misc/cronjobs/CONFIGURE.gmail

2. Before applying this patch, run misc/cronjobs/runreports.pl
    on your favorite report including the proper email parameters
    against your gmail account.

3. Note the failure message stating the authentication
    requirement.

4. Apply this patch, and return the script including the
    additional parameters and specifying "LOGIN" for the method.

5. Note the successful send.

6. perldoc misc/cronjobs/runreport.pl

7. Run the koha qa test tool.

Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 16:11:52 +00:00
Galen Charlton
f4633cc5e5 Bug 11441: (follow-up) improve utility help text
This patch expands and reformats the help text displayed
when running remove_unused_authorities.pl -h.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 15:25:41 +00:00
Juan Romay Sieira
0f6652d62b Bug 11441: enhance remove_unused_authorities.pl ability to select records
remove_unused_authorities.pl previously required that --aut be supplied
to specify one or more authority types to check for unlinked authority
records.  If --aut was omitted, it would default to search for
records of authority type NC, which is not present in many (or any?)
Koha databases.

Now, if --aut is omitted, unlinked authority records of any type
are removed.

To test it:
	Parse only PERSO_NAME authorities:
		misc/migration_tools/remove_unused_authorities.pl -aut PERSO_NAME

	Parse all authorities:
		misc/migration_tools/remove_unused_authorities.pl

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 15:17:28 +00:00
Jonathan Druart
f71283bad5 Bug 11995: restore ability of serialsUpdate.pl to calculate next serial issue dates
Bug 7688 changed the prototype for GetNextDate, but the serialsUpdate.pl
cronjob script had not been updated.  This patch fixes the problem.

Test plan:
Before applying the patch:
1/ Check that the following SQL query returns something:
SELECT serial.*
FROM serial
LEFT JOIN subscription ON (subscription.subscriptionid = serial.subscriptionid)
WHERE serial.status = 1
AND DATE_ADD(planneddate, INTERVAL CAST(graceperiod AS SIGNED) DAY) < NOW()
AND subscription.closed = 0;
2/ Run misc/cronjobs/serialsUpdate.pl -v
   It should die with an error message like this:
   Can't use string ("2011-03-05") as a HASH ref while "strict refs" in use
3/ Apply the patch
4/ Run misc/cronjobs/serialsUpdate.pl -v
   It should exit normally and print messages like this:
   Serial issue with id=XX updated
5/ Run the Koha QA test tools.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 15:10:43 +00:00
Matthias Meusburger
5935654bac Bug 11850: Add -append option to bulkmarcimport.pl to append to logfile
Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Keeps current behaviour as default.
The -append option is described in the POD and works as expected.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described.
Adding a date/time to the output might
be good, to make it easier to find the entry you were looking for.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-07 15:32:01 +00:00
Bernardo Gonzalez Kriegel
fe205c907a Bug 11393: fix display of Thai in language menu when Thai translation is installed
The problem is with the name of PO files

Currently Koha expect, among other variants, that PO filenames
began with (using as example *-pref.po):
{lang}-pref.po
{lang}-{region}-pref.po
{lang}-{script}-pref.po
{lang}-{script}-{region}-pref.po
and expect 2 chars for lang and region, and 4 for script

So the problem with Thai translation files are that it's names
do not match that convention.

This patch only rename Thai files as th-THA-* to th-TH-*.
In that way language description is right.
translate script use that chars to make dirs, and use dirs to find
description.

To test:
1) Go to I18N/L10N sysprefs
2) Install th-THA language (or simply mkdir koha-tmpl/intranet-tmpl/prog/th-THA)
3) Reload page, wrong description
4) Apply patch
5) Install th-TH language (or simply mkdir koha-tmpl/intranet-tmpl/prog/th-TH)
6) Reload page, right description
7) If you want do "mkdir koha-tmpl/intranet-tmpl/prog/th-Thai", reload,
   also right description

To the reporter of this Bug: the rename of the folder is a good
workaround, when this patch is pushed to stable I'll rename Thai
files

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

This does not correct existing problems which need human
intervention. It does, however, allow for a correct installation
of Thai after the patch is made.

If we really want a patch for fixing an existing install. I
wrote it, but have not tested it.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
As pointed out by Mark, this does not fix existing installations.
Putting a note in the release notes might be something we can do here.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-03 15:38:10 +00:00
Jonathan Druart
7408fa5d70 Bug 8168: (follow-up) Use semicolon as default CSV delimiter
installer/data/mysql/sysprefs.sql has semicolon as default.
This fixes both instances to use the same fallback value.

It also prevents CSV header info from being included in non-CSV messages.

Signed-off-by: wajasu <matted-34813@mypacks.net>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-18 12:15:43 +00:00
Daniel Barker
a31210efd3 Bug 8168: Fixing header of non CSV files for overdue notices
This determines if the CSV header should be included or not and
then generates it as needed using the delimiter specified in the
delimiter system preference.

TEST PLAN
---------
1. make some overdues books
2. run the overdue notices script without the -csv
3. check emails notice csv header is in the email
4. apply the patch
5. run the overdue notice again
6. check email notice CSV header is absent

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: wajasu <matted-34813@mypacks.net>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-18 12:14:49 +00:00
8a9cdcd3bc Bug 10415 - Add course reserves to staff client home page
A link to course reserves is in the global header menu but not on the
home page. All links from the global header should be present on the
home page as well. This patch adds it.

To test, apply the patch and if necessary clear your browser cache. View
the staff client home page. If you have "UseCourseReserves" enabled you
should see a link for the course reserves page which is visually
consistent with the other module links. If you do not have course
reserves enabled you should not see the link.

Unrelated: I positioned the admin link after the tools link because it
bugged me.

Signed-off-by: Broust <jean-manuel.broust@univ-lyon2.fr>
Signed-off-by: marjorie barry-vila <marjorie.barry-vila@ccsr.qc.ca>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.
Course reserves is still accessible without permissions, but
you can't make any changes to the reserves then.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-12 18:15:24 +00:00
Galen Charlton
26cdaaae77 Bug 10777: (follow-up) improve CSS3 for Zebra-striping report email output
This patch improves the CSS used to attempt to Zebra-stripe the
output of emailed reports.  This will work with some email clients,
but other email clients (e.g., Gmail) don't handle style elements in the
body or head element.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-11 14:57:26 +00:00
Nicholas van Oudtshoorn
25076dec54 Bug 10777: email HTML reports with the proper Content-Type
The misc/cronjobs/runreport.pl allows for sending html reports
via email. The problem is that the Content-Type isn't set to
text/html, which means that the generated html email isn't
displayed properly.

This patch set the Content-Type, and also adds a tiny bit of
CSS to potentially alternate row colours (just to make long
reports a bit easier on the eye!)

TEST PLAN
----------
1. Run the script similar to this:
    ./misc/cronjobs/runreport.pl --format=html --to=YOUREMAIL --subject="Bad Formatting!" REPORTNUMBER
2. Look at the email - the html code should by visible and ugly.
3. apply the patch
4. Run the script again.
5. Look at the email - the data should look nicer now.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-11 14:57:23 +00:00
Jonathan Druart
4ae3665ad8 Bug 10611: Use mysql_auto_reconnect instead of ping
DBD::Mysql provides a mysql_auto_reconnect flag. Using it avoids
the time required to do a $dbh->ping().

Benchmarks:

use Modern::Perl;
use C4::Context;
for ( 1 .. 1000 ) {
    $dbh = C4::Context->dbh;
}

* without this patch on a local DB:
perl t.pl  0,49s user 0,02s system 98% cpu 0,525 total
* without this patch on a remote DB:
perl t.pl  0,52s user 0,05s system 1% cpu 37,358 total
* with this patch on a local DB:
perl t.pl  0,46s user 0,04s system 99% cpu 0,509 total
* with this patch on a remote DB:
perl t.pl  0,49s user 0,02s system 56% cpu 0,892 total

Testing the auto reconnect:
use Modern::Perl;
use C4::Context;
my $ping = $dbh->ping;
say $ping;
$dbh->disconnect;
$ping = $dbh->ping;
say $ping;

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Real improvement. No koha-qa errors

prove t/db_dependent/Circulation_issuingrules.t produces no error
prove t/db_dependent/Context.t produces no error

Test
1) dumped Koha DB, load it on a non-local server
2) run sample script whit and without patch, local and remote

use Modern::Perl;
use C4::Context;
for ( 1 .. 100000 ) {
    my $dbh = C4::Context->dbh;
}

Main difference I note is with remote server
a) without patch
real    0m16.357s
user    0m2.592s
sys     0m2.132s

b) with patch
real    0m0.259s
user    0m0.240s
sys     0m0.012s

I think this could be good for DBs placed on
remote servers

Bug 10611: add a "new" parameter to C4::Context->dbh

When dbh->disconnect is called and the mysql_auto_reconnect flag is set,
the dbh is not recreated: the old one is used.

Adding a new flag, we can now force the C4::Context->dbh method to
return a new dbh.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 10611: Followup: remove useless calls to dbh->disconnect

These 3 calls to disconnect are done at the end of the script, they are
useless.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 23:15:35 +00:00
Galen Charlton
03338b70e4 Bug 10955: (follow-up) improve usage information
This patch improves rebuild_zebra.pl's usage help
by explaining when --skip-deletes should be considered
and noting that it should be used in conjunction with
a cronjob to process deletions after hours.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 18:46:28 +00:00
b0870311e1 Bug 10955 - Add ability to skip deletions in zebraqueue
It seems that record deletions can cause extreme slowdowns for Koha
installations with extremely large numbers of records. It would be
helpful to be able to skip record deletions when processing the
zebraqueue with rebuild_zebra.pl so the deletions can be processed with
a lower frequency.

Test Plan:
1) Disable any zebra indexing cronjobs you may have
2) Delete a record
3) Note the operation recordDelete in the zebraqueue table having done = 0
4) Run misc/migration_tools/rebuild_zebra.pl -b -z --skip-deletes
5) Note the delete still has done = 0
6) Run misc/migration_tools/rebuild_zebra.pl -b -z
7) Note the delete now has done = 1

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also tested for authorities, no problems found.

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

RM note: this is at best a work-around, and I will emphasize that
--skip-deletes should be used only when absolutely necessary.

I hope that --skip-deletes can go away at some point soon, but
that may depend on changes to Zebra.
2014-03-10 18:44:10 +00:00
Galen Charlton
160c44d4e9 Bug 11078: (follow-up) tidy code
- fix a couple typos in comments
- make replace a "$i" with a more descriptive variable name
- style some of the new code

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 22:24:28 +00:00
07de37f0e5 Bug 11078: QA Follow-up for missing file permissions on lockfile
The original patch creates a lockfile in the ZEBRA_LOCKDIR.
It can fall back to /var/lock or even /tmp.
If the create fails, it dies. This can be considered as very
exceptional.

This followup adjusts the fallback location in /var/lock or /tmp
slightly.  It appends the database name to the folder in order to
prevent interfering between multiple Koha instances. Creation of the
lockfile has been moved to a subroutine extending directory and file
creation testing.

In the very unlikely case that we cannot create the lockfile (after
three separate tries), this follow-up allows you to continue instead
of die.  This is just as we did before we had file locking here. Every
time skipping a reindex could cause more harm than continuing and
having the race condition once in a while.

Test plan:
Test adding and removing lockdir from your koha-conf.xml. Check fallback.
Note that fallback in /var/lock or /tmp must contain database name.
Remove the lockdir config line and remove permissions from fallback. In
this case the reindex should continue but with a warning.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with daemon and one-off invocation simultaneously.
Tested new wait parameter.
Tried all variations of lock directory (changing permissions etc.)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 22:22:47 +00:00
Doug Kingston
88e7faf860 Bug 11078: Add locking to rebuild_zebra
This patch adds locking to rebuild_zebra.pl to ensure that simultaneous
changes are prevented (as one is likely to overwrite the other).
Incremental updates in daemon mode will skipped if the lock is busy
and they will be picked up on the next pass.  Non-daemon mode
invocations will also exit immediately if they cannot get the lock
unless the new flag -wait-for-lock is specified, in which case they
will wait until the get the lock and then proceed.

Supporting changes made to Makefile.PL and templates for the new
locking directory (paralleling the other zebra lock directories).
We stash the zebra_lockdir in koha-conf.xml so rebuild_zebra.pl
can find it.

To address earlier QA concerns we:
1. added code to check if flock is available and ignore locking if
it's missing (from M. de Rooy)

2. changed default for adhoc invocations to abort if they cannot
obtain the lock.  Added option -wait-for-lock if the user prefers
to wait until the lock is free, and then continue processing.

3. added missing entry to t/db_dependent/zebra_config.pl

4. added a fallback locking directory of /tmp

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Doug merged the original patch with the QA changes.
Just for the record, noting here that the original patch was tested
extensively too by Martin Renvoize.
I have added a followup for some exceptional cases.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 22:21:41 +00:00
daf2ebc4f5 Bug 11096: support the retrieval of large MARCXML records
This patch makes Koha <-> Zebra use MARCXML for the serialization when
using DOM, and USMARC for GRS-1.

* The following functions are modified to set the Zebra record syntax
according to the current sysprefs and configuration:

- C4::Context->Zconn
- C4::Context-_new_Zconn

* A new function 'new_record_from_zebra' is introduced, which checks the
context we are in, and creates the MARC::Record object using the right
constructor.

The following packages get touched to make use of the new function:
- C4::Search
- C4::AuthoritiesMarc

and the same happens to the UI scripts that make use of them (both in
the OPAC and STAFF interfaces).

* Calls to the unsafe ZOOM::Record->render()[1] method are removed.

Due to this last change the code for building facets was rewritten. And
for performance on the facets creation I pushed higher version
dependencies for MARC::File::XML and MARC::Record (we rely on
MARC::Field->as_string).

* Calls to MARC::Record->new_from_xml and MARC::Record->new_from_usmarc
are wrapped with eval for catching problems [2].

* As of bug 3087, UNIMARC uses the 'unimarc' record syntax. this case is
  correctly handled.
* As of bug 7818 misc/migration_tools/rebuild_zebra.pl behaves like:

- bib_index_mode (defaults to 'grs1' if not specified)
- auth_index_mode (defaults to 'dom')

here we do exactly the same.

To test:
 - prove t/db_dependent/Search.t should pass.
 - Searching should remain functional.
 - Indexing and searching for a big record should work (that's what the
   unit tests do).
 - Test an index scan search (on the staff interface):
    Search > More options > Check "Scan indexes".
 - Enable 'itemBarcodeFallbackSearch' and try to circulate any word, it
   shouldn't break.
 - Searching for a biblio in a new subscription shouldn't break.
 - Running bulkmarcimport.pl shouldn't break.
 - And so on... for the rest of the .pl files.

[1] http://search.cpan.org/~mirk/Net-Z3950-ZOOM/lib/ZOOM.pod#render()
[2] a record that cannot be parsed by MARC::Record is simply skipped (bug 10684)

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 19:50:09 +00:00
Jonathan Druart
bab96c3f22 Bug 11571: fix breakage of -f option for translate script
Bug 7934 breaks the -f option introduced in bug 9161; this patch
repairs the regression.

While the generation of the command tmpl_process3.pl, a space is
missing if the -x option is given.

The tmpl_process3.pl is called like:
/home/koha/src/misc/translator/tmpl_process3.pl -q update -i
/home/koha/src/koha-tmpl/intranet-tmpl/prog/en/ -s
/home/koha/src/misc/translator/po/fr-FR-i-staff-t-prog-v-3006000.po -r
-x 'help'-f pay.tt

Revised test plan:
1) cd ./misc/translator
2) put a warn at LangInstaller.pm line 375.
3) time ./translate update fr-FR -f pay.tt
-- note the execution time and the output. The options in the
    command contain "-x 'help'-f pay.tt"
    The -f param is not passed to the script.
    The execution time is strangely long.
5) git reset --hard origin/master
6) apply this patch
7) put a warn at LangInstaller.pm line 375.
8) time ./translate update fr-FR -f pay.tt
-- verify the output and the execution time is now corrected.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-26 15:50:41 +00:00
Liz Rea
e6da56acb1 Bug 11138 - Add auto_unsuspend_reserves to crontab.example
To test:

Set up and run the cronjobs from crontab.example with a hold set to
unsuspend today. The hold should be unsuspended.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-17 21:13:56 +00:00
Magnus Enger
e8a24c35f6 Bug 11188 - Make gather_print_notices.pl die on failed open()
Problem:
If you tell gather_print_notices.pl to write output to a location
you do not have write access to, it will silently fail to write the
data, but still mark unsent messages as sent.

Solution:
This patch adds two lines of defense:
1. Check that the location given for the output is writable
2. use "open() or die" instead of just "open()" when writing the
   output
The first measure should catch most of the potential errors, but
I guess a directory can be writable, but the open() still can fail
because the disk is full or something similar.

To test:
- Make sure you have some unsent messages in the message_queue table,
  that do not have an email adress
- Apply the patch
- Run the script, pointing at a location you do not have access to
  write to. Check that the script exits with an appropriate error
  message, and that the unsent messages are still unsent. Do this
  both with and without the -s option.
- To fake passing the first line of defence, comment out line 62
  and put this in instead:
  if ( !$output_directory || !-d $output_directory ) {
- Run the script again as above, check you get an appropriate
  error and that the message queue is not touched
- Reset line 62 to how it was
- Run the script against a directory you do have access to write to
  and check that output is produced as expected and that messages
  are marked as sent
- Sign off

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:12:48 +00:00
Matthias Meusburger
28d97e3228 Bug 11412: fix potential bulkmarcimport crash when searching for duplicates in authorities
bulkmarcimport.pl can crash when searching for duplicates if the 005
field from the incoming or local record is not defined. This patch
fixes it.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Test plan
1/ Create a record with no 005 field
2/ Try to import it checking for duplicates, notice it crashes
3/ Try with a record with a 005 field, but the one in Koha missing
one, still crashes
4/ Apply patch
5/ No more crash

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Patch fixes the problem described for importing authorities
with the bulkmarcimport.pl when trying to match with existing
records.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-26 15:52:02 +00:00
Galen Charlton
b26870e53d Bug 11252: remove deprecated -munge-config switch from rebuild_zebra.pl
The -munge-config switch has been deprecated for years, and
trying to use it would either not work at all or, if it did "work",
almost certainly damage one's Zebra configuration for Koha.

This patch removes this switch.

To test:

[1] Run rebuild_zebra.pl and verify that no mention is made
    of -munge-config.
[2] Run rebuild_zebra.pl to index records in one's test database
    and verify that there are no regressions.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Removing a really dangerous option

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Ran rebuild_zebra.pl with various options and confirmed
that data was reindexed successfully.
No regressions found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-26 15:24:41 +00:00
Gaetan Boisson
6657860010 Bug 11417: make sure remove_unused_authorities.pl accepts --test
This patches adds support for the --test option, as well as a
short message telling the user the script is running in test mode.

Test plan :
- Launch the script with -h to see the help
- Launch the script with --test and --aut with an authtypecode
  that is used in your instance
- Make sure it does the same thing as launching it with -t
- Launch the script for real and make sure it still works as
  expected, deleting unused authorities.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-19 15:09:18 +00:00
Bernardo Gonzalez Kriegel
466a7320d1 Translation update - split staff UI and help files 2013-12-17 16:22:49 -03:00
Bernardo Gonzalez Kriegel
6cf065da5e Bug 7934: generate separate PO files for help pages
This patch modifies LangInstaller.pm to enable separation
of translation for Staff UI and Staff Help files.

It's a move that make sense, Help strings accounts for
44% of total word count for Staff, and as stated on
Comment #1, it could enable a different workflow on
translation work.

It's more a hack than an elegant solution, but it works.
Feel free to suggest another approach.

To test:

We need to test complete functionality, i.e. create and update
translation files and install translation, and verify that no
string is missing.

1) Before applying the patch, we need some data from staff file.
Pick your language, say de_DE, and

cd misc/translator/
perl translate update de-DE
msginit -i po/de-DE-i-staff-t-prog-v-3006000.po -o de-old.po --no-translator --no-wrap --locale=de_DE
egrep ^msgid de-old.po | sort | tee s-old | wc -l > number-old

We have the file s-old with all strings, and the number of strings on number-old

2) Apply the patch

3) New help file is called de-DE-staff-help.po, so create one
cp'ing old staff on new help

cp po/de-DE-i-staff-t-prog-v-3006000.po po/de-DE-staff-help.po

4) Make a new update, and analize

perl translate update de-DE
msginit -i po/de-DE-i-staff-t-prog-v-3006000.po -o de-new.po --no-translator --no-wrap --locale=de_DE
msginit -i po/de-DE-staff-help.po -o de-help.po --no-translator --no-wrap --locale=de_DE
egrep ^msgid de-new.po | sort | tee s-new | wc -l > number-new
egrep ^msgid de-help.po | sort | tee s-help | wc -l > number-help
cat s-new s-help | sort | uniq | tee s-all | wc -l > number-all
cat s-new s-help | sort | uniq -d | tee s-dup | wc -l > number-dup

Ideally what we need to found is:

diff s-old s-all = zero lines (old strings vs new strings)

In my test I got one line, but it's a false positive (the string "• " is present on new staff)

On numbers,

number-old - number-new - nummber-help + number-dup = 0
or
number-old - number-all = 0

(in my test again I have 1 as result, same string. Also there are 137
repeated lines between new staff and help)

All this tells me that all string to translate are preserved

5) Install translation

perl translate install de-DE

Enable language on staff, and check that help files are translated

6) Finally, create translation files

rm po/de-DE-*
perl translate create de-DE

verify that all files are created. Tests of 4) can be repeated.

7) Verify that no strings from help are present on staff UI file

egrep help po/de-DE-i-staff-t-prog-v-3006000.po

Only results came from help-top and bottom, and a few "help" on staff strings

Signed-off-by: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested according to test plan. Checked various pages in OPAC,
staff and intranet, translation was ok.
Passes QA script and tests.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-17 05:42:20 +00:00
1219b3153e Bug 11124: QA Follow-up resolving a warning and three typos
Resolves warning on uninitialized author in split on line 128.
Just adds the same behavior for title on line 129 for completeness.
Fixes typo on occurrences and two other minor typos.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-13 19:49:09 +00:00
Jonathan Druart
4604f595d6 Bug 11124: disallow trying to run the staff benchmark script as the DB account
On step 6 (at least), the circulation and return page redirect to the
select branch page and nothing is done.

The script should die if the user used is the sql administrator account.

Test plan:
Suppose that the sql admin account is root/root and koha/koha a
superlibrarian account.

1/
perl misc/load_testing/benchmark_staff.pl --steps=6
--url=http://admin.koha.local/cgi-bin/koha/
--password="koha" --user="koha"
should produce:
  ...
  Step 6
  ...

2/
perl misc/load_testing/benchmark_staff.pl --steps=1
--url=http://admin.koha.local/cgi-bin/koha/
--password="root" --user="root"
should produce:
Authentication successful
You cannot use the database administrator account to launch this script

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-13 19:47:44 +00:00
Galen Charlton
b25de3e7cf Bug 6435: (follow-up) make -daemon really imply -a and -b
This patch follows up on the previous patch by moving the
check for whether authority and/or biblio indexing have been
specified so that -daemon has a chance to set those modes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-24 18:20:56 +00:00
Doug Kingston
00240d6970 Bug 6435: (follow-up) rebuild_zebra -daemon option now smarter
Based on feedback, make daemon mode imply -z -a -b and abort
on startup if flags incompatible with an incremental update daemon
are used.  Update documentation to match.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-24 18:15:23 +00:00
Doug Kingston
1b0992e8d5 Bug 6435: Add daemon mode to rebuild_zebra.pl
This change adds code to check the zebraqueue table with a cheap SQL query
and a daemon loop that checks for new entries and processes them incrementally
before sleeping for a controllable number of seconds.  The default is 5 seconds
which provides a near realtime search index update.  This is desirable particularly
for libraries that are doing active catalogue updating.  The query is adjusted
based on whether -a, -b, or -a -b are specified.

Help text updated.  Tested against a live 3.12 system.

Note that this fix will benefit from the fix to lack of locking (bug 11078)

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-24 18:12:21 +00:00
Galen Charlton
07b5f01c07 release notes for Koha 3.14.0
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-21 01:40:18 +00:00
Bernardo Gonzalez Kriegel
83a5756645 Translation updates for 3.14.0
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-20 18:33:32 +00:00
0d21dc6c3b Bug 11185: fix bug preventing check-url-quick.pl from working
Revert commit f88f11b4f8

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Before this patch, check-url-quick.pl fails with an error. After the
patch it runs correctly.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-15 15:30:20 +00:00
Galen Charlton
a1d4af3d73 updated release notes for 3.14.0 beta
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-01 15:04:49 +00:00
Sophie Meynieux
394be84dcd Bug 10720: fix issue that prevented use of HTML tags in overdue notices
Substitution term in overdue notices shouldn't be removed if they don't match.
It prevents use of HTML in notices to use with CSS.

Test plan :
- define an overdue notice containing some valid substitution terms + some valid html tags (<strong> or <div class="my class" to use with a css
- find a borrower with overdues that trigger this notice
- run overdue_notices.pl -html <directory>

Without patch, your html tags are missing in your html file
With the patch, they are present and can be used with a css to generate a formatted pdf file.

If you add some invalid substitution term, with the patch, they are still in the final letter, but the warn in the log helps you to correct your notice template.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-01 00:28:04 +00:00
Galen Charlton
7a1c343c91 Bug 8015: (follow-up) update stage_file.pl
This patch fixes the call to BatchStageMarcRecords() made
by the comand-line record importer.  At some point in the future
we could go further and teach that tool how to apply modification
templates.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 22:51:13 +00:00
80897930b7 Bug 2720 - Overdues which debar automatically should undebar automatically when returned
This patch adds a more extensible and flexible debarments system to Koha. The fields
borrowers.debarred and borrowers.debarredcomment are retained for compatibility and
speed.

This system supports having debarments for multiple reasons. There are currently
three types of debarments:
OVERDUES    - Generated by overdue_notices.pl if the notice should debar a patron
SUSPENSION  - A punative debarment generated on checkin via an issuing rule
MANUAL      - A debarment created manually by a librarian

OVERDUE debarments are cleared automatically when all overdue items have been returned,
if the new system preference AutoRemoveOverduesRestrictions is enabled. It is disabled
by default to retain current default functionality.

Whenever a borrowers debarments are modified, the system updates the borrowers debarment
fields with the highest expiration from all the borrowers debarments, and concatenates
the comments from the debarments together.

Test plan:
 1) Apply patch
 2) Run updatedatabase.pl
 3) Verify the borrower_debarments table has been created and
    populated with the pre-existing debarments
 4) Run t/db_dependent/Borrower_Debarments.t
 5) Manually debar a patron, with an expiration date
 6) Verify the patron cannot be issued to
 7) Add another manual debarment with a different expiration date
 8) Verify the 'restricted' message lists the date farthest into the future
 9) Add another manual debarment with no expiration date
10) Verify the borrower is now debarred indefinitely
11) Delete the indefinite debarment
12) Verify the debarment message lists an expiration date dagain
13) Enable the new system preference AutoRemoveOverduesRestrictions
14) Set an overdue notice to debar after 1 day of being overdue
15) Check out an item to a patron and backdate the due date to yesterday
16) Run overdue_notices.pl
17) Verify the OVERDUES debarment was created
18) Return the item
19) Verify the OVERDUES debarment was removed
20) Disable AutoRemoveOverduesRestrictions
21) Repeat steps 15 though 18, verify the OVERDUES debarment was *not* removed
22) Add issuing rules so that an overdue item causes a temporary debarment
23) Check out an item to a patron and backdate the due date by a year
24) Return the item
25) Verify the SUSPENSION debarment was added to the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 01:53:22 +00:00
Galen Charlton
997a502c22 Bug 7131: (follow-up) update the command-line import tools
misc/commit_file.pl now properly displays the number
of replaced and ignored items.

misc/stage_file.pl now has a new command-line switch --item-action:

  --item-action       action to take if --add-items is specifed;
                      choices are 'always_add',
                      'add_only_for_matches', 'add_only_for_new',
                      'ignore', or 'replace'

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 04:35:17 +00:00
Bernardo Gonzalez Kriegel
616db836b9 Translation files for 3.14.0-beta
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-29 14:24:34 +00:00
Fridolyn SOMERS
20022e5b58 Bug 9192: let UNIMARC_sync_date_created_with_marc_biblio.pl create fields if needed
Prior to this patch, this script would only modify the date
created and modified fields; this patch changes the behavior
so that the fields can be created if they're not already present
in the record.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Mason James <mtj@kohaaloha.com>

Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation (followup)

Add tests :
if field < 10 it must not have a subfield
if field > 9 is must have a subfield

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Both patches applied, no koha-qa errors.

Bug 9192: followup fix typo

Fix typo on usage message.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-23 14:20:14 +00:00
Galen Charlton
0c219d3dd8 update 3.14 release notes for second alpha
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-22 21:08:45 +00:00
Katrin Fischer
dbc0a84720 Bug 9739: (follow-up) improve help text a bit
Changes only strings in the script: the help text and the
success message for updated serial issues.

Thx to Jared for proof reading!

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-20 18:57:19 +00:00
Bernardo Gonzalez Kriegel
cc795c75d9 Bug 9739: (follow-up) add missing comma
Adds a missing comma in select statement.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-20 18:56:57 +00:00
Fridolyn SOMERS
ed38698247 Bug 9739: (follow-up) cosmetic changes
Cosmetic changes:

* perltidy
* q{} for query
* list of columns is query instead of SELECT *

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Your cosmetic changes missed a comma, fixed in a followup

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-20 18:56:27 +00:00
Fridolyn SOMERS
3a1a94d4ef Bug 9739: more options for serialsUpdate.pl
Script serialsUpdate.pl must be set in crontab to run daily.
It checks serials that are late, modifies status and adds a note.

This patch adds some options :
--note : defined note, a defaut one is used if not defined
--no-note : disable automatic note
--verbose : used to control output
This patch also implements confirmation option "-c" who whas present but not used.

Test plan :
Run script on a database with late serials :
- serialsUpdate.pl -h
=> you get help text in output
- serialsUpdate.pl --man
=> you get full help
- serialsUpdate.pl -v
=> you get output of changed serials but database has not changed
- serialsUpdate.pl -c -v
=> you get output of changed serials and database has changed, with note "Automatically set to late"
- serialsUpdate.pl -c
=> database has changed without anything in output
- serialsUpdate.pl -c --note "LATE"
=> database has changed, with note "LATE"
- serialsUpdate.pl -c --no-note
=> database has changed with no note

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described. No koha-qa errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
New options behave as described.
There are some existing problems with this script that I have noted
directly on the bug report.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-20 18:56:09 +00:00
Galen Charlton
5e8abb1191 start 3.14 release notes -- first alpha
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 23:47:08 +00:00
Galen Charlton
e0b0ae2053 bug 8798: (follow-up) pass DB connection params to DBIC schema updater explicitly
This patch changes update_dbix_class_files.pl so that the connection
parameters to the reference database must be passed explicitly via
command-line switches, rather than grabbing them from the current Koha
context.

The purpose of this is to intentionally put up a roadblock to reduce
the chance that a developer (or release manager) accidentally updates
the schema files to include local testing cruft such as temporary
tables.

Usage is now as follows:

[1] Create an empty database
[2] Load the schema creation script into it, e.g.,

mysql -u dbic -pdbic dbic < installer/data/mysql/kohastructure.sql

[3] Run the schema updater:

./misc/devel/update_dbix_class_files.pl --db_user=dbic --db_name=dbic --db_passwd=dbic

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:08:03 +00:00
bdf7988c46 Bug 8798: (follow-up) rename schema class updater script
updateDatabase.pl is a bit too close to updatedatabase.pl in installer
and may cause some confusion. I would suggest update_dbix_class_files.pl
as a unambiguous and descriptive name for this file.

Signed-off-by: wajasu <matted-34813@mypacks.net>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:08:01 +00:00
Elliott Davis
8a480ad75d Bug 8798: DBIx::Class base classes for all Koha tables
* Added base class files for all tables in koha using
DBIx::Class::Schema::Loader.
* Added a (very basic) test file for C4::Context
* Also added dependencies in required files.

To Test:

[1] Install patch
[2] Make sure you can still connect to Koha
[3] You may optionally run this test script:

        use Koha::Database;
        use Data::Dumper;
        my $db = Koha::Database->new();
        my $schema = $db->schema();
        print Dumper($schema->resultset("Borrower"));

    If you run this file you should get a DBIx dump of the borrowers table.

Signed-off-by: wajasu <matted-34813@mypacks.net>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-14 21:07:24 +00:00
Galen Charlton
88936cb524 bug 10419: (follow-up) improvements to the usage text
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 22:13:40 +00:00
Jonathan Druart
cf31604a0e Bug 10419: (follow-up) patrons with fines should not be deleted
Test plan:
- add a fine for a patron
- verify the script does not delete this patron.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works, script do not delete a patron with fines.
No koha-qa errors with all patches applied

Test
1) Added a fine to a patron
2) run script
3) reports condition
Trying to delete patron 5... Failed to delete patron 5: patron has 10.00 in fines
4) Patron is not deleted

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Tested various combinations of options:
./delete_patrons.pl
  Gives a helpful message about the use of the script.
./delete_patrons.pl -h
  Outputs useful information about the use of the script
  and its various options.
./delete_patrons.pl --category_code ST --library CPL
  Gives the correct results in numbers and deletion was done
  properly.

Also tested:
  --expired_before
  --not_borrowed_since
  -v

Testing various conditions where a delete should not occur:
- Patron has checkouts
  Patron is not in list of patrons to delete (x patrons to delete)
- Patron has fines
  Patron is still in list of patrons to delete (x patrons to delete)

Checked deleted patrons had been moved to deletedborrowers.

Notes about possible enhancements:
- only print the success message 'x patrons deleted' when confirm
  flag was set
- patrons with current checkouts are silently excluded from the number
  of patrons to be deleted. Printing the number with current checkouts
  might be helpful.

Changes made:
  Fixed a small error in the documentation: expired_date is expired_before.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:44:53 +00:00
Jonathan Druart
b90e1ff892 Bug 10419: (follow-up) fix hardcoded records and pod
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Missing a sign. Removes harcoded values

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:44:21 +00:00
Galen Charlton
86c73e9b40 Bug 10419: (follow-up) functional improvements
[1] Patron deletion now happens atomically; if one part
    of the process fails, the record isn't left in a
    partially deleted state.
[2] The routine for handling lists properly during patron
    deletion is now invoked.
[3] The script now prints an indication if it's run
    without --confirm; otherwise, one might think that
    patron records were actually being deleted.
[4] --verbose now actually does something.

Without --verbose, the script will print the dry-run
warning (if applicable), the number of patrons to be
deleted, and error messages.

With --verbose, the script will also print a line with
the borrowernumber of each patron to be deleted.

To test:

[1] Run the script with and without --verbose and compare
    the, well, verbosity.
[2] Run the script without --confirm and note that the script
    prints a message saying that it's running in dry-run mode.
[3] Use the script to try to delete one or more patrons that have
    loans.  Confirm that error messages are printed reporting
    foreign constraints preventing the deletion.  Also confirm that
    no new rows are added to deletedborrowers for those patrons that
    could not be completely deleted.
[4] Use the script to delete a patron that has a public list.  Verify
    that after the deletion, the public list still exists but now
    has a null owner.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:42:03 +00:00
Galen Charlton
2a9c129d31 Bug 10419: (follow-up) tidy names of command-line switches
[1] Use --library instead of --branchcode to be consistent
    with other scripts and user-facing Koha terminology.
[2] Use --not_borrowed_since instead of --not_borrowered_since;
    no need to expose typos in the API to the user.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:41:50 +00:00
Chris Cormack
b8a16ee2fc Bug 10419: (followup) fix license statement
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:41:41 +00:00
Jonathan Druart
b9f74eaf41 Bug 10419: (follow-up) add branchcode parameter to patron deletion script
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:41:27 +00:00
Jonathan Druart
497795f32a Bug 10419: (followup) - tidy up cronjob for deleting patrons
This followup adds:
- execute flag (+x) for the cronjob script.
- replaces --dry-run with --confirm (according with existing scripts).
- changes output text (remove 'first person' style).
- updates the doc and simplifies the dates parameters.
- changes flags PrintError and RaiseError for the dbh in order to catch
  something if an error occurs...

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:41:14 +00:00
Jonathan Druart
231ed790e4 Bug 10419: new cronjob for deleting patrons
This patch provides a cronjob script for deleting patrons.

It takes 3 options:

--not_borrowed_since
--expired_date
--category_code

See the perldoc misc/cronjobs/delete_patrons.pl.
Use the -v flag for a verbose mode.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-03 21:33:04 +00:00
Jonathan Druart
f2c0fe0ca1 Bug 10806: make the staff benchmark script check authentication failure.
Currently, if you launch the script
misc/load_testing/benchmark_staff.pl, it always displays
"Authentication successful" or continue to execute the script even if
nothing is done.

This patch checks if the url is right and if the authentication is
correctly done.

Test plan:
Suppose that a correct login/pwd is koha/koha
1/
perl misc/load_testing/benchmark_staff.pl --steps=1
--url=http://admin.koha.local/cgi-bin/koha/
--password="koha" --user="koha"
should produce:
  Authentication successful
  ...
  Step 1
  ...

2/
perl misc/load_testing/benchmark_staff.pl --steps=1
--url=http://admin.koha.local/cgi-bin/koha/
--password="KOHA" --user="KOHA"
should produce:
Authentication failure: bad login/password

3/
perl misc/load_testing/benchmark_staff.pl --steps=1
--url=http://admin.kobe.local/cgi-bin/koha/
--password="koha" --user="koha"
should produce:
Authentication failure:
    500 Can't connect to admin.kobe.local:80 (Bad
    hostname)

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Works as described, detects bad url and user credentials.
No koha-qa errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described and gives better error messages.
There are some warnings output when running the script before
and after applying the patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-02 15:30:49 +00:00
Meenakshi.R
0005f6bad3 Bug 7639: add option to forgive overdue fines when declaring items lost
This patch adds functionality to forgive overdue fine when an item is
set to lost status.  Fines are forgiven only when the syspref
WhenLostForgiveFine is set to yes. Item can be set to lost status from:

- catalogue/moredetail.pl
- cataloguing/additem.pl
- tools/batchMod.pl
- misc/cronjobs/longoverdue.pl

Changed subroutine C4::Circulation::LostItem to forgive fines on the
item depending on the value of syspref WhenLostForgiveFine. This
routine is currently used to return an item and charge a replacement
cost.

Also added a new syspref in C4::Circulation::LostItem -
WhenLostChargeReplacementFee.  The replacement fee will now be charged
only if this syspref is set to yes.  The default value of the
WhenLostChargeReplacementFee is yes, meaning that current behavior
will not change during upgrade.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Alex Hatley <alexh@cctexas.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch in series.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-17 15:10:46 +00:00
Galen Charlton
fc84903dfb Bug 9372: (follow-up) tidy whitespace in new lines
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-16 18:38:50 +00:00
Sophie Meynieux
6dbfe1512d Bug 9372: replace carriage return with <br /> in printed HTML files for overdues
For PDF generation, HTML files need explicit <br /> HTML tags. With
this patch, carriage return are replaced by <br /> when letters are
written into HTML files.

Test plan :
- Ensure you've got at least one reader with overdue triggering notice
- Ensure that your notice template got HTML checked
- Run misc/cronjobs/overdue_notices.pl -v -n -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of the letter is all on one line in PDF file
With the patch, PDF file is correctly formated

- remove your reader email
- Run misc/cronjobs/overdue_notices.pl -v -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of PDF file is all on one line
with the patch, PDF file is correctly formated.

- restore reader email
- run misc/cronjobs/overdue_notice.pl -v -html <dirname>

Verify that the a message has been generated in message_queue table
With or without patch, the message is the same

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-16 18:37:47 +00:00
Magnus Enger
b54e33c1f6 Bug 10810 - Fix synopsis for -html option to overdue_notices.pl
The synopsis for the -html option used to be:
  -html <filename> Output html to file
but the argument to this option should actually be a directory,
not a filename. This patch fixes the synopsis.

To test:
- Run perldoc misc/cronjobs/overdue_notices.pl
- Check that the synopsis is as shown above
- Apply this patch
- Run perldoc misc/cronjobs/overdue_notices.pl
- Check that
  - the synopsis asks for a directory, not a filename
  - that the description of the -html option further down in the
    perldoc now mentions the filename that the HTML file will be
    created with.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described. No koha-qa errors.

If feeded with a filename -html option fails with many messages like
print() on closed filehandle $html_fh at misc/cronjobs/overdue_notices.pl line 384.
Perhaps it could be improved, but that was the old behavior.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Improves documentation, no negative side effects found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-16 15:40:30 +00:00
Galen Charlton
ad5d9ca169 Bug 10771: remove disused statistical reports cronjobs
This patch removes three cronjobs that are believed to be
unused for the following reasons:

[1] The commit message that introduces them indicates that they
    were written for a particular library.  A staff member from
    that library has confirmed that they are not in use.
[2] The scripts have received essentially no patches since they
    were introduced except for being caught up in a broader
    code-improvement patch.
[3] They refer to a column that no longer exists in biblioitems.
[4] They no longer adhere to guidelines for command-line utilities,
    and there's been no sign that anybody has felt the urge to
    correct that.
[5] They are not referenced by another code or the manual, and
    the mailing list archives do not include any substantive discussion
    of their use.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-06 18:26:35 +00:00
Sophie Meynieux
30b32d9938 Bug 10727: Replace carriage return with <br /> when printing hold notices
This patch replaces carriage return with <br /> in the content of
hold notices for printing. This is necessary to convert html file
into well formatted pdf file.

Test plan :
  - check in an item reserved by a borrower
    that has not activated email notification
  - verify in message_queue table that you've got a
    new HOLD_PRINT notice with status 'pending'
  - run gather_print_notices.pl <directory>

Without the patch, the script generates a html file without <br /> tags.
If you run printoverdues.sh <directory>, the text in the resulting PDF
file is all on one line

With the patch, the script generates a html file with <br/> tags and
the PDF file created by printoverdues.sh is well formatted.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-06 16:52:59 +00:00
Mirko Tietgen
1d5a4a0a81 Bug 10361: Add option to cleanup_database.pl to purge OPAC search history
Add an option to cleanup_database.pl to purge the search_history
entries older than X days.

Test plan:

- Apply patch
- Check that your test DB has some entries a little older than 30 days
  and a few ones even older than that in search_history:

  SELECT * FROM search_history WHERE time < DATE_SUB( NOW(), INTERVAL 30 DAY );

  If not, modify some existing entries.

- Run cleanup_database with a fixed number of days (replace XX with
  something higher than 30)

  /misc/cronjobs/cleanup_database.pl --searchhistory XX

- Check that entries older than XX days got deleted from search_history
- Run without the day parameter
  /misc/cronjobs/cleanup_database.pl --searchhistory
- Check that entries older than 30 days got deleted from search_history

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-04 14:22:50 +00:00
e476378323 Bug 10664 [QA Followup] - fix error in overdue_notices.pl if there is no active currency
Fixes the following koha-qa.pl error:
 FAIL   misc/cronjobs/overdue_notices.pl
    OK     pod
    OK     forbidden patterns
    OK     valid
    FAIL   critic
               # Variables::ProhibitConditionalDeclarations:

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-16 14:39:02 +00:00
Sophie Meynieux
a9a3bb7b3d Bug 10664: fix error in overdue_notices.pl if there is no active currency
If there is no active currency, when running overdue_notices.pl
you get a sofware error "Can't use an undefined value as a HASH
reference" on GetCurrency() function call.

With this patch, if there is no active currency, fines are formated
by default 0.00 and notices are correctly generated.

Test plan :
- have at least one borrower with overdue that should trigger a notice
- verify that there is no active currency (Adminitration > Currency &
  Exchange rates)
- run misc/cronjobs/overdue_notices.pl -v -n (to get the notice directly
  on output)

=> without the patch you get the software error
=> with the patch, notices are correctly generated

If an active currency is defined, the script overdue_notices.pl runs
the same with or without patch

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-16 14:37:47 +00:00
Colin Campbell
40e6f6a8f2 Bug 10712: Save missing config variables to install log
The variables for AUTH_INDEX_MODE and ZEBRA_TOKENIZER were not
being saved to the koha_install_log file.  As a result when using the
--prev-install-log option in Makefile.PL the user was still prompted
to select them.

This patch adds the appropriate variables to the list saved in
the install log.

To test:

On a (non-package) system installed/upgraded without the patch running
'perl Makefile.PL --prev-install-log /path/to/koha-install-log' will
still prompt you to choose authorities indexing mode and select
between chr and icu, after upgrading with this patch applied the same
command should get the responses from the install log and not require
user intervention.

The values can be seen written into misc/koha-install-log

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-13 14:14:30 +00:00
Sophie Meynieux
04e9022e4f Bug 10127 : Printoverdues.sh should tar only pdf files
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

From the bug report:
At the end of printoverdues.sh, an archive is generated
containing all files present in  directory given as parameter.
As archives are generated in this given directory, they
contain previously generated tar files, creating oversized files.
Only .pdf files should be archived

All tests and QA script pass.
Worked ok in my tests, only packign PDF in the given directory.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-16 15:47:13 +00:00
Galen Charlton
93aee04405 bug 9998: (follow-up) use Modern::Perl as per coding guidelines
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-02 07:09:22 -07:00
aa4fde7d0d Bug 9998: new tool to import/export and compare system preferences
This patch adds a new maintenance script: cmp_sysprefs.pl

Test plan:
1 Run with -cmd backup -file zz01. Check that file.
  Run with -cmd test -file zz01. Check zz01.sav.
2 Run with -cmd compare -file zz01. No differences expected.
3 Edit zz01: delete two prefs, change two prefs and add two new prefs.
4 Run with -cmd compare -file zz01. Are all six changes reported?
5 Add local use preference zz02 in the staff client (no explanation, options).
6 Run with -cmd backup -file zz02.
7 Delete local use pref zz02 from the staff client.
8 Run with -cmd restore -file zz02. Check if local pref zz02 came back.
9 Delete local use pref zz02 again from the staff client.
10 Run with -cmd compare -file zz02 -add. Check if local pref zz02 came back.
11 Change the value of zz02 in the staff client.
12 Run with -cmd compare -file zz02 -add. Check the value: not updated?
13 Run with -cmd compare -file zz02 -upd. Check the value: updated now?
14 Edit file zz02. Add a comment line and delete the line for pref zz02.
15 Run with -cmd compare -file zz02 -del. Is pref zz02 deleted?
16 Add local use preference zz02 in the staff client (WITH explanation).
17 Run with -cmd compare -file zz02 -del. pref zz02 should not be deleted.
18 Run with -cmd compare -file zz02 -del -ign-opt. zz02 should be deleted now.

Do the next steps only on a restorable test db:
19 Create file zz03. Leave it empty.
   Compare with: -cmd compare -file zz03 -del -ign-opt.
   All prefs gone except Version?
20 Restore with: -cmd restore -file zz01.sav.
   Compare with -cmd compare -file zz01.sav. Nothing reported?
   Note: The explanation or options are not recovered. (See also BZ 10199.)
   This affects local use preferences only.
   If you need them, restore your test db. Remove the zz files.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Amended patch
Only cosmetic stuff:
Perltidied with xt/perltidyrc.
Replaced most double quotes by single quotes around SQL statements.
Moved the usage into POD for pod2usage.
Passing no file shows help screen too.
Counting the db updates more accurately with return value of do.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-02 07:08:05 -07:00
Frédérick Capovilla
68b8b9d7a8 Bug 8584: cleanup_database.pl : Add a DAYS parameter for email purges.
You can now specify a number of days with the --mail parameter. Only
mails older than the specified number of days will be deleted.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-06-05 07:19:25 -07:00
Janusz Kaczmarek
9d02840967 Bug 10326: bulkmarcimport.pl doesn't restore value of CataloguingLog syspref
To test:

0) Don't apply the patch yet.
1) Have the CataloguingLog system preference set to 'Log'.
2) Import a file of bibliographic records with bulkmarcimport.pl.
3) Check the state of CataloguingLog system preference -- it will be
   set to 'Don't log'.
4) Apply the patch.
5) Repeat steps 1-3.  The CataloguingLog system preference
   will be 'Log'.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-31 07:30:25 -07:00
cd150a23bb Bug 9286 - Add script to add a bib to the zebra queue from the command line
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: No test plan, but works.
Tested adding auth, biblios or both, then rebuilding -z
No errors.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Test Plan

1/ run misc/mod_zebraqueue.pl -a 1
2/ In your koha db
SELECT * FROM zebraqueue WHERE done = 0;
Check that a row for authority record id 1 has been inserted
3/ run misc/mod_zebraqueue.pl -b 1
4/ In your koha db
SELECT * FROM zebraqueue WHERE done = 0;
Check that a row for biblio record id 1 has been inserted
5/ run misc/mod_zebraqueue.pl
Make sure the help is sensible
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-28 08:00:15 -07:00
Jonathan Druart
37234811a5 Bug 9161: Followup: the -f param does not work correctly
Without this patch, the -f param (for the translate script) add the
modified line in the po file BUT comment all lines from others files.

This patch concat the generated file with the previous one and merge
them. This way produce a pretty po file with all our strings :)

+ Modification in LangInstaller.pm to fix a bug when the -f param was not
given.

Test plan:
1/ Update your po file :
cd misc/translator
perl translate update fr-FR
git commit -a -m"TMP PO"
2/ Modification on 2 files:
ie.
catalogue/advsearch.tt:32 <h1>Advanced search Foo</h1>
catalogue/issuehistory.tt:38 <th>Patron Bar</th>

3/ Update your po file with only the first file:
perl translate update fr-FR -f advsearch.tt

4/ Edit your po file and check that only the foo string is present (or
git diff).

5/ Update your po file with only the second file:
perl translate update fr-FR -f issuehistory

6/ Edit your po file and check that 2 strings are present (or git diff).

7/ Change the translation for these 2 strings and delete the fuzzy
lines.

8/ Install the first file for your language:
perl translate install fr-FR -f advsearch.tt

9/ Edit your translated file and verify the string is translated. Check
that the issuehistory.tt file is not changed.

10/ Same for issuehistory:
perl translate install fr-FR -f issuehistory

11/ stash your modification in your tt files (or reset --hard):
git stash

12/ Check in your po file that the 2 strings are commented (git diff).

13/ To finish, install all template files and check that they are
replaced correctly:
perl translate install fr-FR

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

I have squashed the both follow-up patches.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-24 09:08:27 -07:00
Jonathan Druart
6525818076 Bug 9161: Translate only specific files
The previous version of tmpl_process3.pl says in the pod:

  -i, --input=SOURCE          Get or update strings from SOURCE file.
                              SOURCE is a directory if -r is also specified.

But is was not possible to specify one or more files.

This patch allows us to give one or more specific file with the -f
parameter.

for eg.:

perl tmpl_process3.pl install -i /home/koha/koha-tmpl/opac-tmpl/prog/en/modules/
    -o /home/koha/koha-tmpl/opac-tmpl/prog/fr-FR/modules/
    -s /home/koha/misc/translator/po/fr-FR-i-opac-t-prog-v-3006000.po
    -r
    -f opac-account.tt
    -f opac-main.tt

You can specify:
  -f advsearch.tt => translate all files with a filename containing
  'advsearch.tt'
or
  -f search => will translate acqui/histsearch.tt, acqui/z3950_search.tt, etc.

Bug 9161: Followup: Add a -f param for the translate script

Now you can directly call the translate script
(misc/translator/translate) with the -f parameter

eg.:
./translate install|create|update -f search.tt -f main.tt

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

I've squashed the 3 patches, and reported doc into 'translate' script.
It works as advertised.

Side note: It would be great to extend this functionnality in order to
be able to apply the translation to XSL files stored outside Koha
directories hierarchy. Useful to translate site-specific XSLs defined
with XSLTResultsDisplay, and other sysprefs.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-24 09:08:25 -07:00
Jared Camins-Esakov
7233475247 Update release notes for final 3.12.00 release
(cherry picked from commit 3b825dcf38)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-19 17:57:26 -04:00
Jared Camins-Esakov
f04b9ec326 Fix incorrect entities in PO files
There were numerous malformed HTML entities in the PO files for various
languages. No longer.
2013-05-19 08:12:40 -04:00
Jared Camins-Esakov
bacd4e834c Update release notes for Koha 3.12.0 RC3
(cherry picked from commit e8030f7f31)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-18 12:35:58 -04:00
D Ruth Bavousett
7b3652d8cc Translation update for 3.12.0
(cherry picked from commit a7dd685090)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-18 12:35:49 -04:00
Jared Camins-Esakov
6f9b5f3486 Update 3.12 release notes for Koha 3.12.0-rc2
(cherry picked from commit bbc4267296)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-15 22:14:14 -04:00
D Ruth Bavousett
63302e77b8 Language update for 3.12-RC
(cherry picked from commit 8e1e34f2fa)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-15 21:57:53 -04:00
9ce862e451 Bug 10214 Add header to syspref po files
With this patch, header is created when creating a new syspref .po file
for a new language (translate create), and is added if it doesn't
already exist when updating an existing language (translate update).

To test:

(1) Create a new language syspref file:

    ./translate create -p xx-XX

    Check that there is an header

(2) Update an existing syspref file without header:

    ./translate update fr-FR

    Check that fr-FR-pref.po has a header

(3) Update an existing syspref file with header:

    Modify fr-FR-pref.po. Add an email, or whatever.

    ./translate update fr-FR

    Check that fr-FR-pref.po has a header with the manual modification

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Work as described. No errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Also tested that updated pref files can still be installed correctly.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-15 07:22:32 -04:00
2e103a018c Bug 10156 - Fix usr/bin/perl path for get_report_social_data.pl
Currently, the perl path for get_report_social_data.pl is "#!/bin/perl"
when it should be "#!/usr/bin/perl".

While I'm not entirely sure how to test this, rangi did mention:

23:47 (it wouldnt work on my debian install)
23:48  zsh: no such file or directory: /bin/perl

It's a pretty trivial change, so I'm not sure it needs much of a test
plan.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Before the patch "grep -r '#!/bin/perl' in the misc dir shows one file
with this line, and it is indeed get_report_social_data.pl. After the
patch there are no occurrences left.
Passed-QA-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-08 09:52:21 -04:00
Jared Camins-Esakov
4e13ddd4d6 Add release notes for 3.12.0-beta3
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-01 23:07:26 -04:00
Peter Crellan Kelly
571dab9c7c Bug 6506: When AnonymousPatron not set, deletion of issue history silently failed.
Remedied by:
- in Circulation.pm changing AnonymiseIssueHistory so that it returns ($rows, $err_history_not_deleted) instead of $rows
- consequential change to misc/cronjobs/batch_anonymise.pl to handle updated return value, and fail if there is an error
- consequential change to tools/cleanborrowers.pl although this still fails silently (raised as bug 9944)
- update of opac-privacy.pl to check return value and pass on error
- update of opac-privacy.tt to display error if appropriate

Note bug 9942 remains unfixed, which is a similar issue upon issue return.

To test:
1. OPAC
- enable privacy mode (preference OpacPrivacy)
- leave anonymous patron set to zero (preference AnonymousPatron)
- attempt to delete user history
- observe error
- check history - still there
- change anonymous patron to a valid user
- attempt to delete user history
- observe success message
- check history - gone

2. cleanborrowers.pl
- test it functions as before.  bug 9944 has been raised for it continuing to silently fail.

3. batch_anonymise.pl
- enable privacy mode (preference OpacPrivacy)
- leave anonymous patron set to zero (preference AnonymousPatron)
- run script (I use --days -1 for testing)
- script should fail with a Carp message
- change anonymous patron to a valid user
- run script as before
- script returns quietly
- check history - gone

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-01 08:44:11 -04:00
Chris Cormack
3588e2820e Bug 6709 : Patch for testing translating .xml files
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment on second patch.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-01 06:53:38 -04:00
Aaron Wells
109f316efb Bug 9671: Make fines.pl help text more accurate
To test:

run kohaclone/misc/cronjobs/fines.pl --help and note the help text. It should match the settings in System Preferences.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Documentation change, passes all tests.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-26 18:35:40 -04:00
2eefd1f3a5 Bug 8745: General whitespace and tab tidy
http://bugs.koha-community.org/show_bug.cgi?id=8745
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
1) Runs not with root.
2) Runs with root and -run-as-root.
3) Runs using the normal koha user.

Note: Maybe the message should be clear about why
running as root is bad and which user you should
be running the script with?
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-21 09:41:34 -04:00
Barry Cannon
ef86a77801 Bug 8745 - Disallow rebuild_zebra.pl from executing, when run by root user.
Added a check to warn users of execution as root user.
Added a 'runas-root' switch to allow users to force execution as root user.

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-21 09:41:34 -04:00
Julian Maurice
357cf7fdd8 Bug 8746 [Follow-up] Replace == by eq in string comparison
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-21 09:23:23 -04:00
Julian Maurice
a4e8443691 Bug 8746: Fix indexation in DOM index mode
When in DOM index mode, files exported by `rebuild_zebra.pl -x` are
wrapped by '<collection></collection>' tag.
This is a problem because splitting files produces invalid files.
This is fixed by adding the missing <collection> tags in each generated
file.
Another problem was that the wrong zebra configuration file was used.
The script now uses C4::Context->zebraconfig($server)->{config} to know
which configuration file has to be used.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-21 09:23:22 -04:00
Julian Maurice
eef4b3f23c Bug 8746: rebuild_zebra_sliced.sh now export/index records as MARCXML
This avoid indexing failures due to "bad offset" or "bad length" error
with ISO2709 format

+ minor improvements:
  -  --length parameter is optional. If not given, it will execute the
     right sql query to find the number of records to index
  -  new parameter --reset-index. If set, index is reset before indexing

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Work as described. No errors.

Test: Edit record to make it longer than 9999. Without patch rebuild_sliced
fails. With patches works.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-21 09:23:22 -04:00
Katrin Fischer
0454377380 Bug 8200: Follow up - Removing unused file stats.pl
Patch removes misc/translator/stats.pl that is no
longer used and references deleted script
update.pl in same directory.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-07 13:38:06 -04:00