[Koha-patches] [PATCH] kohabug 2427 Correcting C4::Items:: _koha_new_item to populate items.copynumber

Chris Nighswonger chris.nighswonger at liblime.com
Thu Aug 7 23:05:41 CEST 2008


The INSERT was missing the copynumber parameter. moredetail.pl was also not setting
the copyvol template variable. This patch corrects these issues so that the copynumber
is both inserted when a new item is created (including during a bulkmarcimport.pl run)
and displayed properly on moredetail.pl
---
 C4/Items.pm             |    8 +++++---
 catalogue/moredetail.pl |    7 ++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/C4/Items.pm b/C4/Items.pm
index f9edacf..a0d2a4b 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -1790,9 +1790,10 @@ sub _koha_new_item {
             ccode               = ?,
             itype               = ?,
             materials           = ?,
-			uri                 = ?,
+            uri = ?,
             enumchron           = ?,
-			more_subfields_xml  = ?
+            more_subfields_xml  = ?,
+            copynumber          = ?
           ";
     my $sth = $dbh->prepare($query);
    $sth->execute(
@@ -1827,7 +1828,8 @@ sub _koha_new_item {
             $item->{'materials'},
             $item->{'uri'},
             $item->{'enumchron'},
-			$item->{'more_subfields_xml'},
+            $item->{'more_subfields_xml'},
+            $item->{'copynumber'},
     );
     my $itemnumber = $dbh->{'mysql_insertid'};
     if ( defined $sth->errstr ) {
diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl
index 76ec022..5d09087 100755
--- a/catalogue/moredetail.pl
+++ b/catalogue/moredetail.pl
@@ -94,9 +94,10 @@ foreach my $item (@items){
     $item->{'datelastseen'} = format_date($item->{'datelastseen'});
     $item->{'ordernumber'} = $ordernum;
     $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
-	if ($item->{notforloantext} or $item->{itemlost} or $item->{damaged} or $item->{wthdrawn}) {
-		$item->{status_advisory} = 1;
-	}
+    $item->{'copyvol'} = $item->{'copynumber'};
+    if ($item->{notforloantext} or $item->{itemlost} or $item->{damaged} or $item->{wthdrawn}) {
+        $item->{status_advisory} = 1;
+    }
 
     if (C4::Context->preference("IndependantBranches")) {
         #verifying rights
-- 
1.5.5.GIT




More information about the Koha-patches mailing list