@@ -, +, @@ the correct media type code. --- C4/SIP/ILS/Item.pm | 5 ++- Koha/Template/Plugin/AuthorisedValues.pm | 5 +++ Koha/Template/Plugin/EncodeUTF8.pm | 31 ++++++++++++++++++++ admin/itemtypes.pl | 8 ++++- installer/data/mysql/de-DE/optional/auth_val.sql | 13 ++++++++ installer/data/mysql/en/optional/auth_val.sql | 13 ++++++++ installer/data/mysql/es-ES/optional/auth_val.sql | 13 ++++++++ installer/data/mysql/kohastructure.sql | 1 + .../data/mysql/nb-NO/2-Valgfritt/auth_val.sql | 13 ++++++++ installer/data/mysql/pl-PL/optional/auth_val.sql | 13 ++++++++ installer/data/mysql/updatedatabase.pl | 23 ++++++++++++++ .../prog/en/modules/admin/itemtypes.tt | 16 ++++++++++ 12 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 Koha/Template/Plugin/EncodeUTF8.pm --- a/C4/SIP/ILS/Item.pm +++ a/C4/SIP/ILS/Item.pm @@ -86,7 +86,10 @@ sub new { $item->{permanent_location}= $item->{homebranch}; $item->{'collection_code'} = $item->{ccode}; $item->{ 'call_number' } = $item->{itemcallnumber}; - # $item->{'destination_loc'} = ? + + my $it = C4::Context->preference('item-level_itypes') ? $item->{itype} : $item->{itemtype}; + my $sip_media_type = C4::Context->dbh->selectrow_array('SELECT sip_media_type FROM itemtypes WHERE itemtype = ?', undef, ( $it ) ); + $item->{sip_media_type} = $sip_media_type; # check if its on issue and if so get the borrower my $issue = GetItemIssue($item->{'itemnumber'}); --- a/Koha/Template/Plugin/AuthorisedValues.pm +++ a/Koha/Template/Plugin/AuthorisedValues.pm @@ -31,4 +31,9 @@ sub GetByCode { return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); } +sub Get { + my ( $self, $category, $selected, $opac ) = @_; + return GetAuthorisedValues( $category, $selected, $opac ); +} + 1; --- a/Koha/Template/Plugin/EncodeUTF8.pm +++ a/Koha/Template/Plugin/EncodeUTF8.pm @@ -0,0 +1,31 @@ +package Koha::Template::Plugin::EncodeUTF8; + +# Copyright Bywater Solutions 2013 +# +# 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, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use base qw{Template::Plugin::Filter}; + +use Encode qw{encode}; + +sub filter { + my ( $self, $value ) = @_; + return encode( 'UTF-8', $value ); +} + +1; --- a/admin/itemtypes.pl +++ a/admin/itemtypes.pl @@ -119,6 +119,7 @@ if ( $op eq 'add_form' ) { summary => $data->{summary}, imagesets => $imagesets, remote_image => $remote_image, + sip_media_type => $data->{sip_media_type}, ); # END $OP eq ADD_FORM @@ -141,6 +142,7 @@ elsif ( $op eq 'add_validate' ) { , notforloan = ? , imageurl = ? , summary = ? + , sip_media_type = ? WHERE itemtype = ? '; $sth = $dbh->prepare($query2); @@ -156,15 +158,16 @@ elsif ( $op eq 'add_validate' ) { ) ), $input->param('summary'), + $input->param('sip_media_type'), $input->param('itemtype') ); } else { # add a new itemtype & not modif an old my $query = " INSERT INTO itemtypes - (itemtype,description,rentalcharge, notforloan, imageurl,summary) + (itemtype,description,rentalcharge, notforloan, imageurl,summary,sip_media_type) VALUES - (?,?,?,?,?,?); + (?,?,?,?,?,?,?); "; my $sth = $dbh->prepare($query); my $image = $input->param('image'); @@ -177,6 +180,7 @@ elsif ( $op eq 'add_validate' ) { $image eq 'remoteImage' ? $input->param('remoteImage') : $image, $input->param('summary'), + $input->param('sip_media_type'), ); } --- a/installer/data/mysql/de-DE/optional/auth_val.sql +++ a/installer/data/mysql/de-DE/optional/auth_val.sql @@ -57,3 +57,16 @@ INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_ INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'PAT', 'Benutzer'); INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACQ', 'Erwerbung'); INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACC', 'Gebühren'); + +-- SIP2 media types +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '000', 'Other'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '001', 'Book'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '002', 'Magazine'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '003', 'Bound journal'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '004', 'Audio tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '005', 'Video tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '006', 'CD/CDROM'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '007', 'Diskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '008', 'Book with deskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '009', 'Book with cd'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '010', 'Book with audio tape'); --- a/installer/data/mysql/en/optional/auth_val.sql +++ a/installer/data/mysql/en/optional/auth_val.sql @@ -57,3 +57,16 @@ INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_ INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'PAT', 'Patrons'); INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACQ', 'Acquisitions'); INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACC', 'Accounts'); + +-- SIP2 media types +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '000', 'Other'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '001', 'Book'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '002', 'Magazine'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '003', 'Bound journal'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '004', 'Audio tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '005', 'Video tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '006', 'CD/CDROM'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '007', 'Diskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '008', 'Book with deskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '009', 'Book with cd'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '010', 'Book with audio tape'); --- a/installer/data/mysql/es-ES/optional/auth_val.sql +++ a/installer/data/mysql/es-ES/optional/auth_val.sql @@ -50,3 +50,16 @@ INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_N -- OPAC Suggestions reasons INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','damaged','The copy on the shelf is damaged','The copy on the shelf is damaged'); INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES ('OPAC_SUG','bestseller','Upcoming title by popular author','Upcoming title by popular author'); + +-- SIP2 media types +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '000', 'Other'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '001', 'Book'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '002', 'Magazine'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '003', 'Bound journal'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '004', 'Audio tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '005', 'Video tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '006', 'CD/CDROM'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '007', 'Diskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '008', 'Book with deskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '009', 'Book with cd'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '010', 'Book with audio tape'); --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1108,6 +1108,7 @@ CREATE TABLE `itemtypes` ( -- defines the item types `notforloan` smallint(6) default NULL, -- 1 if the item is not for loan, 0 if the item is available for loan `imageurl` varchar(200) default NULL, -- URL for the item type icon `summary` text, -- information from the summary field, may include HTML + sip_media_type VARCHAR(3) DEFAULT NULL, -- SIP2 protocol media type for this itemtype PRIMARY KEY (`itemtype`), UNIQUE KEY `itemtype` (`itemtype`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- a/installer/data/mysql/nb-NO/2-Valgfritt/auth_val.sql +++ a/installer/data/mysql/nb-NO/2-Valgfritt/auth_val.sql @@ -78,3 +78,16 @@ INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_ INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'PAT', 'Lånere'); INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACQ', 'Innkjøp'); INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('REPORT_GROUP', 'ACC', 'Gebyrer'); + +-- SIP2 media types +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '000', 'Other'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '001', 'Book'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '002', 'Magazine'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '003', 'Bound journal'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '004', 'Audio tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '005', 'Video tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '006', 'CD/CDROM'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '007', 'Diskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '008', 'Book with deskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '009', 'Book with cd'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '010', 'Book with audio tape'); --- a/installer/data/mysql/pl-PL/optional/auth_val.sql +++ a/installer/data/mysql/pl-PL/optional/auth_val.sql @@ -38,3 +38,16 @@ INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('NOT_L -- restricted status of an item, linked to items.restricted INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('RESTRICTED','1','Restricted Access'); + +-- SIP2 media types +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '000', 'Other'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '001', 'Book'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '002', 'Magazine'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '003', 'Bound journal'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '004', 'Audio tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '005', 'Video tape'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '006', 'CD/CDROM'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '007', 'Diskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '008', 'Book with deskette'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '009', 'Book with cd'); +INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('SIP_MEDIA_TYPE', '010', 'Book with audio tape'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -6935,6 +6935,29 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "3.15.00.XXX"; +if(CheckVersion($DBversion)) { + $dbh->do(q{ + ALTER TABLE itemtypes ADD sip_media_type VARCHAR( 3 ) DEFAULT NULL + }); + $dbh->do(q{ + INSERT INTO authorised_values (category, authorised_value, lib) VALUES + ('SIP_MEDIA_TYPE', '000', 'Other'), + ('SIP_MEDIA_TYPE', '001', 'Book'), + ('SIP_MEDIA_TYPE', '002', 'Magazine'), + ('SIP_MEDIA_TYPE', '003', 'Bound journal'), + ('SIP_MEDIA_TYPE', '004', 'Audio tape'), + ('SIP_MEDIA_TYPE', '005', 'Video tape'), + ('SIP_MEDIA_TYPE', '006', 'CD/CDROM'), + ('SIP_MEDIA_TYPE', '007', 'Diskette'), + ('SIP_MEDIA_TYPE', '008', 'Book with deskette'), + ('SIP_MEDIA_TYPE', '009', 'Book with cd'), + ('SIP_MEDIA_TYPE', '010', 'Book with audio tape') + }); + print "Upgrade to $DBversion done (Bug 11351 - Add support for SIP2 media type)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -1,3 +1,5 @@ +[% USE EncodeUTF8 %] +[% USE AuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › Item types [% IF ( add_form ) %]› [% IF ( itemtype ) %] @@ -229,6 +231,20 @@ Item types administration <input type="text" id="rentalcharge" name="rentalcharge" size="10" value="[% rentalcharge %]" /> </li> <li> + <li> + <label for="sip_media_type">SIP media type: </label> + <select id="sip_media_type" name="sip_media_type"> + <option value=""></option> + [% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE', sip_media_type ) %] + [% IF a.selected %] + <option value="[% a.authorised_value %]" selected="selected">[% a.lib | $EncodeUTF8 %]</option> + [% ELSE %] + <option value="[% a.authorised_value %]">[% a.lib | $EncodeUTF8 %]</option> + [% END %] + [% END %] + </select> + </li> + <li> <label for="summary">Summary: </label> <textarea id="summary" name="summary" cols="55" rows="5">[% summary %]</textarea> <p>Enter a summary that will overwrite the default one in search results lists. Example, for a website itemtype : </p> --