Bugzilla – Attachment 174452 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.01 KB, created by
Fridolin Somers
on 2024-11-13 10:13:26 UTC
(
hide
)
Description:
Bug 18760: Add item printable checkin alert field
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2024-11-13 10:13:26 UTC
Size:
14.01 KB
patch
obsolete
>From 497604176a7175669c8b4e4ef1532e7a41b311c7 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Tue, 13 Jun 2017 14:43:14 +0200 >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 ++ > Koha/Item.pm | 1 + > Koha/Schema/Result/Deleteditem.pm | 7 +++ > Koha/Schema/Result/Item.pm | 7 +++ > api/v1/swagger/definitions/item.yaml | 5 +++ > circ/printalert.pl | 45 +++++++++++++++++++ > circ/returns.pl | 19 ++++++++ > ...g_18760-add-items-checkin-alert-column.sql | 2 + > installer/data/mysql/kohastructure.sql | 2 + > .../prog/en/modules/circ/printalert.tt | 21 +++++++++ > .../prog/en/modules/circ/returns.tt | 34 ++++++++++++++ > 11 files changed, 147 insertions(+) > create mode 100755 circ/printalert.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 65f440d5c3..db24692d08 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2586,6 +2586,10 @@ sub AddReturn { > ) if C4::Context->preference('RealTimeHoldsQueue'); > } > >+ if ( $item->checkin_alert ) { >+ $messages->{checkin_alert} = $item->checkin_alert; >+ } >+ > return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} )); > } > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 18d3f7af79..8d88987e28 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1695,6 +1695,7 @@ sub to_api_mapping { > copynumber => 'copy_number', > stocknumber => 'inventory_number', > new_status => 'new_status', >+ checkin_alert => 'checkin_alert', > deleted_on => undef, > }; > } >diff --git a/Koha/Schema/Result/Deleteditem.pm b/Koha/Schema/Result/Deleteditem.pm >index a30646271c..b5321df830 100644 >--- a/Koha/Schema/Result/Deleteditem.pm >+++ b/Koha/Schema/Result/Deleteditem.pm >@@ -379,6 +379,11 @@ inventory number (MARC21 952$i) > > 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. > >+=head2 checkin_alert >+ >+ data_type: 'longtext' >+ is_nullable: 1 >+ > =head2 exclude_from_local_holds_priority > > data_type: 'tinyint' >@@ -506,6 +511,8 @@ __PACKAGE__->add_columns( > { data_type => "varchar", is_nullable => 1, size => 32 }, > "new_status", > { data_type => "varchar", is_nullable => 1, size => 32 }, >+ "checkin_alert", >+ { data_type => "longtext", is_nullable => 1 }, > "exclude_from_local_holds_priority", > { data_type => "tinyint", is_nullable => 1 }, > ); >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index 8320ce4c76..56768da28b 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -383,6 +383,11 @@ inventory number (MARC21 952$i) > > 'new' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob. > >+=head2 checkin_alert >+ >+ data_type: 'longtext' >+ is_nullable: 1 >+ > =head2 exclude_from_local_holds_priority > > data_type: 'tinyint' >@@ -520,6 +525,8 @@ __PACKAGE__->add_columns( > { data_type => "varchar", is_nullable => 1, size => 32 }, > "new_status", > { data_type => "varchar", is_nullable => 1, size => 32 }, >+ "checkin_alert", >+ { data_type => "longtext", is_nullable => 1 }, > "exclude_from_local_holds_priority", > { data_type => "tinyint", is_nullable => 1 }, > ); >diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml >index 1d0ed7ac95..892b4a2984 100644 >--- a/api/v1/swagger/definitions/item.yaml >+++ b/api/v1/swagger/definitions/item.yaml >@@ -220,6 +220,11 @@ properties: > - string > - "null" > description: "'new' value, whatever free-text information." >+ checkin_alert: >+ type: >+ - string >+ - "null" >+ description: Chekin alert field. Put html is this field, it will be displayed and printable while checkin item. > exclude_from_local_holds_priority: > type: boolean > description: Exclude this item from local holds priority. >diff --git a/circ/printalert.pl b/circ/printalert.pl >new file mode 100755 >index 0000000000..80a9f82f04 >--- /dev/null >+++ b/circ/printalert.pl >@@ -0,0 +1,45 @@ >+#!/usr/bin/perl >+ >+ >+# Copyright 2008 LibLime >+# >+# 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::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+use Koha::Items; >+ >+my $input = CGI->new; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "circ/printalert.tt", >+ query => $input, >+ type => "intranet", >+ flagsrequired => { circulate => "circulate_remaining_permissions" }, >+ } >+); >+ >+my $itemnumber = $input->param('itemnumber'); >+my $item = Koha::Items->find( $itemnumber ) if $itemnumber; >+my $checkin_alert = $item->checkin_alert if $item; >+ >+$template->param( alert => $checkin_alert ) if $checkin_alert; >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/circ/returns.pl b/circ/returns.pl >index 79c14b982d..4db2fc1f2d 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -209,6 +209,13 @@ if ( $query->param('recall_id') ) { > } > } > >+if ( $query->param('print_alert') ) { >+ $template->param( >+ print_alert => 1, >+ itemnumber => $itemnumber, >+ ); >+} >+ > my $borrower; > my $returned = 0; > my $messages; >@@ -680,6 +687,15 @@ if ( $messages->{TransferredRecall} ) { > } > } > >+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 ) { >@@ -759,6 +775,9 @@ foreach my $code ( keys %$messages ) { > elsif ( $code eq 'DataCorrupted' ) { > $err{data_corrupted} = 1; > } >+ elsif ( $code eq 'checkin_alert' ) { >+ ; >+ } > elsif ( $code eq 'ReturnClaims' ) { > $template->param( ReturnClaims => $messages->{ReturnClaims} ); > } elsif ( $code eq 'RecallFound' ) { >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 0000000000..6e1381ea54 >--- /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; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 5af7021f1a..12f7dfd053 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2780,6 +2780,7 @@ CREATE TABLE `deleteditems` ( > `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)', > `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)', > `new_status` varchar(32) DEFAULT NULL COMMENT '''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. > `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority', > PRIMARY KEY (`itemnumber`), > KEY `delitembarcodeidx` (`barcode`), >@@ -4037,6 +4038,7 @@ CREATE TABLE `items` ( > `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)', > `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)', > `new_status` varchar(32) DEFAULT NULL COMMENT '''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. > `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority', > PRIMARY KEY (`itemnumber`), > UNIQUE KEY `itembarcodeidx` (`barcode`), >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 0000000000..0b5b726723 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printalert.tt >@@ -0,0 +1,21 @@ >+[% USE raw %] >+[% USE Asset %] >+[% USE Koha %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Print alert › Circulation › Koha</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 | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" /> >+[% Asset.css("css/print.css") | $raw %] >+[% IF ( Koha.Preference('SlipCSS') ) %] >+<link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') | $raw %]" /> >+[% END %] >+ >+[% INCLUDE 'slip-print.inc' #printThenClose %] >+</head> >+<body id="circ_printalert" class="circ"> >+<div id="receipt"> >+ >+[% IF ( alert ) %][% alert | $raw %][% 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 bb02f1b6f2..5cd7527bfd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -222,6 +222,36 @@ > </div> > [% END %] > >+ [% IF ( checkin_alert ) %] >+ <div id="checkin-alert" class="dialog message audio-alert-action"> >+ <form method="post" action="returns.pl" class="confirm"> >+ <h3> >+ Alert: >+ <br/> >+ <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber | uri %]"> >+ [% itembarcode | html %]: [% title | html %] >+ </a> >+ </h3> >+ [% checkin_alert_message | $raw %] >+ [% FOREACH inputloo IN inputloop %] >+ <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" /> >+ <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" /> >+ <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" /> >+ [% END %] >+ <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" /> >+ <input type="hidden" name="print_alert" value="0" /> >+ >+ <button type="submit" class="print" onclick="this.form.print_alert.value = 1; this.form.submit();"> >+ <i class="fa fa-print"></i> Print alert >+ </button> >+ >+ <button type="submit" class="deny" onclick="$('.dialog:visible').hide('slow'); $('#barcode').focus(); return false;"> >+ <i class="fa fa-times"></i> Ignore >+ </button> >+ </form> >+ </div> >+ [% END %] >+ > <!-- Bundle has items missing --> > [% IF missing_items %] > <div id="bundle_missing_items" class="dialog alert"> >@@ -1485,6 +1515,10 @@ > Dopop('/cgi-bin/koha/recalls/recall_pickup_slip.pl?recall_id=[% recall_id | uri %]'); > [% END %] > >+ [% IF print_alert %] >+ Dopop('printalert.pl?itemnumber=[% itemnumber | uri %]'); >+ [% END %] >+ > var returns_table = KohaTable("checkedintable", { > "searching":false, > "paginate":false, >-- >2.47.0
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
| 174452