Bug 20816

Summary: Add ability to send custom field(s) containing patron information in SIP patron responses
Product: Koha Reporter: Kyle M Hall <kyle>
Component: SIP2Assignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, andrewfh, bouzid.fergani, colin.campbell, george, jesse, lucas, martin.renvoize
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.05.00, 19.11.06
Attachments: Bug 20816: Add ability to define custom templated fields in SIP patron responses
Bug 20816: Add ability to define custom templated fields in SIP patron responses
Bug 20816: Make SIP tests pass under ES
Bug 20816: Add ability to define custom templated fields in SIP patron responses
Bug 20816: Make SIP tests pass under ES
Bug 20816: Make SIP tests pass under ES
Bug 20816: Add ability to define custom templated fields in SIP patron responses
Bug 20816: Make SIP tests pass under ES
Bug 20816: Add ability to define custom templated fields in SIP patron responses
Bug 20816: Make SIP tests pass under ES
Bug 20816: [19.11.x] Add ability to define custom templated fields in SIP patron responses

Description Kyle M Hall 2018-05-24 17:16:21 UTC
add a user's expiration date to the SIP2 message in its own field, at least Patron Information Response (64), and probably the Patron Status Response (24)
Comment 1 Nick Clemens 2019-06-19 18:06:54 UTC Comment hidden (obsolete)
Comment 2 Jesse Maseto 2019-10-02 14:21:19 UTC Comment hidden (obsolete)
Comment 3 Nick Clemens 2019-10-02 14:54:29 UTC Comment hidden (obsolete)
Comment 4 Nick Clemens 2019-10-02 14:54:37 UTC Comment hidden (obsolete)
Comment 5 Nick Clemens 2020-01-04 16:01:24 UTC
Created attachment 96811 [details] [review]
Bug 20816: Add ability to define custom templated fields in SIP patron responses

To test:
 1 - You will need to enable SIP on your testing instance
    cp etc/SIPconfig.xml /etc/koha/sites/kohadev/
    sudo koha-start-sip
    add a user listed in the SIPconfig to your system and give them permissions (superlibrarian works)
    on koha-testing-docker you should be able to start sip with user koha/koha without any adjustments
 2 - If you copied the above file you should be set to get custom field DE with dateexpiry
     Otherwise edit the sip login for the user to have a custom section like:
		  <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" >
			  <custom_patron_field field="DE" template="[% patron.dateexpiry %]" />
		  </login>
 3 - send a status test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_status_request
 4 - send an information test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_information
 5 - confirm you receive the DE field with a dateexpiry
 6 - Add your own custom fields and confirm it works with several
         <custom_patron_field field="EW" template="Phone: [% patron.phone %] Email: [% patron.email %]" />
 7 - prove -v t/db_dependent/SIP/Patron.t
 8 - prove -v t/db_dependent/SIP/
Comment 6 Nick Clemens 2020-01-04 16:01:27 UTC
Created attachment 96812 [details] [review]
Bug 20816: Make SIP tests pass under ES
Comment 7 Andrew Fuerste-Henry 2020-04-06 14:10:47 UTC
The ES patch no longer applies.
Comment 8 Nick Clemens 2020-04-06 14:30:41 UTC
Created attachment 102447 [details] [review]
Bug 20816: Make SIP tests pass under ES
Comment 9 Andrew Fuerste-Henry 2020-04-06 21:32:53 UTC
Created attachment 102469 [details] [review]
Bug 20816: Add ability to define custom templated fields in SIP patron responses

To test:
 1 - You will need to enable SIP on your testing instance
    cp etc/SIPconfig.xml /etc/koha/sites/kohadev/
    sudo koha-start-sip
    add a user listed in the SIPconfig to your system and give them permissions (superlibrarian works)
    on koha-testing-docker you should be able to start sip with user koha/koha without any adjustments
 2 - If you copied the above file you should be set to get custom field DE with dateexpiry
     Otherwise edit the sip login for the user to have a custom section like:
		  <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" >
			  <custom_patron_field field="DE" template="[% patron.dateexpiry %]" />
		  </login>
 3 - send a status test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_status_request
 4 - send an information test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_information
 5 - confirm you receive the DE field with a dateexpiry
 6 - Add your own custom fields and confirm it works with several
         <custom_patron_field field="EW" template="Phone: [% patron.phone %] Email: [% patron.email %]" />
 7 - prove -v t/db_dependent/SIP/Patron.t
 8 - prove -v t/db_dependent/SIP/

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 10 Andrew Fuerste-Henry 2020-04-06 21:32:57 UTC
Created attachment 102470 [details] [review]
Bug 20816: Make SIP tests pass under ES

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 11 Martin Renvoize 2020-04-21 15:20:40 UTC
Created attachment 103385 [details] [review]
Bug 20816: Add ability to define custom templated fields in SIP patron responses

To test:
 1 - You will need to enable SIP on your testing instance
    cp etc/SIPconfig.xml /etc/koha/sites/kohadev/
    sudo koha-start-sip
    add a user listed in the SIPconfig to your system and give them permissions (superlibrarian works)
    on koha-testing-docker you should be able to start sip with user koha/koha without any adjustments
 2 - If you copied the above file you should be set to get custom field DE with dateexpiry
     Otherwise edit the sip login for the user to have a custom section like:
		  <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" >
			  <custom_patron_field field="DE" template="[% patron.dateexpiry %]" />
		  </login>
 3 - send a status test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_status_request
 4 - send an information test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_information
 5 - confirm you receive the DE field with a dateexpiry
 6 - Add your own custom fields and confirm it works with several
         <custom_patron_field field="EW" template="Phone: [% patron.phone %] Email: [% patron.email %]" />
 7 - prove -v t/db_dependent/SIP/Patron.t
 8 - prove -v t/db_dependent/SIP/

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2020-04-21 15:20:44 UTC
Created attachment 103386 [details] [review]
Bug 20816: Make SIP tests pass under ES

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize 2020-04-21 15:22:46 UTC
Works well and code makes sense.  Tests pass, though the QA script spits out a random POD error.. manually checking the POD it looks OK to me.

Passing QA.

I like that we're generalised the TT parsing into a ->format method, though it may be nice to have abstracted that a level higher somehow as it's almost exactly repeated in SIP/ILS/Item at least... one for another day however.
Comment 14 Martin Renvoize 2020-04-22 12:44:43 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 15 Joy Nelson 2020-05-08 19:41:17 UTC
tests don't apply to 19.11.x  please rebase if needed in 19.11
Comment 16 Nick Clemens 2020-05-08 21:52:03 UTC
Created attachment 104622 [details] [review]
Bug 20816: [19.11.x] Add ability to define custom templated fields in SIP patron responses

To test:
 1 - You will need to enable SIP on your testing instance
    cp etc/SIPconfig.xml /etc/koha/sites/kohadev/
    sudo koha-start-sip
    add a user listed in the SIPconfig to your system and give them permissions (superlibrarian works)
    on koha-testing-docker you should be able to start sip with user koha/koha without any adjustments
 2 - If you copied the above file you should be set to get custom field DE with dateexpiry
     Otherwise edit the sip login for the user to have a custom section like:
		  <login id="koha"   password="koha"  delimiter="|" error-detect="enabled" institution="kohalibrary" encoding="utf8" >
			  <custom_patron_field field="DE" template="[% patron.dateexpiry %]" />
		  </login>
 3 - send a status test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_status_request
 4 - send an information test using the sip cli tester:
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l kohalibrary --patron 23529001000463 -m patron_information
 5 - confirm you receive the DE field with a dateexpiry
 6 - Add your own custom fields and confirm it works with several
         <custom_patron_field field="EW" template="Phone: [% patron.phone %] Email: [% patron.email %]" />
 7 - prove -v t/db_dependent/SIP/Patron.t
 8 - prove -v t/db_dependent/SIP/

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 20816: Make SIP tests pass under ES

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 17 Joy Nelson 2020-05-11 19:28:48 UTC
Thanks for the rebase!  Backported to 19.11.x for 19.11.06
Comment 18 Lucas Gass 2020-05-15 18:16:49 UTC
enhancement will not be backported to 19.05.x