From e5d5a30671bab02e54145ef3b10bd217991204bf Mon Sep 17 00:00:00 2001 From: Aleisha Date: Thu, 24 Mar 2016 00:28:42 +0000 Subject: [PATCH] Bug 3669: Moving 'Add a new message' into a pop up box and adding to patron toolbar This patch moves all the code into an include which can be accessed from the 'Add a new message' link or the patron toolbar. EDIT: Ensuring modal opens on all pages EDIT2: Once the form has been submitted the page will redirect to where you submitted the form from. EDIT3: Fixing indentation of member-add-message.inc Ensuring messages save on every page Fill branch Ensure predefined notes appear Form redirects to where it was submitted from, or just the circulation page. EDIT4: Removing the new include file and moving it all into the modal in the toolbar To test: 1) Go to a patron circ page (circ/circulation.pl?borrowernumber=X) 2) Click 'Add a new message' under Messages 3) Confirm this brings up the modal to add a message. Confirm clicking Save saves your message. If it is an OPAC message (for the user), confirm it shows as expected on the OPAC. 4) Click Cancel. Confirm this closes the modal. 5) Click 'Add message' button in toolbar. Complete steps 3 and 4. 6) Confirm the modal opens from all other pages with the members toolbar. Confirm predefined notes shows. circ/circulation.pl members/moremember.pl members/routing-lists.pl members/statistics.pl members/boraccount.pl members/pay.pl members/maninvoice.pl members/mancredit.pl members/readingrec.pl members/notices.pl members/member-flags.pl members/member-password.pl members/paycollect.pl members/files.pl 7) Confirm that the page redirects to where you submitted the form from once you have submitted it. 8) Go to Check Out tab and confirm your message saved (or OPAC, wherever you saved it) Sponsored-by: Catalyst IT --- circ/add_message.pl | 4 +- .../prog/en/includes/.member-add-message.inc.swp | Bin 0 -> 12288 bytes .../prog/en/includes/members-toolbar.inc | 44 ++++++++++++++++++++ .../prog/en/modules/circ/circulation.tt | 39 +---------------- members/boraccount.pl | 8 ++++ members/files.pl | 8 ++++ members/mancredit.pl | 8 ++++ members/maninvoice.pl | 8 ++++ members/member-flags.pl | 8 ++++ members/member-password.pl | 8 ++++ members/moremember.pl | 5 +++ members/notices.pl | 8 ++++ members/pay.pl | 6 +++ members/paycollect.pl | 5 +++ members/readingrec.pl | 7 ++++ members/routing-lists.pl | 4 ++ members/statistics.pl | 8 ++++ 17 files changed, 138 insertions(+), 40 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/.member-add-message.inc.swp diff --git a/circ/add_message.pl b/circ/add_message.pl index 317f34b..aee65a1 100755 --- a/circ/add_message.pl +++ b/circ/add_message.pl @@ -51,5 +51,5 @@ Koha::Patron::Message->new( } )->store; -print $input->redirect( - "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); +my $url = $input->referer() // "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"; +print $input->redirect($url); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/.member-add-message.inc.swp b/koha-tmpl/intranet-tmpl/prog/en/includes/.member-add-message.inc.swp new file mode 100644 index 0000000000000000000000000000000000000000..fd04c90841c21fb730c67ea2f9fa22eb400dec97 GIT binary patch literal 12288 zcmeI2zi$*r6vxNzLgIiD$xWnayvTwmx?2ZFNd)VYY-7up5FkM|1wzN%&bzx+=4Mtq zbH+4K(a=y(Qc%%_ivJ)f@<&8Ul`a(pWu&~>-NU!%^#P@oH`4cZ=f}M_^LcN^vTnL7 zd+i_jx6M_C&VWJ&616S12%=AOh*cz*m1RD-v*oCYiq-+eqTG59l_RaQ3y+nWrlmteu*Z6LM ztzP(Q#kZUdmiVWi>=GU#Km>>Y5g-CYfCvx)B0vQGM+96t#~$E%=gT!OmCw1UXIZ5O z5g-CYfCvx)B0vO)01+SpM1Tko0U~e$2?)v9r4JbU6Xk#ZAOHXV>NI12p?*jGhU%cc zM9rgKf6Un5sAs4w4 zu_vg9s0*ln%K5y+r}6WmLIj8a5g-CYfCvzQlS_bOiNan2N?LF&#(aY>QKHk4(W%E=ZMMBs6z+dQ534A+LE_AIB+5Z!O@Lf3swUj8-*|5th|9% zI_i|SMFXBlM0upO6@_DCRX@?RV+65v^)gPG`6*16`bqi`QD{LyjDemUKly&V)yYwj zNnK)e9{vJkEVKsM!3A}+abP>jn5Ig)9%&1W&ghTA!rIJ9ZD0F&YkhO4)(&r9t!+>1 z;Eb0swS=H`BPYZC>}Ss?Dj1f#!S9eFn8lmHy&-fTsklL6n>~{ao6})#`fUSi`G8{W z_EuggEQ4%o2?w`}VV8n>Fp&~nP#hhgD?f?W^$aBR5{yH>3VYF~s~>dKKwUPqxB2;F zIDRorvOdLTr`Htmji7by`uZksa7>S0l3C}E7j)$7c9fO1x5T2Fh*vO-PV{I>Nw~r63W~z!bA1~8e8lP@&+Rz2V@a^8%;_D-Hk|h@8p3ipcQ>g6P$p3;=nts45 H_ // Search to hold [% END %] + Add message +
+ + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 4727192..531ab1e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -45,7 +45,6 @@ var relatives_borrowernumbers = new Array(); relatives_borrowernumbers.push("[% b %]"); [% END %] -var MSG_ADD_MESSAGE = _("Add a new message"); var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); @@ -159,43 +158,6 @@ $(document).ready(function() { [% END %] - - [% IF ( was_renewed ) %]
Patron's account has been renewed until [% expiry | $KohaDates %]
[% END %] [% IF additional_materials %] @@ -856,6 +818,7 @@ No patron matched [% message %] [% END %] [% END %] + Add a new message diff --git a/members/boraccount.pl b/members/boraccount.pl index 0b64083..5cbc4c3 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -33,6 +33,7 @@ use C4::Branch; use C4::Accounts; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; +use C4::Koha; my $input=new CGI; @@ -105,9 +106,16 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } +my $branch = C4::Context->userenv->{'branch'}; + +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param(%$data); $template->param( + canned_bor_notes_loop => $canned_notes, + branch => $branch, finesview => 1, borrowernumber => $borrowernumber, branchname => GetBranchName($data->{'branchcode'}), diff --git a/members/files.pl b/members/files.pl index 73a486a..b490e71 100755 --- a/members/files.pl +++ b/members/files.pl @@ -28,6 +28,7 @@ use C4::Output; use C4::Members; use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Debug; +use C4::Koha; use Koha::DateUtils; use Koha::Patron::Files; @@ -119,7 +120,14 @@ else { my $patron_image = Koha::Patron::Images->find($data->{borrowernumber}); $template->param( picture => 1 ) if $patron_image; + my $branch = C4::Context->userenv->{'branch'}; + + # get authorised values with type of BOR_NOTES + my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param( + branch => $branch, + canned_bor_notes_loop => $canned_notes, files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(), diff --git a/members/mancredit.pl b/members/mancredit.pl index c48f8cd..1e790f7 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -35,6 +35,7 @@ use C4::Accounts; use C4::Items; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; +use C4::Koha; my $input=new CGI; my $flagsrequired = { borrowers => 1, updatecharges => 1 }; @@ -92,9 +93,16 @@ if ($add){ ); } + my $branch = C4::Context->userenv->{'branch'}; + + # get authorised values with type of BOR_NOTES + my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param(%$data); $template->param( + branch => $branch, + canned_bor_notes_loop => $canned_notes, finesview => 1, borrowernumber => $borrowernumber, categoryname => $data->{'description'}, diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 3558871..96d8cbe 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -34,6 +34,7 @@ use C4::Items; use C4::Branch; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; +use C4::Koha; my $input=new CGI; my $flagsrequired = { borrowers => 1 }; @@ -118,8 +119,15 @@ if ($add){ ); } + my $branch = C4::Context->userenv->{'branch'}; + + # get authorised values with type of BOR_NOTES + my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param(%$data); $template->param( + canned_bor_notes_loop => $canned_notes, + branch => $branch, finesview => 1, borrowernumber => $borrowernumber, categoryname => $data->{'description'}, diff --git a/members/member-flags.pl b/members/member-flags.pl index 5bd2d07..4c9bdd6 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -18,6 +18,7 @@ use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Output; use Koha::Patron::Images; +use C4::Koha; my $input = new CGI; @@ -169,7 +170,14 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } +my $branch = C4::Context->userenv->{'branch'}; + +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param( + branch => $branch, + canned_bor_notes_loop => $canned_notes, borrowernumber => $bor->{'borrowernumber'}, cardnumber => $bor->{'cardnumber'}, surname => $bor->{'surname'}, diff --git a/members/member-password.pl b/members/member-password.pl index 85e4b97..f144e38 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -17,6 +17,7 @@ use C4::Circulation; use CGI qw ( -utf8 ); use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; +use C4::Koha; use Digest::MD5 qw(md5_base64); @@ -112,7 +113,14 @@ if ( C4::Context->preference('ExtendedPatronAttributes') ) { ); } +my $branch = C4::Context->userenv->{'branch'}; + +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param( + branch => $branch, + canned_bor_notes_loop => $canned_notes, othernames => $bor->{'othernames'}, surname => $bor->{'surname'}, firstname => $bor->{'firstname'}, diff --git a/members/moremember.pl b/members/moremember.pl index 7c962a4..207199c 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -317,9 +317,14 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification")); } +# get authorised values with type of BOR_NOTES + +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + # in template => instutitional (A for Adult, C for children) $template->param( $data->{'categorycode'} => 1 ); $template->param( + canned_bor_notes_loop => $canned_notes, detailview => 1, borrowernumber => $borrowernumber, othernames => $data->{'othernames'}, diff --git a/members/notices.pl b/members/notices.pl index 2668e1f..1f18724 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -29,6 +29,7 @@ use C4::Branch; use C4::Letters; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; +use C4::Koha; my $input=new CGI; @@ -73,9 +74,16 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } +my $branch = C4::Context->userenv->{'branch'}; + +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param(%$borrower); $template->param( + canned_bor_notes_loop => $canned_notes, + branch => $branch, QUEUED_MESSAGES => $queued_messages, borrowernumber => $borrowernumber, sentnotices => 1, diff --git a/members/pay.pl b/members/pay.pl index 8267f7c..6ff9ef2 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -103,7 +103,13 @@ for (@names) { } } +# get authorised values with type of BOR_NOTES + +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param( + branch => $branch, + canned_bor_notes_loop => $canned_notes, finesview => 1, activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), diff --git a/members/paycollect.pl b/members/paycollect.pl index e9de655..ee9fc21 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -143,9 +143,14 @@ if ( $total_paid and $total_paid ne '0.00' ) { borrower_add_additional_fields($borrower, $template); +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param(%$borrower); $template->param( + canned_bor_notes_loop => $canned_notes, + branch => $branch, borrowernumber => $borrowernumber, # some templates require global borrower => $borrower, total => $total_due, diff --git a/members/readingrec.pl b/members/readingrec.pl index 79351ff..c7f025c 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -33,6 +33,7 @@ use List::MoreUtils qw/any uniq/; use Koha::DateUtils; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patron::Images; +use C4::Koha; my $input = CGI->new; @@ -119,11 +120,17 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } +my $branch = C4::Context->userenv->{'branch'}; + +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); $template->param(%$data); $template->param( + canned_bor_notes_loop => $canned_notes, readingrecordview => 1, + branch => $branch, borrowernumber => $borrowernumber, privacy => $data->{'privacy'}, categoryname => $data->{description}, diff --git a/members/routing-lists.pl b/members/routing-lists.pl index 1925880..a047690 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -29,6 +29,7 @@ use C4::Context; use C4::Serials; use Koha::Patron::Images; use CGI::Session; +use C4::Koha; my $query = new CGI; @@ -101,10 +102,13 @@ if ($borrowernumber) { ################################################################################## +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); $template->param(%$borrower); $template->param( + canned_bor_notes_loop => $canned_notes, findborrower => $findborrower, borrower => $borrower, borrowernumber => $borrowernumber, diff --git a/members/statistics.pl b/members/statistics.pl index 07406fd..0cfd09d 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -33,6 +33,7 @@ use C4::Members::Statistics; use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Output; use Koha::Patron::Images; +use C4::Koha; my $input = new CGI; @@ -97,9 +98,16 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber}); $template->param( picture => 1 ) if $patron_image; +my $branch = C4::Context->userenv->{'branch'}; + +# get authorised values with type of BOR_NOTES +my $canned_notes = GetAuthorisedValues("BOR_NOTES"); + $template->param(%$borrower); $template->param( + canned_bor_notes_loop => $canned_notes, + branch => $branch, statisticsview => 1, datas => $datas, column_names => \@statistic_column_names, -- 1.7.10.4