Bugzilla – Attachment 160385 Details for
Bug 35369
SIP default 'Greetings from Koha.' message for patrons should be optional and configurable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35369: SIP default 'Greetings from Koha.' message for patrons should be optional and configurable
Bug-35369-SIP-default-Greetings-from-Koha-message-.patch (text/plain), 6.17 KB, created by
David Nind
on 2023-12-31 22:13:11 UTC
(
hide
)
Description:
Bug 35369: SIP default 'Greetings from Koha.' message for patrons should be optional and configurable
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-12-31 22:13:11 UTC
Size:
6.17 KB
patch
obsolete
>From 3d4383fe9b9d45f3f6368bbdc77a6043f36896a0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 21 Nov 2023 06:54:36 -0500 >Subject: [PATCH] Bug 35369: SIP default 'Greetings from Koha.' message for > patrons should be optional and configurable > >It would be nice to have a syspref / sip configuration option to remove or customize this message without having to use regex on the AF field > >Test Plan: >1) Apply this patch >2) Restart all the things! >3) Make a SIP2 patron info request >4) Note the standard AF field response >5) Set the new syspref SIP2ScreenMessageGreeting to something else >6) Restart all the things again! >7) Make another SIP2 patron info request >8) Note your new AF field greeting message! > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/SIP/ILS/Patron.pm | 2 +- > .../data/mysql/atomicupdate/bug_35369.pl | 17 ++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/circulation.pref | 3 +++ > t/db_dependent/SIP/Patron.t | 20 ++++++++++++++++++- > 5 files changed, 41 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_35369.pl > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 9bcb1c0124..47c48ce46d 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -131,7 +131,7 @@ sub new { > fees => 0, # currently not distinct from fines > recall_overdue => 0, > items_billed => 0, >- screen_msg => 'Greetings from Koha. ' . $kp->{opacnote} . $fines_msg, >+ screen_msg => process_tt( C4::Context->preference('SIP2ScreenMessageGreeting'), { borrower => $patron, sip_borrower => $kp } ) . $kp->{opacnote} . $fines_msg, > print_line => '', > items => [], > hold_items => $flags->{WAITING}->{itemlist}, >diff --git a/installer/data/mysql/atomicupdate/bug_35369.pl b/installer/data/mysql/atomicupdate/bug_35369.pl >new file mode 100755 >index 0000000000..e61afde1d2 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35369.pl >@@ -0,0 +1,17 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "BUG_NUMBER", >+ description => "A single line description", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{ >+ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('SIP2ScreenMessageGreeting','Greetings from Koha. ','','SIP greetings message that will being each SIP AF field','Free') >+ }); >+ >+ say $out "Added new system preference 'SIP2ScreenMessageGreeting'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index b58114d802..7447a20630 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -694,6 +694,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ShowReviewerPhoto','1','','If ON, photo of reviewer will be shown beside comments in OPAC','YesNo'), > ('SIP2SortBinMapping','',NULL,'Use the following mappings to determine the sort_bin of a returned item. The mapping should be on the form \"branchcode:item field:item field value:sort bin number\", with one mapping per line.','free'), > ('SIP2AddOpacMessagesToScreenMessage','1','','If enabled, patron OPAC messages will be included in the SIP2 screen message','YesNo'), >+('SIP2ScreenMessageGreeting','Greetings from Koha. ','','SIP greetings message that will being each SIP AF field','Free'), > ('SkipHoldTrapOnNotForLoanValue','',NULL,'If set, Koha will never trap items for hold with this notforloan value','Integer'), > ('SlipCSS','',NULL,'Slips CSS url.','free'), > ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 40f2d65a81..ae4e342158 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -1391,6 +1391,9 @@ Circulation: > 1: Do > 0: Don't > - send OPAC patron messages in the SIP2 screen message field. >+ - >+ - Begin each SIP screen message with the phrase >+ - pref: SIP2AddOpacMessagesToScreenMessage > > Curbside pickup module: > - >diff --git a/t/db_dependent/SIP/Patron.t b/t/db_dependent/SIP/Patron.t >index 9b6f151644..f69ac148cb 100755 >--- a/t/db_dependent/SIP/Patron.t >+++ b/t/db_dependent/SIP/Patron.t >@@ -4,7 +4,7 @@ > # This needs to be extended! Your help is appreciated.. > > use Modern::Perl; >-use Test::More tests => 10; >+use Test::More tests => 11; > > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -31,6 +31,7 @@ is( defined $sip_patron, 1, "Patron is valid" ); > $schema->resultset('Borrower')->search({ cardnumber => $card })->delete; > my $sip_patron2 = C4::SIP::ILS::Patron->new( $card ); > is( $sip_patron2, undef, "Patron is not valid (anymore)" ); >+t::lib::Mocks::mock_preference( 'SIP2ScreenMessageGreeting', "Greetings from Koha. " ); > > subtest "new tests" => sub { > >@@ -421,3 +422,20 @@ subtest "Patron messages tests" => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest "Test SIP2ScreenMessageGreeting" => sub { >+ plan tests => 2; >+ $schema->storage->txn_begin; >+ my $today = output_pref( { dt => dt_from_string(), dateonly => 1 } ); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { opacnote => q{} } } ); >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ is( $sip_patron->screen_msg, 'Greetings from Koha. ' ); >+ >+ t::lib::Mocks::mock_preference( 'SIP2ScreenMessageGreeting', "Welcome to your local library! " ); >+ $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ is( $sip_patron->screen_msg, 'Welcome to your local library! ' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35369
:
159154
|
160385
|
160386
|
165132
|
180031
|
180128