Bugzilla – Attachment 48011 Details for
Bug 15632
Move the messages related code to Koha::Patron::Messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15632: Koha::Patron::Messages - Remove AddMessage
Bug-15632-KohaPatronMessages---Remove-AddMessage.patch (text/plain), 3.23 KB, created by
Kyle M Hall (khall)
on 2016-02-12 19:05:19 UTC
(
hide
)
Description:
Bug 15632: Koha::Patron::Messages - Remove AddMessage
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-02-12 19:05:19 UTC
Size:
3.23 KB
patch
obsolete
>From 79b38c412db2ea883a7fdf4293b37a428f5a315e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Jan 2016 17:56:58 +0000 >Subject: [PATCH] Bug 15632: Koha::Patron::Messages - Remove AddMessage >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The AddMessage subroutine just >1. checked if all the parameters were passed >2. inserted the message in the DB >3. logged the action if needed > >These 3 jobs are now done by the overloaded store method of >Koha::Patron::Message. > >Test plan: >1/ Go on the "check out" page of a patron >2/ Add different new messages > >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Members.pm | 29 ----------------------------- > circ/add_message.pl | 20 ++++++++++---------- > 2 files changed, 10 insertions(+), 39 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 4ba1f19..57e37ba 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -99,7 +99,6 @@ BEGIN { > &GetExpiryDate > &GetUpcomingMembershipExpires > >- &AddMessage > &DeleteMessage > &GetMessages > &GetMessagesCount >@@ -2191,34 +2190,6 @@ sub ModPrivacy { > privacy => $privacy ); > } > >-=head2 AddMessage >- >- AddMessage( $borrowernumber, $message_type, $message, $branchcode ); >- >-Adds a message to the messages table for the given borrower. >- >-Returns: >- True on success >- False on failure >- >-=cut >- >-sub AddMessage { >- my ( $borrowernumber, $message_type, $message, $branchcode ) = @_; >- >- my $dbh = C4::Context->dbh; >- >- if ( ! ( $borrowernumber && $message_type && $message && $branchcode ) ) { >- return; >- } >- >- my $query = "INSERT INTO messages ( borrowernumber, branchcode, message_type, message ) VALUES ( ?, ?, ?, ? )"; >- my $sth = $dbh->prepare($query); >- $sth->execute( $borrowernumber, $branchcode, $message_type, $message ); >- logaction("MEMBERS", "ADDCIRCMESSAGE", $borrowernumber, $message) if C4::Context->preference("BorrowersLog"); >- return 1; >-} >- > =head2 GetMessages > > GetMessages( $borrowernumber, $type ); >diff --git a/circ/add_message.pl b/circ/add_message.pl >index 912314a..e0ffc40 100755 >--- a/circ/add_message.pl >+++ b/circ/add_message.pl >@@ -17,20 +17,13 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > >-use C4::Context; > use C4::Auth; > use C4::Output; >-use C4::Members; >-use C4::Accounts; >-use C4::Stats; >-use C4::Koha; >-use C4::Overdues; >-use C4::Branch; # GetBranches >+use Koha::Patron::Message; > > my $input = new CGI; > >@@ -49,7 +42,14 @@ my $branchcode = $input->param('branchcode'); > my $message_type = $input->param('message_type'); > my $borrower_message = $input->param('borrower_message'); > >-AddMessage( $borrowernumber, $message_type, $borrower_message, $branchcode ); >+Koha::Patron::Message->new( >+ { >+ borrowernumber => $borrowernumber, >+ branchcode => $branchcode, >+ message_type => $message_type, >+ message => $borrower_message, >+ } >+); > > print $input->redirect( > "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); >-- >2.1.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 15632
:
47091
|
47092
|
47093
|
47094
|
47095
|
47096
|
47097
|
47515
|
47516
|
47525
|
47571
|
47572
|
47573
|
47574
|
47575
|
47580
|
47581
|
47582
|
47583
|
47584
|
47585
|
47586
|
47587
|
48004
|
48009
|
48010
| 48011 |
48012
|
48013
|
48014
|
48015
|
48016
|
48017
|
48018
|
48020
|
48422
|
48423
|
48424
|
48425
|
48426
|
48427
|
48591
|
48592
|
48593