[Koha-patches] [biblibre-integration] Fixing item batch modification
Henri-Damien LAURENT
henridamien.laurent at biblibre.com
Tue Sep 1 01:19:17 CEST 2009
From: Paul Poulain <paul.poulain at biblibre.com>
---
tools/batchMod.pl | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/tools/batchMod.pl b/tools/batchMod.pl
index a9cbf3a..81fb5d5 100755
--- a/tools/batchMod.pl
+++ b/tools/batchMod.pl
@@ -59,10 +59,6 @@ my $authvals = [['items.notforloan', 'Item not for loan', 'notforloan'],
];
my $itemlevelpref = C4::Context->preference('item-level_itypes');
-#we use item -level itemtypes
-if ( $itemlevelpref ){
- push(@$authvals, ['items.itype', 'itemtype', 'itype']);
-}
if ( $invars->{op} && $invars->{op} eq 'barcodes'){
#Parse barcodes list
my @barcodelist;
@@ -98,10 +94,11 @@ if ( $invars->{op} && $invars->{op} eq 'barcodes'){
push @$authloop, $fieldstatusauth;
}
}
- my $itemtypes = [];
- #we use biblio level itype
- if ( ! $itemlevelpref){
- my $itypes = GetItemTypes();
+
+ #we use item level itype
+ my $itemtypes = [];
+ if ($itemlevelpref){
+ my $itypes = GetItemTypes();
for my $key (keys %$itypes){
push(@$itemtypes, $itypes->{$key});
}
@@ -117,6 +114,10 @@ if ( $invars->{op} && $invars->{op} eq 'barcodes'){
for my $field (qw(title isbn itemtype)){
$item->{$field} = $iteminfo->{$field};
}
+ if ($itemlevelpref) {
+ my $iteminfo = GetItem($itemno);
+ $item->{itemtype} = $iteminfo->{itype};
+ }
#kind of flakey, though we can be pretty sure the values will be in the same order as in the authloop
#have to use this since in html::template::pro i can't access one loop from inside an other,
#and variable substitution doesn't work (<!-- TMPL_VAR name="<!-- TMPL_VAR name="foo" -->" -->)
@@ -131,10 +132,11 @@ if ( $invars->{op} && $invars->{op} eq 'barcodes'){
}
}
if ( ! $authvaluename){
- $authvaluename = "Not found or invalid";
+ $authvaluename = $item->{$authfield->{itemfieldname}};
}
push(@$itemauthloop, { 'authvalue' => $authvaluename} );
}
+
for my $type (@$itemtypes){
if ( $item->{itemtype} eq $type->{itemtype} ) {
$item->{itemtypedesc} = $type->{description};
@@ -145,7 +147,6 @@ if ( $invars->{op} && $invars->{op} eq 'barcodes'){
$itemslst .= $item->{'itemnumber'} . ',';
}
}
-
$template->param( 'itemsloop' => \@items,
'authloop' => $authloop,
'branches' => $branches,
@@ -173,6 +174,9 @@ if ( $invars->{op} && $invars->{op} eq 'barcodes'){
if ($invars->{homebranch} && $invars->{homebranch} ne '0'){
$item->{homebranch} = $invars->{homebranch};
}
+ if ($invars->{itemtypes} && $invars->{itemtypes} ne '0') {
+ $item->{itype} = $invars->{itemtypes};
+ }
ModItem($item, $item->{biblionumber}, $item->{itemnumber});
}
}
--
1.6.0.4
More information about the Koha-patches
mailing list