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

(-)a/C4/Acquisition.pm (-2 / +2 lines)
Lines 1674-1680 sub CancelReceipt { Link Here
1674
            for my $in ( @itemnumbers ) {
1674
            for my $in ( @itemnumbers ) {
1675
                my $item = Koha::Items->find( $in ); # FIXME We do not need that, we already have Koha::Items from $order_obj->items
1675
                my $item = Koha::Items->find( $in ); # FIXME We do not need that, we already have Koha::Items from $order_obj->items
1676
                my $biblio = $item->biblio;
1676
                my $biblio = $item->biblio;
1677
                my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $biblio->frameworkcode );
1677
                my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber' );
1678
                my $item_marc = C4::Items::GetMarcItem( $biblio->biblionumber, $in );
1678
                my $item_marc = C4::Items::GetMarcItem( $biblio->biblionumber, $in );
1679
                for my $affect ( @affects ) {
1679
                for my $affect ( @affects ) {
1680
                    my ( $sf, $v ) = split q{=}, $affect, 2;
1680
                    my ( $sf, $v ) = split q{=}, $affect, 2;
Lines 3238-3244 sub FillWithDefaultValues { Link Here
3238
    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
3238
    my $tagslib = C4::Biblio::GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
3239
    if ($tagslib) {
3239
    if ($tagslib) {
3240
        my ($itemfield) =
3240
        my ($itemfield) =
3241
          C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' );
3241
          C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' );
3242
        for my $tag ( sort keys %$tagslib ) {
3242
        for my $tag ( sort keys %$tagslib ) {
3243
            next unless $tag;
3243
            next unless $tag;
3244
            next if $tag == $itemfield;
3244
            next if $tag == $itemfield;
(-)a/C4/Biblio.pm (-7 / +7 lines)
Lines 336-342 sub _strip_item_fields { Link Here
336
    my $record = shift;
336
    my $record = shift;
337
    my $frameworkcode = shift;
337
    my $frameworkcode = shift;
338
    # get the items before and append them to the biblio before updating the record, atm we just have the biblio
338
    # get the items before and append them to the biblio before updating the record, atm we just have the biblio
339
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
339
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" );
340
340
341
    # delete any item fields from incoming record to avoid
341
    # delete any item fields from incoming record to avoid
342
    # duplication or incorrect data - use AddItem() or ModItem()
342
    # duplication or incorrect data - use AddItem() or ModItem()
Lines 729-735 sub GetISBDView { Link Here
729
    my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd';
729
    my $sysprefname = $template eq 'opac' ? 'opacisbd' : 'isbd';
730
    my $framework = $params->{framework};
730
    my $framework = $params->{framework};
731
    my $itemtype  = $framework;
731
    my $itemtype  = $framework;
732
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
732
    my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch" );
733
    my $tagslib = GetMarcStructure( 1, $itemtype, { unsafe => 1 } );
733
    my $tagslib = GetMarcStructure( 1, $itemtype, { unsafe => 1 } );
734
734
735
    my $ISBD = C4::Context->preference($sysprefname);
735
    my $ISBD = C4::Context->preference($sysprefname);
Lines 2811-2817 sub EmbedItemsInMarcBiblio { Link Here
2811
    my $dbh = C4::Context->dbh;
2811
    my $dbh = C4::Context->dbh;
2812
    my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ?");
2812
    my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ?");
2813
    $sth->execute($biblionumber);
2813
    $sth->execute($biblionumber);
2814
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
2814
    my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" );
2815
2815
2816
    my @item_fields; # Array holding the actual MARC data for items to be included.
2816
    my @item_fields; # Array holding the actual MARC data for items to be included.
2817
    my @items;       # Array holding items which are both in the list (sitenumbers)
2817
    my @items;       # Array holding items which are both in the list (sitenumbers)
Lines 2863-2871 the MARC XML. Link Here
2863
sub _koha_marc_update_bib_ids {
2863
sub _koha_marc_update_bib_ids {
2864
    my ( $record, $frameworkcode, $biblionumber, $biblioitemnumber ) = @_;
2864
    my ( $record, $frameworkcode, $biblionumber, $biblioitemnumber ) = @_;
2865
2865
2866
    my ( $biblio_tag,     $biblio_subfield )     = GetMarcFromKohaField( "biblio.biblionumber",          $frameworkcode );
2866
    my ( $biblio_tag,     $biblio_subfield )     = GetMarcFromKohaField( "biblio.biblionumber" );
2867
    die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag;
2867
    die qq{No biblionumber tag for framework "$frameworkcode"} unless $biblio_tag;
2868
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode );
2868
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" );
2869
    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag;
2869
    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag;
2870
2870
2871
    if ( $biblio_tag < 10 ) {
2871
    if ( $biblio_tag < 10 ) {
Lines 2894-2900 sub _koha_marc_update_biblioitem_cn_sort { Link Here
2894
    my $biblioitem    = shift;
2894
    my $biblioitem    = shift;
2895
    my $frameworkcode = shift;
2895
    my $frameworkcode = shift;
2896
2896
2897
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.cn_sort", $frameworkcode );
2897
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.cn_sort" );
2898
    return unless $biblioitem_tag;
2898
    return unless $biblioitem_tag;
2899
2899
2900
    my ($cn_sort) = GetClassSort( $biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'} );
2900
    my ($cn_sort) = GetClassSort( $biblioitem->{'biblioitems.cn_source'}, $biblioitem->{'cn_class'}, $biblioitem->{'cn_item'} );
Lines 3531-3537 sub UpdateTotalIssues { Link Here
3531
        return;
3531
        return;
3532
    }
3532
    }
3533
    my $biblioitem = $biblio->biblioitem;
3533
    my $biblioitem = $biblio->biblioitem;
3534
    my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField('biblioitems.totalissues', $biblio->frameworkcode);
3534
    my ($totalissuestag, $totalissuessubfield) = GetMarcFromKohaField( 'biblioitems.totalissues' );
3535
    unless ($totalissuestag) {
3535
    unless ($totalissuestag) {
3536
        return 1; # There is nothing to do
3536
        return 1; # There is nothing to do
3537
    }
3537
    }
(-)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 459-465 sub AddItemsToImportBiblio { Link Here
459
    my @import_items_ids = ();
459
    my @import_items_ids = ();
460
   
460
   
461
    my $dbh = C4::Context->dbh; 
461
    my $dbh = C4::Context->dbh; 
462
    my ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",'');
462
    my ($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" );
463
    foreach my $item_field ($marc_record->field($item_tag)) {
463
    foreach my $item_field ($marc_record->field($item_tag)) {
464
        my $item_marc = MARC::Record->new();
464
        my $item_marc = MARC::Record->new();
465
        $item_marc->leader("00000    a              "); # must set Leader/09 to 'a'
465
        $item_marc->leader("00000    a              "); # must set Leader/09 to 'a'
Lines 618-624 sub BatchCommitRecords { Link Here
618
618
619
        if ($record_type eq 'biblio') {
619
        if ($record_type eq 'biblio') {
620
            # remove any item tags - rely on BatchCommitItems
620
            # remove any item tags - rely on BatchCommitItems
621
            ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",'');
621
            ($item_tag,$item_subfield) = &GetMarcFromKohaField( "items.itemnumber" );
622
            foreach my $item_field ($marc_record->field($item_tag)) {
622
            foreach my $item_field ($marc_record->field($item_tag)) {
623
                $marc_record->delete_field($item_field);
623
                $marc_record->delete_field($item_field);
624
            }
624
            }
Lines 743-749 sub BatchCommitItems { Link Here
743
        my $item_marc = MARC::Record->new_from_xml( StripNonXmlChars( $row->{'marcxml'} ), 'UTF-8', $row->{'encoding'} );
743
        my $item_marc = MARC::Record->new_from_xml( StripNonXmlChars( $row->{'marcxml'} ), 'UTF-8', $row->{'encoding'} );
744
744
745
        # Delete date_due subfield as to not accidentally delete item checkout due dates
745
        # Delete date_due subfield as to not accidentally delete item checkout due dates
746
        my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.onloan', GetFrameworkCode($biblionumber) );
746
        my ( $MARCfield, $MARCsubfield ) = GetMarcFromKohaField( 'items.onloan' );
747
        $item_marc->field($MARCfield)->delete_subfield( code => $MARCsubfield );
747
        $item_marc->field($MARCfield)->delete_subfield( code => $MARCsubfield );
748
748
749
        my $item = TransformMarcToKoha( $item_marc );
749
        my $item = TransformMarcToKoha( $item_marc );
(-)a/C4/Items.pm (-5 / +5 lines)
Lines 176-182 sub AddItemFromMarc { Link Here
176
176
177
    # parse item hash from MARC
177
    # parse item hash from MARC
178
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
178
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
179
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
179
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
180
180
181
    my $localitemmarc = MARC::Record->new;
181
    my $localitemmarc = MARC::Record->new;
182
    $localitemmarc->append_fields( $source_item_marc->field($itemtag) );
182
    $localitemmarc->append_fields( $source_item_marc->field($itemtag) );
Lines 304-310 sub AddItemBatchFromMarc { Link Here
304
    $record = $record->clone();
304
    $record = $record->clone();
305
    # loop through the item tags and start creating items
305
    # loop through the item tags and start creating items
306
    my @bad_item_fields = ();
306
    my @bad_item_fields = ();
307
    my ($itemtag, $itemsubfield) = C4::Biblio::GetMarcFromKohaField("items.itemnumber",'');
307
    my ($itemtag, $itemsubfield) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
308
    my $item_sequence_num = 0;
308
    my $item_sequence_num = 0;
309
    ITEMFIELD: foreach my $item_field ($record->field($itemtag)) {
309
    ITEMFIELD: foreach my $item_field ($record->field($itemtag)) {
310
        $item_sequence_num++;
310
        $item_sequence_num++;
Lines 438-444 sub ModItemFromMarc { Link Here
438
    my $itemnumber = shift;
438
    my $itemnumber = shift;
439
439
440
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
440
    my $frameworkcode = C4::Biblio::GetFrameworkCode($biblionumber);
441
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
441
    my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
442
442
443
    my $localitemmarc = MARC::Record->new;
443
    my $localitemmarc = MARC::Record->new;
444
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
444
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
Lines 1928-1934 sub _marc_from_item_hash { Link Here
1928
1928
1929
    my $item_marc = MARC::Record->new();
1929
    my $item_marc = MARC::Record->new();
1930
    foreach my $item_field ( keys %{$mungeditem} ) {
1930
    foreach my $item_field ( keys %{$mungeditem} ) {
1931
        my ( $tag, $subfield ) = C4::Biblio::GetMarcFromKohaField( $item_field, $frameworkcode );
1931
        my ( $tag, $subfield ) = C4::Biblio::GetMarcFromKohaField( $item_field );
1932
        next unless defined $tag and defined $subfield;    # skip if not mapped to MARC field
1932
        next unless defined $tag and defined $subfield;    # skip if not mapped to MARC field
1933
        my @values = split(/\s?\|\s?/, $mungeditem->{$item_field}, -1);
1933
        my @values = split(/\s?\|\s?/, $mungeditem->{$item_field}, -1);
1934
        foreach my $value (@values){
1934
        foreach my $value (@values){
Lines 2350-2356 sub PrepareItemrecordDisplay { Link Here
2350
2350
2351
    my $dbh = C4::Context->dbh;
2351
    my $dbh = C4::Context->dbh;
2352
    $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum;
2352
    $frameworkcode = C4::Biblio::GetFrameworkCode($bibnum) if $bibnum;
2353
    my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
2353
    my ( $itemtagfield, $itemtagsubfield ) = C4::Biblio::GetMarcFromKohaField( "items.itemnumber" );
2354
2354
2355
    # Note: $tagslib obtained from GetMarcStructure() in 'unsafe' mode is
2355
    # Note: $tagslib obtained from GetMarcStructure() in 'unsafe' mode is
2356
    # a shared data structure. No plugin (including custom ones) should change
2356
    # 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 (-1 / +1 lines)
Lines 677-683 sub get_matches { Link Here
677
            else {
677
            else {
678
                if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
678
                if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
679
                    foreach my $matched ( @{$searchresults} ) {
679
                    foreach my $matched ( @{$searchresults} ) {
680
                        my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", $marcframework_used );
680
                        my ( $biblionumber_tag, $biblionumber_subfield ) = C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber" );
681
                        my $id = ( $biblionumber_tag > 10 ) ?
681
                        my $id = ( $biblionumber_tag > 10 ) ?
682
                            $matched->field($biblionumber_tag)->subfield($biblionumber_subfield) :
682
                            $matched->field($biblionumber_tag)->subfield($biblionumber_subfield) :
683
                            $matched->field($biblionumber_tag)->data();
683
                            $matched->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 2030-2036 sub searchResults { Link Here
2030
                    my $hostbiblio = GetMarcBiblio({
2030
                    my $hostbiblio = GetMarcBiblio({
2031
                        biblionumber => $hostbiblionumber,
2031
                        biblionumber => $hostbiblionumber,
2032
                        embed_items  => 1 });
2032
                        embed_items  => 1 });
2033
                    my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
2033
                    my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber' );
2034
                    if( $hostbiblio ) {
2034
                    if( $hostbiblio ) {
2035
                        my @hostitems = $hostbiblio->field($itemfield);
2035
                        my @hostitems = $hostbiblio->field($itemfield);
2036
                        foreach my $hostitem (@hostitems){
2036
                        foreach my $hostitem (@hostitems){
(-)a/C4/Serials.pm (-1 / +1 lines)
Lines 1446-1452 sub NewSubscription { Link Here
1446
    my $biblio = Koha::Biblios->find( $biblionumber );
1446
    my $biblio = Koha::Biblios->find( $biblionumber );
1447
    if ( $biblio and !$biblio->serial ) {
1447
    if ( $biblio and !$biblio->serial ) {
1448
        my $record = GetMarcBiblio({ biblionumber => $biblionumber });
1448
        my $record = GetMarcBiblio({ biblionumber => $biblionumber });
1449
        my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial', $biblio->frameworkcode );
1449
        my ( $tag, $subf ) = GetMarcFromKohaField( 'biblio.serial' );
1450
        if ($tag) {
1450
        if ($tag) {
1451
            eval { $record->field($tag)->update( $subf => 1 ); };
1451
            eval { $record->field($tag)->update( $subf => 1 ); };
1452
        }
1452
        }
(-)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 801-810 if ($biblionumber) { Link Here
801
801
802
    # if it's a modif, retrieve bibli and biblioitem numbers for the future modification of old-DB.
802
    # if it's a modif, retrieve bibli and biblioitem numbers for the future modification of old-DB.
803
    ( $biblionumbertagfield, $biblionumbertagsubfield ) =
803
    ( $biblionumbertagfield, $biblionumbertagsubfield ) =
804
	&GetMarcFromKohaField( "biblio.biblionumber", $frameworkcode );
804
        &GetMarcFromKohaField( "biblio.biblionumber" );
805
    ( $biblioitemnumtagfield, $biblioitemnumtagsubfield ) =
805
    ( $biblioitemnumtagfield, $biblioitemnumtagsubfield ) =
806
	&GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode );
806
        &GetMarcFromKohaField( "biblioitems.biblioitemnumber" );
807
	    
807
808
    # search biblioitems value
808
    # search biblioitems value
809
    my $sth =  $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?");
809
    my $sth =  $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?");
810
    $sth->execute($biblionumber);
810
    $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 522-528 if ($op eq "additem") { Link Here
522
        }
522
        }
523
        else {
523
        else {
524
            # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
524
            # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
525
            my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
525
            my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" );
526
            my $fieldItem = $itemrecord->field($tagfield);
526
            my $fieldItem = $itemrecord->field($tagfield);
527
            $itemrecord->delete_field($fieldItem);
527
            $itemrecord->delete_field($fieldItem);
528
            $fieldItem->delete_subfields($tagsubfield);
528
            $fieldItem->delete_subfields($tagsubfield);
Lines 538-545 if ($op eq "additem") { Link Here
538
        my $barcodeobj = C4::Barcodes->new;
538
        my $barcodeobj = C4::Barcodes->new;
539
        my $copynumber = $addedolditem->{'copynumber'};
539
        my $copynumber = $addedolditem->{'copynumber'};
540
        my $oldbarcode = $addedolditem->{'barcode'};
540
        my $oldbarcode = $addedolditem->{'barcode'};
541
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
541
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" );
542
        my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField("items.copynumber",$frameworkcode);
542
        my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField( "items.copynumber" );
543
543
544
    # If there is a barcode and we can't find their new values, we can't add multiple copies
544
    # If there is a barcode and we can't find their new values, we can't add multiple copies
545
	my $testbarcode;
545
	my $testbarcode;
Lines 625-631 if ($op eq "additem") { Link Here
625
    }
625
    }
626
    else {
626
    else {
627
        # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
627
        # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin
628
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
628
        my ($tagfield,$tagsubfield) = &GetMarcFromKohaField( "items.barcode" );
629
        my $fieldItem = $itemrecord->field($tagfield);
629
        my $fieldItem = $itemrecord->field($tagfield);
630
        $itemrecord->delete_field($fieldItem);
630
        $itemrecord->delete_field($fieldItem);
631
        $fieldItem->delete_subfields($tagsubfield);
631
        $fieldItem->delete_subfields($tagsubfield);
Lines 744-751 my $temp = GetMarcBiblio({ biblionumber => $biblionumber }); Link Here
744
my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
744
my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code
745
my @big_array;
745
my @big_array;
746
#---- finds where items.itemnumber is stored
746
#---- finds where items.itemnumber is stored
747
my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", $frameworkcode);
747
my (  $itemtagfield,   $itemtagsubfield) = &GetMarcFromKohaField( "items.itemnumber" );
748
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", $frameworkcode);
748
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField( "items.homebranch" );
749
C4::Biblio::EmbedItemsInMarcBiblio({
749
C4::Biblio::EmbedItemsInMarcBiblio({
750
    marc_record  => $temp,
750
    marc_record  => $temp,
751
    biblionumber => $biblionumber });
751
    biblionumber => $biblionumber });
Lines 767-773 if ( C4::Context->preference('EasyAnalyticalRecords') ) { Link Here
767
                biblionumber => $hostbiblionumber,
767
                biblionumber => $hostbiblionumber,
768
                embed_items  => 1 });
768
                embed_items  => 1 });
769
            if ($hostrecord) {
769
            if ($hostrecord) {
770
                my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
770
                my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber' );
771
                foreach my $hostitem ($hostrecord->field($itemfield)){
771
                foreach my $hostitem ($hostrecord->field($itemfield)){
772
                    if ($hostitem->subfield('9') eq $hostfield->subfield('9')){
772
                    if ($hostitem->subfield('9') eq $hostfield->subfield('9')){
773
                        push (@fields, $hostitem);
773
                        push (@fields, $hostitem);
Lines 827-833 foreach my $field (@fields) { Link Here
827
    }
827
    }
828
}
828
}
829
829
830
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbranch",$frameworkcode);
830
my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField( "items.holdingbranch" );
831
@big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
831
@big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array;
832
832
833
# now, construct template !
833
# 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 64-70 my @overduesloop; Link Here
64
my @getoverdues = GetOverduesForBranch( $default, $location );
64
my @getoverdues = GetOverduesForBranch( $default, $location );
65
$debug and warn "HERE : $default / $location" . Dumper(@getoverdues);
65
$debug and warn "HERE : $default / $location" . Dumper(@getoverdues);
66
# search for location authorised value
66
# search for location authorised value
67
my ($tag,$subfield) = GetMarcFromKohaField('items.location','');
67
my ($tag,$subfield) = GetMarcFromKohaField( 'items.location' );
68
my $tagslib = &GetMarcStructure(1,'');
68
my $tagslib = &GetMarcStructure(1,'');
69
if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
69
if ($tagslib->{$tag}->{$subfield}->{authorised_value}) {
70
    my $values= GetAuthorisedValues($tagslib->{$tag}->{$subfield}->{authorised_value});
70
    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-ISBDdetail.pl (-1 / +1 lines)
Lines 97-103 if ( ! $record ) { Link Here
97
my @all_items = GetItemsInfo($biblionumber);
97
my @all_items = GetItemsInfo($biblionumber);
98
my $biblio = Koha::Biblios->find( $biblionumber );
98
my $biblio = Koha::Biblios->find( $biblionumber );
99
my $framework = $biblio ? $biblio->frameworkcode : q{};
99
my $framework = $biblio ? $biblio->frameworkcode : q{};
100
my ($tag_itemnumber, $subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework);
100
my ($tag_itemnumber, $subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' );
101
my @nonhiddenitems = $record->field($tag_itemnumber);
101
my @nonhiddenitems = $record->field($tag_itemnumber);
102
if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) {
102
if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) {
103
    print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
103
    print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
(-)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 339-351 if ( $op and $op eq 'serialchangestatus' ) { Link Here
339
                    #New Item
339
                    #New Item
340
340
341
                  # if autoBarcode is set to 'incremental', calculate barcode...
341
                  # if autoBarcode is set to 'incremental', calculate barcode...
342
                    my ( $barcodetagfield, $barcodetagsubfield ) =
342
                    my ( $barcodetagfield, $barcodetagsubfield ) = GetMarcFromKohaField( 'items.barcode' );
343
                      GetMarcFromKohaField(
344
                        'items.barcode',
345
                        GetFrameworkCode(
346
                            $serialdatalist[0]->{'biblionumber'}
347
                        )
348
                      );
349
                    if ( C4::Context->preference('autoBarcode') eq
343
                    if ( C4::Context->preference('autoBarcode') eq
350
                        'incremental' )
344
                        'incremental' )
351
                    {
345
                    {
(-)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 474-480 subtest 'SearchItems test' => sub { Link Here
474
    ok($found, "item1 found");
474
    ok($found, "item1 found");
475
475
476
    my $frameworkcode = q||;
476
    my $frameworkcode = q||;
477
    my ($itemfield) = GetMarcFromKohaField('items.itemnumber', $frameworkcode);
477
    my ($itemfield) = GetMarcFromKohaField( 'items.itemnumber' );
478
478
479
    # Create item subfield 'z' without link
479
    # Create item subfield 'z' without link
480
    $dbh->do('DELETE FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=?', undef, $itemfield, $frameworkcode);
480
    $dbh->do('DELETE FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=?', undef, $itemfield, $frameworkcode);
Lines 627-633 subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub { Link Here
627
    t::lib::Mocks::mock_preference( 'OpacHiddenItems', '' );
627
    t::lib::Mocks::mock_preference( 'OpacHiddenItems', '' );
628
628
629
    my ($itemfield) =
629
    my ($itemfield) =
630
      C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' );
630
      C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' );
631
    my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber });
631
    my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber });
632
    warning_is { C4::Biblio::EmbedItemsInMarcBiblio() }
632
    warning_is { C4::Biblio::EmbedItemsInMarcBiblio() }
633
    { carped => 'EmbedItemsInMarcBiblio: No MARC record passed' },
633
    { 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