Bugzilla – Attachment 67185 Details for
Bug 18760
Printable checkin alerts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18760 - Add item printable checkin alert field
Bug-18760---Add-item-printable-checkin-alert-field.patch (text/plain), 14.87 KB, created by
Alex Arnaud
on 2017-09-18 15:32:13 UTC
(
hide
)
Description:
Bug 18760 - Add item printable checkin alert field
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2017-09-18 15:32:13 UTC
Size:
14.87 KB
patch
obsolete
>From 7be9005fc416d3d30400e5e37905ce5624facde7 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Tue, 13 Jun 2017 12:26:45 +0000 >Subject: [PATCH] Bug 18760 - Add item printable checkin alert field > >Test plan: > - Apply this patch(es), > - update databases, > - launch misc/devel/update_dbix_class_files.pl, > - edit an item to have html or text content in chekin_alert (may > need > a koha to marc mapping for gui edition), > - check out this item, > - check it in: you should get a modal showing the alert, > - check that you can print the alert. > >Test plan #1: > - Create a koha to marc mapping for the column checkin alert, > - import an item with a checkin alert message, > - check that the mapping is done >--- > C4/Circulation.pm | 4 ++ > C4/Items.pm | 5 ++- > circ/print-alert.pl | 51 ++++++++++++++++++++++ > circ/returns.pl | 19 ++++++++ > .../bug_18760-add-items-checkin-alert-column.sql | 2 + > .../marc21/mandatory/marc21_framework_DEFAULT.sql | 1 + > .../mandatory/unimarc_framework_DEFAULT.sql | 1 + > installer/data/mysql/kohastructure.sql | 2 + > .../prog/en/modules/circ/printalert.tt | 19 ++++++++ > .../intranet-tmpl/prog/en/modules/circ/returns.tt | 44 +++++++++++++++++++ > 10 files changed, 147 insertions(+), 1 deletion(-) > create mode 100755 circ/print-alert.pl > create mode 100644 installer/data/mysql/atomicupdate/bug_18760-add-items-checkin-alert-column.sql > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/printalert.tt > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index abb4c50..871d53d 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2099,6 +2099,10 @@ sub AddReturn { > } > } > >+ if ( $item->{checkin_alert} ) { >+ $messages->{checkin_alert} = $item->{checkin_alert}; >+ } >+ > return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} )); > } > >diff --git a/C4/Items.pm b/C4/Items.pm >index 0b6a77e..e3b577a 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -478,6 +478,7 @@ sub _build_default_values_for_mod_marc { > stocknumber => undef, > uri => undef, > withdrawn => 0, >+ checkin_alert => undef, > }; > my %default_values_for_mod_from_marc; > while ( my ( $field, $default_value ) = each %$default_values ) { >@@ -1784,7 +1785,8 @@ sub _koha_new_item { > more_subfields_xml = ?, > copynumber = ?, > stocknumber = ?, >- new_status = ? >+ new_status = ?, >+ checkin_alert = ? > "; > my $sth = $dbh->prepare($query); > my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); >@@ -1829,6 +1831,7 @@ sub _koha_new_item { > $item->{'copynumber'}, > $item->{'stocknumber'}, > $item->{'new_status'}, >+ $item->{'checkin_alert'}, > ); > > my $itemnumber; >diff --git a/circ/print-alert.pl b/circ/print-alert.pl >new file mode 100755 >index 0000000..e763a95 >--- /dev/null >+++ b/circ/print-alert.pl >@@ -0,0 +1,51 @@ >+#!/usr/bin/perl >+ >+ >+# Copyright 2017 Biblibre >+# >+# 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 C4::Context; >+use C4::Output; >+use CGI qw ( -utf8 ); >+use C4::Auth qw/:DEFAULT get_session/; >+use C4::Items qw/GetItem/; >+ >+use vars qw($debug); >+ >+BEGIN { >+ $debug = $ENV{DEBUG} || 0; >+} >+ >+my $input = new CGI; >+my $itemnumber = $input->param('itemnumber'); >+my $item = GetItem( $itemnumber ); >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "circ/printalert.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { circulate => "circulate_remaining_permissions" }, >+ debug => $debug, >+ } >+); >+ >+$template->param( alert => $item->{checkin_alert} ) if ($item->{checkin_alert}); >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/circ/returns.pl b/circ/returns.pl >index c42e750..2c5ba2c 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -198,6 +198,14 @@ my $messages; > my $issue; > my $itemnumber; > my $barcode = $query->param('barcode'); >+ >+if ( $query->param('print_alert') ) { >+ $template->param( >+ print_alert => 1, >+ itemnumber => $query->param('itemnumber') >+ ); >+} >+ > my $exemptfine = $query->param('exemptfine'); > if ( > $exemptfine && >@@ -486,6 +494,15 @@ if ( $messages->{'ResFound'}) { > } # else { ; } # error? > } > >+if ( $messages->{checkin_alert} ) { >+ $template->param( >+ found => 1, >+ checkin_alert => 1, >+ checkin_alert_message => $messages->{checkin_alert}, >+ itemnumber => $itemnumber >+ ); >+} >+ > # Error Messages > my @errmsgloop; > foreach my $code ( keys %$messages ) { >@@ -556,6 +573,8 @@ foreach my $code ( keys %$messages ) { > elsif ( $code eq 'DataCorrupted' ) { > $err{data_corrupted} = 1; > } >+ elsif ( $code eq 'checkin_alert' ) { >+ } > else { > die "Unknown error code $code"; # note we need all the (empty) elsif's above, or we die. > # This forces the issue of staying in sync w/ Circulation.pm >diff --git a/installer/data/mysql/atomicupdate/bug_18760-add-items-checkin-alert-column.sql b/installer/data/mysql/atomicupdate/bug_18760-add-items-checkin-alert-column.sql >new file mode 100644 >index 0000000..05d1dbb >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_18760-add-items-checkin-alert-column.sql >@@ -0,0 +1,2 @@ >+ALTER TABLE items ADD checkin_alert longtext DEFAULT NULL AFTER new_status; >+ALTER TABLE deleteditems ADD checkin_alert longtext DEFAULT NULL AFTER new_status; >\ No newline at end of file >diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql >index 6834df9..60c2d47 100644 >--- a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql >+++ b/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql >@@ -107,6 +107,7 @@ INSERT IGNORE INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblib > ('952', 'h', 'Serial Enumeration / chronology', 'Serial Enumeration / chronology', 0, 0, 'items.enumchron', 10, '', '', '', 0, 0, '', '', '', NULL), > ('952', 'i', 'Inventory number', 'Inventory number', 0, 0, 'items.stocknumber', 10, '', '', '', 0, 0, '', '', '', NULL), > ('952', 'j', 'Shelving control number', 'Shelving control number', 0, 0, 'items.stack', 10, 'STACK', '', '', NULL, -1, '', '', '', NULL), >+ ('952', 'k', 'Checkin alert', '', 0, 0, 'items.checkin_alert', 10, '', '', '', NULL, -1, '', '', '', NULL), > ('952', 'l', 'Total Checkouts', 'Total Checkouts', 0, 0, 'items.issues', 10, '', '', '', NULL, -5, '', '', '', NULL), > ('952', 'm', 'Total Renewals', 'Total Renewals', 0, 0, 'items.renewals', 10, '', '', '', NULL, -5, '', '', '', NULL), > ('952', 'n', 'Total Holds', 'Total Holds', 0, 0, 'items.reserves', 10, '', '', '', NULL, -5, '', '', '', NULL), >diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql >index 94ccaa9..dc19282 100644 >--- a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql >+++ b/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql >@@ -148,6 +148,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` > ('995', 'm', 'Date of loan or deposit', 'Date of loan or deposit', 0, 0, 'items.datelastborrowed', 10, '', '', '', 0, -5, '', '', '', NULL), > ('995', 'n', 'Expiration of loan date', 'Expiration of loan date', 0, 0, 'items.onloan', 10, '', '', '', 0, -1, '', '', '', NULL), > ('995', 'o', 'Circulation type (not for loan)', 'Circulation type (not for loan)', 0, 0, 'items.notforloan', 10, '', '', '', 0, 0, '', '', '', NULL), >+ ('952', 'q', 'Checkin alert', '', 0, 0, 'items.checkin_alert', 10, '', '', '', NULL, -1, '', '', '', NULL), > ('995', 'r', 'Type of item and material', 'Type of item and material', 0, 1, 'items.itype', 10, 'itemtypes', '', '', 0, 0, '', '', '', NULL), > ('995', 'u', 'Copy note', 'Copy note', 0, 0, 'items.itemnotes', 10, '', '', '', 0, 0, '', '', '', NULL), > ('995', 'v', 'Serial Enumeration / chronology', 'Serial Enumeration / chronology', 0, 0, 'items.enumchron', 10, '', '', '', 0, -1, '', '', '', NULL); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index e227125..975614b 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -692,6 +692,7 @@ CREATE TABLE `deleteditems` ( > `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) > `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) > `new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. >+ `checkin_alert` longtext DEFAULT NULL, -- Chekin alert field. Put html is this field, it will be displayed and printable while checkin item. > PRIMARY KEY (`itemnumber`), > KEY `delitembarcodeidx` (`barcode`), > KEY `delitemstocknumberidx` (`stocknumber`), >@@ -952,6 +953,7 @@ CREATE TABLE `items` ( -- holdings/item information > `copynumber` varchar(32) default NULL, -- copy number (MARC21 952$t) > `stocknumber` varchar(32) default NULL, -- inventory number (MARC21 952$i) > `new_status` VARCHAR(32) DEFAULT NULL, -- 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. >+ `checkin_alert` longtext DEFAULT NULL, -- Chekin alert field. Put html is this field, it will be displayed and printable while checkin item. > PRIMARY KEY (`itemnumber`), > UNIQUE KEY `itembarcodeidx` (`barcode`), > KEY `itemstocknumberidx` (`stocknumber`), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printalert.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printalert.tt >new file mode 100644 >index 0000000..2f25e1b >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printalert.tt >@@ -0,0 +1,19 @@ >+[% USE Koha %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Circulation › Print alert</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >+<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" /> >+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/print.css" /> >+[% IF ( Koha.Preference('SlipCSS') ) %] >+<link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') %]" /> >+[% END %] >+ >+[% INCLUDE 'slip-print.inc' #printThenClose %] >+</head> >+<body id="circ_printalert" class="circ"> >+<div id="receipt"> >+ >+[% IF ( alert ) %][% alert %][% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index b3b5910..28fd5ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -58,6 +58,10 @@ $(document).ready(function () { > Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&biblionumber=[% biblionumber %]'); > [% END %] > >+ [% IF print_alert %] >+ Dopop('print-alert.pl?itemnumber=[% itemnumber %]'); >+ [% END %] >+ > var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'returns', 'checkedintable', 'json' ) %] > var returns_table = KohaTable("#checkedintable", { > "bFilter":false, >@@ -577,6 +581,46 @@ $(document).ready(function () { > </div> > </div> > [% END %] >+ [% IF ( checkin_alert ) %] >+ <div id="checkin-alert" class="modal fade audio-alert-action"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <form method="post" action="returns.pl" class="confirm"> >+ <div class="modal-header"> >+ <h3> >+ Alert: >+ <br/> >+ <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]"> >+ [% itembarcode |html %]: [% title |html %] >+ </a> >+ </h3> >+ </div> >+ >+ <div class="modal-body"> >+ [% checkin_alert_message %] >+ [% FOREACH inputloo IN inputloop %] >+ <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" /> >+ <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" /> >+ <input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" /> >+ [% END %] >+ <input type="hidden" name="itemnumber" value="[% itemnumber %]" /> >+ <input type="hidden" name="print_alert" value="0" /> >+ </div> >+ >+ <div class="modal-footer"> >+ <button type="submit" class="btn btn-default print" onclick="this.form.print_alert.value = 1; this.form.submit();"> >+ <i class="fa fa-print"></i> Print alert >+ </button> >+ >+ <button data-dismiss="modal" aria-hidden="true" type="submit" class="btn btn-danger deny" onclick="$('#barcode').focus(); return false;"> >+ <i class="fa fa-times"></i> Ignore >+ </button> >+ </div> >+ </form> >+ </div> >+ </div> >+ </div> >+ [% END %] > [% END %] > > [% IF ( errmsgloop ) %] >-- >2.7.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 18760
:
64256
| 67185