Bug 15857

Summary: Add test mode to process_message_queue.pl
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: NoticesAssignee: Kyle M Hall (khall) <kyle>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: mtompset, srdjan, veron
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 15857 - Add test mode to process_message_queue.pl
Bug 15857 - Add test mode to process_message_queue.pl

Description Kyle M Hall (khall) 2016-02-18 18:35:35 UTC
It would be nice for testing and migration purposes if we could run process_message_queue.pl but have the emails go to a testing address instead of the patron's email address, and have SMS messages go to a testing phone number instead of the patron's sms number.
Comment 1 Kyle M Hall (khall) 2016-02-18 18:53:43 UTC Comment hidden (obsolete)
Comment 2 Marc VĂ©ron 2016-02-22 10:21:47 UTC
With patch applied, I get (with and without test mode):

"state" variable @_ masks earlier declaration in same scope at /usr/share/kohaclone/C4/Letters.pm line 1282.
"my" variable $message masks earlier declaration in same scope at /usr/share/kohaclone/C4/Letters.pm line 1298.
syntax error at /usr/share/kohaclone/C4/Letters.pm line 1237, near ")

    if"
syntax error at /usr/share/kohaclone/C4/Letters.pm line 1246, near "}"
Global symbol "$message" requires explicit package name at /usr/share/kohaclone/C4/Letters.pm line 1250.
syntax error at /usr/share/kohaclone/C4/Letters.pm line 1256, near "}"
Can't use global @_ in "my" at /usr/share/kohaclone/C4/Letters.pm line 1261, near "= @_"
syntax error at /usr/share/kohaclone/C4/Letters.pm line 1279, near "}"
  (Might be a runaway multi-line << string starting on line 1265)
Can't use global @_ in "my" at /usr/share/kohaclone/C4/Letters.pm line 1282, near "= @_"
syntax error at /usr/share/kohaclone/C4/Letters.pm line 1295, near "}"
syntax error at /usr/share/kohaclone/C4/Letters.pm line 1344, near "}"
Can't use global @_ in "my" at /usr/share/kohaclone/C4/Letters.pm line 1347, near "= @_"
/usr/share/kohaclone/C4/Letters.pm has too many errors.
Compilation failed in require at misc/cronjobs/process_message_queue.pl line 28.
BEGIN failed--compilation aborted at misc/cronjobs/process_message_queue.pl line 28.
Comment 3 Mark Tompsett 2016-02-23 00:37:09 UTC
Could you hashref that huge parameter list while you are at it?
Comment 4 Kyle M Hall (khall) 2016-03-14 16:13:41 UTC
Created attachment 49114 [details] [review]
Bug 15857 - Add test mode to process_message_queue.pl

It would be nice for testing and migration purposes if we could run
process_message_queue.pl but have the emails go to a testing address
instead of the patron's email address, and have SMS messages go to a
testing phone number instead of the patron's sms number.

Test Plan:
1) Apply this patch
2) Add some stuff to the message queue however you wish
3) Run process_message_queue.pl with the addition parameters
   --test --test-email your@email.com
4) Note that you recieve those emails, and not the address listed
   in the message_queue table!
5) Bonus points: If you have an SMS service, repeat the test with
   SMS notices and --test-sms
Comment 5 Kyle M Hall (khall) 2016-03-14 16:14:21 UTC
(In reply to M. Tompsett from comment #3)
> Could you hashref that huge parameter list while you are at it?

Fixed! Could you specify which sub's parameter list you are referring to?
Comment 6 Srdjan Jankovic 2016-06-07 04:48:01 UTC
_send_message_by_email( $message, $params ) and _send_message_by_sms( $message, $params ) rather than exploding individual params.
Comment 7 Owen Leonard 2017-04-10 16:51:36 UTC
Kyle does Srdjan's comment require a follow-up, or is this still 'Needs Signoff?'
Comment 8 Katrin Fischer 2020-01-08 23:37:45 UTC
I believe that bug 8000 added the test mode intended here.

*** This bug has been marked as a duplicate of bug 8000 ***