Bugzilla – Attachment 131015 Details for
Bug 27123
Add messages to batch patrons modification
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27123: Add messages to batch patrons modification
Bug-27123-Add-messages-to-batch-patrons-modificati.patch (text/plain), 9.44 KB, created by
Jérémy Breuillard
on 2022-02-22 14:38:38 UTC
(
hide
)
Description:
Bug 27123: Add messages to batch patrons modification
Filename:
MIME Type:
Creator:
Jérémy Breuillard
Created:
2022-02-22 14:38:38 UTC
Size:
9.44 KB
patch
obsolete
>From 882dfab9ec35304fa90db1d3322eb0d9b5107124 Mon Sep 17 00:00:00 2001 >From: jeremy breuillard <jeremy.breuillard@biblibre.com> >Date: Tue, 22 Feb 2022 14:03:08 +0100 >Subject: [PATCH] Bug 27123: Add messages to batch patrons modification > >With this patch you can write or delete circulation messages on the batch patrons modification form > >Test plan: >1)Go to Home > Tools > Batch patron modification >2)Write one or more card numbers to access the modification form >3)Notice the input you can interact with >4)Apply patch and repeat 1) & 2) >5)Notice the new input 'Message:' which appeared down the form >6)Write a message and choose a type (opac or intranet) >7)Save & notice the new 'Message' column filled up with what you wrote before >8)To delete: back on the modification form - check the checkbox beside the input - save again >--- > .../prog/en/modules/tools/modborrowers.tt | 22 ++++++++ > tools/modborrowers.pl | 50 ++++++++++++++++++- > 2 files changed, 71 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >index f60a917a9b..9af64ec41f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -223,6 +223,7 @@ > <th>Expiry date</th> > <th>Circulation note</th> > <th>OPAC note</th> >+ <th>Message</th> > <th>Restriction expiration</th> > <th>Restriction comment</th> > [% FOREACH attrh IN attributes_header %] >@@ -259,6 +260,18 @@ > <td data-order="[% borrower.dateexpiry | html %]">[% borrower.dateexpiry | $KohaDates %]</td> > <td>[% borrower.borrowernotes | html %]</td> > <td>[% borrower.opacnote | html %]</td> >+ <td> >+ [% FOREACH patron_message IN borrower.patron_messages %] >+ [% patron_message.message %] <br> >+ <strong> >+ [% IF (patron_message.message_type == 'B') %] >+ ( OPAC ) >+ [% ELSE %] >+ ( Staff ) >+ [% END %] >+ </strong><br><br> >+ [% END %] >+ </td> > <td data-order="[% borrower.debarred | html %]">[% borrower.debarred | $KohaDates %]</td> > <td>[% borrower.debarredcomment | html %]</td> > [% FOREACH pa IN borrower.patron_attributes %] >@@ -330,6 +343,8 @@ > Circulation note: > [% CASE 'opacnote' %] > OPAC note: >+ [% CASE "message" %] >+ Message: > [% CASE 'debarred' %] > Restriction expiration: > [% CASE 'debarredcomment' %] >@@ -339,6 +354,13 @@ > [% IF ( field.type == 'text' ) %] > <input type="text" name="[% field.name | html %]" value="" /> > [% END %] >+ [% IF ( field.type == 'message_type' ) %] >+ <input type="text" name="[% field.name | html %]" value="" /> >+ <select name="add_message_type" id="message_type"> >+ <option value="L">Staff - Internal note</option> >+ <option value="B">OPAC</option> >+ </select> >+ [% END %] > [% IF ( field.type == 'select' ) %] > [% IF field.option.size %] > <select name="[% field.name | html %]" > >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index 769c9a4738..ee3d17b8e4 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -31,12 +31,14 @@ use C4::Auth qw( get_template_and_user ); > use C4::Koha qw( GetAuthorisedValues ); > use C4::Members; > use C4::Output qw( output_html_with_http_headers ); >+use C4::Context; > use Koha::DateUtils qw( dt_from_string ); > use Koha::List::Patron qw( GetPatronLists ); > use Koha::Libraries; > use Koha::Patron::Categories; > use Koha::Patron::Debarments qw( AddDebarment DelDebarment GetDebarments ); > use Koha::Patrons; >+use Koha::Patron::Messages; > > my $input = CGI->new; > my $op = $input->param('op') || 'show_form'; >@@ -107,6 +109,12 @@ if ( $op eq 'show' ) { > if ( $logged_in_user->can_see_patron_infos( $patron ) ) { > my $borrower = $patron->unblessed; > my $attributes = $patron->extended_attributes; >+ my $patron_messages = Koha::Patron::Messages->search( >+ { >+ 'me.borrowernumber' => $patron->borrowernumber, >+ } >+ ); >+ $borrower->{patron_messages} = $patron_messages->as_list; > $borrower->{patron_attributes} = $attributes->as_list; > $borrower->{patron_attributes_count} = $attributes->count; > $max_nb_attr = $borrower->{patron_attributes_count} if $borrower->{patron_attributes_count} > $max_nb_attr; >@@ -315,6 +323,12 @@ if ( $op eq 'show' ) { > mandatory => ( grep /opacnote/, @mandatoryFields ) ? 1 : 0, > } > , >+ { >+ name => "message", >+ type => "message_type", >+ mandatory => ( grep /message/, @mandatoryFields ) ? 1 : 0, >+ } >+ , > { > name => "debarred", > type => "date", >@@ -378,7 +392,11 @@ if ( $op eq 'do' ) { > } > }; > } >- >+ # If 'message' or 'add_message_type' is defined then delete both at the same time >+ if ( grep { $_ eq 'message' } @disabled) { >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ $patron->messages()->delete(); >+ } > $infos->{borrowernumber} = $borrowernumber; > eval { Koha::Patrons->find( $borrowernumber )->set($infos)->store; }; > if ( $@ ) { # FIXME We could provide better error handling here >@@ -417,6 +435,30 @@ if ( $op eq 'do' ) { > } > $i++; > } >+ # Créer un bloc pour enregistrer en bdd l'update de la table patron_messages + sécurité : 'si' tel champ est remplit alors.... etc >+ my $patron_messages = Koha::Patron::Messages->search( >+ { >+ 'me.borrowernumber' => $patron->borrowernumber, >+ } >+ ); >+ if ( defined $patron_messages ) { >+ if ( defined $infos ) { >+ my $message = $input->param('message'); >+ my $borrowernumber = $patron->borrowernumber; >+ my $branchcode = C4::Context::mybranch; >+ my $message_type = $input->param('add_message_type'); >+ >+ Koha::Patron::Message->new( >+ { >+ borrowernumber => $borrowernumber, >+ branchcode => $branchcode, >+ message_type => $message_type, >+ message => $message, >+ } >+ )->store; >+ $template->param( message_type => $message_type ); >+ } >+ } > } > $op = "show_results"; # We have process modifications, the user want to view its > >@@ -428,6 +470,12 @@ if ( $op eq 'do' ) { > if ( $patron ) { > my $category_description = $patron->category->description; > my $borrower = $patron->unblessed; >+ my $patron_messages = Koha::Patron::Messages->search( >+ { >+ 'me.borrowernumber' => $patron->borrowernumber, >+ } >+ ); >+ $borrower->{patron_messages} = $patron_messages->as_list; > $borrower->{category_description} = $category_description; > my $attributes = $patron->extended_attributes; > $borrower->{patron_attributes} = $attributes->as_list; >-- >2.17.1
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 27123
:
131015
|
131042
|
132923
|
132924
|
132925
|
132926
|
132927
|
134065
|
172012
|
172013
|
172053
|
172086
|
172087
|
172120
|
172121
|
172122