Bugzilla – Attachment 59638 Details for
Bug 17698
Make patron notes show up on staff dashboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17698: Make patron notes show up on staff dashboard
Bug-17698-Make-patron-notes-show-up-on-staff-dashb.patch (text/plain), 24.57 KB, created by
Aleisha Amohia
on 2017-01-29 21:52:20 UTC
(
hide
)
Description:
Bug 17698: Make patron notes show up on staff dashboard
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-01-29 21:52:20 UTC
Size:
24.57 KB
patch
obsolete
>From e094f508c5dbac93ab391b42901adbc5f1fab524 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 1 Dec 2016 00:54:07 +0000 >Subject: [PATCH] Bug 17698: Make patron notes show up on staff dashboard > >This patch adds a user permission for managing issue notes, and a 'noteseen' >column to the issues table. > >To test: >1) Apply Bug 14224 first, update database, rebuild schema. >2) Apply this patch, update database, rebuild schema. >3) Restart koha-common and memcached >4) Turn on AllowIssueNotes syspref if haven't already >5) Issue two items to two different users (one item each) >6) Log into the OPAC as one of the users and add an issue note to their >issue >7) Log out and log back into the OPAC as the other user >8) Disable Javascript >9) Refresh opac-user.pl >10) Leave an issue note on their issue >11) Enable javascript and log into the Staff Client as a superlibrarian >user >12) Go to your user's account and edit their permissions to have >everything ticked EXCEPT circulate->manage issue notes. >13) Go to main intranet page. There should be no message saying >'checkout notes pending'. >14) Go to circulation home page. There should be no link to Checkout notes. >15) Go back to user's permissions and tick circulate->manage issue >notes. >16) Go back to main intranet page. There should now be a message at the >bottom saying 'Checkout notes pending: 2' >17) Go to circulation home page. There should be a link to Checkout notes >with a 2 next to it. Click this link >18) Attempt to mark an issue note as seen. This should update the status >of the issue note to 'seen' and disable to 'mark as seen' button while >enabling the 'mark as not seen' button. >19) Test both buttons with both issues. >20) Test select all and clear all buttons >21) Confirm that buttons at the bottom are only enabled if a checkbox is >checked >22) Try selecting both issues and using the buttons at the bottom to >mark multiple issue notes at once. >23) Confirm the barcode link to the item works as expected. >24) Confirm the cardnumber link to the user works as expected. >25) Confirm all table details show correctly. > >Sponsored-by: Catalyst IT >--- > Koha/Schema/Result/Issue.pm | 11 +- > checkout_notes/checkout-notes.pl | 71 +++++++++ > circ/circulation-home.pl | 3 + > .../bug-17698_add-noteseen-column-to-issues.sql | 2 + > ...-17698_add-permission-to-manage-issue-notes.sql | 1 + > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/userpermissions.sql | 1 + > .../intranet-tmpl/prog/en/includes/permissions.inc | 1 + > .../en/modules/checkout_notes/checkout-notes.tt | 165 +++++++++++++++++++++ > .../prog/en/modules/circ/circulation-home.tt | 1 + > .../intranet-tmpl/prog/en/modules/intranet-main.tt | 7 + > mainpage.pl | 3 + > opac/opac-issue-note.pl | 2 +- > opac/svc/patron_notes | 2 +- > svc/issue_notes | 62 ++++++++ > 15 files changed, 329 insertions(+), 4 deletions(-) > create mode 100755 checkout_notes/checkout-notes.pl > create mode 100644 installer/data/mysql/atomicupdate/bug-17698_add-noteseen-column-to-issues.sql > create mode 100644 installer/data/mysql/atomicupdate/bug-17698_add-permission-to-manage-issue-notes.sql > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/checkout_notes/checkout-notes.tt > create mode 100755 svc/issue_notes > >diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm >index 43d5c75..eb8b80b 100644 >--- a/Koha/Schema/Result/Issue.pm >+++ b/Koha/Schema/Result/Issue.pm >@@ -112,6 +112,11 @@ __PACKAGE__->table("issues"); > datetime_undef_if_invalid: 1 > is_nullable: 1 > >+=head2 noteseen >+ >+ data_type: 'integer' >+ is_nullable: 1 >+ > =cut > > __PACKAGE__->add_columns( >@@ -170,6 +175,8 @@ __PACKAGE__->add_columns( > datetime_undef_if_invalid => 1, > is_nullable => 1, > }, >+ "noteseen", >+ { data_type => "integer", is_nullable => 1 }, > ); > > =head1 PRIMARY KEY >@@ -241,8 +248,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-01 02:20:55 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:a7FCuypwxtuE6oJjEnRJRg >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-12-12 02:41:09 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZF/YAX9BT1WrgCLUsXSqXQ > > __PACKAGE__->belongs_to( > "borrower", >diff --git a/checkout_notes/checkout-notes.pl b/checkout_notes/checkout-notes.pl >new file mode 100755 >index 0000000..a3ec71b >--- /dev/null >+++ b/checkout_notes/checkout-notes.pl >@@ -0,0 +1,71 @@ >+#!/usr/bin/perl >+ >+# Copyright 2016 Aleisha Amohia <aleisha@catalyst.net.nz> >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use CGI qw ( -utf8 ); >+use C4::Context; >+use C4::Output; >+use C4::Auth; >+use Koha::Checkouts; >+ >+my $query = new CGI; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "checkout_notes/checkout-notes.tt", >+ query => $query, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { circulation => "manage_issue_notes" }, >+ } >+); >+ >+my $schema = Koha::Database->new()->schema(); >+my @notes = $schema->resultset('Issue')->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] }); >+$template->param( >+ notes => \@notes, >+); >+ >+my $action; >+foreach (qw( seen notseen )) { >+ $action = $_ if ( $query->param("mark_selected-$_") ); >+} >+$action ||= 'none'; >+ >+my @issue_ids = $query->multi_param('issue_ids'); >+ >+if ( $action eq 'seen' ) { >+ foreach my $issue_id ( @issue_ids ) { >+ my $issue = Koha::Checkouts->find($issue_id); >+ $issue->set({ noteseen => 1 })->store; >+ } >+} elsif ( $action eq 'notseen' ) { >+ foreach my $issue_id ( @issue_ids ) { >+ my $issue = Koha::Checkouts->find($issue_id); >+ $issue->set({ noteseen => 0 })->store; >+ } >+} >+ >+$template->param( >+ selected_count => scalar(@issue_ids), >+ action => $action, >+); >+ >+output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/circ/circulation-home.pl b/circ/circulation-home.pl >index 4f29f49..399171b 100755 >--- a/circ/circulation-home.pl >+++ b/circ/circulation-home.pl >@@ -22,6 +22,7 @@ use C4::Auth; > use C4::Output; > use C4::Context; > use Koha::BiblioFrameworks; >+use Koha::Checkouts; > > my $query = new CGI; > my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( >@@ -41,5 +42,7 @@ $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ) > $template->param( display_transfer => 1 ) if ( ($flags->{'superlibrarian'} == 1) || (C4::Context->preference("IndependentBranches") == 0) ); > $template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation'); > >+my $pendingissuenotes = Koha::Checkouts->search({ noteseen => 0 })->count; >+$template->param( pendingissuenotes => $pendingissuenotes ); > > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/installer/data/mysql/atomicupdate/bug-17698_add-noteseen-column-to-issues.sql b/installer/data/mysql/atomicupdate/bug-17698_add-noteseen-column-to-issues.sql >new file mode 100644 >index 0000000..6c7ce70 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-17698_add-noteseen-column-to-issues.sql >@@ -0,0 +1,2 @@ >+ALTER IGNORE TABLE issues ADD `noteseen` int(1) default NULL; >+ALTER IGNORE TABLE old_issues ADD `noteseen` int(1) default NULL; >diff --git a/installer/data/mysql/atomicupdate/bug-17698_add-permission-to-manage-issue-notes.sql b/installer/data/mysql/atomicupdate/bug-17698_add-permission-to-manage-issue-notes.sql >new file mode 100644 >index 0000000..8e7272a >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-17698_add-permission-to-manage-issue-notes.sql >@@ -0,0 +1 @@ >+INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'manage_issue_notes', 'Mark issue notes as seen/not seen'); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index d5f3521..ac1e91f 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1778,6 +1778,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r > `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag > `note` mediumtext default NULL, -- issue note text > `notedate` datetime default NULL, -- datetime of issue note (yyyy-mm-dd hh:mm::ss) >+ `noteseen` int(1) default NULL, -- describes whether issue note has been seen 1, not been seen 0 or doesn't exist null > PRIMARY KEY (`issue_id`), > KEY `old_issuesborridx` (`borrowernumber`), > KEY `old_issuesitemidx` (`itemnumber`), >diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql >index 6b72278..9bd2513 100644 >--- a/installer/data/mysql/userpermissions.sql >+++ b/installer/data/mysql/userpermissions.sql >@@ -5,6 +5,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 1, 'force_checkout', 'Force checkout if a limitation exists'), > ( 1, 'manage_restrictions', 'Manage restrictions for accounts'), > ( 1, 'self_checkout', 'Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID'), >+ ( 1, 'manage_issue_notes', 'Mark issue notes as seen/not seen'), > ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), > ( 3, 'manage_circ_rules', 'Manage circulation rules'), > ( 6, 'place_holds', 'Place holds for patrons'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index bcff76b..222656f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -30,6 +30,7 @@ > [%- CASE 'overdues_report' -%]<span>Execute overdue items report</span> > [%- CASE 'override_renewals' -%]<span>Override blocked renewals</span> > [%- CASE 'self_checkout' -%]<span>Perform self checkout at the OPAC. It should be used for the patron matching the AutoSelfCheckID</span> >+ [%- CASE 'manage_issue_notes' -%]<span>Mark issue notes as seen/notseen</span> > [%- CASE 'manage_circ_rules' -%]<span>manage circulation rules</span> > [%- CASE 'parameters_remaining_permissions' -%]<span>Remaining system parameters permissions</span> > [%- CASE 'modify_holds_priority' -%]<span>Modify holds priority</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/checkout_notes/checkout-notes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/checkout_notes/checkout-notes.tt >new file mode 100644 >index 0000000..0c02bd3 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/checkout_notes/checkout-notes.tt >@@ -0,0 +1,165 @@ >+[% USE Koha %] >+[% USE KohaDates %] >+[% USE Branches %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Home › Circulation › Issue Notes</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >+[% INCLUDE 'datatables.inc' %] >+<script type="text/javascript"> >+//<![CDATA[ >+ $(document).ready(function(){ >+ $("#notestable").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ 0, -1 ], "bSearchable": false, "bSortable": false }, >+ ], >+ "sPaginationType": "four_button" >+ })); >+ >+ $(".SelectAll").on("click", function(){ >+ $("input[name='issue_ids'][type='checkbox']").prop("checked", true); >+ $(".btn-sm").prop("disabled", false); >+ }); >+ >+ $(".ClearAll").on("click", function(){ >+ $("input[name='issue_ids'][type='checkbox']").prop("checked", false); >+ $(".btn-sm").prop("disabled", true); >+ }); >+ >+ $("#error").hide(); >+ >+ $("input[type='checkbox']").click(function(event){ >+ if ( $("input[type='checkbox']").is(":checked") ) { >+ $(".btn-sm").prop("disabled", false); >+ } else { >+ $(".btn-sm").prop("disabled", true); >+ } >+ }); >+ >+ $(".btn-xs").click(function(event){ >+ event.preventDefault(); // prevent form submission >+ var $action = $(this).attr("name"); >+ var $issue_id = $(this).data('issue_id'); >+ var ajaxData = { >+ 'action': $action, >+ 'issue_id': $issue_id, >+ }; >+ >+ $.ajax({ >+ url: '/cgi-bin/koha/svc/issue_notes/', >+ type: 'POST', >+ dataType: 'json', >+ data: ajaxData, >+ }) >+ >+ .done(function(data){ >+ if (data.status == 'success'){ >+ if ( $action == 'notseen' ){ >+ $("#status_" + $issue_id).text("Not seen"); >+ $(event.target).siblings(".seen").prop("disabled", false); >+ $(event.target).prop("disabled", true); >+ } else { >+ $("#status_" + $issue_id).text("Seen"); >+ $(event.target).siblings(".notseen").prop("disabled", false); >+ $(event.target).prop("disabled", true); >+ } >+ } else { >+ $("#error").text("Unable to change status of note."); >+ $("#error").show(); >+ } >+ }); >+ }); >+ }); >+//]]> >+</script> >+[% INCLUDE 'calendar.inc' %] >+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >+</head> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'circ-search.inc' %] >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> › >+ <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> › >+ Checkout notes >+</div> >+ >+<div id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2" --> >+ <div id="bd"> >+ <div id="yui-main"> >+ >+ <h1>Checkout notes</h1> >+ >+ <div class="dialog alert" id="error"></div> >+ >+ [% IF ( selected_count ) %] >+ <div class="dialog message"> >+ [% IF ( action == 'seen' ) %] >+ [% selected_count %] note(s) marked as seen. >+ [% ELSIF ( action == 'notseen' ) %] >+ [% selected_count %] note(s) marked as not seen. >+ [% ELSE %] >+ Failed to change the status of [% selected_count %] item(s). >+ [% END %] >+ </div> >+ <a href="/cgi-bin/koha/issue_notes/issue-notes.pl" class="btn btn-small"><i class="fa fa-left"></i> Back to issue notes</a> >+ [% ELSE %] >+ >+ [% IF ( notes ) %] >+ >+ <fieldset class="action"> >+ <a class="SelectAll"><i class="fa fa-check"></i> Select all</a> | <a class="ClearAll"><i class="fa fa-remove"></i> Clear all</a> >+ </fieldset> >+ >+ <form id="mark_selected" method="post" action="/cgi-bin/koha/issue_notes/issue-notes.pl"> >+ >+ <table id="notestable"> >+ <thead> >+ <tr> >+ <th> </th> >+ <th>Title</th> >+ <th>Note</th> >+ <th>Date</th> >+ <th>Set by</th> >+ <th>Status</th> >+ <th>Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH note IN notes %] >+ <tr> >+ <td><input type="checkbox" name="issue_ids" value="[% note.issue_id %]"></td> >+ <td>[% note.item.biblionumber.title %] - [% note.item.biblionumber.author %] (<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% note.item.biblionumber.biblionumber %]">[% note.item.barcode %]</a>)</td> >+ <td>[% note.note %]</td> >+ <td>[% note.notedate | $KohaDates %]</td> >+ <td>[% note.borrower.firstname %] [% note.borrower.surname %] (<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% note.borrower.borrowernumber %]">[% note.borrower.cardnumber %]</a>)</td> >+ <td>[% IF ( note.noteseen == 0 ) %] >+ <span id="status_[% note.issue_id %]">Not seen</span> >+ [% ELSIF ( note.noteseen == 1 ) %] >+ <span id="status_[% note.issue_id %]">Seen</span> >+ [% END %]</td> >+ <td class="actions">[% IF ( note.noteseen == 1 ) %] >+ <button name="seen" data-issue_id="[% note.issue_id %]" class="seen btn btn-default btn-xs" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button> <button name="notseen" data-issue_id="[% note.issue_id %]" class="notseen btn btn-default btn-xs"><i class="fa fa-eye-slash"></i> Mark not seen</button> >+ [% ELSIF ( note.noteseen == 0 ) %] >+ <button name="seen" data-issue_id="[% note.issue_id %]" class="seen btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark seen</button> <button name="notseen" data-issue_id="[% note.issue_id %]" class="notseen btn btn-default btn-xs" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button> >+ [% END %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ >+ <fieldset class="action"> >+ <button type="submit" class="btn btn-default btn-sm" name="mark_selected-seen" value="seen" disabled="disabled"><i class="fa fa-eye"></i> Mark seen</button> >+ <button type="submit" class="btn btn-default btn-sm" name="mark_selected-notseen" value="notseen" disabled="disabled"><i class="fa fa-eye-slash"></i> Mark not seen</button> >+ </fieldset> >+ >+ </form> >+ >+ [% END %] <!-- notes --> >+ >+ [% END %] <!-- selected_count --> >+ >+ </div> <!-- yui-main --> >+ </div> <!-- bd --> >+</div> <!-- doc3 --> >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >index 48f4f8d..d183ed1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >@@ -30,6 +30,7 @@ > <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA">Fast cataloging</a></li> > [% END %] > [% END %] >+ [% IF ( Koha.Preference('AllowIssueNotes') && CAN_user_circulate_manage_issue_notes ) %]<li><a href="/cgi-bin/koha/checkout_notes/checkout-notes.pl">Checkout notes</a> [% IF ( pendingissuenotes ) %]<span class="number_box"><a href="/cgi-bin/koha/checkout_notes/checkout-notes.pl">[% pendingissuenotes %]</a></span>[% END %]</li>[% END %] > </ul> > </div> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index c34c9ce..12980b6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -162,6 +162,13 @@ > </div> > [% END %] > >+ [% IF Koha.Preference('AllowIssueNotes') && CAN_user_circulate_manage_issue_notes && pending_issue_notes %] >+ <div class="pending-info" id="checkout_notes_pending"> >+ <a href="/cgi-bin/koha/checkout_notes/checkout-notes.pl">Checkout notes pending</a>: >+ <span class="pending-number-link">[% pending_issue_notes %]</span> >+ </div> >+ [% END %] >+ > </div> > > [% END %] >diff --git a/mainpage.pl b/mainpage.pl >index 7410247..b65c9dd 100755 >--- a/mainpage.pl >+++ b/mainpage.pl >@@ -31,6 +31,7 @@ use Koha::Patron::Modifications; > use Koha::Patron::Discharge; > use Koha::Reviews; > use Koha::ArticleRequests; >+use Koha::Checkouts; > > my $query = new CGI; > >@@ -74,6 +75,7 @@ my $pending_article_requests = Koha::ArticleRequests->count( > $branch ? ( branchcode => $branch ) : (), > } > ); >+my $pending_issue_notes = Koha::Checkouts->search({ noteseen => 0 })->count; > > $template->param( > pendingcomments => $pendingcomments, >@@ -82,6 +84,7 @@ $template->param( > pending_borrower_modifications => $pending_borrower_modifications, > pending_discharge_requests => $pending_discharge_requests, > pending_article_requests => $pending_article_requests, >+ pending_issue_notes => $pending_issue_notes, > ); > > # >diff --git a/opac/opac-issue-note.pl b/opac/opac-issue-note.pl >index de2d82b..5a195c6 100755 >--- a/opac/opac-issue-note.pl >+++ b/opac/opac-issue-note.pl >@@ -67,7 +67,7 @@ if ( $action eq 'issuenote' && C4::Context->preference('AllowIssueNotes') ) { > my $note = $query->param('note'); > my $scrubber = C4::Scrubber->new(); > my $clean_note = $scrubber->scrub($note); >- if ( $issue->set({ notedate => dt_from_string(), note => $clean_note })->store ) { >+ if ( $issue->set({ notedate => dt_from_string(), note => $clean_note, noteseen => 0 })->store ) { > if ($clean_note) { # only send email if note not empty > my $branch = Koha::Libraries->find( $issue->branchcode ); > my $letter = C4::Letters::GetPreparedLetter ( >diff --git a/opac/svc/patron_notes b/opac/svc/patron_notes >index 5a103d7..ceba389 100755 >--- a/opac/svc/patron_notes >+++ b/opac/svc/patron_notes >@@ -79,7 +79,7 @@ if ($is_ajax) { > $error = "Invalid issue id!"; > } > >- if ( (not $error) && $issue->set({ notedate => dt_from_string(), note => $clean_note })->store ) { >+ if ( (not $error) && $issue->set({ notedate => dt_from_string(), note => $clean_note, noteseen => 0 })->store ) { > if($clean_note) { # only send email if note not empty > my $branch = Koha::Libraries->find( $issue->branchcode ); > my $biblio = GetBiblioFromItemNumber($issue->itemnumber); >diff --git a/svc/issue_notes b/svc/issue_notes >new file mode 100755 >index 0000000..0b1056a >--- /dev/null >+++ b/svc/issue_notes >@@ -0,0 +1,62 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz> >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use CGI; >+use C4::Service; >+use C4::Auth qw /check_cookie_auth/; >+use C4::Output qw(:DEFAULT :ajax); >+use Koha::Checkouts; >+ >+=head1 NAME >+ >+svc/issue_notes - Web service for managing patron notes set on issues >+ >+=head1 DESCRIPTION >+ >+=cut >+ >+# AJAX requests >+my $is_ajax = is_ajax(); >+my $query = new CGI; >+my ( $auth_status, $sessionID ) = check_cookie_auth( $query->cookie('CGISESSID'), {} ); >+if ( $auth_status ne "ok" ) { >+ exit 0; >+} >+if ($is_ajax) { >+ my $issue_id = $query->param('issue_id'); >+ my $issue = Koha::Checkouts->find($issue_id); >+ my $action = $query->param('action'); >+ my $status = 'success'; >+ if ($action eq 'seen'){ >+ $issue->set({ noteseen => 1 })->store; >+ if ( $issue->noteseen != 1 ) { >+ $status = 'failure'; >+ } >+ } elsif ($action eq 'notseen'){ >+ $issue->set({ noteseen => 0 })->store; >+ if ( $issue->noteseen != 0 ) { >+ $status = 'failure'; >+ } >+ } >+ my $response = "{\"status\": \"$status\"}"; >+ output_with_http_headers $query, undef, $response, 'js'; >+ exit; >+} >-- >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 17698
:
57851
|
58779
|
58780
|
58786
|
59480
|
59638
|
59762
|
59778
|
59809
|
59828
|
59829
|
59957
|
61857
|
62337
|
62351
|
64662
|
64683
|
64835
|
71100
|
71126
|
71127
|
72875
|
72876
|
72877
|
73004
|
73005
|
73006
|
73839
|
73840
|
73841
|
74044
|
74193
|
75837
|
75838
|
75839
|
75840
|
75841
|
75842
|
76011
|
76012
|
76028
|
76029
|
76030
|
76031
|
76032
|
76033
|
76034
|
76035
|
76036
|
76037
|
89964
|
90037