X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FItems.pm;h=0b2f99b9ee86fd053d5824dad4f1dfe19ba790ba;hb=f91bd36399b1ab46649482f80e0ff1b438a8d9f6;hp=b257e524559a8f177f4863dc7cda51e5e6b35c8b;hpb=a7f7aeb138b8275448937102cb7a46cf49530aef;p=koha_gimpoz diff --git a/C4/Items.pm b/C4/Items.pm index b257e52455..0b2f99b9ee 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -26,6 +26,7 @@ use C4::Context; use C4::Koha; use C4::Biblio; use C4::Dates qw/format_date format_date_in_iso/; +use C4::Search qw/SimpleSearch/; use MARC::Record; use C4::ClassSource; use C4::Log; @@ -307,7 +308,7 @@ Sequence number of original item tag in the MARC record. Item barcode, provide to assist in the construction of useful error messages. -=item error_condition +=item error_code Code representing the error condition. Can be 'duplicate_barcode', 'invalid_homebranch', or 'invalid_holdingbranch'. @@ -327,6 +328,9 @@ sub AddItemBatchFromMarc { my @errors = (); my $dbh = C4::Context->dbh; + # We modify the record, so lets work on a clone so we don't change the + # original. + $record = $record->clone(); # loop through the item tags and start creating items my @bad_item_fields = (); my ($itemtag, $itemsubfield) = &GetMarcFromKohaField("items.itemnumber",''); @@ -653,7 +657,7 @@ sub CheckItemPreSave { # check for valid home branch if (exists $item_ref->{'homebranch'} and defined $item_ref->{'homebranch'}) { - my $branch_name = GetBranchName($item_ref->{'homebranch'}); + my $branch_name = C4::Branch::GetBranchName($item_ref->{'homebranch'}); unless (defined $branch_name) { # relies on fact that branches.branchname is a non-NULL column, # so GetBranchName returns undef only if branch does not exist @@ -663,7 +667,7 @@ sub CheckItemPreSave { # check for valid holding branch if (exists $item_ref->{'holdingbranch'} and defined $item_ref->{'holdingbranch'}) { - my $branch_name = GetBranchName($item_ref->{'holdingbranch'}); + my $branch_name = C4::Branch::GetBranchName($item_ref->{'holdingbranch'}); unless (defined $branch_name) { # relies on fact that branches.branchname is a non-NULL column, # so GetBranchName returns undef only if branch does not exist @@ -1185,7 +1189,9 @@ sub GetItemsInfo { items.notforloan as itemnotforloan, itemtypes.description, itemtypes.notforloan as notforloan_per_itemtype, - holding.branchurl + holding.branchurl, + holding.branchname, + holding.opac_info as branch_opac_info FROM items LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode LEFT JOIN branches AS home ON items.homebranch=home.branchcode @@ -2573,6 +2579,7 @@ sub PrepareItemrecordDisplay { $subfield_data{subfield} = $subfield; $subfield_data{countsubfield} = $cntsubf++; $subfield_data{kohafield} = $tagslib->{$tag}->{$subfield}->{'kohafield'}; + $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".int(rand(1000000)); # $subfield_data{marc_lib}=$tagslib->{$tag}->{$subfield}->{lib}; $subfield_data{marc_lib} = $tagslib->{$tag}->{$subfield}->{lib}; @@ -2711,8 +2718,6 @@ sub PrepareItemrecordDisplay { my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? - my $index_subfield = int(rand(1000000)); - $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; $subfield_data{marc_value} = qq[