Bugzilla – Attachment 69442 Details for
Bug 18595
Move C4::Members::Messaging to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18595: Move C4::Members::Messaging::GetMessagingOptions
Bug-18595-Move-C4MembersMessagingGetMessagingOptio.patch (text/plain), 7.49 KB, created by
Lari Taskula
on 2017-12-01 16:19:23 UTC
(
hide
)
Description:
Bug 18595: Move C4::Members::Messaging::GetMessagingOptions
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-12-01 16:19:23 UTC
Size:
7.49 KB
patch
obsolete
>From b06fec6caf038dfc35ed469989540e6141e7852f Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Thu, 27 Oct 2016 13:58:22 +0300 >Subject: [PATCH] Bug 18595: Move C4::Members::Messaging::GetMessagingOptions >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch moves C4::Members::GetMessagingOptions to >Koha::Patron::Message::Preferences->get_options. > >The patch makes a heavy touch on core messaging preference features, >but should not introduce any visible changes for end user. Keep this in mind >if testing. If you notice any changes in Koha, something is probably wrong! > >This patch also removes previously unused GetMessagingOptions in opac-messaging.pl > >To test: > >Make sure you have enabled the following system preferences: >- opacuserlogin >- EnhancedMessagingPreferences >- EnhancedMessagingPreferencesOPAC > >---- GENERAL ---- >1. Apply patch >2. Search Koha source code for references of "GetMessagingOptions" > (grep -r 'GetMessagingOptions'). >3. Observe no results in source code. > >---- OPAC ---- >1. Login to OPAC. >2. Go to "your messaging" (cgi-bin/koha/opac-messaging.pl). >3. Observe the preferences looking normal and as they should be. >4. Set any combination of messaging preferences. >5. Observe them apply as expected, repeat step 4-5 as much as you like. > >---- INTRANET ---- >1. Login to intranet. >2. Go to edit patron's details and scroll down to their messaging preferences. >3. Observe the preferences looking normal and as they should be. >4. Set any combination of messaging preferences. >5. Observe them apply as expected, repeat step 4-5 as much as you like. >6. Go to Administration -> Patron categories -> Edit (for any category) >7. Scroll down to observe default messaging preferences for this patron category >8. Observe the preferences looking normal and as they should be. >9. Set any combination of messaging preferences. >10. Observe them apply as expected, repeat step 9-10 as much as you like. >11. Go to cgi-bin/koha/members/memberentry.pl?op=add&categorycode=XXX, replace XXX > with the categorycode you were just editing. >12. Fill in required data, do not modify messaging preferences, click Save. >13. Observe a new patron with default messaging preferences. > >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Form/MessagingPreferences.pm | 5 +++-- > C4/Members/Messaging.pm | 40 +--------------------------------------- > Koha/Patron/Category.pm | 3 ++- > opac/opac-messaging.pl | 1 - > 4 files changed, 6 insertions(+), 43 deletions(-) > >diff --git a/C4/Form/MessagingPreferences.pm b/C4/Form/MessagingPreferences.pm >index b98015f..4b171f5 100644 >--- a/C4/Form/MessagingPreferences.pm >+++ b/C4/Form/MessagingPreferences.pm >@@ -24,6 +24,7 @@ use CGI qw ( -utf8 ); > use C4::Context; > use C4::Members::Messaging; > use C4::Debug; >+use Koha::Patron::Message::Preferences; > > use constant MAX_DAYS_IN_ADVANCE => 30; > >@@ -73,7 +74,7 @@ adds a settings_updated template variable. > > sub handle_form_action { > my ($query, $target_params, $template, $insert, $categorycode) = @_; >- my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); >+ my $messaging_options = Koha::Patron::Message::Preferences->get_options; > # TODO: If a "NONE" box and another are checked somehow (javascript failed), we should pay attention to the "NONE" box > my $prefs_set = 0; > OPTION: foreach my $option ( @$messaging_options ) { >@@ -128,7 +129,7 @@ C<$template> is the Template::Toolkit object for the response. > sub set_form_values { > my ($target_params, $template) = @_; > # walk through the options and update them with these borrower_preferences >- my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); >+ my $messaging_options = Koha::Patron::Message::Preferences->get_options; > PREF: foreach my $option ( @$messaging_options ) { > my $pref = C4::Members::Messaging::GetMessagingPreferences( { %{ $target_params }, message_name => $option->{'message_name'} } ); > $option->{ $option->{'message_name'} } = 1; >diff --git a/C4/Members/Messaging.pm b/C4/Members/Messaging.pm >index 2270c37..09d4d43 100644 >--- a/C4/Members/Messaging.pm >+++ b/C4/Members/Messaging.pm >@@ -21,8 +21,6 @@ use strict; > use warnings; > use C4::Context; > >- >- > =head1 NAME > > C4::Members::Messaging - manage patron messaging preferences >@@ -184,42 +182,6 @@ END_SQL > return; > } > >-=head2 GetMessagingOptions >- >- my $messaging_options = C4::Members::Messaging::GetMessagingOptions() >- >-returns a hashref of messaging options available. >- >-=cut >- >-sub GetMessagingOptions { >- >- my $sql = <<'END_SQL'; >-select message_attributes.message_attribute_id, takes_days, message_name, message_transport_type, is_digest >- FROM message_attributes >- LEFT JOIN message_transports >- ON message_attributes.message_attribute_id = message_transports.message_attribute_id >-END_SQL >- >- my $sth = C4::Context->dbh->prepare($sql); >- $sth->execute(); >- my $choices; >- while ( my $row = $sth->fetchrow_hashref() ) { >- $choices->{ $row->{'message_name'} }->{'message_attribute_id'} = $row->{'message_attribute_id'}; >- $choices->{ $row->{'message_name'} }->{'message_name'} = $row->{'message_name'}; >- $choices->{ $row->{'message_name'} }->{'takes_days'} = $row->{'takes_days'}; >- $choices->{ $row->{'message_name'} }->{'has_digest'} = 1 if $row->{'is_digest'}; >- $choices->{ $row->{'message_name'} }->{'transport_' . $row->{'message_transport_type'}} = ' '; >- } >- >- my @return = values %$choices; >- >- @return = sort { $a->{message_attribute_id} <=> $b->{message_attribute_id} } @return; >- >- # warn( Data::Dumper->Dump( [ \@return ], [ 'return' ] ) ); >- return \@return; >-} >- > =head2 SetMessagingPreferencesFromDefaults > > C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $borrower->{'borrowernumber'} >@@ -240,7 +202,7 @@ sub SetMessagingPreferencesFromDefaults { > } > } > >- my $messaging_options = GetMessagingOptions(); >+ my $messaging_options = Koha::Patron::Message::Preferences->get_options; > OPTION: foreach my $option ( @$messaging_options ) { > my $default_pref = GetMessagingPreferences( { categorycode => $params->{categorycode}, > message_name => $option->{'message_name'} } ); >diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm >index c96764b..7632593 100644 >--- a/Koha/Patron/Category.pm >+++ b/Koha/Patron/Category.pm >@@ -23,6 +23,7 @@ use C4::Members::Messaging; > > use Koha::Database; > use Koha::DateUtils; >+use Koha::Patron::Message::Preferences; > > use base qw(Koha::Object); > >@@ -79,7 +80,7 @@ my $messaging = $category->default_messaging(); > > sub default_messaging { > my ( $self ) = @_; >- my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); >+ my $messaging_options = Koha::Patron::Message::Preferences->get_options; > my @messaging; > foreach my $option (@$messaging_options) { > my $pref = C4::Members::Messaging::GetMessagingPreferences( >diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl >index 906d56f..a110e1c 100755 >--- a/opac/opac-messaging.pl >+++ b/opac/opac-messaging.pl >@@ -51,7 +51,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > ); > > my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; >-my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); > > if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) { > my $sms = $query->param('SMSnumber'); >-- >2.7.4
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 18595
:
63435
|
63436
|
63437
|
63438
|
63439
|
63440
|
63441
|
63794
|
63795
|
63796
|
63797
|
63798
|
63799
|
63800
|
63813
|
63815
|
63816
|
63817
|
63818
|
63819
|
63820
|
63821
|
63822
|
63823
|
63824
|
63825
|
63826
|
63827
|
63828
|
63829
|
69441
|
69442
|
69443
|
69444
|
69445
|
69446
|
69447
|
69448
|
69449
|
69450
|
69451
|
69452
|
69453
|
69667
|
69668
|
69669
|
69670
|
69671
|
69672
|
69673
|
69674
|
93873
|
93874
|
93875
|
93876
|
93877
|
93878
|
93879
|
93880
|
93908
|
94753
|
94754
|
103444
|
103445
|
103446
|
103447
|
103448
|
103449
|
103450
|
103451
|
103452
|
110151
|
110152
|
110153
|
110154
|
110155
|
110156
|
110157
|
110158
|
110159
|
112147
|
112148
|
112149
|
112150
|
112151
|
112152
|
112153
|
112154
|
112155
|
112690
|
113126
|
113192
|
113221
|
113222
|
113769
|
146541
|
146542
|
146543
|
146544
|
146545
|
146546
|
146547
|
146548
|
146549
|
146550
|
146551
|
146552