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 2) Apply this patch, update database, rebuild schema. 3) Restart koha-common and memcached 4) Turn on AllowCheckoutNotes 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 a checkout 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 checkout 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 checkout 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 checkout note as seen. This should update the status of the checkout 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 Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Followed test plan, works as expected Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Amended patch: Remove self-checkout permissions Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
98 lines
3.2 KiB
Perl
Executable file
98 lines
3.2 KiB
Perl
Executable file
#!/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::Koha;
|
|
use C4::Context;
|
|
use C4::Scrubber;
|
|
use C4::Output;
|
|
use C4::Auth;
|
|
use C4::Biblio;
|
|
use C4::Letters;
|
|
use Koha::Checkouts;
|
|
use Koha::DateUtils;
|
|
use Koha::Patrons;
|
|
|
|
my $query = new CGI;
|
|
|
|
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
|
{
|
|
template_name => "opac-issue-note.tt",
|
|
query => $query,
|
|
type => "opac",
|
|
authnotrequired => 0,
|
|
debug => 1,
|
|
}
|
|
);
|
|
|
|
my $patron = Koha::Patrons->find( $borrowernumber );
|
|
$template->param(
|
|
firstname => $patron->firstname,
|
|
surname => $patron->surname,
|
|
borrowernumber => $borrowernumber,
|
|
);
|
|
|
|
my $issue_id = $query->param('issue_id');
|
|
my $issue = Koha::Checkouts->find( $issue_id );
|
|
my $itemnumber = $issue->itemnumber;
|
|
my $biblio = $issue->item->biblio;
|
|
$template->param(
|
|
issue_id => $issue_id,
|
|
title => $biblio->title,
|
|
author => $biblio->author,
|
|
note => $issue->note,
|
|
itemnumber => $issue->itemnumber,
|
|
);
|
|
|
|
my $action = $query->param('action') || "";
|
|
if ( $action eq 'issuenote' && C4::Context->preference('AllowCheckoutNotes') ) {
|
|
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, 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 (
|
|
module => 'circulation',
|
|
letter_code => 'CHECKOUT_NOTE',
|
|
branchcode => $branch,
|
|
tables => {
|
|
'biblio' => $biblio->biblionumber,
|
|
'borrowers' => $borrowernumber,
|
|
},
|
|
);
|
|
|
|
my $to_address = $branch->branchemail || $branch->branchreplyto || C4::Context->ReplytoDefault || C4::Context->preference('KohaAdminEmailAddress');
|
|
my $from_address = $patron->email || $patron->emailpro || $patron->B_email;
|
|
|
|
C4::Letters::EnqueueLetter({
|
|
letter => $letter,
|
|
message_transport_type => 'email',
|
|
borrowernumber => $patron->borrowernumber,
|
|
to_address => $to_address,
|
|
from_address => $from_address,
|
|
});
|
|
}
|
|
}
|
|
print $query->redirect("/cgi-bin/koha/opac-user.pl");
|
|
}
|
|
|
|
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
|