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

(-)a/C4/Acquisition.pm (-2 / +2 lines)
Lines 32-38 use Koha::Acquisition::Order; Link Here
32
use Koha::Acquisition::Bookseller;
32
use Koha::Acquisition::Bookseller;
33
use Koha::Number::Price;
33
use Koha::Number::Price;
34
34
35
use C4::Koha qw( subfield_is_koha_internal_p );
35
use C4::Koha;
36
36
37
use MARC::Field;
37
use MARC::Field;
38
use MARC::Record;
38
use MARC::Record;
Lines 2995-3001 sub FillWithDefaultValues { Link Here
2995
            next unless $tag;
2995
            next unless $tag;
2996
            next if $tag == $itemfield;
2996
            next if $tag == $itemfield;
2997
            for my $subfield ( sort keys %{ $tagslib->{$tag} } ) {
2997
            for my $subfield ( sort keys %{ $tagslib->{$tag} } ) {
2998
                next if ( subfield_is_koha_internal_p($subfield) );
2998
                next unless ref $tagslib->{$tag}{$subfield}; # Not a valid subfield (mandatory, tab, lib)
2999
                my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue};
2999
                my $defaultvalue = $tagslib->{$tag}{$subfield}{defaultvalue};
3000
                if ( defined $defaultvalue and $defaultvalue ne '' ) {
3000
                if ( defined $defaultvalue and $defaultvalue ne '' ) {
3001
                    my @fields = $record->field($tag);
3001
                    my @fields = $record->field($tag);
(-)a/C4/Items.pm (-1 / +1 lines)
Lines 2939-2945 sub PrepareItemrecordDisplay { Link Here
2939
            # loop through each subfield
2939
            # loop through each subfield
2940
            my $cntsubf;
2940
            my $cntsubf;
2941
            foreach my $subfield ( sort keys %{ $tagslib->{$tag} } ) {
2941
            foreach my $subfield ( sort keys %{ $tagslib->{$tag} } ) {
2942
                next if ( subfield_is_koha_internal_p($subfield) );
2942
                next unless ref $tagslib->{$tag}{$subfield}; # Not a valid subfield (mandatory, tab, lib)
2943
                next if ( $tagslib->{$tag}->{$subfield}->{'tab'} ne "10" );
2943
                next if ( $tagslib->{$tag}->{$subfield}->{'tab'} ne "10" );
2944
                my %subfield_data;
2944
                my %subfield_data;
2945
                $subfield_data{tag}           = $tag;
2945
                $subfield_data{tag}           = $tag;
(-)a/C4/Koha.pm (-12 lines)
Lines 40-46 BEGIN { Link Here
40
	@ISA    = qw(Exporter);
40
	@ISA    = qw(Exporter);
41
	@EXPORT = qw(
41
	@EXPORT = qw(
42
		&slashifyDate
42
		&slashifyDate
43
		&subfield_is_koha_internal_p
44
		&GetPrinters &GetPrinter
43
		&GetPrinters &GetPrinter
45
		&GetItemTypes &getitemtypeinfo
44
		&GetItemTypes &getitemtypeinfo
46
                &GetItemTypesCategorized &GetItemTypesByCategory
45
                &GetItemTypesCategorized &GetItemTypesByCategory
Lines 117-133 sub slashifyDate { Link Here
117
    return ("$dateOut[2]/$dateOut[1]/$dateOut[0]");
116
    return ("$dateOut[2]/$dateOut[1]/$dateOut[0]");
118
}
117
}
119
118
120
# FIXME.. this should be moved to a MARC-specific module
121
sub subfield_is_koha_internal_p {
122
    my ($subfield) = @_;
123
124
    # We could match on 'lib' and 'tab' (and 'mandatory', & more to come!)
125
    # But real MARC subfields are always single-character
126
    # so it really is safer just to check the length
127
128
    return length $subfield != 1;
129
}
130
131
=head2 GetSupportName
119
=head2 GetSupportName
132
120
133
  $itemtypename = &GetSupportName($codestring);
121
  $itemtypename = &GetSupportName($codestring);
(-)a/authorities/authorities-home.pl (-1 / +1 lines)
Lines 29-35 use C4::Auth; Link Here
29
use C4::Output;
29
use C4::Output;
30
use C4::AuthoritiesMarc;
30
use C4::AuthoritiesMarc;
31
use C4::Acquisition;
31
use C4::Acquisition;
32
use C4::Koha;    # XXX subfield_is_koha_internal_p
32
use C4::Koha;
33
use C4::Biblio;
33
use C4::Biblio;
34
use C4::Search::History;
34
use C4::Search::History;
35
35
(-)a/authorities/authorities.pl (-1 / +1 lines)
Lines 26-32 use C4::Output; Link Here
26
use C4::AuthoritiesMarc;
26
use C4::AuthoritiesMarc;
27
use C4::ImportBatch; #GetImportRecordMarc
27
use C4::ImportBatch; #GetImportRecordMarc
28
use C4::Context;
28
use C4::Context;
29
use C4::Koha; # XXX subfield_is_koha_internal_p
29
use C4::Koha;
30
use Date::Calc qw(Today);
30
use Date::Calc qw(Today);
31
use MARC::File::USMARC;
31
use MARC::File::USMARC;
32
use MARC::File::XML;
32
use MARC::File::XML;
(-)a/cataloguing/addbiblio.pl (-2 / +2 lines)
Lines 30-37 use C4::AuthoritiesMarc; Link Here
30
use C4::Context;
30
use C4::Context;
31
use MARC::Record;
31
use MARC::Record;
32
use C4::Log;
32
use C4::Log;
33
use C4::Koha;    # XXX subfield_is_koha_internal_p
33
use C4::Koha;
34
use C4::Branch;    # XXX subfield_is_koha_internal_p
34
use C4::Branch;
35
use C4::ClassSource;
35
use C4::ClassSource;
36
use C4::ImportBatch;
36
use C4::ImportBatch;
37
use C4::Charset;
37
use C4::Charset;
(-)a/cataloguing/additem.pl (-5 / +4 lines)
Lines 28-35 use C4::Biblio; Link Here
28
use C4::Items;
28
use C4::Items;
29
use C4::Context;
29
use C4::Context;
30
use C4::Circulation;
30
use C4::Circulation;
31
use C4::Koha; # XXX subfield_is_koha_internal_p
31
use C4::Koha;
32
use C4::Branch; # XXX subfield_is_koha_internal_p
32
use C4::Branch;
33
use C4::ClassSource;
33
use C4::ClassSource;
34
use Koha::DateUtils;
34
use Koha::DateUtils;
35
use List::MoreUtils qw/any/;
35
use List::MoreUtils qw/any/;
Lines 606-612 if ($op eq "additem") { Link Here
606
        my $tag = $field->{_tag};
606
        my $tag = $field->{_tag};
607
        foreach my $subfield ($field->subfields()){
607
        foreach my $subfield ($field->subfields()){
608
            my $subfieldtag = $subfield->[0];
608
            my $subfieldtag = $subfield->[0];
609
            if (subfield_is_koha_internal_p($subfieldtag) || $tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"
609
            if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10"
610
            ||  abs($tagslib->{$tag}->{$subfieldtag}->{hidden})>4 ){
610
            ||  abs($tagslib->{$tag}->{$subfieldtag}->{hidden})>4 ){
611
                my $fieldItem = $itemrecord->field($tag);
611
                my $fieldItem = $itemrecord->field($tag);
612
                $itemrecord->delete_field($fieldItem);
612
                $itemrecord->delete_field($fieldItem);
Lines 871-877 if($itemrecord){ Link Here
871
            my $value       = $subfield->[1];
871
            my $value       = $subfield->[1];
872
            my $subfieldlib = $tagslib->{$tag}->{$subfieldtag};
872
            my $subfieldlib = $tagslib->{$tag}->{$subfieldtag};
873
873
874
            next if subfield_is_koha_internal_p($subfieldtag);
875
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
874
            next if ($tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10");
876
875
877
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
876
            my $subfield_data = generate_subfield_form($tag, $subfieldtag, $value, $tagslib, $subfieldlib, $branches, $biblionumber, $temp, \@loop_data, $i, $restrictededition);
Lines 891-897 $itemrecord = $cookieitemrecord if ($prefillitem and not $justaddeditem and $op Link Here
891
# We generate form, and fill with values if defined
890
# We generate form, and fill with values if defined
892
foreach my $tag ( keys %{$tagslib}){
891
foreach my $tag ( keys %{$tagslib}){
893
    foreach my $subtag (keys %{$tagslib->{$tag}}){
892
    foreach my $subtag (keys %{$tagslib->{$tag}}){
894
        next if subfield_is_koha_internal_p($subtag);
893
        next unless ref $tagslib->{$tag}{$subtag}; # Not a valid subfield (mandatory, tab, lib)
895
        next if ($tagslib->{$tag}->{$subtag}->{'tab'} ne "10");
894
        next if ($tagslib->{$tag}->{$subtag}->{'tab'} ne "10");
896
        next if any { /^$tag$subtag$/ }  @fields;
895
        next if any { /^$tag$subtag$/ }  @fields;
897
896
(-)a/labels/label-item-search.pl (-1 / +1 lines)
Lines 31-37 use C4::Context; Link Here
31
use C4::Search qw(SimpleSearch);
31
use C4::Search qw(SimpleSearch);
32
use C4::Biblio qw(TransformMarcToKoha);
32
use C4::Biblio qw(TransformMarcToKoha);
33
use C4::Items qw(GetItemInfosOf get_itemnumbers_of);
33
use C4::Items qw(GetItemInfosOf get_itemnumbers_of);
34
use C4::Koha qw(GetItemTypes);    # XXX subfield_is_koha_internal_p
34
use C4::Koha qw(GetItemTypes);
35
use C4::Creators::Lib qw(html_table);
35
use C4::Creators::Lib qw(html_table);
36
use C4::Debug;
36
use C4::Debug;
37
use Koha::DateUtils;
37
use Koha::DateUtils;
(-)a/opac/opac-authorities-home.pl (-1 / +1 lines)
Lines 28-34 use C4::Context; Link Here
28
use C4::Auth;
28
use C4::Auth;
29
use C4::Output;
29
use C4::Output;
30
use C4::AuthoritiesMarc;
30
use C4::AuthoritiesMarc;
31
use C4::Koha;    # XXX subfield_is_koha_internal_p
31
use C4::Koha;
32
use C4::Search::History;
32
use C4::Search::History;
33
33
34
use Koha::Authority::Types;
34
use Koha::Authority::Types;
(-)a/reports/guided_reports.pl (-1 / +1 lines)
Lines 28-34 use C4::Reports::Guided; Link Here
28
use C4::Auth qw/:DEFAULT get_session/;
28
use C4::Auth qw/:DEFAULT get_session/;
29
use C4::Output;
29
use C4::Output;
30
use C4::Debug;
30
use C4::Debug;
31
use C4::Branch; # XXX subfield_is_koha_internal_p
31
use C4::Branch;
32
use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/;
32
use C4::Koha qw/IsAuthorisedValueCategory GetFrameworksLoop/;
33
use C4::Context;
33
use C4::Context;
34
use C4::Log;
34
use C4::Log;
(-)a/t/db_dependent/Acquisition/FillWithDefaultValues.t (-2 / +6 lines)
Lines 21-28 $biblio_module->mock( Link Here
21
        {
21
        {
22
            # default value for an existing field
22
            # default value for an existing field
23
            '245' => {
23
            '245' => {
24
                c => { defaultvalue => $default_author },
24
                c          => { defaultvalue => $default_author },
25
            },
25
                mandatory  => 0,
26
                repeatable => 0,
27
                tab        => 0,
28
                lib        => 'a lib',
29
              },
26
30
27
            # default for a nonexisting field
31
            # default for a nonexisting field
28
            '099' => {
32
            '099' => {
(-)a/tools/batchMod.pl (-4 / +3 lines)
Lines 27-34 use C4::Biblio; Link Here
27
use C4::Items;
27
use C4::Items;
28
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Context;
29
use C4::Context;
30
use C4::Koha; # XXX subfield_is_koha_internal_p
30
use C4::Koha;
31
use C4::Branch; # XXX subfield_is_koha_internal_p
31
use C4::Branch;
32
use C4::BackgroundJob;
32
use C4::BackgroundJob;
33
use C4::ClassSource;
33
use C4::ClassSource;
34
use C4::Debug;
34
use C4::Debug;
Lines 308-314 my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod); Link Here
308
foreach my $tag (sort keys %{$tagslib}) {
308
foreach my $tag (sort keys %{$tagslib}) {
309
    # loop through each subfield
309
    # loop through each subfield
310
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
310
    foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
311
     	next if subfield_is_koha_internal_p($subfield);
311
        next unless ref $tagslib->{$tag}{$subfield}; # Not a valid subfield (mandatory, tab, lib)
312
        next if (not $allowAllSubfields and $restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow );
312
        next if (not $allowAllSubfields and $restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow );
313
    	next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
313
    	next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10");
314
        # barcode and stocknumber are not meant to be batch-modified
314
        # barcode and stocknumber are not meant to be batch-modified
315
- 

Return to bug 5404