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

(-)a/C4/Items.pm (-5 / +7 lines)
Lines 2401-2411 sub PrepareItemrecordDisplay { Link Here
2401
2401
2402
                # search for itemcallnumber if applicable
2402
                # search for itemcallnumber if applicable
2403
                if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
2403
                if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
2404
                    && C4::Context->preference('itemcallnumber') ) {
2404
                    && C4::Context->preference('itemcallnumber') && $itemrecord) {
2405
                    my $CNtag      = substr( C4::Context->preference('itemcallnumber'), 0, 3 );
2405
                    foreach my $itemcn_pref (split(/,/,C4::Context->preference('itemcallnumber'))){
2406
                    my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 );
2406
                        my $CNtag      = substr( $itemcn_pref, 0, 3 );
2407
                    if ( $itemrecord and my $field = $itemrecord->field($CNtag) ) {
2407
                        next unless my $field = $itemrecord->field($CNtag);
2408
                        $defaultvalue = $field->subfield($CNsubfield);
2408
                        my $CNsubfields = substr( $itemcn_pref, 3 );
2409
                        $defaultvalue = $field->as_string( $CNsubfields, ' ');
2410
                        last if $defaultvalue;
2409
                    }
2411
                    }
2410
                }
2412
                }
2411
                if (   $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
2413
                if (   $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
(-)a/cataloguing/additem.pl (-9 / +8 lines)
Lines 154-173 sub generate_subfield_form { Link Here
154
154
155
        my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
155
        my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
156
        if (!$value && $subfieldlib->{kohafield} eq 'items.itemcallnumber' && $pref_itemcallnumber) {
156
        if (!$value && $subfieldlib->{kohafield} eq 'items.itemcallnumber' && $pref_itemcallnumber) {
157
            my $CNtag       = substr( $pref_itemcallnumber, 0, 3 ); # 3-digit tag number
157
            foreach my $pref_itemcallnumber_part (split(/,/, $pref_itemcallnumber)){
158
            my $CNsubfields = substr( $pref_itemcallnumber, 3 ); # Any and all subfields
158
                my $CNtag       = substr( $pref_itemcallnumber, 0, 3 ); # 3-digit tag number
159
            my @subfields = ( $CNsubfields =~ m/./g ); # Split into single-character elements
159
                my $CNsubfields = substr( $pref_itemcallnumber, 3 ); # Any and all subfields
160
            my $temp2 = $temp->field($CNtag);
160
                my @subfields = ( $CNsubfields =~ m/./g ); # Split into single-character elements
161
                my $temp2 = $temp->field($CNtag);
161
162
162
            if ($temp2) {
163
                next unless $temp2;
163
                my @selectedsubfields;
164
                my @selectedsubfields;
164
                foreach my $subfieldcode( @subfields ){
165
                foreach my $subfieldcode( @subfields ){
165
                    push @selectedsubfields, $temp2->subfield( $subfieldcode );
166
                    push @selectedsubfields, $temp2->subfield( $subfieldcode );
166
                }
167
                }
167
                $value = join( ' ', @selectedsubfields );
168
                $value = join( ' ', @selectedsubfields );
168
169
                #remove any trailing space incase one subfield is used
170
                $value =~ s/^\s+|\s+$//g;
169
                $value =~ s/^\s+|\s+$//g;
170
                #remove any trailing space incase one subfield is used
171
                last if $value;
171
            }
172
            }
172
        }
173
        }
173
174
Lines 889-896 foreach my $subfield_code (sort keys(%witness)) { Link Here
889
my @loop_data =();
890
my @loop_data =();
890
my $i=0;
891
my $i=0;
891
892
892
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber');
893
894
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
893
my $branch = $input->param('branch') || C4::Context->userenv->{branch};
895
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
894
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
896
for my $library ( @$libraries ) {
895
for my $library ( @$libraries ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-3 / +2 lines)
Lines 72-80 Cataloging: Link Here
72
                  no: bibliographic record
72
                  no: bibliographic record
73
            - as the authoritative item type (for determining circulation and fines rules, for displaying an item type icon on either opac detail or results page, etc).
73
            - as the authoritative item type (for determining circulation and fines rules, for displaying an item type icon on either opac detail or results page, etc).
74
        -
74
        -
75
            - Map the MARC subfield
75
            - Map the MARC subfields
76
            - pref: itemcallnumber
76
            - pref: itemcallnumber
77
            - "to an item's callnumber. (This can contain multiple subfields to look in; for instance <code>082ab</code> would look in 082 subfields a and b.)<br />Examples (for MARC21 records): <strong>Dewey</strong>: <code>082ab</code> or <code>092ab</code>; <strong>LOC</strong>: <code>050ab</code> or <code>090ab</code>; <strong>from the item record</strong>: <code>852hi</code>"
77
            - "to an item's callnumber. List multiple comma-separated fields to check them sequentially. Each field can include multiple subfields. For example: '082ab,092ab' will look in the 082$a and 082$b, then the 092$a and 092$b. Examples (for MARC21 records): Dewey: 082ab,092ab; LOC: 050ab,090ab; from the item record: 952hi"
78
        -
78
        -
79
            - Display MARC subfield
79
            - Display MARC subfield
80
            - pref: AlternateHoldingsField
80
            - pref: AlternateHoldingsField
81
- 

Return to bug 3426