Bugzilla – Attachment 57851 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]
[NOT READY FOR TESTING] Bug 17698: Make patron notes show up on staff dashboard
NOT-READY-FOR-TESTING-Bug-17698-Make-patron-notes-.patch (text/plain), 11.38 KB, created by
Aleisha Amohia
on 2016-12-01 00:55:36 UTC
(
hide
)
Description:
[NOT READY FOR TESTING] Bug 17698: Make patron notes show up on staff dashboard
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2016-12-01 00:55:36 UTC
Size:
11.38 KB
patch
obsolete
>From e51344d4bbe5af468820f421fc24e146ba1593df Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 1 Dec 2016 00:54:07 +0000 >Subject: [PATCH] [NOT READY FOR TESTING] Bug 17698: Make patron notes show up > on staff dashboard > >Test plan will come when patch is complete > >Sponsored-by: Catalyst IT >--- > Koha/Issue.pm | 2 +- > .../bug-17698_add-noteseen-column-to-issues.sql | 1 + > installer/data/mysql/kohastructure.sql | 1 + > issue_notes/issue-notes.pl | 113 +++++++++++++++++++++ > .../prog/en/modules/circ/circulation-home.tt | 1 + > .../intranet-tmpl/prog/en/modules/intranet-main.tt | 7 ++ > .../prog/en/modules/issue_notes/issue-notes.tt | 57 +++++++++++ > mainpage.pl | 3 + > 8 files changed, 184 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug-17698_add-noteseen-column-to-issues.sql > create mode 100644 issue_notes/issue-notes.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/issue_notes/issue-notes.tt > >diff --git a/Koha/Issue.pm b/Koha/Issue.pm >index dee0381..990a953 100644 >--- a/Koha/Issue.pm >+++ b/Koha/Issue.pm >@@ -108,7 +108,7 @@ sub SetIssueNote { > return; > } > >- my $query = "UPDATE issues SET notedate=NOW(),note=? WHERE issue_id=?"; >+ my $query = "UPDATE issues SET notedate=NOW(),note=?,noteseen=0 WHERE issue_id=?"; > my $sth = $dbh->prepare($query); > return $sth->execute( $note, $issue_id ); > } >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..004acd1 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-17698_add-noteseen-column-to-issues.sql >@@ -0,0 +1 @@ >+ALTER IGNORE TABLE issues ADD `noteseen` int(1) default NULL; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index a8ef821..99c085f 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -861,6 +861,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues > `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 `issuesborridx` (`borrowernumber`), > KEY `itemnumber_idx` (`itemnumber`), >diff --git a/issue_notes/issue-notes.pl b/issue_notes/issue-notes.pl >new file mode 100644 >index 0000000..a0b6927 >--- /dev/null >+++ b/issue_notes/issue-notes.pl >@@ -0,0 +1,113 @@ >+#!/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 strict; >+use warnings; >+ >+use CGI qw ( -utf8 ); >+use CGI::Cookie; # need to check cookies before having CGI parse the POST request >+use C4::Koha; >+use C4::Context; >+use C4::Biblio; >+use C4::Output qw(:DEFAULT :ajax); >+use C4::Auth; >+ >+sub ajax_auth_cgi { # returns CGI object >+ my $needed_flags = shift; >+ my %cookies = fetch CGI::Cookie; >+ my $input = CGI->new; >+ my $sessid = $cookies{'CGISESSID'}->value; >+ my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags); >+ if ($auth_status ne "ok") { >+ output_with_http_headers $input, undef, >+ "window.alert('Your CGI session cookie ($sessid) is not current. " . >+ "Please refresh the page and try again.');\n", 'js'; >+ exit 0; >+ } >+ return $input; >+} >+ >+if (is_ajax()) { >+ my $input = &ajax_auth_cgi({}) || CGI->new(); >+ my ($note, $js_reply); >+ if ($note = $input->param('seen')) { >+ $js_reply = ( markseen($note) ? 'success' : 'failure') . "_seen('$note');\n"; >+ } >+ output_with_http_headers $input, undef, $js_reply, 'js'; >+ exit; >+} >+ >+my $query = new CGI; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "issue_notes/issue-notes.tt", >+ query => $query, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { circulation => 1 }, >+ debug => 1, >+ } >+); >+ >+my @notes = get_notes(); >+my $pending_notes = Koha::Issues->search({ noteseen => 0 }); >+#my $borrower = C4::Members::GetMember( borrowernumber => $notes->{'borrowernumber'} ); >+#my $itemnumber = $notes->{'itemnumber'}; >+#my $biblio = GetBiblioFromItemNumber($itemnumber); >+$template->param( >+ notes => @notes, >+ pending => $pending_notes, >+# title => $biblio->{'title'}, >+# issuenote => $notes->{'note'}, >+# barcode => $biblio->{'barcode'}, >+# borrower => $borrower, >+# date => $notes->{'notedate'}, >+); >+ >+ >+sub get_notes { >+ my $dbh = C4::Context->dbh; >+ my $q = "SELECT issues.borrowernumber AS borrowernumber, >+ issues.itemnumber AS itemnumber, >+ issues.note AS note, >+ issues.notedate AS notedate, >+ issues.noteseen AS noteseen, >+ borrowers.firstname AS firstname, >+ borrowers.surname AS surname, >+ items.barcode AS barcode, >+ biblio.title AS title, >+ biblio.author AS author >+ FROM issues >+ JOIN borrowers >+ ON issues.borrowernumber = borrowers.borrowernumber >+ JOIN items >+ ON issues.itemnumber = items.itemnumber >+ JOIN biblio >+ ON items.biblionumber = biblio.biblionumber >+ WHERE issues.note IS NOT NULL"; >+ my $sth = $dbh->prepare($q); >+ $sth->execute(); >+ return $sth->fetchall_arrayref({}); >+} >+ >+ >+output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >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..d700ba0 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 %] >+ <li><a href="/cgi-bin/koha/issue_notes/issue-notes.pl">Issue notes</a></li> > </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 060ba39..b288d41 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -172,6 +172,13 @@ var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This > </div> > [% END %] > >+ [% IF Koha.Preference('AllowIssueNotes') && pending_issue_notes %] >+ <div class="pending-info" id="issue_notes_pending"> >+ <a href="/cgi-bin/koha/issue_notes/issue-notes.pl">Issue notes pending</a>: >+ <span class="pending-number-link">[% pending_issue_notes %]</span> >+ </div> >+ [% END %] >+ > </div> > > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/issue_notes/issue-notes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/issue_notes/issue-notes.tt >new file mode 100644 >index 0000000..29cbf02 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/issue_notes/issue-notes.tt >@@ -0,0 +1,57 @@ >+[% USE Koha %] >+[% USE KohaDates %] >+[% USE Branches %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Home › Circulation › Issue Notes › Review Issue Notes</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >+[% INCLUDE 'datatables.inc' %] >+[% 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> › >+ <a href="/cgi-bin/koha/issue_notes/issue-notes.pl">Issue notes</a> › Issue notes management >+</div> >+ >+<div id="doc3" class="yui-t7"> <!-- <div id="doc3" class="yui-t2" --> >+ <div id="bd"> >+ <div id="yui-main"> >+ >+ <h1>Issue notes</h1> >+ >+ [% IF ( notes ) %] >+ <table id="notestable"> >+ <thead> >+ <tr> >+ <th>Note</th> >+ <th>Title</th> >+ <th>Barcode</th> >+ <th>Date</th> >+ <th>Set by</th> >+ <th>Seen</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH note in notes %] >+ <tr> >+ <td>[% note.note %]</td> >+ <td>[% note.title %]</td> >+ <td>[% note.barcode %]</td> >+ <td>[% note.date %]</td> >+ <td>[% note.firstname %] [% note.surname %] ([% note.borrowernumber %])</td> >+ <td>[% IF ( pending ) %]<button class="btn btn-mini">Not seen</button>[% ELSE %]<button class="btn btn-mini">Seen</button>[% END %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] >+ >+ </div> <!-- yui-main --> >+ </div> <!-- bd --> >+</div> <!-- doc3 --> >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/mainpage.pl b/mainpage.pl >index 7410247..b94d9b4 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::Issues; > > my $query = new CGI; > >@@ -74,6 +75,7 @@ my $pending_article_requests = Koha::ArticleRequests->count( > $branch ? ( branchcode => $branch ) : (), > } > ); >+my $pending_issue_notes = Koha::Issues->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, > ); > > # >-- >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