Bugzilla – Attachment 23342 Details for
Bug 11351
Add support for SIP2 media types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11351 - Add support for SIP2 media types
Bug-11351---Add-support-for-SIP2-media-types.patch (text/plain), 8.45 KB, created by
Kyle M Hall (khall)
on 2013-12-06 18:38:36 UTC
(
hide
)
Description:
Bug 11351 - Add support for SIP2 media types
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-12-06 18:38:36 UTC
Size:
8.45 KB
patch
obsolete
>From 423a9f4b9b20bea939fb44046ebf5b4b1c120e9f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 6 Dec 2013 13:35:49 -0500 >Subject: [PATCH] Bug 11351 - Add support for SIP2 media types > >Koha's SIP2 server implementation does not currently support the SIP2 >protocol field "media type" ( CK ). > >This patch implements the SIP2 media type by allowing an arbitrary >mapping of itemtypes to SIP2 media types. > >Test Plan: >1) Apply this patch >2) Run updatedatabase >3) Edit an itemtype, select a SIP media type, and save the changes >4) Make a SIP2 Item Information Request >5) Verify that the CK field of the Item Information Response contains > the correct media type code. >--- > C4/SIP/ILS/Item.pm | 6 ++- > admin/itemtypes.pl | 8 ++- > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/updatedatabase.pl | 9 +++ > .../prog/en/modules/admin/itemtypes.tt | 71 ++++++++++++++++++++ > 5 files changed, 92 insertions(+), 3 deletions(-) > >diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm >index ba85cd7..a9a5c64 100644 >--- a/C4/SIP/ILS/Item.pm >+++ b/C4/SIP/ILS/Item.pm >@@ -21,6 +21,7 @@ use C4::Items; > use C4::Circulation; > use C4::Members; > use C4::Reserves; >+use Koha::Database; > > our $VERSION = 3.07.00.049; > >@@ -86,7 +87,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 $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it ); >+ $item->{sip_media_type} = $item->sip_media_type() if $itemtype; > > # check if its on issue and if so get the borrower > my $issue = GetItemIssue($item->{'itemnumber'}); >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index 3c33073..df91e7b 100755 >--- a/admin/itemtypes.pl >+++ b/admin/itemtypes.pl >@@ -121,6 +121,7 @@ if ( $op eq 'add_form' ) { > checkinmsgtype => $data->{'checkinmsgtype'}, > imagesets => $imagesets, > remote_image => $remote_image, >+ sip_media_type => $data->{sip_media_type}, > ); > > # END $OP eq ADD_FORM >@@ -145,6 +146,7 @@ elsif ( $op eq 'add_validate' ) { > , summary = ? > , checkinmsg = ? > , checkinmsgtype = ? >+ , sip_media_type = ? > WHERE itemtype = ? > '; > $sth = $dbh->prepare($query2); >@@ -162,15 +164,16 @@ elsif ( $op eq 'add_validate' ) { > $input->param('summary'), > $input->param('checkinmsg'), > $input->param('checkinmsgtype'), >+ $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, checkinmsg, checkinmsgtype) >+ (itemtype,description,rentalcharge, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type) > VALUES >- (?,?,?,?,?,?,?,?); >+ (?,?,?,?,?,?,?,?,?); > "; > my $sth = $dbh->prepare($query); > my $image = $input->param('image'); >@@ -185,6 +188,7 @@ elsif ( $op eq 'add_validate' ) { > $input->param('summary'), > $input->param('checkinmsg'), > $input->param('checkinmsgtype'), >+ $input->param('sip_media_type'), > ); > } > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 07160c8..a37b8ff 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1235,6 +1235,7 @@ CREATE TABLE `itemtypes` ( -- defines the item types > summary text, -- information from the summary field, may include HTML > checkinmsg VARCHAR(255), -- message that is displayed when an item with the given item type is checked in > checkinmsgtype CHAR(16) DEFAULT 'message' NOT NULL, -- type (CSS class) for the checkinmsg, can be "alert" or "message" >+ sip_media_type VARCHAR( 3 ) NOT NULL DEFAULT "", -- SIP2 protocol media type for this itemtype > PRIMARY KEY (`itemtype`), > UNIQUE KEY `itemtype` (`itemtype`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index f3e39b5..598ec31 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7797,6 +7797,15 @@ 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 ) NOT NULL DEFAULT "" >+ }); >+ print "Upgrade to $DBversion done ()\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >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 57847eb..d2c5876 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >@@ -246,6 +246,77 @@ Item types administration > <select> > </li> > <li> >+ <label for="sip_media_type">SIP media type: </label> >+ <select id="sip_media_type" name="sip_media_type"> >+ <option value=""></option> >+ [% IF sip_media_type == '000' %] >+ <option value="000" selected="selected">Other</option> >+ [% ELSE %] >+ <option value="000">Other</option> >+ [% END %] >+ >+ [% IF sip_media_type == '001' %] >+ <option value="001" selected="selected">Book</option> >+ [% ELSE %] >+ <option value="001">Book</option> >+ [% END %] >+ >+ [% IF sip_media_type == '002' %] >+ <option value="002" selected="selected">Magazine</option> >+ [% ELSE %] >+ <option value="002">Magazine</option> >+ [% END %] >+ >+ [% IF sip_media_type == '003' %] >+ <option value="003" selected="selected">Bound journal</option> >+ [% ELSE %] >+ <option value="003">Bound journal</option> >+ [% END %] >+ >+ [% IF sip_media_type == '004' %] >+ <option value="004" selected="selected">Audio tape</option> >+ [% ELSE %] >+ <option value="004">Audio tape</option> >+ [% END %] >+ >+ [% IF sip_media_type == '005' %] >+ <option value="005" selected="selected">Video tape</option> >+ [% ELSE %] >+ <option value="005">Video tape</option> >+ [% END %] >+ >+ [% IF sip_media_type == '006' %] >+ <option value="006" selected="selected">CD/CDROM</option> >+ [% ELSE %] >+ <option value="006">CD/CDROM</option> >+ [% END %] >+ >+ [% IF sip_media_type == '007' %] >+ <option value="007" selected="selected">Diskette</option> >+ [% ELSE %] >+ <option value="007">Diskette</option> >+ [% END %] >+ >+ [% IF sip_media_type == '008' %] >+ <option value="008" selected="selected">Book with diskette</option> >+ [% ELSE %] >+ <option value="008">Book with diskette</option> >+ [% END %] >+ >+ [% IF sip_media_type == '009' %] >+ <option value="009" selected="selected">Book with CD</option> >+ [% ELSE %] >+ <option value="009">Book with CD</option> >+ [% END %] >+ >+ [% IF sip_media_type == '010' %] >+ <option value="010" selected="selected">Book with audio tape</option> >+ [% ELSE %] >+ <option value="010">Book with audio tape</option> >+ [% 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> >-- >1.7.2.5
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 11351
:
23342
|
23343
|
23344
|
23354
|
23355
|
24944
|
24946
|
27453
|
27476