From 91dcc17ca6b46cfebae556c8a61b2d27541829b0 Mon Sep 17 00:00:00 2001 From: Shinoy M Date: Tue, 5 Jun 2012 17:25:08 +0530 Subject: [PATCH] Bug 6777 - Display link to related acquisitions details from catalogue record A new column -Acq info- has been added to the holding tab of the catalog detail page .The column will contain the link which will redirect to the order details of that item. The permission settings has been done so that the user who has the Manage orders & basket permission can see the link.The link is also visible under Item information in the Items tab. Signed-off-by: Delaye Stephane --- C4/Items.pm | 18 ++++++++++++++++++ catalogue/detail.pl | 6 ++++++ catalogue/moredetail.pl | 1 + .../prog/en/modules/catalogue/detail.tt | 2 ++ .../prog/en/modules/catalogue/moredetail.tt | 1 + 5 files changed, 28 insertions(+), 0 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 2afe537..07e0e97 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -71,6 +71,7 @@ BEGIN { get_hostitemnumbers_of GetItemnumberFromBarcode GetBarcodeFromItemnumber + GetOrdernumberFromItemnumber GetHiddenItemnumbers DelItemCheck MoveItemFromBiblio @@ -1579,6 +1580,23 @@ sub GetBarcodeFromItemnumber { return ($result); } +=head2 GetOrdernumberFromItemnumber + + $result = GetOrdernumberFromItemnumber($itemnumber); + +=cut + +sub GetOrdernumberFromItemnumber { + my ($itemnumber) = @_; + my $dbh = C4::Context->dbh; + + my $rq = + $dbh->prepare("SELECT ordernumber FROM aqorders_items LEFT JOIN items ON aqorders_items.itemnumber=items.itemnumber WHERE items.itemnumber=?"); + $rq->execute($itemnumber); + my ($result) = $rq->fetchrow; + return ($result); +} + =head2 GetHiddenItemnumbers =over 4 diff --git a/catalogue/detail.pl b/catalogue/detail.pl index be4fd9a..d8b26bc 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -179,6 +179,7 @@ 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 +my $ordernumber_flag; foreach my $item (@items) { $item->{homebranch} = GetBranchName($item->{homebranch}); @@ -260,6 +261,10 @@ foreach my $item (@items) { if ($item->{'materials'} ne ''){ $materials_flag = 1; } + $item->{'ordernumber'} = GetOrdernumberFromItemnumber($item->{itemnumber}); + if($item->{'ordernumber'}){ + $ordernumber_flag = 1; + } push @itemloop, $item; } @@ -284,6 +289,7 @@ $template->param( hostrecords => $hostrecords, analytics_flag => $analytics_flag, C4::Search::enabled_staff_search_views, + ordernumber_flag => $ordernumber_flag, materials => $materials_flag, ); diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index ca7d13c..27b6f3a 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -129,6 +129,7 @@ foreach ( keys %{$data} ) { ($itemnumber) and @items = (grep {$_->{'itemnumber'} == $itemnumber} @items); foreach my $item (@items){ + $item->{'ordernumber'} = GetOrdernumberFromItemnumber($item->{itemnumber}); $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw); $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw); $item->{'collection'} = $ccodes->{ $item->{ccode} } if ($ccodes); 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 ce52040..860066d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -276,6 +276,7 @@ function verify_images() { Status Last seen Barcode + [% IF ( CAN_user_acquisition_order_manage ) %][% IF ( ordernumber_flag ) %]Acq info[% END %][% END %] [% IF ( volinfo ) %]Publication details[% END %] [% IF ( itemdata_uri ) %]url[% END %] [% IF ( itemdata_copynumber ) %]Copy no.[% END %] @@ -387,6 +388,7 @@ function verify_images() { [% itemloo.datelastseen %] [% itemloo.barcode %] + [% IF ( CAN_user_acquisition_order_manage ) %][% IF ( ordernumber_flag ) %][% IF ( itemloo.ordernumber ) %]View order[% ELSE %]  [% END %][% END %][% END %] [% IF ( volinfo ) %] [% IF ( itemdata_enumchron ) %] [% IF ( itemloo.enumchron ) %] 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 afd2a6d..2c6ce3d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -58,6 +58,7 @@
  • Item callnumber: [% ITEM_DAT.itemcallnumber %] 
  • [% IF ( ITEM_DAT.copyvol ) %]
  • Copy / Vol : [% ITEM_DAT.copyvol %] 
  • [% END %] [% IF ( ITEM_DAT.replacementprice ) %]
  • Replacement price: [% ITEM_DAT.replacementprice %] 
  • [% END %] + [% IF ( CAN_user_acquisition_order_manage ) %][% IF ( ITEM_DAT.ordernumber ) %]
  • Acquisition info:View order 
  • [% END %][% END %] [% IF ITEM_DAT.materials %]
  • Materials specified: [% ITEM_DAT.materials %]
  • [% END %]

    Statuses [% IF ( ITEM_DAT.status_advisory ) %]( -- 1.7.2.5