Bug 21560: create Koha::Util::OpenDocument with subroutine for ODS generation
authorFridolin Somers <fridolin.somers@biblibre.com>
Mon, 18 Feb 2019 16:33:37 +0000 (17:33 +0100)
committerroot <root@f1ebe1bec408>
Fri, 15 Mar 2019 12:02:46 +0000 (12:02 +0000)
commitffb40290f88380418635a951dbb0788bf7b7e3ce
tree0a8393cb1ab240782afd4db27745174ccc6c8947
parent5d4f80feac811a9d6e177975b50c57ba85e3434d
Bug 21560: create Koha::Util::OpenDocument with subroutine for ODS generation

There is nearly the same code in misc/cronjobs/gather_print_notices.pl and reports/guided_reports.pl.
This patch creates a new module with subroutine called by both scripts.

If file path or content is undefined, subroutine will just return undef.
If content is an empty arrayref, empty ods file is still generated.

Unicode encoding is kept outisde because it may not be necessary.

Note that for print notices the first line of message is always the column names so it is extracted only from first message.

Test plan :
Run previous patches test plans and check ODS files are the same.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Koha/Util/OpenDocument.pm [new file with mode: 0644]
misc/cronjobs/gather_print_notices.pl
reports/guided_reports.pl