View | Details | Raw Unified | Return to bug 22721
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-2 / +2 lines)
Lines 1675-1681 sub CancelReceipt { Link Here
1675
            for my $in ( @itemnumbers ) {
1675
            for my $in ( @itemnumbers ) {
1676
                my $item = Koha::Items->find( $in ); # FIXME We do not need that, we already have Koha::Items from $order_obj->items
1676
                my $item = Koha::Items->find( $in ); # FIXME We do not need that, we already have Koha::Items from $order_obj->items
1677
                my $biblio = $item->biblio;
1677
                my $biblio = $item->biblio;
1678
                my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $biblio->frameworkcode );
1678
                my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber' );
1679
                my $item_marc = C4::Items::GetMarcItem( $biblio->biblionumber, $in );
1679
                my $item_marc = C4::Items::GetMarcItem( $biblio->biblionumber, $in );
1680
                for my $affect ( @affects ) {
1680
                for my $affect ( @affects ) {
1681
                    my ( $sf, $v ) = split q{=}, $affect, 2;
1681
                    my ( $sf, $v ) = split q{=}, $affect, 2;
Lines 3239-3245 sub FillWithDefaultValues { Link Here
3239
    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
3239
    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
3240
    if ($tagslib) {
3240
    if ($tagslib) {
3241
        my ($itemfield) =
3241
        my ($itemfield) =
3242
          C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' );
3242
          C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' );
3243
        for my $tag ( sort keys %$tagslib ) {
3243
        for my $tag ( sort keys %$tagslib ) {
3244
            next unless $tag;
3244
            next unless $tag;
3245
            next if $tag == $itemfield;
3245
            next if $tag == $itemfield;
(-)a/C4/Biblio.pm (-7 / +7 lines)
Lines 339-345 sub _strip_item_fields { Link Here
339
    my $record = shift;
339
    my $record = shift;
340
    my $frameworkcode = shift;
340
    my $frameworkcode = shift;
341
    # get the items before and append them to the biblio before updating the record, atm we just have the biblio
341
    # get the items before and append them to the biblio before updating the record, atm we just have the biblio
342
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
342
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" );
343
343
344
    # delete any item fields from incoming record to avoid
344
    # delete any item fields from incoming record to avoid
345
    # duplication or incorrect data - use AddItem() or ModItem()
345
    # duplication or incorrect data - use AddItem() or ModItem()
Lines 730-736 sub GetISBDView { Link Here
730
    my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd';
730
    my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd';
731
    my $framework = $params->{framework};
731
    my $framework = $params->{framework};
732
    my $itemtype  = $framework;
732
    my $itemtype  = $framework;
733
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
733
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch" );
734
    my $tagslib = GetMarcStructure( 1, $itemtype, { unsafe => 1 } );
734
    my $tagslib = GetMarcStructure( 1, $itemtype, { unsafe => 1 } );
735
735
736
    my $ISBD = C4::Context->preference($sysprefname);
736
    my $ISBD = C4::Context->preference($sysprefname);
Lines 2646-2652 sub EmbedItemsInMarcBiblio { Link Here
2646
    my $dbh = C4::Context->dbh;
2646
    my $dbh = C4::Context->dbh;
2647
    my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ?");
2647
    my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ?");
2648
    $sth->execute($biblionumber);
2648
    $sth->execute($biblionumber);
2649
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
2649
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" );
2650
2650
2651
    my @item_fields; # Array holding the actual MARC data for items to be included.
2651
    my @item_fields; # Array holding the actual MARC data for items to be included.
2652
    my @items;       # Array holding items which are both in the list (sitenumbers)
2652
    my @items;       # Array holding items which are both in the list (sitenumbers)
Lines 2698-2706 the MARC XML. Link Here
2698
sub _koha_marc_update_bib_ids {
2698
sub _koha_marc_update_bib_ids {
2699
    my ( $record, $frameworkcode, $biblionumber, $biblioitemnumber ) = @_;
2699
    my ( $record, $frameworkcode, $biblionumber, $biblioitemnumber ) = @_;
2700
2700
2701
    my ( $biblio_tag,     $biblio_subfield )     = GetMarcFromKohaField( "biblio.biblionumber",          $frameworkcode );
2701
    my ( $biblio_tag,     $biblio_subfield )     = GetMarcFromKohaField( "biblio.biblionumber" );
2702
    die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag;
2702
    die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag;
2703
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode );
2703
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" );
2704
    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag;
2704
    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag;
2705
2705
2706
    if ( $biblio_tag < 10 ) {
2706
    if ( $biblio_tag < 10 ) {
Lines 2729-2735 sub _koha_marc_update_biblioitem_cn_sort { Link Here
2729
    my $biblioitem    = shift;
2729
    my $biblioitem    = shift;
2730
    my $frameworkcode = shift;
2730
    my $frameworkcode = shift;
2731
2731
2732
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.cn_sort", $frameworkcode );
2732
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.cn_sort" );
2733
    return unless $biblioitem_tag;
2733
    return unless $biblioitem_tag;
2734
2734
2735
    my ($cn_sort) = GetClassSort( $biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'} );
2735
    my ($cn_sort) = GetClassSort( $biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'} );
Lines 3366-3372 sub UpdateTotalIssues { Link Here
3366
        return;
3366
        return;
3367
    }
3367
    }
3368
    my $biblioitem = $biblio->biblioitem;
3368
    my $biblioitem = $biblio->biblioitem;
3369
    my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField('biblioitems.totalissues', $biblio->frameworkcode);
3369
    my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField( 'biblioitems.totalissues' );
3370
    unless ($totalissuestag) {
3370
    unless ($totalissuestag) {
3371
        return 1; # There is nothing to do
3371
        return 1; # There is nothing to do
3372
    }
3372
    }
(-)a/C4/Charset.pm (-1 / +1 lines)
Lines 440-446 sub SanitizeRecord { Link Here
440
    my $record_modified = 0;
440
    my $record_modified = 0;
441
    my $frameworkcode   = C4::Biblio::GetFrameworkCode($biblionumber);
441
    my $frameworkcode   = C4::Biblio::GetFrameworkCode($biblionumber);
442
    my ( $url_field, $url_subfield ) =
442
    my ( $url_field, $url_subfield ) =
443
      C4::Biblio::GetMarcFromKohaField( 'biblioitems.url', $frameworkcode );
443
      C4::Biblio::GetMarcFromKohaField( 'biblioitems.url' );
444
    foreach my $field ( $record->fields() ) {
444
    foreach my $field ( $record->fields() ) {
445
        if ( $field->is_control_field() ) {
445
        if ( $field->is_control_field() ) {
446
            my $value           = $field->data();
446
            my $value           = $field->data();
(-)a/C4/ImportBatch.pm (-4 / +4 lines)
Lines 195-201 sub GetRecordFromImportBiblio { Link Here
195
195
196
sub EmbedItemsInImportBiblio {
196
sub EmbedItemsInImportBiblio {
197
    my ( $record, $import_record_id ) = @_;
197
    my ( $record, $import_record_id ) = @_;
198
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber", '');
198
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" );
199
    my $dbh = C4::Context->dbh;
199
    my $dbh = C4::Context->dbh;
200
    my $import_items = $dbh->selectall_arrayref(q|
200
    my $import_items = $dbh->selectall_arrayref(q|
201
        SELECT import_items.marcxml
201
        SELECT import_items.marcxml
Lines 457-463 sub AddItemsToImportBiblio { Link Here
457
    my @import_items_ids = ();
457
    my @import_items_ids = ();
458
   
458
   
459
    my $dbh = C4::Context->dbh; 
459
    my $dbh = C4::Context->dbh; 
460
    my ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",'');
460
    my ($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" );
461
    foreach my $item_field ($marc_record->field($item_tag)) {
461
    foreach my $item_field ($marc_record->field($item_tag)) {
462
        my $item_marc = MARC::Record->new();
462
        my $item_marc = MARC::Record->new();
463
        $item_marc->leader("00000    a              "); # must set Leader/09 to 'a'
463
        $item_marc->leader("00000    a              "); # must set Leader/09 to 'a'
Lines 616-622 sub BatchCommitRecords { Link Here
616
616
617
        if ($record_type eq 'biblio') {
617
        if ($record_type eq 'biblio') {
618
            # remove any item tags - rely on BatchCommitItems
618
            # remove any item tags - rely on BatchCommitItems
619
            ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",'');
619
            ($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" );
620
            foreach my $item_field ($marc_record->field($item_tag)) {
620
            foreach my $item_field ($marc_record->field($item_tag)) {
621
                $marc_record->delete_field($item_field);
621
                $marc_record->delete_field($item_field);
622
            }
622
            }
Lines 741-747 sub BatchCommitItems { Link Here
741
        my $item_marc = MARC::Record->new_from_xml( StripNonXmlChars( $row->{'marcxml'} ), 'UTF-8', $row->{'encoding'} );
741
        my $item_marc = MARC::Record->new_from_xml( StripNonXmlChars( $row->{'marcxml'} ), 'UTF-8', $row->{'encoding'} );
742
742
743
        # Delete date_due subfield as to not accidentally delete item checkout due dates
743
        # Delete date_due subfield as to not accidentally delete item checkout due dates
744
        my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.onloan', GetFrameworkCode($biblionumber) );
744
        my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.onloan' );
745
        $item_marc->field($MARCfield)->delete_subfield( code => $MARCsubfield );
745
        $item_marc->field($MARCfield)->delete_subfield( code => $MARCsubfield );
746
746
747
        my $item = TransformMarcToKoha( $item_marc );
747
        my $item = TransformMarcToKoha( $item_marc );
(-)a/C4/Items.pm (-5 / +5 lines)
Lines 156-162 sub AddItemFromMarc { Link Here
156
156
157
    # parse item hash from MARC
157
    # parse item hash from MARC
158
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
158
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
159
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
159
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
160
160
161
    my $localitemmarc = MARC::Record->new;
161
    my $localitemmarc = MARC::Record->new;
162
    $localitemmarc->append_fields( $source_item_marc->field($itemtag) );
162
    $localitemmarc->append_fields( $source_item_marc->field($itemtag) );
Lines 284-290 sub AddItemBatchFromMarc { Link Here
284
    $record = $record->clone();
284
    $record = $record->clone();
285
    # loop through the item tags and start creating items
285
    # loop through the item tags and start creating items
286
    my @bad_item_fields = ();
286
    my @bad_item_fields = ();
287
    my ($itemtag, $itemsubfield) = C4::Biblio::GetMarcFromKohaField("items.itemnumber",'');
287
    my ($itemtag, $itemsubfield) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
288
    my $item_sequence_num = 0;
288
    my $item_sequence_num = 0;
289
    ITEMFIELD: foreach my $item_field ($record->field($itemtag)) {
289
    ITEMFIELD: foreach my $item_field ($record->field($itemtag)) {
290
        $item_sequence_num++;
290
        $item_sequence_num++;
Lines 418-424 sub ModItemFromMarc { Link Here
418
    my $itemnumber = shift;
418
    my $itemnumber = shift;
419
419
420
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
420
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
421
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
421
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
422
422
423
    my $localitemmarc = MARC::Record->new;
423
    my $localitemmarc = MARC::Record->new;
424
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
424
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
Lines 1912-1918 sub _marc_from_item_hash { Link Here
1912
1912
1913
    my $item_marc = MARC::Record->new();
1913
    my $item_marc = MARC::Record->new();
1914
    foreach my $item_field ( keys %{$mungeditem} ) {
1914
    foreach my $item_field ( keys %{$mungeditem} ) {
1915
        my ( $tag, $subfield ) = C4::Biblio::GetMarcFromKohaField( $item_field, $frameworkcode );
1915
        my ( $tag, $subfield ) = C4::Biblio::GetMarcFromKohaField( $item_field );
1916
        next unless defined $tag and defined $subfield;    # skip if not mapped to MARC field
1916
        next unless defined $tag and defined $subfield;    # skip if not mapped to MARC field
1917
        my @values = split(/\s?\|\s?/, $mungeditem->{$item_field}, -1);
1917
        my @values = split(/\s?\|\s?/, $mungeditem->{$item_field}, -1);
1918
        foreach my $value (@values){
1918
        foreach my $value (@values){
Lines 2334-2340 sub PrepareItemrecordDisplay { Link Here
2334
2334
2335
    my $dbh = C4::Context->dbh;
2335
    my $dbh = C4::Context->dbh;
2336
    $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum;
2336
    $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum;
2337
    my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
2337
    my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
2338
2338
2339
    # Note: $tagslib obtained from GetMarcStructure() in 'unsafe' mode is
2339
    # Note: $tagslib obtained from GetMarcStructure() in 'unsafe' mode is
2340
    # a shared data structure. No plugin (including custom ones) should change
2340
    # a shared data structure. No plugin (including custom ones) should change
(-)a/C4/Labels/Label.pm (-1 / +1 lines)
Lines 159-165 sub _get_barcode_data { Link Here
159
        elsif ( $f =~ /^([0-9a-z]{3})(\w)(\W?).*?/ ) {
159
        elsif ( $f =~ /^([0-9a-z]{3})(\w)(\W?).*?/ ) {
160
            my ($field,$subf,$ws) = ($1,$2,$3);
160
            my ($field,$subf,$ws) = ($1,$2,$3);
161
            my $subf_data;
161
            my $subf_data;
162
            my ($itemtag, $itemsubfieldcode) = &GetMarcFromKohaField("items.itemnumber",'');
162
            my ($itemtag, $itemsubfieldcode) = &GetMarcFromKohaField( "items.itemnumber" );
163
            my @marcfield = $record->field($field);
163
            my @marcfield = $record->field($field);
164
            if(@marcfield) {
164
            if(@marcfield) {
165
                if($field eq $itemtag) {  # item-level data, we need to get the right item.
165
                if($field eq $itemtag) {  # item-level data, we need to get the right item.
(-)a/C4/Matcher.pm (-2 / +1 lines)
Lines 621-627 sub get_matches { Link Here
621
    my ($source_record, $max_matches) = @_;
621
    my ($source_record, $max_matches) = @_;
622
622
623
    my $matches = {};
623
    my $matches = {};
624
    my $marcframework_used = ''; # use the default framework
625
624
626
    my $QParser;
625
    my $QParser;
627
    $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
626
    $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
Lines 677-683 sub get_matches { Link Here
677
            else {
676
            else {
678
                foreach my $matched ( @{$searchresults} ) {
677
                foreach my $matched ( @{$searchresults} ) {
679
                    my $target_record = C4::Search::new_record_from_zebra( 'biblioserver', $matched );
678
                    my $target_record = C4::Search::new_record_from_zebra( 'biblioserver', $matched );
680
                    my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", $marcframework_used );
679
                    my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" );
681
                    my $id = ( $biblionumber_tag > 10 ) ?
680
                    my $id = ( $biblionumber_tag > 10 ) ?
682
                        $target_record->field($biblionumber_tag)->subfield($biblionumber_subfield) :
681
                        $target_record->field($biblionumber_tag)->subfield($biblionumber_subfield) :
683
                        $target_record->field($biblionumber_tag)->data();
682
                        $target_record->field($biblionumber_tag)->data();
(-)a/C4/Search.pm (-4 / +4 lines)
Lines 1883-1896 sub searchResults { Link Here
1883
    my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };
1883
    my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };
1884
1884
1885
    #search item field code
1885
    #search item field code
1886
    my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" );
1886
    my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber" );
1887
1887
1888
    ## find column names of items related to MARC
1888
    ## find column names of items related to MARC
1889
    my %subfieldstosearch;
1889
    my %subfieldstosearch;
1890
    my @columns = Koha::Database->new()->schema()->resultset('Item')->result_source->columns;
1890
    my @columns = Koha::Database->new()->schema()->resultset('Item')->result_source->columns;
1891
    for my $column ( @columns ) {
1891
    for my $column ( @columns ) {
1892
        my ( $tagfield, $tagsubfield ) =
1892
        my ( $tagfield, $tagsubfield ) =
1893
          &GetMarcFromKohaField( "items." . $column, "" );
1893
          &GetMarcFromKohaField( "items." . $column );
1894
        if ( defined $tagsubfield ) {
1894
        if ( defined $tagsubfield ) {
1895
            $subfieldstosearch{$column} = $tagsubfield;
1895
            $subfieldstosearch{$column} = $tagsubfield;
1896
        }
1896
        }
Lines 1907-1913 sub searchResults { Link Here
1907
1907
1908
    my $marcflavour = C4::Context->preference("marcflavour");
1908
    my $marcflavour = C4::Context->preference("marcflavour");
1909
    # We get the biblionumber position in MARC
1909
    # We get the biblionumber position in MARC
1910
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
1910
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField( 'biblio.biblionumber' );
1911
1911
1912
    # set stuff for XSLT processing here once, not later again for every record we retrieved
1912
    # set stuff for XSLT processing here once, not later again for every record we retrieved
1913
    my $xslfile;
1913
    my $xslfile;
Lines 2036-2042 sub searchResults { Link Here
2036
                    my $hostbiblio = GetMarcBiblio({
2036
                    my $hostbiblio = GetMarcBiblio({
2037
                        biblionumber => $hostbiblionumber,
2037
                        biblionumber => $hostbiblionumber,
2038
                        embed_items  => 1 });
2038
                        embed_items  => 1 });
2039
                    my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
2039
                    my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber' );
2040
                    if( $hostbiblio ) {
2040
                    if( $hostbiblio ) {
2041
                        my @hostitems = $hostbiblio->field($itemfield);
2041
                        my @hostitems = $hostbiblio->field($itemfield);
2042
                        foreach my $hostitem (@hostitems){
2042
                        foreach my $hostitem (@hostitems){
(-)a/C4/Serials.pm (-1 / +1 lines)
Lines 1457-1463 sub NewSubscription { Link Here
1457
    my $biblio = Koha::Biblios->find( $biblionumber );
1457
    my $biblio = Koha::Biblios->find( $biblionumber );
1458
    if ( $biblio and !$biblio->serial ) {
1458
    if ( $biblio and !$biblio->serial ) {
1459
        my $record = GetMarcBiblio({ biblionumber => $biblionumber });
1459
        my $record = GetMarcBiblio({ biblionumber => $biblionumber });
1460
        my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $biblio->frameworkcode );
1460
        my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial' );
1461
        if ($tag) {
1461
        if ($tag) {
1462
            eval { $record->field($tag)->update( $subf => 1 ); };
1462
            eval { $record->field($tag)->update( $subf => 1 ); };
1463
        }
1463
        }
(-)a/Koha/Exporter/Record.pm (-1 / +1 lines)
Lines 131-137 sub _get_biblio_for_export { Link Here
131
            item_numbers => $itemnumbers });
131
            item_numbers => $itemnumbers });
132
        if ($only_export_items_for_branches && @$only_export_items_for_branches) {
132
        if ($only_export_items_for_branches && @$only_export_items_for_branches) {
133
            my %export_items_for_branches = map { $_ => 1 } @$only_export_items_for_branches;
133
            my %export_items_for_branches = map { $_ => 1 } @$only_export_items_for_branches;
134
            my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch', '' );    # Should be GetFrameworkCode( $biblionumber )?
134
            my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch' );
135
135
136
            for my $itemfield ( $record->field($homebranchfield) ) {
136
            for my $itemfield ( $record->field($homebranchfield) ) {
137
                my $homebranch = $itemfield->subfield($homebranchsubfield);
137
                my $homebranch = $itemfield->subfield($homebranchsubfield);
(-)a/Koha/Filter/MARC/EmbedItemsAvailability.pm (-1 / +1 lines)
Lines 71-77 sub _processrecord { Link Here
71
71
72
    my $record = shift;
72
    my $record = shift;
73
73
74
    my ($biblionumber_field, $biblionumber_subfield) = GetMarcFromKohaField("biblio.biblionumber", '');
74
    my ($biblionumber_field, $biblionumber_subfield) = GetMarcFromKohaField( "biblio.biblionumber" );
75
    my $biblionumber  = ( $biblionumber_field > 9 )
75
    my $biblionumber  = ( $biblionumber_field > 9 )
76
                      ? $record->field($biblionumber_field)->subfield($biblionumber_subfield)
76
                      ? $record->field($biblionumber_field)->subfield($biblionumber_subfield)
77
                      : $record->field($biblionumber_field)->data();
77
                      : $record->field($biblionumber_field)->data();
(-)a/Koha/Filter/MARC/EmbedSeeFromHeadings.pm (-1 / +1 lines)
Lines 72-78 sub filter { Link Here
72
sub _processrecord {
72
sub _processrecord {
73
    my $record = shift;
73
    my $record = shift;
74
74
75
    my ($item_tag) = GetMarcFromKohaField("items.itemnumber", '');
75
    my ($item_tag) = GetMarcFromKohaField( "items.itemnumber" );
76
    $item_tag ||= '';
76
    $item_tag ||= '';
77
77
78
    foreach my $field ( $record->fields() ) {
78
    foreach my $field ( $record->fields() ) {
(-)a/Koha/FrameworkPlugin.pm (-1 lines)
Lines 115-121 use Modern::Perl; Link Here
115
use base qw(Class::Accessor);
115
use base qw(Class::Accessor);
116
116
117
use C4::Context;
117
use C4::Context;
118
use C4::Biblio qw/GetMarcFromKohaField/;
119
118
120
__PACKAGE__->mk_ro_accessors( qw|
119
__PACKAGE__->mk_ro_accessors( qw|
121
    name path errstr javascript noclick
120
    name path errstr javascript noclick
(-)a/Koha/SearchEngine/Search.pm (-1 / +1 lines)
Lines 68-74 extract_biblionumber method of the specific search engine. Link Here
68
sub extract_biblionumber {
68
sub extract_biblionumber {
69
    my ( $record ) = @_;
69
    my ( $record ) = @_;
70
    return if ref($record) ne 'MARC::Record';
70
    return if ref($record) ne 'MARC::Record';
71
    my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( 'biblio.biblionumber', '' );
71
    my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( 'biblio.biblionumber' );
72
    if( $biblionumbertagfield < 10 ) {
72
    if( $biblionumbertagfield < 10 ) {
73
        my $controlfield = $record->field( $biblionumbertagfield );
73
        my $controlfield = $record->field( $biblionumbertagfield );
74
        return $controlfield ? $controlfield->data : undef;
74
        return $controlfield ? $controlfield->data : undef;
(-)a/acqui/addorderiso2709.pl (-1 / +1 lines)
Lines 182-188 if ($op eq ""){ Link Here
182
            my $bibitemnum;
182
            my $bibitemnum;
183
183
184
            # remove ISBN -
184
            # remove ISBN -
185
            my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn', '' );
185
            my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn' );
186
            if ( $marcrecord->field($isbnfield) ) {
186
            if ( $marcrecord->field($isbnfield) ) {
187
                foreach my $field ( $marcrecord->field($isbnfield) ) {
187
                foreach my $field ( $marcrecord->field($isbnfield) ) {
188
                    foreach my $subfield ( $field->subfield($isbnsubfield) ) {
188
                    foreach my $subfield ( $field->subfield($isbnsubfield) ) {
(-)a/acqui/finishreceive.pl (-1 / +1 lines)
Lines 82-88 if ($quantityrec > $origquantityrec ) { Link Here
82
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
82
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
83
        if ( @affects ) {
83
        if ( @affects ) {
84
            my $frameworkcode = GetFrameworkCode($biblionumber);
84
            my $frameworkcode = GetFrameworkCode($biblionumber);
85
            my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $frameworkcode );
85
            my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber' );
86
            for my $in ( @received_items ) {
86
            for my $in ( @received_items ) {
87
                my $item = C4::Items::GetMarcItem( $biblionumber, $in );
87
                my $item = C4::Items::GetMarcItem( $biblionumber, $in );
88
                for my $affect ( @affects ) {
88
                for my $affect ( @affects ) {
(-)a/acqui/neworderempty.pl (-4 / +4 lines)
Lines 177-183 if ( $ordernumber eq '' and defined $params->{'breedingid'}){ Link Here
177
177
178
my ( @order_user_ids, @order_users, @catalog_details );
178
my ( @order_user_ids, @order_users, @catalog_details );
179
our $tagslib = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
179
our $tagslib = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
180
my ( $itemnumber_tag, $itemnumber_subtag ) = GetMarcFromKohaField( 'items.itemnumber', 'ACQ' );
180
my ( $itemnumber_tag, $itemnumber_subtag ) = GetMarcFromKohaField( 'items.itemnumber' );
181
if ( not $ordernumber ) {    # create order
181
if ( not $ordernumber ) {    # create order
182
    $new = 'yes';
182
    $new = 'yes';
183
183
Lines 388-394 if ( defined $from_subscriptionid ) { Link Here
388
}
388
}
389
389
390
# Find the items.barcode subfield for barcode validations
390
# Find the items.barcode subfield for barcode validations
391
my (undef, $barcode_subfield) = GetMarcFromKohaField('items.barcode', '');
391
my (undef, $barcode_subfield) = GetMarcFromKohaField( 'items.barcode' );
392
392
393
# fill template
393
# fill template
394
$template->param(
394
$template->param(
Lines 491-497 sub MARCfindbreeding { Link Here
491
    # remove the - in isbn, koha store isbn without any -
491
    # remove the - in isbn, koha store isbn without any -
492
    if ($marc) {
492
    if ($marc) {
493
        my $record = MARC::Record->new_from_usmarc($marc);
493
        my $record = MARC::Record->new_from_usmarc($marc);
494
        my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField('biblioitems.isbn','');
494
        my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField( 'biblioitems.isbn' );
495
        if ( $record->field($isbnfield) ) {
495
        if ( $record->field($isbnfield) ) {
496
            foreach my $field ( $record->field($isbnfield) ) {
496
            foreach my $field ( $record->field($isbnfield) ) {
497
                foreach my $subfield ( $field->subfield($isbnsubfield) ) {
497
                foreach my $subfield ( $field->subfield($isbnsubfield) ) {
Lines 523-529 sub MARCfindbreeding { Link Here
523
            if (    C4::Context->preference("z3950NormalizeAuthor")
523
            if (    C4::Context->preference("z3950NormalizeAuthor")
524
                and C4::Context->preference("z3950AuthorAuthFields") )
524
                and C4::Context->preference("z3950AuthorAuthFields") )
525
            {
525
            {
526
                my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author", '');
526
                my ( $tag, $subfield ) = GetMarcFromKohaField( "biblio.author" );
527
527
528
                my $auth_fields =
528
                my $auth_fields =
529
                C4::Context->preference("z3950AuthorAuthFields");
529
                C4::Context->preference("z3950AuthorAuthFields");
(-)a/catalogue/MARCdetail.pl (-1 / +1 lines)
Lines 280-286 foreach my $field (@fields) { Link Here
280
    push @item_loop, $item if $item;
280
    push @item_loop, $item if $item;
281
}
281
}
282
282
283
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$frameworkcode);
283
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField( "items.holdingbranch" );
284
@item_loop = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @item_loop;
284
@item_loop = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @item_loop;
285
285
286
@item_subfield_codes = uniq @item_subfield_codes;
286
@item_subfield_codes = uniq @item_subfield_codes;
(-)a/cataloguing/addbiblio.pl (-10 / +10 lines)
Lines 72-78 sub MARCfindbreeding { Link Here
72
    # remove the - in isbn, koha store isbn without any -
72
    # remove the - in isbn, koha store isbn without any -
73
    if ($marc) {
73
    if ($marc) {
74
        my $record = MARC::Record->new_from_usmarc($marc);
74
        my $record = MARC::Record->new_from_usmarc($marc);
75
        my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField('biblioitems.isbn','');
75
        my ($isbnfield,$isbnsubfield) = GetMarcFromKohaField( 'biblioitems.isbn' );
76
        if ( $record->field($isbnfield) ) {
76
        if ( $record->field($isbnfield) ) {
77
            foreach my $field ( $record->field($isbnfield) ) {
77
            foreach my $field ( $record->field($isbnfield) ) {
78
                foreach my $subfield ( $field->subfield($isbnsubfield) ) {
78
                foreach my $subfield ( $field->subfield($isbnsubfield) ) {
Lines 105-111 sub MARCfindbreeding { Link Here
105
                and C4::Context->preference("z3950AuthorAuthFields")
105
                and C4::Context->preference("z3950AuthorAuthFields")
106
                and C4::Context->preference("marcflavour") eq 'UNIMARC' )
106
                and C4::Context->preference("marcflavour") eq 'UNIMARC' )
107
            {
107
            {
108
                my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author", '');
108
                my ( $tag, $subfield ) = GetMarcFromKohaField( "biblio.author" );
109
109
110
                my $auth_fields =
110
                my $auth_fields =
111
                  C4::Context->preference("z3950AuthorAuthFields");
111
                  C4::Context->preference("z3950AuthorAuthFields");
Lines 249-259 sub CreateKey { Link Here
249
249
250
sub GetMandatoryFieldZ3950 {
250
sub GetMandatoryFieldZ3950 {
251
    my $frameworkcode = shift;
251
    my $frameworkcode = shift;
252
    my @isbn   = GetMarcFromKohaField('biblioitems.isbn',$frameworkcode);
252
    my @isbn   = GetMarcFromKohaField( 'biblioitems.isbn' );
253
    my @title  = GetMarcFromKohaField('biblio.title',$frameworkcode);
253
    my @title  = GetMarcFromKohaField( 'biblio.title' );
254
    my @author = GetMarcFromKohaField('biblio.author',$frameworkcode);
254
    my @author = GetMarcFromKohaField( 'biblio.author' );
255
    my @issn   = GetMarcFromKohaField('biblioitems.issn',$frameworkcode);
255
    my @issn   = GetMarcFromKohaField( 'biblioitems.issn' );
256
    my @lccn   = GetMarcFromKohaField('biblioitems.lccn',$frameworkcode);
256
    my @lccn   = GetMarcFromKohaField( 'biblioitems.lccn' );
257
    
257
    
258
    return {
258
    return {
259
        $isbn[0].$isbn[1]     => 'isbn',
259
        $isbn[0].$isbn[1]     => 'isbn',
Lines 808-817 if ($biblionumber) { Link Here
808
808
809
    # if it's a modif, retrieve bibli and biblioitem numbers for the future modification of old-DB.
809
    # if it's a modif, retrieve bibli and biblioitem numbers for the future modification of old-DB.
810
    ( $biblionumbertagfield, $biblionumbertagsubfield ) =
810
    ( $biblionumbertagfield, $biblionumbertagsubfield ) =
811
	&GetMarcFromKohaField( "biblio.biblionumber", $frameworkcode );
811
        &GetMarcFromKohaField( "biblio.biblionumber" );
812
    ( $biblioitemnumtagfield, $biblioitemnumtagsubfield ) =
812
    ( $biblioitemnumtagfield, $biblioitemnumtagsubfield ) =
813
	&GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode );
813
        &GetMarcFromKohaField( "biblioitems.biblioitemnumber" );
814
	    
814
815
    # search biblioitems value
815
    # search biblioitems value
816
    my $sth =  $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?");
816
    my $sth =  $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?");
817
    $sth->execute($biblionumber);
817
    $sth->execute($biblionumber);
(-)a/cataloguing/additem.pl (-10 / +10 lines)
Lines 95-101 sub set_item_default_location { Link Here
95
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript
95
# NOTE: 'incremental' is the ONLY autoBarcode option available to those not using javascript
96
sub _increment_barcode {
96
sub _increment_barcode {
97
    my ($record, $frameworkcode) = @_;
97
    my ($record, $frameworkcode) = @_;
98
    my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
98
    my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" );
99
    unless ($record->field($tagfield)->subfield($tagsubfield)) {
99
    unless ($record->field($tagfield)->subfield($tagsubfield)) {
100
        my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items");
100
        my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items");
101
        $sth_barcode->execute;
101
        $sth_barcode->execute;
Lines 353-359 sub removeFieldsForPrefill { Link Here
353
    my $item = shift;
353
    my $item = shift;
354
354
355
    # Getting item tag
355
    # Getting item tag
356
    my ($tag, $subtag) = GetMarcFromKohaField("items.barcode", '');
356
    my ($tag, $subtag) = GetMarcFromKohaField( "items.barcode" );
357
357
358
    # Getting list of subfields to keep
358
    # Getting list of subfields to keep
359
    my $subfieldsToUseWhenPrefill = C4::Context->preference('SubfieldsToUseWhenPrefill');
359
    my $subfieldsToUseWhenPrefill = C4::Context->preference('SubfieldsToUseWhenPrefill');
Lines 526-532 if ($op eq "additem") { Link Here
526
        }
526
        }
527
        else {
527
        else {
528
            # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
528
            # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
529
            my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
529
            my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" );
530
            my $fieldItem = $itemrecord->field($tagfield);
530
            my $fieldItem = $itemrecord->field($tagfield);
531
            $itemrecord->delete_field($fieldItem);
531
            $itemrecord->delete_field($fieldItem);
532
            $fieldItem->delete_subfields($tagsubfield);
532
            $fieldItem->delete_subfields($tagsubfield);
Lines 542-549 if ($op eq "additem") { Link Here
542
        my $barcodeobj = C4::Barcodes->new;
542
        my $barcodeobj = C4::Barcodes->new;
543
        my $copynumber = $addedolditem->{'copynumber'};
543
        my $copynumber = $addedolditem->{'copynumber'};
544
        my $oldbarcode = $addedolditem->{'barcode'};
544
        my $oldbarcode = $addedolditem->{'barcode'};
545
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
545
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" );
546
        my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField("items.copynumber",$frameworkcode);
546
        my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField( "items.copynumber" );
547
547
548
    # If there is a barcode and we can't find their new values, we can't add multiple copies
548
    # If there is a barcode and we can't find their new values, we can't add multiple copies
549
	my $testbarcode;
549
	my $testbarcode;
Lines 629-635 if ($op eq "additem") { Link Here
629
    }
629
    }
630
    else {
630
    else {
631
        # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
631
        # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
632
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
632
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" );
633
        my $fieldItem = $itemrecord->field($tagfield);
633
        my $fieldItem = $itemrecord->field($tagfield);
634
        $itemrecord->delete_field($fieldItem);
634
        $itemrecord->delete_field($fieldItem);
635
        $fieldItem->delete_subfields($tagsubfield);
635
        $fieldItem->delete_subfields($tagsubfield);
Lines 748-755 my $temp = GetMarcBiblio({ biblionumber => $biblionumber }); Link Here
748
my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
748
my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
749
my @big_array;
749
my @big_array;
750
#---- finds where items.itemnumber is stored
750
#---- finds where items.itemnumber is stored
751
my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", $frameworkcode);
751
my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
752
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", $frameworkcode);
752
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" );
753
C4::Biblio::EmbedItemsInMarcBiblio({
753
C4::Biblio::EmbedItemsInMarcBiblio({
754
    marc_record  => $temp,
754
    marc_record  => $temp,
755
    biblionumber => $biblionumber });
755
    biblionumber => $biblionumber });
Lines 771-777 if ( C4::Context->preference('EasyAnalyticalRecords') ) { Link Here
771
                biblionumber => $hostbiblionumber,
771
                biblionumber => $hostbiblionumber,
772
                embed_items  => 1 });
772
                embed_items  => 1 });
773
            if ($hostrecord) {
773
            if ($hostrecord) {
774
                my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
774
                my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber' );
775
                foreach my $hostitem ($hostrecord->field($itemfield)){
775
                foreach my $hostitem ($hostrecord->field($itemfield)){
776
                    if ($hostitem->subfield('9') eq $hostfield->subfield('9')){
776
                    if ($hostitem->subfield('9') eq $hostfield->subfield('9')){
777
                        push (@fields, $hostitem);
777
                        push (@fields, $hostitem);
Lines 831-837 foreach my $field (@fields) { Link Here
831
    }
831
    }
832
}
832
}
833
833
834
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$frameworkcode);
834
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField( "items.holdingbranch" );
835
@big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
835
@big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
836
836
837
# now, construct template !
837
# now, construct template !
(-)a/cataloguing/value_builder/barcode.pl (-2 / +3 lines)
Lines 24-29 use Modern::Perl; Link Here
24
24
25
use C4::Context;
25
use C4::Context;
26
use C4::Barcodes::ValueBuilder;
26
use C4::Barcodes::ValueBuilder;
27
use C4::Biblio qw/GetMarcFromKohaField/;
27
use Koha::DateUtils;
28
use Koha::DateUtils;
28
29
29
use Algorithm::CheckDigits;
30
use Algorithm::CheckDigits;
Lines 37-44 my $builder = sub { Link Here
37
38
38
	# find today's date
39
	# find today's date
39
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
40
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
40
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField("items.barcode", '');
41
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField( "items.barcode" );
41
    ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField("items.homebranch", '');
42
    ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField( "items.homebranch" );
42
43
43
	my $nextnum;
44
	my $nextnum;
44
    my $scr;
45
    my $scr;
(-)a/cataloguing/value_builder/barcode_manual.pl (-2 / +2 lines)
Lines 38-45 my $builder = sub { Link Here
38
38
39
# find today's date
39
# find today's date
40
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
40
    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
41
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField("items.barcode", '');
41
    ($args{tag},$args{subfield})       =  GetMarcFromKohaField( "items.barcode" );
42
    ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField("items.homebranch", '');
42
    ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField( "items.homebranch" );
43
43
44
    my $nextnum;
44
    my $nextnum;
45
    my $scr;
45
    my $scr;
(-)a/circ/branchoverdues.pl (-1 / +1 lines)
Lines 66-72 my @overduesloop; Link Here
66
my @getoverdues = GetOverduesForBranch( $default, $location );
66
my @getoverdues = GetOverduesForBranch( $default, $location );
67
$debug and warn "HERE : $default / $location" . Dumper(@getoverdues);
67
$debug and warn "HERE : $default / $location" . Dumper(@getoverdues);
68
# search for location authorised value
68
# search for location authorised value
69
my ($tag,$subfield) = GetMarcFromKohaField('items.location','');
69
my ($tag,$subfield) = GetMarcFromKohaField( 'items.location' );
70
my $tagslib = &GetMarcStructure(1,'');
70
my $tagslib = &GetMarcStructure(1,'');
71
if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
71
if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
72
    my $values= GetAuthorisedValues($tagslib->{$tag}->{$subfield}->{authorised_value});
72
    my $values= GetAuthorisedValues($tagslib->{$tag}->{$subfield}->{authorised_value});
(-)a/misc/batchImportMARCWithBiblionumbers.pl (-1 / +1 lines)
Lines 53-59 my $fh = IO::File->new($input_marc_file); # don't let MARC::Batch open the file, Link Here
53
my $batch = MARC::Batch->new( 'USMARC', $fh );
53
my $batch = MARC::Batch->new( 'USMARC', $fh );
54
$batch->warnings_off();
54
$batch->warnings_off();
55
$batch->strict_off();
55
$batch->strict_off();
56
my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
56
my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField( "biblio.biblionumber" );
57
57
58
my $i=0;
58
my $i=0;
59
while ( my $record = $batch->next() ) {
59
while ( my $record = $batch->next() ) {
(-)a/misc/batchRebuildBiblioTables.pl (-1 / +1 lines)
Lines 53-59 $|=1; # flushes output Link Here
53
$starttime = gettimeofday;
53
$starttime = gettimeofday;
54
54
55
#1st of all, find item MARC tag.
55
#1st of all, find item MARC tag.
56
my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.itemnumber",'');
56
my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
57
# $dbh->do("lock tables biblio write, biblioitems write, items write, marc_biblio write, marc_subfield_table write, marc_blob_subfield write, marc_word write, marc_subfield_structure write");
57
# $dbh->do("lock tables biblio write, biblioitems write, items write, marc_biblio write, marc_subfield_table write, marc_blob_subfield write, marc_word write, marc_subfield_structure write");
58
my $sth = $dbh->prepare("SELECT biblionumber FROM biblio");
58
my $sth = $dbh->prepare("SELECT biblionumber FROM biblio");
59
$sth->execute;
59
$sth->execute;
(-)a/misc/batchRebuildItemsTables.pl (-1 / +1 lines)
Lines 57-63 my $mergelimit = C4::Context->preference('AuthorityMergeLimit'); Link Here
57
$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'");
57
$dbh->do("UPDATE systempreferences SET value=0 WHERE variable='CataloguingLog'");
58
$dbh->do("UPDATE systempreferences SET value=0 where variable='AuthorityMergeLimit'");
58
$dbh->do("UPDATE systempreferences SET value=0 where variable='AuthorityMergeLimit'");
59
$dbh->commit() unless $test_parameter;
59
$dbh->commit() unless $test_parameter;
60
my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber", '' );
60
my ( $itemfield, $itemnumbersubfield ) = &GetMarcFromKohaField( "items.itemnumber" );
61
61
62
#dbh query init
62
#dbh query init
63
my $query =
63
my $query =
(-)a/misc/migration_tools/22_to_30/missing090field.pl (-2 / +2 lines)
Lines 37-44 sub MARCmodbiblionumber{ Link Here
37
    
37
    
38
    return unless $record;
38
    return unless $record;
39
39
40
    my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
40
    my ($tagfield,$biblionumtagsubfield) = &GetMarcFromKohaField( "biblio.biblionumber" );
41
    my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField("biblio.biblioitemnumber","");
41
    my ($tagfield2,$biblioitemtagsubfield) = &GetMarcFromKohaField( "biblio.biblioitemnumber" );
42
        
42
        
43
    my $update=0;
43
    my $update=0;
44
    if (defined $record) {
44
    if (defined $record) {
(-)a/misc/migration_tools/bulkmarcimport.pl (-2 / +2 lines)
Lines 240-246 if ($authorities){ Link Here
240
}
240
}
241
else {
241
else {
242
   ( $tagid, $subfieldid ) =
242
   ( $tagid, $subfieldid ) =
243
            GetMarcFromKohaField( "biblio.biblionumber", $framework );
243
            GetMarcFromKohaField( "biblio.biblionumber" );
244
	$tagid||="001";
244
	$tagid||="001";
245
}
245
}
246
246
Lines 506-512 RECORD: while ( ) { Link Here
506
			}
506
			}
507
            if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) {
507
            if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) {
508
                # Find the record called 'barcode'
508
                # Find the record called 'barcode'
509
                my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField('items.barcode', $framework);
509
                my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField( 'items.barcode' );
510
                # Now remove any items that didn't have a duplicate_barcode error,
510
                # Now remove any items that didn't have a duplicate_barcode error,
511
                # erase the barcodes on items that did, and re-add those items.
511
                # erase the barcodes on items that did, and re-add those items.
512
                my %dupes;
512
                my %dupes;
(-)a/misc/migration_tools/rebuild_zebra.pl (-3 / +3 lines)
Lines 171-178 my $authorityserverdir = C4::Context->zebraconfig('authorityserver')->{directory Link Here
171
171
172
my $kohadir = C4::Context->config('intranetdir');
172
my $kohadir = C4::Context->config('intranetdir');
173
173
174
my ($biblionumbertagfield,$biblionumbertagsubfield) = C4::Biblio::GetMarcFromKohaField("biblio.biblionumber","");
174
my ($biblionumbertagfield,$biblionumbertagsubfield) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" );
175
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = C4::Biblio::GetMarcFromKohaField("biblioitems.biblioitemnumber","");
175
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = C4::Biblio::GetMarcFromKohaField( "biblioitems.biblioitemnumber" );
176
176
177
my $marcxml_open = q{<?xml version="1.0" encoding="UTF-8"?>
177
my $marcxml_open = q{<?xml version="1.0" encoding="UTF-8"?>
178
<collection xmlns="http://www.loc.gov/MARC21/slim">
178
<collection xmlns="http://www.loc.gov/MARC21/slim">
Lines 495-501 sub export_marc_records_from_sth { Link Here
495
    print {$fh} $marcxml_open;
495
    print {$fh} $marcxml_open;
496
496
497
    my $i = 0;
497
    my $i = 0;
498
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField("items.itemnumber",'');
498
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
499
    while (my ($record_number) = $sth->fetchrow_array) {
499
    while (my ($record_number) = $sth->fetchrow_array) {
500
        print "." if ( $verbose_logging );
500
        print "." if ( $verbose_logging );
501
        print "\r$i" unless ($i++ %100 or !$verbose_logging);
501
        print "\r$i" unless ($i++ %100 or !$verbose_logging);
(-)a/opac/opac-MARCdetail.pl (-3 / +3 lines)
Lines 105-111 my @all_items = GetItemsInfo($biblionumber); Link Here
105
my $biblio = Koha::Biblios->find( $biblionumber );
105
my $biblio = Koha::Biblios->find( $biblionumber );
106
my $framework = $biblio ? $biblio->frameworkcode : q{};
106
my $framework = $biblio ? $biblio->frameworkcode : q{};
107
my $tagslib = &GetMarcStructure( 0, $framework );
107
my $tagslib = &GetMarcStructure( 0, $framework );
108
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework);
108
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' );
109
my @nonhiddenitems = $record->field($tag_itemnumber);
109
my @nonhiddenitems = $record->field($tag_itemnumber);
110
if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) {
110
if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) {
111
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
111
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
Lines 129-135 if(my $cart_list = $query->cookie("bib_list")){ Link Here
129
    }
129
    }
130
}
130
}
131
131
132
my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$framework);
132
my ($bt_tag,$bt_subtag) = GetMarcFromKohaField( 'biblio.title' );
133
$template->param(
133
$template->param(
134
    bibliotitle => $biblio->title,
134
    bibliotitle => $biblio->title,
135
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
135
) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
Lines 307-313 foreach my $field (@fields) { Link Here
307
    push @item_loop, $item if $item;
307
    push @item_loop, $item if $item;
308
}
308
}
309
my ( $holdingbrtagf, $holdingbrtagsubf ) =
309
my ( $holdingbrtagf, $holdingbrtagsubf ) =
310
  &GetMarcFromKohaField( "items.holdingbranch", $framework );
310
  &GetMarcFromKohaField( "items.holdingbranch" );
311
@item_loop =
311
@item_loop =
312
  sort { ($a->{$holdingbrtagsubf}||'') cmp ($b->{$holdingbrtagsubf}||'') } @item_loop;
312
  sort { ($a->{$holdingbrtagsubf}||'') cmp ($b->{$holdingbrtagsubf}||'') } @item_loop;
313
313
(-)a/serials/serials-edit.pl (-7 / +1 lines)
Lines 340-352 if ( $op and $op eq 'serialchangestatus' ) { Link Here
340
                    #New Item
340
                    #New Item
341
341
342
                  # if autoBarcode is set to 'incremental', calculate barcode...
342
                  # if autoBarcode is set to 'incremental', calculate barcode...
343
                    my ( $barcodetagfield, $barcodetagsubfield ) =
343
                    my ( $barcodetagfield, $barcodetagsubfield ) = GetMarcFromKohaField( 'items.barcode' );
344
                      GetMarcFromKohaField(
345
                        'items.barcode',
346
                        GetFrameworkCode(
347
                            $serialdatalist[0]->{'biblionumber'}
348
                        )
349
                      );
350
                    if ( C4::Context->preference('autoBarcode') eq
344
                    if ( C4::Context->preference('autoBarcode') eq
351
                        'incremental' )
345
                        'incremental' )
352
                    {
346
                    {
(-)a/svc/bib (-1 / +1 lines)
Lines 98-104 sub update_bib { Link Here
98
    } else {
98
    } else {
99
        my $fullrecord = $record->clone();
99
        my $fullrecord = $record->clone();
100
        my ( $itemtag, $itemsubfield ) =
100
        my ( $itemtag, $itemsubfield ) =
101
          GetMarcFromKohaField( "items.itemnumber", '' );
101
          GetMarcFromKohaField( "items.itemnumber" );
102
102
103
        # delete any item tags
103
        # delete any item tags
104
        foreach my $field ( $record->field($itemtag) ) {
104
        foreach my $field ( $record->field($itemtag) ) {
(-)a/svc/new_bib (-1 / +1 lines)
Lines 70-76 sub add_bib { Link Here
70
70
71
        # delete any item tags
71
        # delete any item tags
72
        my ( $itemtag, $itemsubfield ) =
72
        my ( $itemtag, $itemsubfield ) =
73
          GetMarcFromKohaField( "items.itemnumber", '' );
73
          GetMarcFromKohaField( "items.itemnumber" );
74
        foreach my $field ( $record->field($itemtag) ) {
74
        foreach my $field ( $record->field($itemtag) ) {
75
            $record->delete_field($field);
75
            $record->delete_field($field);
76
        }
76
        }
(-)a/t/db_dependent/Biblio.t (-1 / +1 lines)
Lines 319-325 sub run_tests { Link Here
319
        biblionumber => $biblionumber,
319
        biblionumber => $biblionumber,
320
        embed_items  => 0 });
320
        embed_items  => 0 });
321
    my $frameworkcode = GetFrameworkCode($biblionumber);
321
    my $frameworkcode = GetFrameworkCode($biblionumber);
322
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode );
322
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" );
323
    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag;
323
    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag;
324
    my $biblioitemnumbertotest;
324
    my $biblioitemnumbertotest;
325
    if ( $biblioitem_tag < 10 ) {
325
    if ( $biblioitem_tag < 10 ) {
(-)a/t/db_dependent/Biblio/TransformHtmlToMarc.t (-1 / +1 lines)
Lines 7-13 use Test::More tests => 2; Link Here
7
7
8
use C4::Biblio;
8
use C4::Biblio;
9
9
10
my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", '' );
10
my ( $biblionumbertagfield, $biblionumbertagsubfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" );
11
subtest 'Biblio record' => sub {
11
subtest 'Biblio record' => sub {
12
    plan tests => 10;
12
    plan tests => 10;
13
    my $leader = '00203nam a2200097   4500';
13
    my $leader = '00203nam a2200097   4500';
(-)a/t/db_dependent/Charset.t (-1 / +1 lines)
Lines 21-27 $dbh->do(qq| Link Here
21
    INSERT INTO marc_subfield_structure(frameworkcode,kohafield,tagfield,tagsubfield)
21
    INSERT INTO marc_subfield_structure(frameworkcode,kohafield,tagfield,tagsubfield)
22
    VALUES ('$frameworkcode', 'biblioitems.url', '856', 'u')
22
    VALUES ('$frameworkcode', 'biblioitems.url', '856', 'u')
23
|);
23
|);
24
my ( $url_field, $url_subfield ) = C4::Biblio::GetMarcFromKohaField('biblioitems.url', $frameworkcode);
24
my ( $url_field, $url_subfield ) = C4::Biblio::GetMarcFromKohaField( 'biblioitems.url' );
25
25
26
my $title = q|My title & a word & another word|;
26
my $title = q|My title & a word & another word|;
27
my $url = q|http://www.example.org/index.pl?arg1=val1&amp;arg2=val2|;
27
my $url = q|http://www.example.org/index.pl?arg1=val1&amp;arg2=val2|;
(-)a/t/db_dependent/Circulation/GetTopIssues.t (-2 / +2 lines)
Lines 117-124 $schema->storage->txn_rollback(); Link Here
117
sub create_biblio {
117
sub create_biblio {
118
    my ($title, $itemtype) = @_;
118
    my ($title, $itemtype) = @_;
119
119
120
    my ($title_tag, $title_subfield) = GetMarcFromKohaField('biblio.title', '');
120
    my ($title_tag, $title_subfield) = GetMarcFromKohaField( 'biblio.title' );
121
    my ($it_tag, $it_subfield) = GetMarcFromKohaField('biblioitems.itemtype', '');
121
    my ($it_tag, $it_subfield) = GetMarcFromKohaField( 'biblioitems.itemtype' );
122
122
123
    my $record = MARC::Record->new();
123
    my $record = MARC::Record->new();
124
    $record->append_fields(
124
    $record->append_fields(
(-)a/t/db_dependent/Filter_MARC_ViewPolicy.t (-3 / +3 lines)
Lines 59-65 sub run_hiding_tests { Link Here
59
    };
59
    };
60
60
61
    my ( $isbn_field, $isbn_subfield ) =
61
    my ( $isbn_field, $isbn_subfield ) =
62
      GetMarcFromKohaField( 'biblioitems.isbn', q{} );
62
      GetMarcFromKohaField( 'biblioitems.isbn' );
63
    my $update_sql = q{UPDATE marc_subfield_structure SET hidden=? };
63
    my $update_sql = q{UPDATE marc_subfield_structure SET hidden=? };
64
    my $sth        = $dbh->prepare($update_sql);
64
    my $sth        = $dbh->prepare($update_sql);
65
    foreach my $hidden_value (@valid_hidden_values) {
65
    foreach my $hidden_value (@valid_hidden_values) {
Lines 170-178 sub run_hiding_tests { Link Here
170
sub create_marc_record {
170
sub create_marc_record {
171
171
172
    my ( $title_field, $title_subfield ) =
172
    my ( $title_field, $title_subfield ) =
173
      GetMarcFromKohaField( 'biblio.title', q{} );
173
      GetMarcFromKohaField( 'biblio.title' );
174
    my ( $isbn_field, $isbn_subfield ) =
174
    my ( $isbn_field, $isbn_subfield ) =
175
      GetMarcFromKohaField( 'biblioitems.isbn', q{} );
175
      GetMarcFromKohaField( 'biblioitems.isbn' );
176
    my $isbn        = '0590353403';
176
    my $isbn        = '0590353403';
177
    my $title       = 'Foundation';
177
    my $title       = 'Foundation';
178
    my $marc_record = MARC::Record->new;
178
    my $marc_record = MARC::Record->new;
(-)a/t/db_dependent/ImportBatch.t (-1 / +1 lines)
Lines 86-92 my $record = MARC::Record->new; Link Here
86
my $original_record = MARC::Record->new;
86
my $original_record = MARC::Record->new;
87
$record->leader('03174nam a2200445 a 4500');
87
$record->leader('03174nam a2200445 a 4500');
88
$original_record->leader('03174nam a2200445 a 4500');
88
$original_record->leader('03174nam a2200445 a 4500');
89
my ($item_tag, $item_subfield) = C4::Biblio::GetMarcFromKohaField('items.itemnumber','');
89
my ($item_tag, $item_subfield) = C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' );
90
my @fields = (
90
my @fields = (
91
    MARC::Field->new(
91
    MARC::Field->new(
92
        100, '1', ' ',
92
        100, '1', ' ',
(-)a/t/db_dependent/Items.t (-2 / +2 lines)
Lines 487-493 subtest 'SearchItems test' => sub { Link Here
487
    ok($found, "item1 found");
487
    ok($found, "item1 found");
488
488
489
    my $frameworkcode = q||;
489
    my $frameworkcode = q||;
490
    my ($itemfield) = GetMarcFromKohaField('items.itemnumber', $frameworkcode);
490
    my ($itemfield) = GetMarcFromKohaField( 'items.itemnumber' );
491
491
492
    # Create item subfield 'z' without link
492
    # Create item subfield 'z' without link
493
    $dbh->do('DELETE FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=?', undef, $itemfield, $frameworkcode);
493
    $dbh->do('DELETE FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=?', undef, $itemfield, $frameworkcode);
Lines 640-646 subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub { Link Here
640
    t::lib::Mocks::mock_preference( 'OpacHiddenItems', '' );
640
    t::lib::Mocks::mock_preference( 'OpacHiddenItems', '' );
641
641
642
    my ($itemfield) =
642
    my ($itemfield) =
643
      C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' );
643
      C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' );
644
    my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber });
644
    my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber });
645
    warning_is { C4::Biblio::EmbedItemsInMarcBiblio() }
645
    warning_is { C4::Biblio::EmbedItemsInMarcBiblio() }
646
    { carped => 'EmbedItemsInMarcBiblio: No MARC record passed' },
646
    { carped => 'EmbedItemsInMarcBiblio: No MARC record passed' },
(-)a/t/db_dependent/Items/AutomaticItemModificationByAge.t (-1 / +1 lines)
Lines 66-72 my ($item_bibnum, $item_bibitemnum, $itemnumber) = C4::Items::AddItem( Link Here
66
my $item = Koha::Items->find( $itemnumber );
66
my $item = Koha::Items->find( $itemnumber );
67
is ( $item->new_status, 'new_value', q|AddItem insert the 'new_status' field| );
67
is ( $item->new_status, 'new_value', q|AddItem insert the 'new_status' field| );
68
68
69
my ( $tagfield, undef ) = GetMarcFromKohaField('items.itemnumber', $frameworkcode);
69
my ( $tagfield, undef ) = GetMarcFromKohaField( 'items.itemnumber' );
70
my $marc_item = C4::Items::GetMarcItem( $biblionumber, $itemnumber );
70
my $marc_item = C4::Items::GetMarcItem( $biblionumber, $itemnumber );
71
is( $marc_item->subfield($tagfield, $new_tagfield), 'new_value', q|Koha mapping is correct|);
71
is( $marc_item->subfield($tagfield, $new_tagfield), 'new_value', q|Koha mapping is correct|);
72
72
(-)a/t/db_dependent/Items/GetItemsForInventory.t (-1 / +1 lines)
Lines 287-293 sub OldWay { # FIXME Do we really still need so much code to check results ?? Link Here
287
        # Auth values
287
        # Auth values
288
        foreach my $field (sort keys %$row) {
288
        foreach my $field (sort keys %$row) {
289
            # If the koha field is mapped to a marc field
289
            # If the koha field is mapped to a marc field
290
            my ($f, $sf) = C4::Biblio::GetMarcFromKohaField("items.$field", $row->{'frameworkcode'});
290
            my ($f, $sf) = C4::Biblio::GetMarcFromKohaField( "items.$field" );
291
            if (defined($f) and defined($sf)) {
291
            if (defined($f) and defined($sf)) {
292
                # We replace the code with it's description
292
                # We replace the code with it's description
293
                my $avs;
293
                my $avs;
(-)a/t/db_dependent/Koha/Filter/EmbedItemsAvailability.t (-2 / +2 lines)
Lines 40-46 subtest 'EmbedItemsAvailability tests' => sub { Link Here
40
40
41
    my $biblio = Test::MockModule->new('C4::Biblio');
41
    my $biblio = Test::MockModule->new('C4::Biblio');
42
    $biblio->mock( 'GetMarcFromKohaField', sub {
42
    $biblio->mock( 'GetMarcFromKohaField', sub {
43
        my ( $kohafield, $frameworkcode ) = @_;
43
        my ( $kohafield ) = @_;
44
        if ( $kohafield eq 'biblio.biblionumber' ) {
44
        if ( $kohafield eq 'biblio.biblionumber' ) {
45
            if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
45
            if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
46
                return ( '001', '@' );
46
                return ( '001', '@' );
Lines 51-57 subtest 'EmbedItemsAvailability tests' => sub { Link Here
51
        }
51
        }
52
        else {
52
        else {
53
            my $func_ref = $biblio->original( 'GetMarcFromKohaField' );
53
            my $func_ref = $biblio->original( 'GetMarcFromKohaField' );
54
            &$func_ref( $kohafield, $frameworkcode );
54
            &$func_ref( $kohafield );
55
        }
55
        }
56
    });
56
    });
57
57
(-)a/t/db_dependent/Serials.t (-2 / +2 lines)
Lines 145-152 subtest 'Values should not be erased on editing' => sub { Link Here
145
145
146
    my $biblio = $builder->build_sample_biblio();
146
    my $biblio = $builder->build_sample_biblio();
147
    my $biblionumber = $biblio->biblionumber;
147
    my $biblionumber = $biblio->biblionumber;
148
    my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' );
148
    my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber' );
149
    my ( $it_tag, $it_sf )   = GetMarcFromKohaField( 'items.itype', '' );
149
    my ( $it_tag, $it_sf )   = GetMarcFromKohaField( 'items.itype' );
150
150
151
    my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype};
151
    my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype};
152
    my $itemcallnumber = 'XXXmy itemcallnumberXXX';
152
    my $itemcallnumber = 'XXXmy itemcallnumberXXX';
(-)a/t/db_dependent/XISBN.t (-2 / +2 lines)
Lines 29-37 my $errors; Link Here
29
my $context = C4::Context->new;
29
my $context = C4::Context->new;
30
30
31
my ( $biblionumber_tag, $biblionumber_subfield ) =
31
my ( $biblionumber_tag, $biblionumber_subfield ) =
32
  GetMarcFromKohaField( 'biblio.biblionumber', '' );
32
  GetMarcFromKohaField( 'biblio.biblionumber' );
33
my ( $isbn_tag, $isbn_subfield ) =
33
my ( $isbn_tag, $isbn_subfield ) =
34
  GetMarcFromKohaField( 'biblioitems.isbn', '' );
34
  GetMarcFromKohaField( 'biblioitems.isbn' );
35
35
36
# Harry Potter and the Sorcerer's Stone, 1st American ed. 1997
36
# Harry Potter and the Sorcerer's Stone, 1st American ed. 1997
37
my $isbn1 = '0590353403';
37
my $isbn1 = '0590353403';
(-)a/tools/batchMod.pl (-5 / +4 lines)
Lines 160-166 if ($op eq "action") { Link Here
160
	}
160
	}
161
161
162
	#initializing values for updates
162
	#initializing values for updates
163
	my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", "");
163
    my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
164
	if ($values_to_modify){
164
	if ($values_to_modify){
165
	    my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag, 'ITEM');
165
	    my $xml = TransformHtmlToXml(\@tags,\@subfields,\@values,\@indicator,\@ind_tag, 'ITEM');
166
	    $marcitem = MARC::Record::new_from_xml($xml, 'UTF-8');
166
	    $marcitem = MARC::Record::new_from_xml($xml, 'UTF-8');
Lines 536-543 sub BuildItemsData{ Link Here
536
		my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
536
		my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
537
		my @big_array;
537
		my @big_array;
538
		#---- finds where items.itemnumber is stored
538
		#---- finds where items.itemnumber is stored
539
		my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", "");
539
    my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
540
		my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", "");
540
    my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" );
541
		foreach my $itemnumber (@itemnumbers){
541
		foreach my $itemnumber (@itemnumbers){
542
            my $itemdata = Koha::Items->find($itemnumber);
542
            my $itemdata = Koha::Items->find($itemnumber);
543
            next unless $itemdata; # Should have been tested earlier, but just in case...
543
            next unless $itemdata; # Should have been tested earlier, but just in case...
Lines 622-628 sub BuildItemsData{ Link Here
622
# And $tag>10
622
# And $tag>10
623
sub UpdateMarcWith {
623
sub UpdateMarcWith {
624
  my ($marcfrom,$marcto)=@_;
624
  my ($marcfrom,$marcto)=@_;
625
    my (  $itemtag,   $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", "");
625
    my (  $itemtag,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
626
    my $fieldfrom=$marcfrom->field($itemtag);
626
    my $fieldfrom=$marcfrom->field($itemtag);
627
    my @fields_to=$marcto->field($itemtag);
627
    my @fields_to=$marcto->field($itemtag);
628
    my $modified = 0;
628
    my $modified = 0;
629
- 

Return to bug 22721