Bug 24591

Summary: Add developer script to preview a letter
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: NoticesAssignee: Julian Maurice <julian.maurice>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, bgkriegel, jonathan.druart, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.03
Circulation function:
Attachments: Bug 24591: Add developer script to preview a letter
Bug 24591: Add developer script to preview a letter
Bug 24591: Add developer script to preview a letter
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl
Bug 24591: Add developer script to preview a letter
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl
Bug 24591: Add developer script to preview a letter
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl

Description Julian Maurice 2020-02-05 11:27:06 UTC
I just a wrote a tiny script to help me preview a letter content. I'm not sure if it should go in Koha sources but I don't know where to put it and I think it may help other people
Comment 1 Julian Maurice 2020-02-05 11:27:44 UTC
Created attachment 98448 [details] [review]
Bug 24591: Add developer script to preview a letter

The script is very simple, it just calls GetPreparedLetter with
arguments given on command line and print the resulting letter content

Usage example:

misc/devel/get-prepared-letter.pl --module circulation \
    --letter_code ODUE --tables '{"borrowers":1,"branches":"CPL"}' \
    --repeat '{"item":[{"biblio":1,"items":1}]}' \
    --loops '{"overdues":[1]}'
Comment 2 Bernardo Gonzalez Kriegel 2020-03-22 17:54:12 UTC
Hi, could you add a copyright message?
Comment 3 Julian Maurice 2020-03-22 18:21:20 UTC
Created attachment 101389 [details] [review]
Bug 24591: Add developer script to preview a letter

The script is very simple, it just calls GetPreparedLetter with
arguments given on command line and print the resulting letter content

Usage example:

misc/devel/get-prepared-letter.pl --module circulation \
    --letter_code ODUE --tables '{"borrowers":1,"branches":"CPL"}' \
    --repeat '{"item":[{"biblio":1,"items":1}]}' \
    --loops '{"overdues":[1]}'
Comment 4 Julian Maurice 2020-03-22 18:21:44 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #2)
> Hi, could you add a copyright message?

Done ;)
Comment 5 Bernardo Gonzalez Kriegel 2020-03-22 18:55:32 UTC
Created attachment 101390 [details] [review]
Bug 24591: Add developer script to preview a letter

The script is very simple, it just calls GetPreparedLetter with
arguments given on command line and print the resulting letter content

Usage example:

misc/devel/get-prepared-letter.pl --module circulation \
    --letter_code ODUE --tables '{"borrowers":1,"branches":"CPL"}' \
    --repeat '{"item":[{"biblio":1,"items":1}]}' \
    --loops '{"overdues":[1]}'

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works for the example and other cases.
Correct option is 'letter-code', with dash, not underscore.
An usage message would be nice.
No errors
Comment 6 Jonathan Druart 2020-03-24 09:51:03 UTC
Julian, please add usage (Pod::Usage) and perltidy the script.
Comment 7 Julian Maurice 2020-04-10 09:24:09 UTC
Created attachment 102685 [details] [review]
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl

Also fix code style with perltidy
Comment 8 Nick Clemens (kidclamp) 2020-08-07 00:50:35 UTC
Created attachment 107935 [details] [review]
Bug 24591: Add developer script to preview a letter

The script is very simple, it just calls GetPreparedLetter with
arguments given on command line and print the resulting letter content

Usage example:

misc/devel/get-prepared-letter.pl --module circulation \
    --letter_code ODUE --tables '{"borrowers":1,"branches":"CPL"}' \
    --repeat '{"item":[{"biblio":1,"items":1}]}' \
    --loops '{"overdues":[1]}'

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works for the example and other cases.
Correct option is 'letter-code', with dash, not underscore.
An usage message would be nice.
No errors

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Nick Clemens (kidclamp) 2020-08-07 00:50:38 UTC
Created attachment 107936 [details] [review]
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl

Also fix code style with perltidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Jonathan Druart 2020-08-07 08:23:27 UTC
Created attachment 107942 [details] [review]
Bug 24591: Add developer script to preview a letter

The script is very simple, it just calls GetPreparedLetter with
arguments given on command line and print the resulting letter content

Usage example:

misc/devel/get-prepared-letter.pl --module circulation \
    --letter_code ODUE --tables '{"borrowers":1,"branches":"CPL"}' \
    --repeat '{"item":[{"biblio":1,"items":1}]}' \
    --loops '{"overdues":[1]}'

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works for the example and other cases.
Correct option is 'letter-code', with dash, not underscore.
An usage message would be nice.
No errors

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

JD amended patch: tidy the new file and rename it matching the other
scripts' names in this directory
Comment 11 Jonathan Druart 2020-08-07 08:23:41 UTC
Created attachment 107943 [details] [review]
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl

Also fix code style with perltidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Jonathan Druart 2020-08-07 14:55:48 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 13 Lucas Gass (lukeg) 2020-08-14 22:49:37 UTC
small and very. useful enhancement, choosing to backport

backported to 20.05.x for 20.05.03
Comment 14 Aleisha Amohia 2020-08-16 23:32:11 UTC
enhancement, not backported to 19.11.x