[Patches] [PATCH] Bug 7728 : Materials Specified field made larger and

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Thu Dec 1 10:55:02 NZDT 2011


From: Chris Cormack <chrisc at catalyst.net.nz>
Date: Thu, 1 Dec 2011 10:46:52 +1300
Subject: [PATCH] Bug 7728 : Materials Specified field made larger and
 displayed

This first page makes the database change, and displays the field on
the detail.pl and moredetail.pl pages in the staff client

How to Test:

* Add a note to the materials specified page in cataloguing (952
subfield 3 for MARC21, but it shouldn't matter as long as you have a
field mapped to items.materials
* Check it displays at catalogue/detail.pl
* Check it displays at catalogue/moredetail.pl

Patch to follow to have the note display at checkin/checkout

http://bugs.koha-community.org/show_bug.cgi?id=7278
---
 catalogue/detail.pl                                |    6 +++++-
 installer/data/mysql/kohastructure.sql             |    2 +-
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../prog/en/modules/catalogue/detail.tt            |    4 ++++
 .../prog/en/modules/catalogue/moredetail.tt        |    1 +
 5 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 580949d..a700b95 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -174,6 +174,7 @@ my $authvalcode_items_itemlost = GetAuthValCode('items.itemlost',$fw);
 my $authvalcode_items_damaged  = GetAuthValCode('items.damaged', $fw);
 
 my $analytics_flag;
+my $materials_flag; # set this if the items have anything in the materials field
 foreach my $item (@items) {
 
     $item->{homebranch}        = GetBranchName($item->{homebranch});
@@ -251,7 +252,9 @@ foreach my $item (@items) {
 		$analytics_flag=1;
 		$item->{countanalytics} = $countanalytics;
 	}
-
+    if ($item->{'materials'} ne ''){
+	$materials_flag = 1;
+    }
     push @itemloop, $item;
 }
 
@@ -276,6 +279,7 @@ $template->param(
         hostrecords         => $hostrecords,
 	analytics_flag	=> $analytics_flag,
 	C4::Search::enabled_staff_search_views,
+        materials       => $materials_flag,
 );
 
 if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) {
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 452173d..494b0cb 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1031,7 +1031,7 @@ CREATE TABLE `items` (
   `cn_source` varchar(10) default NULL,
   `cn_sort` varchar(30) default NULL,
   `ccode` varchar(10) default NULL,
-  `materials` varchar(10) default NULL,
+  `materials` text default NULL,
   `uri` varchar(255) default NULL,
   `itype` varchar(10) default NULL,
   `more_subfields_xml` longtext default NULL,
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index efa9898..4c616ab 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4564,6 +4564,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.07.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE items MODIFY materials text;");
+    print "Upgrade to $DBversion done alter items.material from varchar(10) to text \n";
+    SetVersion ($DBversion);
+}
+
 
 =head1 FUNCTIONS
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
index 019fa10..2a4a975 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -243,6 +243,7 @@ function verify_images() {
                 <th>Status</th>
                 <th>Last seen</th>
                 <th>Barcode</th>
+		[% IF materials %]<th>Materials Specified</th>[% END %]
                 [% IF ( volinfo ) %]<th>Publication Details</th>[% END %]
                 [% IF ( itemdata_uri ) %]<th>url</th>[% END %]
                 [% IF ( itemdata_copynumber ) %]<th>Copy No.</th>[% END %]
@@ -372,6 +373,9 @@ function verify_images() {
 				[% IF ( itemdata_copynumber ) %]
 					<td class="copynumber">[% itemloo.copynumber %]</td>
 				[% END %]
+	        [% IF itemloo.materials %]
+		    <td> [% itemloo.materials %] </td>
+		[% END %]
                 [% IF ( itemdata_itemnotes ) %]<td><div class="itemnotes">[% itemloo.itemnotes %]</div></td>[% END %]
 		[% IF ( SpineLabelShowPrintOnBibDetails ) %]
 			<td><a href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=[% itemloo.barcode %]" >Print Label</a></td>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
index 36e7149..59bcb35 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
@@ -57,6 +57,7 @@
             <li><span class="label">Item Callnumber:</span> [% ITEM_DAT.itemcallnumber %] </li>
             [% IF ( ITEM_DAT.copyvol ) %]<li><span class="label">Copy / Vol :</span> [% ITEM_DAT.copyvol %] </li> [% END %]
             [% IF ( ITEM_DAT.replacementprice ) %]<li><span class="label">Replacement Price:</span> [% ITEM_DAT.replacementprice %] </li> [% END %]
+	    [% IF ITEM_DAT.materials %]<li><span class="label">Materials Specified:</span> [% ITEM_DAT.materials %] </li> [% END %]
             </ol></div>
            <div class="listgroup"><h4>Statuses [% IF ( ITEM_DAT.status_advisory ) %](
                 [% IF ( ITEM_DAT.notforloantext ) %][% ITEM_DAT.notforloantext %] [% END %]
-- 
1.7.5.4


More information about the Patches mailing list