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

(-)a/C4/Items.pm (-2 / +4 lines)
Lines 2200-2207 sub DelItemCheck { Link Here
2200
    my ( $dbh, $biblionumber, $itemnumber ) = @_;
2200
    my ( $dbh, $biblionumber, $itemnumber ) = @_;
2201
    my $error;
2201
    my $error;
2202
2202
2203
        my $countanalytics=GetAnalyticsCount($itemnumber);
2203
    my $countanalytics = 0;
2204
2204
    if ( C4::Context->preference('EasyAnalyticalRecords') ) {
2205
        $countanalytics = GetAnalyticsCount($itemnumber);
2206
    }
2205
2207
2206
    # check that there is no issue on this item before deletion.
2208
    # check that there is no issue on this item before deletion.
2207
    my $sth=$dbh->prepare("select * from issues i where i.itemnumber=?");
2209
    my $sth=$dbh->prepare("select * from issues i where i.itemnumber=?");
(-)a/C4/Reserves.pm (-4 / +7 lines)
Lines 395-404 sub CanBookBeReserved{ Link Here
395
    my ($borrowernumber, $biblionumber) = @_;
395
    my ($borrowernumber, $biblionumber) = @_;
396
396
397
    my $items = GetItemnumbersForBiblio($biblionumber);
397
    my $items = GetItemnumbersForBiblio($biblionumber);
398
    #get items linked via host records
398
    
399
    my @hostitems = get_hostitemnumbers_of($biblionumber);
399
    if ( C4::Context->preference('EasyAnalyticalRecords') ) {
400
    if (@hostitems){
400
        #get items linked via host records
401
    push (@$items,@hostitems);
401
        my @hostitems = get_hostitemnumbers_of($biblionumber);
402
        if (@hostitems){
403
            push (@$items,@hostitems);
404
        }
402
    }
405
    }
403
406
404
    foreach my $item (@$items){
407
    foreach my $item (@$items){
(-)a/C4/Search.pm (-23 / +26 lines)
Lines 1582-1587 Format results in a form suitable for passing to the template Link Here
1582
sub searchResults {
1582
sub searchResults {
1583
    my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, $marcresults ) = @_;
1583
    my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, $marcresults ) = @_;
1584
    my $dbh = C4::Context->dbh;
1584
    my $dbh = C4::Context->dbh;
1585
    my $marcflavour = C4::Context->preference("marcflavour");
1585
    my @newresults;
1586
    my @newresults;
1586
1587
1587
    require C4::Items;
1588
    require C4::Items;
Lines 1646-1652 sub searchResults { Link Here
1646
        $times = $hits;	 # FIXME: if $hits is undefined, why do we want to equal it?
1647
        $times = $hits;	 # FIXME: if $hits is undefined, why do we want to equal it?
1647
    }
1648
    }
1648
1649
1649
	my $marcflavour = C4::Context->preference("marcflavour");
1650
    # We get the biblionumber position in MARC
1650
    # We get the biblionumber position in MARC
1651
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
1651
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
1652
1652
Lines 1727-1754 sub searchResults { Link Here
1727
1727
1728
        # Pull out the items fields
1728
        # Pull out the items fields
1729
        my @fields = $marcrecord->field($itemtag);
1729
        my @fields = $marcrecord->field($itemtag);
1730
        my $marcflavor = C4::Context->preference("marcflavour");
1730
1731
        # adding linked items that belong to host records
1731
        if ( C4::Context->preference('EasyAnalyticalRecords') ) {
1732
        my $analyticsfield = '773';
1732
            # adding linked items that belong to host records
1733
        if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') {
1733
            my $analyticsfield = '773';
1734
            $analyticsfield = '773';
1734
            if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') {
1735
        } elsif ($marcflavor eq 'UNIMARC') {
1735
                $analyticsfield = '773';
1736
            $analyticsfield = '461';
1736
            } elsif ($marcflavour eq 'UNIMARC') {
1737
        }
1737
                $analyticsfield = '461';
1738
        foreach my $hostfield ( $marcrecord->field($analyticsfield)) {
1738
            }
1739
            my $hostbiblionumber = $hostfield->subfield("0");
1739
            foreach my $hostfield ( $marcrecord->field($analyticsfield) ) {
1740
            my $linkeditemnumber = $hostfield->subfield("9");
1740
                my $hostbiblionumber = $hostfield->subfield("0");
1741
            if(!$hostbiblionumber eq undef){
1741
                my $linkeditemnumber = $hostfield->subfield("9");
1742
                my $hostbiblio = GetMarcBiblio($hostbiblionumber, 1);
1742
                if ( $hostbiblionumber && $linkeditemnumber ) {
1743
                my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
1743
                    my $hostbiblio = GetMarcBiblio($hostbiblionumber, 1);
1744
                if(!$hostbiblio eq undef){
1744
                    my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) );
1745
                    my @hostitems = $hostbiblio->field($itemfield);
1745
                    if ( $hostbiblio ){
1746
                    foreach my $hostitem (@hostitems){
1746
                        my @hostitems = $hostbiblio->field($itemfield);
1747
                        if ($hostitem->subfield("9") eq $linkeditemnumber){
1747
                        foreach my $hostitem (@hostitems){
1748
                            my $linkeditem =$hostitem;
1748
                            if ( $hostitem->subfield("9") eq $linkeditemnumber ){
1749
                            # append linked items if they exist
1749
                                my $linkeditem = $hostitem;
1750
                            if (!$linkeditem eq undef){
1750
                                # append linked items if they exist
1751
                                push (@fields, $linkeditem);}
1751
                                if ($linkeditem) {
1752
                                    push (@fields, $linkeditem);
1753
                                }
1754
                            }
1752
                        }
1755
                        }
1753
                    }
1756
                    }
1754
                }
1757
                }
(-)a/catalogue/detail.pl (-11 / +16 lines)
Lines 113-119 my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); Link Here
113
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
113
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
114
my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
114
my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
115
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
115
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
116
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
116
my $marchostsarray   = C4::Context->preference('EasyAnalyticalRecords') ? GetMarcHosts($record,$marcflavour) : ();
117
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
117
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
118
118
119
# Get Branches, Itemtypes and Locations
119
# Get Branches, Itemtypes and Locations
Lines 129-139 for my $itm (@all_items) { Link Here
129
129
130
# flag indicating existence of at least one item linked via a host record
130
# flag indicating existence of at least one item linked via a host record
131
my $hostrecords;
131
my $hostrecords;
132
# adding items linked via host biblios
132
my @hostitems;
133
my @hostitems = GetHostItemsInfo($record);
133
if ( C4::Context->preference('EasyAnalyticalRecords') ) {
134
if (@hostitems){
134
    # adding items linked via host biblios
135
	$hostrecords =1;
135
    @hostitems = GetHostItemsInfo($record);
136
	push (@items,@hostitems);
136
    if (@hostitems){
137
        $hostrecords =1;
138
        push (@items,@hostitems);
139
    }
137
}
140
}
138
141
139
my $dat = &GetBiblioData($biblionumber);
142
my $dat = &GetBiblioData($biblionumber);
Lines 258-268 foreach my $item (@items) { Link Here
258
	$item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title};
261
	$item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title};
259
    }
262
    }
260
	
263
	
261
    #count if item is used in analytical bibliorecords
264
    if ( C4::Context->preference('EasyAnalyticalRecords') ) {
262
    my $countanalytics= GetAnalyticsCount($item->{itemnumber});
265
        #count if item is used in analytical bibliorecords
263
    if ($countanalytics > 0){
266
        my $countanalytics= GetAnalyticsCount($item->{itemnumber});
264
        $analytics_flag=1;
267
        if ($countanalytics > 0){
265
        $item->{countanalytics} = $countanalytics;
268
            $analytics_flag=1;
269
            $item->{countanalytics} = $countanalytics;
270
        }
266
    }
271
    }
267
272
268
    if (defined($item->{'materials'}) && $item->{'materials'} =~ /\S/){
273
    if (defined($item->{'materials'}) && $item->{'materials'} =~ /\S/){
(-)a/catalogue/moredetail.pl (-3 / +5 lines)
Lines 103-113 for my $itm (@all_items) { Link Here
103
my $record=GetMarcBiblio($biblionumber);
103
my $record=GetMarcBiblio($biblionumber);
104
104
105
my $hostrecords;
105
my $hostrecords;
106
# adding items linked via host biblios
106
if ( C4::Context->preference('EasyAnalyticalRecords') ) {
107
my @hostitems = GetHostItemsInfo($record);
107
    # adding items linked via host biblios
108
if (@hostitems){
108
    my @hostitems = GetHostItemsInfo($record);
109
    if (@hostitems){
109
        $hostrecords =1;
110
        $hostrecords =1;
110
        push (@items,@hostitems);
111
        push (@items,@hostitems);
112
    }
111
}
113
}
112
114
113
my $subtitle = GetRecordValue('subtitle', $record, $fw);
115
my $subtitle = GetRecordValue('subtitle', $record, $fw);
(-)a/opac/opac-detail.pl (-16 / +17 lines)
Lines 399-419 $template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") Link Here
399
# change back when ive fixed request.pl
399
# change back when ive fixed request.pl
400
my @all_items = GetItemsInfo( $biblionumber );
400
my @all_items = GetItemsInfo( $biblionumber );
401
401
402
# adding items linked via host biblios
402
if ( C4::Context->preference('EasyAnalyticalRecords') ) {
403
403
    # adding items linked via host biblios
404
my $analyticfield = '773';
404
    my $analyticfield = '773';
405
if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
405
    if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
406
    $analyticfield = '773';
406
        $analyticfield = '773';
407
} elsif ($marcflavour eq 'UNIMARC') {
407
    } elsif ($marcflavour eq 'UNIMARC') {
408
    $analyticfield = '461';
408
        $analyticfield = '461';
409
}
409
    }
410
foreach my $hostfield ( $record->field($analyticfield)) {
410
    foreach my $hostfield ( $record->field($analyticfield)) {
411
    my $hostbiblionumber = $hostfield->subfield("0");
411
        my $hostbiblionumber = $hostfield->subfield("0");
412
    my $linkeditemnumber = $hostfield->subfield("9");
412
        my $linkeditemnumber = $hostfield->subfield("9");
413
    my @hostitemInfos = GetItemsInfo($hostbiblionumber);
413
        my @hostitemInfos = GetItemsInfo($hostbiblionumber);
414
    foreach my $hostitemInfo (@hostitemInfos){
414
        foreach my $hostitemInfo (@hostitemInfos){
415
        if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
415
            if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
416
            push(@all_items, $hostitemInfo);
416
                push(@all_items, $hostitemInfo);
417
            }
417
        }
418
        }
418
    }
419
    }
419
}
420
}
Lines 592-598 my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); Link Here
592
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
593
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
593
my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
594
my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
594
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
595
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
595
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
596
my $marchostsarray   = C4::Context->preference('EasyAnalyticalRecords') ? GetMarcHosts($record,$marcflavour) : ();
596
my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
597
my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
597
598
598
    $template->param(
599
    $template->param(
(-)a/opac/opac-reserve.pl (-5 / +7 lines)
Lines 135-145 foreach my $biblioNumber (@biblionumbers) { Link Here
135
135
136
    # flag indicating existence of at least one item linked via a host record
136
    # flag indicating existence of at least one item linked via a host record
137
    my $hostitemsflag;
137
    my $hostitemsflag;
138
    # adding items linked via host biblios
138
    if ( C4::Context->preference('EasyAnalyticalRecords') ) {
139
    my @hostitemInfos = GetHostItemsInfo($marcrecord);
139
        # adding items linked via host biblios
140
    if (@hostitemInfos){
140
        my @hostitemInfos = GetHostItemsInfo($marcrecord);
141
        $hostitemsflag =1;
141
        if (@hostitemInfos) {
142
        push (@itemInfos,@hostitemInfos);
142
            $hostitemsflag = 1;
143
            push( @itemInfos, @hostitemInfos );
144
        }
143
    }
145
    }
144
146
145
    $biblioData->{itemInfos} = \@itemInfos;
147
    $biblioData->{itemInfos} = \@itemInfos;
(-)a/reserve/request.pl (-6 / +8 lines)
Lines 304-314 foreach my $biblionumber (@biblionumbers) { Link Here
304
    if (my $items = get_itemnumbers_of($biblionumber)->{$biblionumber}){
304
    if (my $items = get_itemnumbers_of($biblionumber)->{$biblionumber}){
305
        @itemnumbers  = @$items;
305
        @itemnumbers  = @$items;
306
    }
306
    }
307
	my @hostitems = get_hostitemnumbers_of($biblionumber);
307
    
308
	if (@hostitems){
308
    if ( C4::Context->preference('EasyAnalyticalRecords') ) {
309
		$template->param('hostitemsflag' => 1);
309
        my @hostitems = get_hostitemnumbers_of($biblionumber);
310
		push(@itemnumbers, @hostitems);
310
        if (@hostitems){
311
	}
311
            $template->param('hostitemsflag' => 1);
312
            push(@itemnumbers, @hostitems);
313
        }
314
    }
312
315
313
    if (!@itemnumbers) {
316
    if (!@itemnumbers) {
314
        $template->param('noitems' => 1);
317
        $template->param('noitems' => 1);
315
- 

Return to bug 9566