From 4d60e7df17321c3f2e2dcd902b88d07c40bfc10d Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Tue, 6 Aug 2024 19:24:52 +0000 Subject: [PATCH] Bug 32485: Add itemtype checkout message These patches add new "Checkout message: " and "Checkout message type:" options for item types. When checking out an item, a dialog box appears with the desired message for that item type. To test: 1) Apply patch, updatedatabase, dbic (for schema), restart_all 2) Visit Administration->Item types 3) Edit the book item type and enter a checkout message. Save your changes. 4) Checkout an item of type book to a patron 5) Your checkout message should be displayed 6) Go back to Admin->Item types, edit book, and then switch the 'Checkout message type:' to 'Alert' 7) Checkout another book item and note the dialog box is now an alert. 8) Checkout item of another type -> the message should not show --- Koha/ItemType.pm | 2 ++ admin/itemtypes.pl | 16 +++++++++++----- circ/circulation.pl | 5 +++++ .../prog/en/modules/admin/itemtypes.tt | 19 +++++++++++++++++++ .../prog/en/modules/circ/circulation.tt | 10 ++++++++++ 5 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm index fb88518c25..024d68452e 100644 --- a/Koha/ItemType.pm +++ b/Koha/ItemType.pm @@ -224,6 +224,8 @@ sub to_api_mapping { return { checkinmsg => 'checkin_message', checkinmsgtype => 'checkin_message_type', + checkoutmsg => 'checkout_message', + checkoutmsgtype => 'checkout_message_type', defaultreplacecost => 'default_replacement_cost', hideinopac => 'hide_in_opac', imageurl => 'image_url', diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 684f9377db..507feedcd6 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -90,11 +90,13 @@ if ( $op eq 'add_form' ) { $image eq 'remoteImage' ? $input->param('remoteImage') : $image ); - my $summary = $input->param('summary'); - my $checkinmsg = $input->param('checkinmsg'); - my $checkinmsgtype = $input->param('checkinmsgtype'); - my $hideinopac = $input->param('hideinopac') // 0; - my $searchcategory = $input->param('searchcategory'); + my $summary = $input->param('summary'); + my $checkinmsg = $input->param('checkinmsg'); + my $checkinmsgtype = $input->param('checkinmsgtype'); + my $checkoutmsg = $input->param('checkoutmsg'); + my $checkoutmsgtype = $input->param('checkoutmsgtype'); + my $hideinopac = $input->param('hideinopac') // 0; + my $searchcategory = $input->param('searchcategory'); my $rentalcharge_daily_calendar = $input->param('rentalcharge_daily_calendar') // 0; my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0; my $automatic_checkin = $input->param('automatic_checkin') // 0; @@ -112,6 +114,8 @@ if ( $op eq 'add_form' ) { $itemtype->summary($summary); $itemtype->checkinmsg($checkinmsg); $itemtype->checkinmsgtype($checkinmsgtype); + $itemtype->checkoutmsg($checkoutmsg); + $itemtype->checkoutmsgtype($checkoutmsgtype); $itemtype->sip_media_type($sip_media_type); $itemtype->hideinopac($hideinopac); $itemtype->searchcategory($searchcategory); @@ -145,6 +149,8 @@ if ( $op eq 'add_form' ) { summary => $summary, checkinmsg => $checkinmsg, checkinmsgtype => $checkinmsgtype, + checkoutmsg => $checkoutmsg, + checkoutmsgtype => $checkoutmsgtype, sip_media_type => $sip_media_type, hideinopac => $hideinopac, searchcategory => $searchcategory, diff --git a/circ/circulation.pl b/circ/circulation.pl index acabfa4d1d..37d408f914 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -517,6 +517,11 @@ if (@$barcodes && $op eq 'cud-checkout') { recall_id => $recall_id, } ); + my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); + if ( $itemtype && $itemtype->checkoutmsg ) { + $template_params->{checkoutmsg} = $itemtype->checkoutmsg; + $template_params->{checkoutmsgtype} = $itemtype->checkoutmsgtype; + } $template_params->{issue} = $issue; $session->clear('auto_renew'); $inprocess = 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index b9ea060e30..0942f3060f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -318,6 +318,25 @@ [% END %] +
  • + + +
  • +
  • + + +