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

(-)a/C4/Circulation.pm (-39 / +31 lines)
Lines 306-336 sub transferbook { Link Here
306
    my ( $tbr, $barcode, $ignoreRs ) = @_;
306
    my ( $tbr, $barcode, $ignoreRs ) = @_;
307
    my $messages;
307
    my $messages;
308
    my $dotransfer      = 1;
308
    my $dotransfer      = 1;
309
    my $itemnumber = GetItemnumberFromBarcode( $barcode );
309
    my $item = Koha::Items->find( { barcode => $barcode } );
310
    my $issue      = GetItemIssue($itemnumber);
311
    my $biblio = GetBiblioFromItemNumber($itemnumber);
312
310
313
    # bad barcode..
311
    # bad barcode..
314
    if ( not $itemnumber ) {
312
    unless ( $item ) {
315
        $messages->{'BadBarcode'} = $barcode;
313
        $messages->{'BadBarcode'} = $barcode;
316
        $dotransfer = 0;
314
        $dotransfer = 0;
317
    }
315
    }
318
316
317
    my $itemnumber = $item->itemnumber;
318
    my $issue = GetOpenIssue($itemnumber);
319
    # get branches of book...
319
    # get branches of book...
320
    my $hbr = $biblio->{'homebranch'};
320
    my $hbr = $item->homebranch;
321
    my $fbr = $biblio->{'holdingbranch'};
321
    my $fbr = $item->holdingbranch;
322
322
323
    # if using Branch Transfer Limits
323
    # if using Branch Transfer Limits
324
    if ( C4::Context->preference("UseBranchTransferLimits") == 1 ) {
324
    if ( C4::Context->preference("UseBranchTransferLimits") == 1 ) {
325
        my $code = C4::Context->preference("BranchTransferLimitsType") eq 'ccode' ? $item->ccode : $item->biblio->biblioitem->itemtype; # BranchTransferLimitsType is 'ccode' or 'itemtype'
325
        if ( C4::Context->preference("item-level_itypes") && C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ) {
326
        if ( C4::Context->preference("item-level_itypes") && C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ) {
326
            if ( ! IsBranchTransferAllowed( $tbr, $fbr, $biblio->{'itype'} ) ) {
327
            if ( ! IsBranchTransferAllowed( $tbr, $fbr, $item->itype ) ) {
327
                $messages->{'NotAllowed'} = $tbr . "::" . $biblio->{'itype'};
328
                $messages->{'NotAllowed'} = $tbr . "::" . $item->itype;
328
                $dotransfer = 0;
329
                $dotransfer = 0;
329
            }
330
            }
330
        } elsif ( ! IsBranchTransferAllowed( $tbr, $fbr, $biblio->{ C4::Context->preference("BranchTransferLimitsType") } ) ) {
331
        } elsif ( ! IsBranchTransferAllowed( $tbr, $fbr, $code ) ) {
331
            $messages->{'NotAllowed'} = $tbr . "::" . $biblio->{ C4::Context->preference("BranchTransferLimitsType") };
332
            $messages->{'NotAllowed'} = $tbr . "::" . $code;
332
            $dotransfer = 0;
333
            $dotransfer = 0;
333
    	}
334
        }
334
    }
335
    }
335
336
336
    # if is permanent...
337
    # if is permanent...
Lines 374-380 sub transferbook { Link Here
374
375
375
    }
376
    }
376
    ModDateLastSeen( $itemnumber );
377
    ModDateLastSeen( $itemnumber );
377
    return ( $dotransfer, $messages, $biblio );
378
    return ( $dotransfer, $messages );
378
}
379
}
379
380
380
381
Lines 673-679 sub CanBookBeIssued { Link Here
673
    my $onsite_checkout     = $params->{onsite_checkout}     || 0;
674
    my $onsite_checkout     = $params->{onsite_checkout}     || 0;
674
    my $override_high_holds = $params->{override_high_holds} || 0;
675
    my $override_high_holds = $params->{override_high_holds} || 0;
675
676
676
    my $item = GetItem(GetItemnumberFromBarcode( $barcode ));
677
    my $item = GetItem(undef, $barcode );
677
    my $issue = GetItemIssue($item->{itemnumber});
678
    my $issue = GetItemIssue($item->{itemnumber});
678
	my $biblioitem = GetBiblioItemData($item->{biblioitemnumber});
679
	my $biblioitem = GetBiblioItemData($item->{biblioitemnumber});
679
	$item->{'itemtype'}=$item->{'itype'}; 
680
	$item->{'itemtype'}=$item->{'itype'}; 
Lines 1147-1154 sub CanBookBeReturned { Link Here
1147
1148
1148
sub checkHighHolds {
1149
sub checkHighHolds {
1149
    my ( $item, $borrower ) = @_;
1150
    my ( $item, $borrower ) = @_;
1150
    my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
1151
    my $branch = _GetCircControlBranch( $item, $borrower );
1151
    my $branch = _GetCircControlBranch( $item, $borrower );
1152
    my $item_object = Koha::Items->find( $item->{itemnumber} );
1152
1153
1153
    my $return_data = {
1154
    my $return_data = {
1154
        exceeded    => 0,
1155
        exceeded    => 0,
Lines 1207-1217 sub checkHighHolds { Link Here
1207
1208
1208
        my $calendar = Koha::Calendar->new( branchcode => $branch );
1209
        my $calendar = Koha::Calendar->new( branchcode => $branch );
1209
1210
1210
        my $itype =
1211
        my $itype = $item_object->effective_itemtype;
1211
          ( C4::Context->preference('item-level_itypes') )
1212
          ? $biblio->{'itype'}
1213
          : $biblio->{'itemtype'};
1214
1215
        my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branch, $borrower );
1212
        my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branch, $borrower );
1216
1213
1217
        my $decreaseLoanHighHoldsDuration = C4::Context->preference('decreaseLoanHighHoldsDuration');
1214
        my $decreaseLoanHighHoldsDuration = C4::Context->preference('decreaseLoanHighHoldsDuration');
Lines 1300-1314 sub AddIssue { Link Here
1300
        # find which item we issue
1297
        # find which item we issue
1301
        my $item = GetItem( '', $barcode )
1298
        my $item = GetItem( '', $barcode )
1302
          or return;    # if we don't get an Item, abort.
1299
          or return;    # if we don't get an Item, abort.
1300
        my $item_object = Koha::Items->find( { barcode => $barcode } );
1303
1301
1304
        my $branch = _GetCircControlBranch( $item, $borrower );
1302
        my $branch = _GetCircControlBranch( $item, $borrower );
1305
1303
1306
        # get actual issuing if there is one
1304
        # get actual issuing if there is one
1307
        my $actualissue = GetItemIssue( $item->{itemnumber} );
1305
        my $actualissue = GetItemIssue( $item->{itemnumber} );
1308
1306
1309
        # get biblioinformation for this item
1310
        my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
1311
1312
        # check if we just renew the issue.
1307
        # check if we just renew the issue.
1313
        if ( $actualissue->{borrowernumber} eq $borrower->{'borrowernumber'}
1308
        if ( $actualissue->{borrowernumber} eq $borrower->{'borrowernumber'}
1314
                and not $switch_onsite_checkout ) {
1309
                and not $switch_onsite_checkout ) {
Lines 1362-1371 sub AddIssue { Link Here
1362
1357
1363
            # Record in the database the fact that the book was issued.
1358
            # Record in the database the fact that the book was issued.
1364
            unless ($datedue) {
1359
            unless ($datedue) {
1365
                my $itype =
1360
                my $itype = $item_object->effective_itemtype;
1366
                  ( C4::Context->preference('item-level_itypes') )
1367
                  ? $biblio->{'itype'}
1368
                  : $biblio->{'itemtype'};
1369
                $datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower );
1361
                $datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower );
1370
1362
1371
            }
1363
            }
Lines 1466-1472 sub AddIssue { Link Here
1466
        logaction(
1458
        logaction(
1467
            "CIRCULATION", "ISSUE",
1459
            "CIRCULATION", "ISSUE",
1468
            $borrower->{'borrowernumber'},
1460
            $borrower->{'borrowernumber'},
1469
            $biblio->{'itemnumber'}
1461
            $item->{'itemnumber'}
1470
        ) if C4::Context->preference("IssueLog");
1462
        ) if C4::Context->preference("IssueLog");
1471
    }
1463
    }
1472
    return $issue;
1464
    return $issue;
Lines 1864-1870 sub AddReturn { Link Here
1864
    }
1856
    }
1865
1857
1866
        # full item data, but no borrowernumber or checkout info (no issue)
1858
        # full item data, but no borrowernumber or checkout info (no issue)
1867
        # we know GetItem should work because GetItemnumberFromBarcode worked
1868
    my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch";
1859
    my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch";
1869
        # get the proper branch to which to return the item
1860
        # get the proper branch to which to return the item
1870
    my $returnbranch = $item->{$hbr} || $branch ;
1861
    my $returnbranch = $item->{$hbr} || $branch ;
Lines 2808-2814 sub AddRenewal { Link Here
2808
    my $lastreneweddate = shift || DateTime->now(time_zone => C4::Context->tz)->ymd();
2799
    my $lastreneweddate = shift || DateTime->now(time_zone => C4::Context->tz)->ymd();
2809
2800
2810
    my $item   = GetItem($itemnumber) or return;
2801
    my $item   = GetItem($itemnumber) or return;
2811
    my $biblio = GetBiblioFromItemNumber($itemnumber) or return;
2802
    my $item_object = Koha::Items->find( $itemnumber ); # Should replace $item
2803
    my $biblio = $item_object->biblio;
2812
2804
2813
    my $dbh = C4::Context->dbh;
2805
    my $dbh = C4::Context->dbh;
2814
2806
Lines 2836-2843 sub AddRenewal { Link Here
2836
    # based on the value of the RenewalPeriodBase syspref.
2828
    # based on the value of the RenewalPeriodBase syspref.
2837
    unless ($datedue) {
2829
    unless ($datedue) {
2838
2830
2839
        my $itemtype = (C4::Context->preference('item-level_itypes')) ? $biblio->{'itype'} : $biblio->{'itemtype'};
2831
        my $itemtype = $item_object->effective_itemtype;
2840
2841
        $datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
2832
        $datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
2842
                                        dt_from_string( $issuedata->{date_due} ) :
2833
                                        dt_from_string( $issuedata->{date_due} ) :
2843
                                        DateTime->now( time_zone => C4::Context->tz());
2834
                                        DateTime->now( time_zone => C4::Context->tz());
Lines 2855-2868 sub AddRenewal { Link Here
2855
    $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber );
2846
    $sth->execute( $datedue->strftime('%Y-%m-%d %H:%M'), $renews, $lastreneweddate, $borrowernumber, $itemnumber );
2856
2847
2857
    # Update the renewal count on the item, and tell zebra to reindex
2848
    # Update the renewal count on the item, and tell zebra to reindex
2858
    $renews = $biblio->{'renewals'} + 1;
2849
    $renews = $item->{renewals} + 1;
2859
    ModItem({ renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $biblio->{'biblionumber'}, $itemnumber);
2850
    ModItem({ renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $item->{biblionumber}, $itemnumber);
2860
2851
2861
    # Charge a new rental fee, if applicable?
2852
    # Charge a new rental fee, if applicable?
2862
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
2853
    my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
2863
    if ( $charge > 0 ) {
2854
    if ( $charge > 0 ) {
2864
        my $accountno = getnextacctno( $borrowernumber );
2855
        my $accountno = getnextacctno( $borrowernumber );
2865
        my $item = GetBiblioFromItemNumber($itemnumber);
2866
        my $manager_id = 0;
2856
        my $manager_id = 0;
2867
        $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; 
2857
        $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; 
2868
        $sth = $dbh->prepare(
2858
        $sth = $dbh->prepare(
Lines 2872-2878 sub AddRenewal { Link Here
2872
                    VALUES (now(),?,?,?,?,?,?,?,?)"
2862
                    VALUES (now(),?,?,?,?,?,?,?,?)"
2873
        );
2863
        );
2874
        $sth->execute( $borrowernumber, $accountno, $charge, $manager_id,
2864
        $sth->execute( $borrowernumber, $accountno, $charge, $manager_id,
2875
            "Renewal of Rental Item $item->{'title'} $item->{'barcode'}",
2865
            "Renewal of Rental Item " . $item_object->title . " $item->{'barcode'}",
2876
            'Rent', $charge, $itemnumber );
2866
            'Rent', $charge, $itemnumber );
2877
    }
2867
    }
2878
2868
Lines 3684-3692 sub ProcessOfflineOperation { Link Here
3684
sub ProcessOfflineReturn {
3674
sub ProcessOfflineReturn {
3685
    my $operation = shift;
3675
    my $operation = shift;
3686
3676
3687
    my $itemnumber = C4::Items::GetItemnumberFromBarcode( $operation->{barcode} );
3677
    my $item = Koha::Items->find({barcode => $operation->{barcode}});
3688
3678
3689
    if ( $itemnumber ) {
3679
    if ( $item ) {
3680
        my $itemnumber = $item->itemnumber;
3690
        my $issue = GetOpenIssue( $itemnumber );
3681
        my $issue = GetOpenIssue( $itemnumber );
3691
        if ( $issue ) {
3682
        if ( $issue ) {
3692
            MarkIssueReturned(
3683
            MarkIssueReturned(
Lines 3715-3724 sub ProcessOfflineIssue { Link Here
3715
    my $borrower = C4::Members::GetMember( cardnumber => $operation->{cardnumber} );
3706
    my $borrower = C4::Members::GetMember( cardnumber => $operation->{cardnumber} );
3716
3707
3717
    if ( $borrower->{borrowernumber} ) {
3708
    if ( $borrower->{borrowernumber} ) {
3718
        my $itemnumber = C4::Items::GetItemnumberFromBarcode( $operation->{barcode} );
3709
        my $item = Koha::Items->find({ barcode => $operation->{barcode} });
3719
        unless ($itemnumber) {
3710
        unless ($item) {
3720
            return "Barcode not found.";
3711
            return "Barcode not found.";
3721
        }
3712
        }
3713
        my $itemnumber = $item->itemnumber;
3722
        my $issue = GetOpenIssue( $itemnumber );
3714
        my $issue = GetOpenIssue( $itemnumber );
3723
3715
3724
        if ( $issue and ( $issue->{borrowernumber} ne $borrower->{borrowernumber} ) ) { # Item already issued to another borrower, mark it returned
3716
        if ( $issue and ( $issue->{borrowernumber} ne $borrower->{borrowernumber} ) ) { # Item already issued to another borrower, mark it returned
(-)a/C4/Members.pm (-6 / +8 lines)
Lines 809-817 sub GetMemberAccountRecords { Link Here
809
    my $total = 0;
809
    my $total = 0;
810
    while ( my $data = $sth->fetchrow_hashref ) {
810
    while ( my $data = $sth->fetchrow_hashref ) {
811
        if ( $data->{itemnumber} ) {
811
        if ( $data->{itemnumber} ) {
812
            my $biblio = GetBiblioFromItemNumber( $data->{itemnumber} );
812
            my $item = Koha::Items->find( $data->{itemnumber} );
813
            $data->{biblionumber} = $biblio->{biblionumber};
813
            my $biblio = $item->biblio;
814
            $data->{title}        = $biblio->{title};
814
            $data->{biblionumber} = $biblio->biblionumber;
815
            $data->{title}        = $biblio->title;
815
        }
816
        }
816
        $acctlines[$numlines] = $data;
817
        $acctlines[$numlines] = $data;
817
        $numlines++;
818
        $numlines++;
Lines 890-898 sub GetBorNotifyAcctRecord { Link Here
890
    my $total = 0;
891
    my $total = 0;
891
    while ( my $data = $sth->fetchrow_hashref ) {
892
    while ( my $data = $sth->fetchrow_hashref ) {
892
        if ( $data->{itemnumber} ) {
893
        if ( $data->{itemnumber} ) {
893
            my $biblio = GetBiblioFromItemNumber( $data->{itemnumber} );
894
            my $item = Koha::Items->find( $data->{itemnumber} );
894
            $data->{biblionumber} = $biblio->{biblionumber};
895
            my $biblio = $item->biblio;
895
            $data->{title}        = $biblio->{title};
896
            $data->{biblionumber} = $biblio->biblionumber;
897
            $data->{title}        = $biblio->title;
896
        }
898
        }
897
        $acctlines[$numlines] = $data;
899
        $acctlines[$numlines] = $data;
898
        $numlines++;
900
        $numlines++;
(-)a/C4/SIP/ILS/Item.pm (-19 / +17 lines)
Lines 22-27 use C4::Circulation; Link Here
22
use C4::Members;
22
use C4::Members;
23
use C4::Reserves;
23
use C4::Reserves;
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::Items;
25
26
26
27
27
=encoding UTF-8
28
=encoding UTF-8
Lines 74-109 sub priority_sort { Link Here
74
sub new {
75
sub new {
75
	my ($class, $item_id) = @_;
76
	my ($class, $item_id) = @_;
76
	my $type = ref($class) || $class;
77
	my $type = ref($class) || $class;
77
	my $self;
78
    my $item = Koha::Items->find( { barcode => $item_id } );
78
    my $itemnumber = GetItemnumberFromBarcode($item_id);
79
	unless ( $item ) {
79
	my $item = GetBiblioFromItemNumber($itemnumber);    # actually biblio.*, biblioitems.* AND items.*  (overkill)
80
	if (! $item) {
81
		syslog("LOG_DEBUG", "new ILS::Item('%s'): not found", $item_id);
80
		syslog("LOG_DEBUG", "new ILS::Item('%s'): not found", $item_id);
82
		warn "new ILS::Item($item_id) : No item '$item_id'.";
81
		warn "new ILS::Item($item_id) : No item '$item_id'.";
83
        return;
82
        return;
84
	}
83
	}
85
    $item->{  'itemnumber'   } = $itemnumber;
84
    my $self = $item->unblessed;
86
    $item->{      'id'       } = $item->{barcode};     # to SIP, the barcode IS the id.
85
    $self->{      'id'       } = $item->barcode;     # to SIP, the barcode IS the id.
87
    $item->{permanent_location}= $item->{homebranch};
86
    $self->{permanent_location}= $item->homebranch;
88
    $item->{'collection_code'} = $item->{ccode};
87
    $self->{'collection_code'} = $item->ccode;
89
    $item->{  'call_number'  } = $item->{itemcallnumber};
88
    $self->{  'call_number'  } = $item->itemcallnumber;
90
89
91
    my $it = C4::Context->preference('item-level_itypes') ? $item->{itype} : $item->{itemtype};
90
    my $it = $item->effective_itemtype;
92
    my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it );
91
    my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it );
93
    $item->{sip_media_type} = $itemtype->sip_media_type() if $itemtype;
92
    $self->{sip_media_type} = $itemtype->sip_media_type() if $itemtype;
94
93
95
	# check if its on issue and if so get the borrower
94
	# check if its on issue and if so get the borrower
96
	my $issue = GetItemIssue($item->{'itemnumber'});
95
	my $issue = GetItemIssue($item->itemnumber);
97
    if ($issue) {
96
    if ($issue) {
98
        $item->{due_date} = $issue->{date_due};
97
        $self->{due_date} = $issue->{date_due};
99
    }
98
    }
100
	my $borrower = GetMember(borrowernumber=>$issue->{'borrowernumber'});
99
	my $borrower = GetMember(borrowernumber=>$issue->{'borrowernumber'});
101
	$item->{patron} = $borrower->{'cardnumber'};
100
    $self->{patron} = $borrower->{'cardnumber'};
102
    my $reserves = GetReservesFromBiblionumber({ biblionumber => $item->{biblionumber} });
101
    my $reserves = GetReservesFromBiblionumber({ biblionumber => $item->biblionumber });
103
    $item->{hold_queue} = [ sort priority_sort @$reserves ];
102
    $self->{hold_queue} = [ sort priority_sort @$reserves ];
104
	$item->{hold_shelf}    = [( grep {   defined $_->{found}  and $_->{found} eq 'W' } @{$item->{hold_queue}} )];
103
	$self->{hold_shelf}    = [( grep {   defined $_->{found}  and $_->{found} eq 'W' } @{$self->{hold_queue}} )];
105
	$item->{pending_queue} = [( grep {(! defined $_->{found}) or  $_->{found} ne 'W' } @{$item->{hold_queue}} )];
104
	$self->{pending_queue} = [( grep {(! defined $_->{found}) or  $_->{found} ne 'W' } @{$self->{hold_queue}} )];
106
	$self = $item;
107
	bless $self, $type;
105
	bless $self, $type;
108
106
109
    syslog("LOG_DEBUG", "new ILS::Item('%s'): found with title '%s'",
107
    syslog("LOG_DEBUG", "new ILS::Item('%s'): found with title '%s'",
(-)a/C4/SIP/ILS/Transaction/Hold.pm (-14 / +10 lines)
Lines 3-19 Link Here
3
3
4
package C4::SIP::ILS::Transaction::Hold;
4
package C4::SIP::ILS::Transaction::Hold;
5
5
6
use warnings;
6
use Modern::Perl;
7
use strict;
8
7
9
use C4::SIP::ILS::Transaction;
8
use C4::SIP::ILS::Transaction;
10
9
11
use C4::Reserves;	# AddReserve
10
use C4::Reserves;	# AddReserve
12
use C4::Members;	# GetMember
11
use C4::Members;	# GetMember
13
use C4::Biblio;		# GetBiblioFromItemNumber GetBiblioItemByBiblioNumber
14
use parent qw(C4::SIP::ILS::Transaction);
12
use parent qw(C4::SIP::ILS::Transaction);
15
13
16
14
use Koha::Items;
17
15
18
my %fields = (
16
my %fields = (
19
	expiration_date => 0,
17
	expiration_date => 0,
Lines 49-56 sub do_hold { Link Here
49
        $self->ok(0);
47
        $self->ok(0);
50
        return $self;
48
        return $self;
51
    }
49
    }
52
    my $bib = GetBiblioFromItemNumber( undef, $self->{item}->id );
50
    my $item = Koha::Items->find({ barcode => $self->{item}->id });
53
    unless ($bib) {
51
    unless ($item) {
54
        $self->screen_msg( 'No biblio record matches barcode "' . $self->{item}->id . '".' );
52
        $self->screen_msg( 'No biblio record matches barcode "' . $self->{item}->id . '".' );
55
        $self->ok(0);
53
        $self->ok(0);
56
        return $self;
54
        return $self;
Lines 61-68 sub do_hold { Link Here
61
        $self->ok(0);
59
        $self->ok(0);
62
        return $self;
60
        return $self;
63
    }
61
    }
64
    my $bibno = $bib->{biblionumber};
62
    AddReserve( $branch, $borrower->{borrowernumber}, $item->biblionumber );
65
    AddReserve( $branch, $borrower->{borrowernumber}, $bibno, GetBiblioItemByBiblioNumber($bibno) );
66
63
67
    # unfortunately no meaningful return value
64
    # unfortunately no meaningful return value
68
    $self->ok(1);
65
    $self->ok(1);
Lines 82-91 sub drop_hold { Link Here
82
		$self->ok(0);
79
		$self->ok(0);
83
		return $self;
80
		return $self;
84
	}
81
	}
85
	my $bib = GetBiblioFromItemNumber(undef, $self->{item}->id);
82
    my $item = Koha::Items->find({ barcode => $self->{item}->id });
86
83
87
      CancelReserve({
84
      CancelReserve({
88
            biblionumber   => $bib->{biblionumber},
85
            biblionumber   => $item->biblionumber,
89
        itemnumber     => $self->{item}->id,
86
        itemnumber     => $self->{item}->id,
90
           borrowernumber => $borrower->{borrowernumber}
87
           borrowernumber => $borrower->{borrowernumber}
91
      });
88
      });
Lines 107-114 sub change_hold { Link Here
107
		$self->ok(0);
104
		$self->ok(0);
108
		return $self;
105
		return $self;
109
	}
106
	}
110
	my $bib = GetBiblioFromItemNumber(undef, $self->{item}->id);
107
    my $item = Koha::Items->find({ barcode => $self->{item}->id });
111
	unless ($bib) {
108
	unless ($item) {
112
		$self->screen_msg('No biblio record matches barcode "' . $self->{item}->id . '".');
109
		$self->screen_msg('No biblio record matches barcode "' . $self->{item}->id . '".');
113
		$self->ok(0);
110
		$self->ok(0);
114
		return $self;
111
		return $self;
Lines 119-126 sub change_hold { Link Here
119
		$self->ok(0);
116
		$self->ok(0);
120
		return $self;
117
		return $self;
121
	}
118
	}
122
	my $bibno = $bib->{biblionumber};
119
    ModReserve({ biblionumber => $item->biblionumber, borrowernumber => $borrower->{borrowernumber}, branchcode => $branch });
123
	ModReserve({ biblionumber => $bibno, borrowernumber => $borrower->{borrowernumber}, branchcode => $branch });
124
120
125
	$self->ok(1);
121
	$self->ok(1);
126
	return $self;
122
	return $self;
(-)a/catalogue/issuehistory.pl (-1 / +1 lines)
Lines 24-30 use C4::Auth; Link Here
24
use C4::Output;
24
use C4::Output;
25
25
26
use C4::Circulation;    # GetBiblioIssues
26
use C4::Circulation;    # GetBiblioIssues
27
use C4::Biblio;    # GetBiblio GetBiblioFromItemNumber
27
use C4::Biblio;    # GetBiblio
28
use C4::Search;		# enabled_staff_search_views
28
use C4::Search;		# enabled_staff_search_views
29
29
30
my $query = new CGI;
30
my $query = new CGI;
(-)a/cataloguing/moveitem.pl (-15 / +9 lines)
Lines 34-39 use C4::Acquisition qw/GetOrderFromItemnumber ModOrder GetOrder/; Link Here
34
use Date::Calc qw(Today);
34
use Date::Calc qw(Today);
35
35
36
use MARC::File::XML;
36
use MARC::File::XML;
37
38
use Koha::Items;
39
37
my $query = CGI->new;
40
my $query = CGI->new;
38
41
39
# The biblio to move the item to
42
# The biblio to move the item to
Lines 61-79 $template->param(biblionumber => $biblionumber); Link Here
61
64
62
# If we already have the barcode of the item to move and the biblionumber to move the item to
65
# If we already have the barcode of the item to move and the biblionumber to move the item to
63
if ($barcode && $biblionumber) { 
66
if ($barcode && $biblionumber) { 
64
    
65
    # We get his itemnumber
66
    my $itemnumber = GetItemnumberFromBarcode($barcode);
67
67
68
    if ($itemnumber) {
68
    my $itemnumber;
69
    	# And then, we get the item
69
    my $item = Koha::Items->find({ barcode => $barcode });
70
	my $item = GetItem($itemnumber);
70
71
    if ($item) {
71
72
72
	if ($item) {
73
        $itemnumber = $item->itemnumber;
74
        my $frombiblionumber = $item->biblionumber;
73
75
74
	    my $results = GetBiblioFromItemNumber($itemnumber, $barcode);
75
	    my $frombiblionumber = $results->{'biblionumber'};
76
	   
77
	    my $moveresult = MoveItemFromBiblio($itemnumber, $frombiblionumber, $biblionumber); 
76
	    my $moveresult = MoveItemFromBiblio($itemnumber, $frombiblionumber, $biblionumber); 
78
	    if ($moveresult) { 
77
	    if ($moveresult) { 
79
		$template->param(success => 1);
78
		$template->param(success => 1);
Lines 87-97 if ($barcode && $biblionumber) { Link Here
87
	    $template->param(error => 1,
86
	    $template->param(error => 1,
88
	                     errornoitem => 1);
87
	                     errornoitem => 1);
89
	}
88
	}
90
    } else {
91
	    $template->param(error => 1,
92
			     errornoitemnumber => 1);
93
94
    }
95
    $template->param(
89
    $template->param(
96
			barcode => $barcode,  
90
			barcode => $barcode,  
97
			itemnumber => $itemnumber,
91
			itemnumber => $itemnumber,
(-)a/circ/branchtransfers.pl (-24 / +22 lines)
Lines 33-38 use C4::Koha; Link Here
33
use C4::Members;
33
use C4::Members;
34
use Koha::BiblioFrameworks;
34
use Koha::BiblioFrameworks;
35
use Koha::AuthorisedValues;
35
use Koha::AuthorisedValues;
36
use Koha::Items;
36
37
37
###############################################
38
###############################################
38
#  Getting state
39
#  Getting state
Lines 112-143 defined $barcode and $barcode =~ s/^\s*|\s*$//g; # FIXME: barcodeInputFilter Link Here
112
# warn "barcode : $barcode";
113
# warn "barcode : $barcode";
113
if ($barcode) {
114
if ($barcode) {
114
115
115
    my $iteminformation;
116
    ( $transfered, $messages ) =
116
    ( $transfered, $messages, $iteminformation ) =
117
      transferbook( $tobranchcd, $barcode, $ignoreRs );
117
      transferbook( $tobranchcd, $barcode, $ignoreRs );
118
#       use Data::Dumper;
118
    my $item = Koha::Items->find({ barcode => $barcode });
119
#       warn "Transfered : $transfered / ".Dumper($messages);
120
    $found = $messages->{'ResFound'};
119
    $found = $messages->{'ResFound'};
121
    if ($transfered) {
120
    if ($transfered) {
122
        my %item;
121
        my %item;
122
        my $biblio = $item->biblio;
123
        my $frbranchcd =  C4::Context->userenv->{'branch'};
123
        my $frbranchcd =  C4::Context->userenv->{'branch'};
124
#         if ( not($found) ) {
124
        $item{'biblionumber'}          = $item->biblionumber;
125
        $item{'biblionumber'}          = $iteminformation->{'biblionumber'};
125
        $item{'itemnumber'}            = $item->itemnumber;
126
        $item{'itemnumber'}            = $iteminformation->{'itemnumber'};
126
        $item{'title'}                 = $biblio->title;
127
        $item{'title'}                 = $iteminformation->{'title'};
127
        $item{'author'}                = $biblio->author;
128
        $item{'author'}                = $iteminformation->{'author'};
128
        $item{'itemtype'}              = $biblio->biblioitem->itemtype;
129
        $item{'itemtype'}              = $iteminformation->{'itemtype'};
129
        $item{'ccode'}                 = $item->ccode;
130
        $item{'ccode'}                 = $iteminformation->{'ccode'};
130
        $item{'itemcallnumber'}        = $item->itemcallnumber;
131
        $item{'itemcallnumber'}        = $iteminformation->{'itemcallnumber'};
131
        my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $item->location });
132
        my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $iteminformation->{location} });
133
        $item{'location'}              = $av->count ? $av->next->lib : '';
132
        $item{'location'}              = $av->count ? $av->next->lib : '';
134
#         }
135
        $item{counter}  = 0;
133
        $item{counter}  = 0;
136
        $item{barcode}  = $barcode;
134
        $item{barcode}  = $barcode;
137
        $item{frombrcd} = $frbranchcd;
135
        $item{frombrcd} = $frbranchcd;
138
        $item{tobrcd}   = $tobranchcd;
136
        $item{tobrcd}   = $tobranchcd;
139
        push( @trsfitemloop, \%item );
137
        push( @trsfitemloop, \%item );
140
#         warn Dumper(@trsfitemloop);
141
    }
138
    }
142
}
139
}
143
140
Lines 153-167 foreach ( $query->param ) { Link Here
153
    $item{barcode}  = $bc;
150
    $item{barcode}  = $bc;
154
    $item{frombrcd} = $frbcd;
151
    $item{frombrcd} = $frbcd;
155
    $item{tobrcd}   = $tobcd;
152
    $item{tobrcd}   = $tobcd;
156
    my ($iteminformation) = GetBiblioFromItemNumber( GetItemnumberFromBarcode($bc) );
153
    my $item = Koha::Items->find({ barcode => $bc });
157
    $item{'biblionumber'}          = $iteminformation->{'biblionumber'};
154
    my $biblio = $item->biblio;
158
    $item{'itemnumber'}            = $iteminformation->{'itemnumber'};
155
    $item{'biblionumber'}          = $item->biblionumber;
159
    $item{'title'}                 = $iteminformation->{'title'};
156
    $item{'itemnumber'}            = $item->itemnumber;
160
    $item{'author'}                = $iteminformation->{'author'};
157
    $item{'title'}                 = $biblio->title;
161
    $item{'itemtype'}              = $iteminformation->{'itemtype'};
158
    $item{'author'}                = $biblio->author;
162
    $item{'ccode'}                 = $iteminformation->{'ccode'};
159
    $item{'itemtype'}              = $biblio->biblioitem->itemtype;
163
    $item{'itemcallnumber'}        = $iteminformation->{'itemcallnumber'};
160
    $item{'ccode'}                 = $item->ccode;
164
    my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $iteminformation->{location} });
161
    $item{'itemcallnumber'}        = $item->itemcallnumber;
162
    my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $item->location });
165
    $item{'location'}              = $av->count ? $av->next->lib : '';
163
    $item{'location'}              = $av->count ? $av->next->lib : '';
166
    push( @trsfitemloop, \%item );
164
    push( @trsfitemloop, \%item );
167
}
165
}
(-)a/circ/returns.pl (-50 / +40 lines)
Lines 52-57 use Koha::DateUtils; Link Here
52
use Koha::Calendar;
52
use Koha::Calendar;
53
use Koha::Checkouts;
53
use Koha::Checkouts;
54
use Koha::BiblioFrameworks;
54
use Koha::BiblioFrameworks;
55
use Koha::Items;
55
56
56
my $query = new CGI;
57
my $query = new CGI;
57
58
Lines 145-158 if ($query->param('WT-itemNumber')){ Link Here
145
}
146
}
146
147
147
if ( $query->param('reserve_id') ) {
148
if ( $query->param('reserve_id') ) {
148
    my $item           = $query->param('itemnumber');
149
    my $itemnumber     = $query->param('itemnumber');
149
    my $borrowernumber = $query->param('borrowernumber');
150
    my $borrowernumber = $query->param('borrowernumber');
150
    my $reserve_id     = $query->param('reserve_id');
151
    my $reserve_id     = $query->param('reserve_id');
151
    my $diffBranchReturned = $query->param('diffBranch');
152
    my $diffBranchReturned = $query->param('diffBranch');
152
    my $iteminfo   = GetBiblioFromItemNumber($item);
153
    my $cancel_reserve = $query->param('cancel_reserve');
153
    my $cancel_reserve = $query->param('cancel_reserve');
154
    # fix up item type for display
154
    # fix up item type for display
155
    $iteminfo->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $iteminfo->{'itype'} : $iteminfo->{'itemtype'};
155
    my $item = Koha::Items->find( $itemnumber );
156
    my $biblio = $item->biblio;
156
157
157
    if ( $cancel_reserve ) {
158
    if ( $cancel_reserve ) {
158
        CancelReserve({ reserve_id => $reserve_id, charge_cancel_fee => !$forgivemanualholdsexpire });
159
        CancelReserve({ reserve_id => $reserve_id, charge_cancel_fee => !$forgivemanualholdsexpire });
Lines 160-178 if ( $query->param('reserve_id') ) { Link Here
160
        my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
161
        my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
161
        # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
162
        # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
162
        # i.e., whether to apply waiting status
163
        # i.e., whether to apply waiting status
163
        ModReserveAffect( $item, $borrowernumber, $diffBranchSend, $reserve_id );
164
        ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id );
164
    }
165
    }
165
#   check if we have other reserves for this document, if we have a return send the message of transfer
166
#   check if we have other reserves for this document, if we have a return send the message of transfer
166
    my ( $messages, $nextreservinfo ) = GetOtherReserves($item);
167
    my ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
167
168
168
    my $borr = GetMember( borrowernumber => $nextreservinfo );
169
    my $borr = GetMember( borrowernumber => $nextreservinfo );
169
    my $name   = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
170
    my $name   = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
170
    if ( $messages->{'transfert'} ) {
171
    if ( $messages->{'transfert'} ) {
171
        $template->param(
172
        $template->param(
172
            itemtitle      => $iteminfo->{'title'},
173
            itemtitle      => $biblio->title,
173
            itemnumber     => $iteminfo->{'itemnumber'},
174
            itemnumber     => $item->itemnumber,
174
            itembiblionumber => $iteminfo->{'biblionumber'},
175
            itembiblionumber => $biblio->biblionumber,
175
            iteminfo       => $iteminfo->{'author'},
176
            iteminfo       => $biblio->author,
176
            name           => $name,
177
            name           => $name,
177
            borrowernumber => $borrowernumber,
178
            borrowernumber => $borrowernumber,
178
            borcnum        => $borr->{'cardnumber'},
179
            borcnum        => $borr->{'cardnumber'},
Lines 255-274 my $returnbranch; Link Here
255
if ($barcode) {
256
if ($barcode) {
256
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
257
    $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
257
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
258
    $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
258
    $itemnumber = GetItemnumberFromBarcode($barcode);
259
    my $item = Koha::Items->find({ barcode => $barcode });
259
260
#
261
# save the return
262
#
263
264
    # get biblio description
265
    my $biblio = GetBiblioFromItemNumber($itemnumber);
266
    # fix up item type for display
267
    $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
268
260
269
    # Check if we should display a checkin message, based on the the item
261
    # Check if we should display a checkin message, based on the the item
270
    # type of the checked in item
262
    # type of the checked in item
271
    my $itemtype = Koha::ItemTypes->find( $biblio->{'itemtype'} );
263
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
272
    if ( $itemtype && $itemtype->checkinmsg ) {
264
    if ( $itemtype && $itemtype->checkinmsg ) {
273
        $template->param(
265
        $template->param(
274
            checkinmsg     => $itemtype->checkinmsg,
266
            checkinmsg     => $itemtype->checkinmsg,
Lines 277-300 if ($barcode) { Link Here
277
    }
269
    }
278
270
279
    # make sure return branch respects home branch circulation rules, default to homebranch
271
    # make sure return branch respects home branch circulation rules, default to homebranch
280
    my $hbr = GetBranchItemRule($biblio->{'homebranch'}, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch";
272
    my $hbr = GetBranchItemRule($item->homebranch, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch";
281
    $returnbranch = $biblio->{$hbr};
273
    $returnbranch = $item->$hbr;
282
274
283
    my $materials = $biblio->{'materials'};
275
    my $materials = $item->materials;
284
    my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
276
    my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
285
    $materials = $descriptions->{lib} // '';
277
    $materials = $descriptions->{lib} // '';
286
278
287
    $template->param(
279
    $template->param(
288
        title            => $biblio->{'title'},
280
        title            => $biblio->title,
289
        homebranch       => $biblio->{'homebranch'},
281
        homebranch       => $item->homebranch,
290
        holdingbranch    => $biblio->{'holdingbranch'},
282
        holdingbranch    => $item->holdingbranch,
291
        returnbranch     => $returnbranch,
283
        returnbranch     => $returnbranch,
292
        author           => $biblio->{'author'},
284
        author           => $biblio->author,
293
        itembarcode      => $biblio->{'barcode'},
285
        itembarcode      => $item->barcode,
294
        itemtype         => $biblio->{'itemtype'},
286
        itemtype         => $item->effective_itemtype,
295
        ccode            => $biblio->{'ccode'},
287
        ccode            => $item->ccode,
296
        itembiblionumber => $biblio->{'biblionumber'},
288
        itembiblionumber => $biblio->biblionumber,
297
        biblionumber     => $biblio->{'biblionumber'},
289
        biblionumber     => $biblio->biblionumber,
298
        borrower         => $borrower,
290
        borrower         => $borrower,
299
        additional_materials => $materials,
291
        additional_materials => $materials,
300
    );
292
    );
Lines 589-613 foreach ( sort { $a <=> $b } keys %returneditems ) { Link Here
589
            $ri{borrowernumber} = $riborrowernumber{$_};
581
            $ri{borrowernumber} = $riborrowernumber{$_};
590
        }
582
        }
591
583
592
        #        my %ri;
584
        my $item = Koha::Items->find({ barcode => $bar_code });
593
        my $biblio = GetBiblioFromItemNumber(GetItemnumberFromBarcode($bar_code));
585
        my $biblio = $item->biblio;
594
        my $item   = GetItem( GetItemnumberFromBarcode($bar_code) );
586
        # FIXME pass $item to the template and we are done here...
595
        # fix up item type for display
587
        $ri{itembiblionumber}    = $biblio->biblionumber;
596
        $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
588
        $ri{itemtitle}           = $biblio->title;
597
        $ri{itembiblionumber}    = $biblio->{'biblionumber'};
589
        $ri{itemauthor}          = $biblio->author;
598
        $ri{itemtitle}           = $biblio->{'title'};
590
        $ri{itemcallnumber}      = $item->itemcallnumber;
599
        $ri{itemauthor}          = $biblio->{'author'};
591
        $ri{dateaccessioned}     = $item->dateaccessioned;
600
        $ri{itemcallnumber}      = $biblio->{'itemcallnumber'};
592
        $ri{itemtype}            = $item->effective_itemtype;
601
        $ri{dateaccessioned}     = $item->{dateaccessioned};
593
        $ri{itemnote}            = $item->itemnotes;
602
        $ri{itemtype}            = $biblio->{'itemtype'};
594
        $ri{itemnotes_nonpublic} = $item->itemnotes_nonpublic;
603
        $ri{itemnote}            = $biblio->{'itemnotes'};
595
        $ri{ccode}               = $item->ccode;
604
        $ri{itemnotes_nonpublic} = $item->{'itemnotes_nonpublic'};
596
        $ri{enumchron}           = $item->enumchron;
605
        $ri{ccode}               = $biblio->{'ccode'};
597
        $ri{itemnumber}          = $item->itemnumber;
606
        $ri{enumchron}           = $biblio->{'enumchron'};
607
        $ri{itemnumber}          = $biblio->{'itemnumber'};
608
        $ri{barcode}             = $bar_code;
598
        $ri{barcode}             = $bar_code;
609
        $ri{homebranch}          = $item->{'homebranch'};
599
        $ri{homebranch}          = $item->homebranch;
610
        $ri{holdingbranch}       = $item->{'holdingbranch'};
600
        $ri{holdingbranch}       = $item->holdingbranch;
611
601
612
        $ri{location}         = $biblio->{'location'};
602
        $ri{location}         = $biblio->{'location'};
613
        my $shelfcode = $ri{'location'};
603
        my $shelfcode = $ri{'location'};
(-)a/circ/transferstoreceive.pl (-8 / +17 lines)
Lines 87-103 while ( my $library = $libraries->next ) { Link Here
87
                $getransf{'messcompa'} = 1;
87
                $getransf{'messcompa'} = 1;
88
				$getransf{'diff'} = $diff;
88
				$getransf{'diff'} = $diff;
89
            }
89
            }
90
            my $gettitle     = GetBiblioFromItemNumber( $num->{'itemnumber'} );
90
            my $item = Koha::Items->find( $num->{itemnumber} );
91
            my $itemtypeinfo = getitemtypeinfo( (C4::Context->preference('item-level_itypes')) ? $gettitle->{'itype'} : $gettitle->{'itemtype'} );
91
            my $biblio = $item->biblio;
92
            my $itemtypeinfo = getitemtypeinfo( $item->effective_itemtype );
92
93
93
            $getransf{'datetransfer'} = $num->{'datesent'};
94
            $getransf{'datetransfer'} = $num->{'datesent'};
94
            $getransf{'itemtype'} = $itemtypeinfo ->{'description'};
95
            $getransf{'itemtype'} = $itemtypeinfo ->{'description'};
95
			foreach (qw(title author biblionumber itemnumber barcode homebranch holdingbranch itemcallnumber)) {
96
            $getransf = {
96
            	$getransf{$_} = $gettitle->{$_};
97
                %getransf,
97
			}
98
                title          => $biblio->title,
98
99
                author         => $biblio->author,
99
            my $record = GetMarcBiblio($gettitle->{'biblionumber'});
100
                biblionumber   => $biblio->biblionumber,
100
            $getransf{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($gettitle->{'biblionumber'}));
101
                itemnumber     => $item->itemnumber,
102
                barcode        => $item->barcode,
103
                homebranch     => $item->homebranch,
104
                holdingbranch  => $item->holdingbranch,
105
                itemcallnumber => $item->itemcallnumber;
106
            };
107
108
            my $record = GetMarcBiblio($biblio->biblionumber);
109
            $getransf{'subtitle'} = GetRecordValue('subtitle', $record, $biblio->frameworkcode);
101
110
102
            # we check if we have a reserv for this transfer
111
            # we check if we have a reserv for this transfer
103
            my @checkreserv = GetReservesFromItemnumber($num->{'itemnumber'});
112
            my @checkreserv = GetReservesFromItemnumber($num->{'itemnumber'});
(-)a/circ/waitingreserves.pl (-17 / +17 lines)
Lines 37-42 use C4::Reserves; Link Here
37
use C4::Koha;
37
use C4::Koha;
38
use Koha::DateUtils;
38
use Koha::DateUtils;
39
use Koha::BiblioFrameworks;
39
use Koha::BiblioFrameworks;
40
use Koha::Items;
40
41
41
my $input = new CGI;
42
my $input = new CGI;
42
43
Lines 92-111 foreach my $num (@getreserves) { Link Here
92
    next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
93
    next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
93
94
94
    my $itemnumber = $num->{'itemnumber'};
95
    my $itemnumber = $num->{'itemnumber'};
95
    my $gettitle     = GetBiblioFromItemNumber( $itemnumber );
96
    my $item = Koha::Items->find( $itemnumber );
97
    my $biblio = $item->biblio;
96
    my $borrowernum = $num->{'borrowernumber'};
98
    my $borrowernum = $num->{'borrowernumber'};
97
    my $holdingbranch = $gettitle->{'holdingbranch'};
99
    my $holdingbranch = $item->holdingbranch;
98
    my $homebranch = $gettitle->{'homebranch'};
100
    my $homebranch = $item->homebranch;
99
101
100
    my %getreserv = (
102
    my %getreserv = (
101
        itemnumber => $itemnumber,
103
        itemnumber => $itemnumber,
102
        borrowernum => $borrowernum,
104
        borrowernum => $borrowernum,
103
    );
105
    );
104
106
105
    # fix up item type for display
106
    $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
107
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
107
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
108
    my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
108
    my $itemtypeinfo = getitemtypeinfo( $item->effective_itemtype );
109
    $getreserv{'waitingdate'} = $num->{'waitingdate'};
109
    $getreserv{'waitingdate'} = $num->{'waitingdate'};
110
    my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
110
    my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
111
111
Lines 115-129 foreach my $num (@getreserves) { Link Here
115
    my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
115
    my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
116
116
117
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
117
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
118
    $getreserv{'title'}          = $gettitle->{'title'};
118
    $getreserv{'title'}          = $biblio->title;
119
    $getreserv{'subtitle'}       = GetRecordValue('subtitle', GetMarcBiblio($gettitle->{'biblionumber'}), GetFrameworkCode($gettitle->{'biblionumber'}));
119
    $getreserv{'subtitle'}       = GetRecordValue('subtitle', GetMarcBiblio($biblio->biblionumber), $biblio->frameworkcode);
120
    $getreserv{'biblionumber'}   = $gettitle->{'biblionumber'};
120
    $getreserv{'biblionumber'}   = $biblio->biblionumber;
121
    $getreserv{'barcode'}        = $gettitle->{'barcode'};
121
    $getreserv{'barcode'}        = $item->barcode;
122
    $getreserv{'homebranch'}     = $gettitle->{'homebranch'};
122
    $getreserv{'homebranch'}     = $homebranch;
123
    $getreserv{'holdingbranch'}  = $gettitle->{'holdingbranch'};
123
    $getreserv{'holdingbranch'}  = $item->holdingbranch;
124
    $getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
124
    $getreserv{'itemcallnumber'} = $item->itemcallnumber;
125
    $getreserv{'enumchron'}      = $gettitle->{'enumchron'};
125
    $getreserv{'enumchron'}      = $item->enumchron;
126
    $getreserv{'copynumber'}     = $gettitle->{'copynumber'};
126
    $getreserv{'copynumber'}     = $item->copynumber;
127
    if ( $homebranch ne $holdingbranch ) {
127
    if ( $homebranch ne $holdingbranch ) {
128
        $getreserv{'dotransfer'} = 1;
128
        $getreserv{'dotransfer'} = 1;
129
    }
129
    }
Lines 194-200 sub cancel { Link Here
194
    if ($nextreservinfo) {
194
    if ($nextreservinfo) {
195
        my %res;
195
        my %res;
196
        my $borrowerinfo = C4::Members::GetMember( borrowernumber => $nextreservinfo );
196
        my $borrowerinfo = C4::Members::GetMember( borrowernumber => $nextreservinfo );
197
        my $iteminfo = GetBiblioFromItemNumber($item);
197
        my $title = Koha::Items->find( $item )->biblio->title;
198
        if ( $messages->{'transfert'} ) {
198
        if ( $messages->{'transfert'} ) {
199
            $res{messagetransfert} = $messages->{'transfert'};
199
            $res{messagetransfert} = $messages->{'transfert'};
200
            $res{branchcode}       = $messages->{'transfert'};
200
            $res{branchcode}       = $messages->{'transfert'};
Lines 205-211 sub cancel { Link Here
205
        $res{nextreservsurname}   = $borrowerinfo->{'surname'};
205
        $res{nextreservsurname}   = $borrowerinfo->{'surname'};
206
        $res{nextreservfirstname} = $borrowerinfo->{'firstname'};
206
        $res{nextreservfirstname} = $borrowerinfo->{'firstname'};
207
        $res{nextreservitem}      = $item;
207
        $res{nextreservitem}      = $item;
208
        $res{nextreservtitle}     = $iteminfo->{'title'};
208
        $res{nextreservtitle}     = $title;
209
        $res{waiting}             = $messages->{'waiting'} ? 1 : 0;
209
        $res{waiting}             = $messages->{'waiting'} ? 1 : 0;
210
210
211
        return \%res;
211
        return \%res;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt (-6 / +2 lines)
Lines 36-53 Link Here
36
		[% IF ( errornonewitem ) %]ERROR: Unable to create the new item.<p>
36
		[% IF ( errornonewitem ) %]ERROR: Unable to create the new item.<p>
37
			[% INCLUDE actions %]
37
			[% INCLUDE actions %]
38
			[% INCLUDE fail %]
38
			[% INCLUDE fail %]
39
		</p>
39
		[% END %]
40
		[% END %]
40
41
41
		[% IF ( errornoitem ) %]ERROR: Unable to get the item.<p>
42
		[% IF ( errornoitem ) %]ERROR: Unable to get the item.<p>
42
			[% INCLUDE actions %]
43
			[% INCLUDE actions %]
43
			[% INCLUDE fail %]
44
			[% INCLUDE fail %]
44
		[% END %]
45
46
		[% IF ( errornoitemnumber ) %]ERROR: Unable to get the item number from this barcode.<p>
47
			[% INCLUDE actions %]
48
			[% INCLUDE fail %]
49
		[% END %]
50
		</p>
45
		</p>
46
		[% END %]
51
    </div>
47
    </div>
52
48
53
	[% ELSE %]
49
	[% ELSE %]
(-)a/misc/cronjobs/advance_notices.pl (-4 / +5 lines)
Lines 57-62 use C4::Members::Messaging; Link Here
57
use C4::Overdues;
57
use C4::Overdues;
58
use Koha::DateUtils;
58
use Koha::DateUtils;
59
use C4::Log;
59
use C4::Log;
60
use Koha::Items;
60
use Koha::Libraries;
61
use Koha::Libraries;
61
62
62
=head1 NAME
63
=head1 NAME
Lines 250-256 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
250
            $due_digest->{ $upcoming->{borrowernumber} }->{email} = $from_address;
251
            $due_digest->{ $upcoming->{borrowernumber} }->{email} = $from_address;
251
            $due_digest->{ $upcoming->{borrowernumber} }->{count}++;
252
            $due_digest->{ $upcoming->{borrowernumber} }->{count}++;
252
        } else {
253
        } else {
253
            my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
254
            my $item = Koha::Items->find( $upcoming->{itemnumber} );
254
            my $letter_type = 'DUE';
255
            my $letter_type = 'DUE';
255
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0');
256
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},'0');
256
            my $titles = "";
257
            my $titles = "";
Lines 264-270 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
264
                my $letter = parse_letter( { letter_code    => $letter_type,
265
                my $letter = parse_letter( { letter_code    => $letter_type,
265
                                      borrowernumber => $upcoming->{'borrowernumber'},
266
                                      borrowernumber => $upcoming->{'borrowernumber'},
266
                                      branchcode     => $upcoming->{'branchcode'},
267
                                      branchcode     => $upcoming->{'branchcode'},
267
                                      biblionumber   => $biblio->{'biblionumber'},
268
                                      biblionumber   => $item->biblionumber,
268
                                      itemnumber     => $upcoming->{'itemnumber'},
269
                                      itemnumber     => $upcoming->{'itemnumber'},
269
                                      substitute     => { 'items.content' => $titles },
270
                                      substitute     => { 'items.content' => $titles },
270
                                      message_transport_type => $transport,
271
                                      message_transport_type => $transport,
Lines 284-290 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
284
            $upcoming_digest->{ $upcoming->{borrowernumber} }->{email} = $from_address;
285
            $upcoming_digest->{ $upcoming->{borrowernumber} }->{email} = $from_address;
285
            $upcoming_digest->{ $upcoming->{borrowernumber} }->{count}++;
286
            $upcoming_digest->{ $upcoming->{borrowernumber} }->{count}++;
286
        } else {
287
        } else {
287
            my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
288
            my $item = Koha::Items->find( $upcoming->{itemnumber} );
288
            my $letter_type = 'PREDUE';
289
            my $letter_type = 'PREDUE';
289
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'});
290
            $sth->execute($upcoming->{'borrowernumber'},$upcoming->{'itemnumber'},$borrower_preferences->{'days_in_advance'});
290
            my $titles = "";
291
            my $titles = "";
Lines 298-304 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
298
                my $letter = parse_letter( { letter_code    => $letter_type,
299
                my $letter = parse_letter( { letter_code    => $letter_type,
299
                                      borrowernumber => $upcoming->{'borrowernumber'},
300
                                      borrowernumber => $upcoming->{'borrowernumber'},
300
                                      branchcode     => $upcoming->{'branchcode'},
301
                                      branchcode     => $upcoming->{'branchcode'},
301
                                      biblionumber   => $biblio->{'biblionumber'},
302
                                      biblionumber   => $item->biblionumber,
302
                                      itemnumber     => $upcoming->{'itemnumber'},
303
                                      itemnumber     => $upcoming->{'itemnumber'},
303
                                      substitute     => { 'items.content' => $titles },
304
                                      substitute     => { 'items.content' => $titles },
304
                                      message_transport_type => $transport,
305
                                      message_transport_type => $transport,
(-)a/offline_circ/enqueue_koc.pl (-3 / +4 lines)
Lines 33-38 use C4::Items; Link Here
33
use C4::Members;
33
use C4::Members;
34
use C4::Stats;
34
use C4::Stats;
35
use Koha::UploadedFiles;
35
use Koha::UploadedFiles;
36
use Koha::Items;
36
37
37
use Date::Calc qw( Add_Delta_Days Date_to_Days );
38
use Date::Calc qw( Add_Delta_Days Date_to_Days );
38
39
Lines 189-198 sub _get_borrowernumber_from_barcode { Link Here
189
190
190
    return unless $barcode;
191
    return unless $barcode;
191
192
192
    my $item = GetBiblioFromItemNumber( undef, $barcode );
193
    my $item = Koha::Items->find({ barcode => $barcode });
193
    return unless $item->{'itemnumber'};
194
    return unless $item;
194
195
195
    my $issue = C4::Circulation::GetItemIssue( $item->{'itemnumber'} );
196
    my $issue = C4::Circulation::GetItemIssue( $item->itemnumber );
196
    return unless $issue->{'borrowernumber'};
197
    return unless $issue->{'borrowernumber'};
197
    return $issue->{'borrowernumber'};
198
    return $issue->{'borrowernumber'};
198
}
199
}
(-)a/offline_circ/list.pl (-3 / +6 lines)
Lines 30-35 use C4::Circulation; Link Here
30
use C4::Members;
30
use C4::Members;
31
use C4::Biblio;
31
use C4::Biblio;
32
32
33
use Koha::Items;
34
33
my $query = CGI->new;
35
my $query = CGI->new;
34
36
35
my ($template, $loggedinuser, $cookie) = get_template_and_user({
37
my ($template, $loggedinuser, $cookie) = get_template_and_user({
Lines 43-51 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
43
my $operations = GetOfflineOperations;
45
my $operations = GetOfflineOperations;
44
46
45
for (@$operations) {
47
for (@$operations) {
46
    my $biblio             = GetBiblioFromItemNumber(undef, $_->{'barcode'});
48
    my $item = Koha::Items->find({ barcode => $_->{barcode} });
47
    $_->{'bibliotitle'}    = $biblio->{'title'};
49
    my $biblio = $item->biblio;
48
    $_->{'biblionumber'}   = $biblio->{'biblionumber'};
50
    $_->{'bibliotitle'}    = $biblio->title;
51
    $_->{'biblionumber'}   = $biblio->biblionumber;
49
    my $borrower           = C4::Members::GetMember( cardnumber => $_->{'cardnumber'} );
52
    my $borrower           = C4::Members::GetMember( cardnumber => $_->{'cardnumber'} );
50
    if ($borrower) {
53
    if ($borrower) {
51
        $_->{'borrowernumber'} = $borrower->{'borrowernumber'};
54
        $_->{'borrowernumber'} = $borrower->{'borrowernumber'};
(-)a/offline_circ/process_koc.pl (-24 / +24 lines)
Lines 249-267 sub kocIssueItem { Link Here
249
    $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
249
    $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
250
    my $branchcode = C4::Context->userenv->{branch};
250
    my $branchcode = C4::Context->userenv->{branch};
251
    my $borrower = GetMember( 'cardnumber'=>$circ->{ 'cardnumber' } );
251
    my $borrower = GetMember( 'cardnumber'=>$circ->{ 'cardnumber' } );
252
    my $item = GetBiblioFromItemNumber( undef, $circ->{ 'barcode' } );
252
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
253
    my $issue = GetItemIssue( $item->{'itemnumber'} );
253
    my $issue = GetItemIssue( $item->itemnumber );
254
254
255
    if ( $issue->{ 'date_due' } ) { ## Item is currently checked out to another person.
255
    if ( $issue->{ 'date_due' } ) { ## Item is currently checked out to another person.
256
        #warn "Item Currently Issued.";
256
        #warn "Item Currently Issued.";
257
        my $issue = GetOpenIssue( $item->{'itemnumber'} );
257
        my $issue = GetOpenIssue( $item->itemnumber );
258
258
259
        if ( $issue->{'borrowernumber'} eq $borrower->{'borrowernumber'} ) { ## Issued to this person already, renew it.
259
        if ( $issue->{'borrowernumber'} eq $borrower->{'borrowernumber'} ) { ## Issued to this person already, renew it.
260
            #warn "Item issued to this member already, renewing.";
260
            #warn "Item issued to this member already, renewing.";
261
261
262
            C4::Circulation::AddRenewal(
262
            C4::Circulation::AddRenewal(
263
                $issue->{'borrowernumber'},    # borrowernumber
263
                $issue->{'borrowernumber'},    # borrowernumber
264
                $item->{'itemnumber'},         # itemnumber
264
                $item->itemnumber,             # itemnumber
265
                undef,                         # branch
265
                undef,                         # branch
266
                undef,                         # datedue - let AddRenewal calculate it automatically
266
                undef,                         # datedue - let AddRenewal calculate it automatically
267
                $circ->{'date'},               # issuedate
267
                $circ->{'date'},               # issuedate
Lines 269-277 sub kocIssueItem { Link Here
269
269
270
            push @output, {
270
            push @output, {
271
                renew => 1,
271
                renew => 1,
272
                title => $item->{ 'title' },
272
                title => $biblio->title,
273
                biblionumber => $item->{'biblionumber'},
273
                biblionumber => $biblio->biblionumber,
274
                barcode => $item->{ 'barcode' },
274
                barcode => $item->barcode,
275
                firstname => $borrower->{ 'firstname' },
275
                firstname => $borrower->{ 'firstname' },
276
                surname => $borrower->{ 'surname' },
276
                surname => $borrower->{ 'surname' },
277
                borrowernumber => $borrower->{'borrowernumber'},
277
                borrowernumber => $borrower->{'borrowernumber'},
Lines 290-298 sub kocIssueItem { Link Here
290
                C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, undef, undef, $circ->{'date'} ) unless ( DEBUG );
290
                C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, undef, undef, $circ->{'date'} ) unless ( DEBUG );
291
                push @output, {
291
                push @output, {
292
                    issue => 1,
292
                    issue => 1,
293
                    title => $item->{ 'title' },
293
                    title => $biblio->title,
294
                    biblionumber => $item->{'biblionumber'},
294
                    biblionumber => $biblio->biblionumber,
295
                    barcode => $item->{ 'barcode' },
295
                    barcode => $item->barcode,
296
                    firstname => $borrower->{ 'firstname' },
296
                    firstname => $borrower->{ 'firstname' },
297
                    surname => $borrower->{ 'surname' },
297
                    surname => $borrower->{ 'surname' },
298
                    borrowernumber => $borrower->{'borrowernumber'},
298
                    borrowernumber => $borrower->{'borrowernumber'},
Lines 310-318 sub kocIssueItem { Link Here
310
        C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, undef, undef, $circ->{'date'} ) unless ( DEBUG );
310
        C4::Circulation::AddIssue( $borrower, $circ->{'barcode'}, undef, undef, $circ->{'date'} ) unless ( DEBUG );
311
        push @output, {
311
        push @output, {
312
            issue => 1,
312
            issue => 1,
313
            title => $item->{ 'title' },
313
            title => $biblio->title,
314
            biblionumber => $item->{'biblionumber'},
314
            biblionumber => $biblio->biblionumber,
315
            barcode => $item->{ 'barcode' },
315
            barcode => $item->barcode,
316
            firstname => $borrower->{ 'firstname' },
316
            firstname => $borrower->{ 'firstname' },
317
            surname => $borrower->{ 'surname' },
317
            surname => $borrower->{ 'surname' },
318
            borrowernumber => $borrower->{'borrowernumber'},
318
            borrowernumber => $borrower->{'borrowernumber'},
Lines 325-351 sub kocIssueItem { Link Here
325
sub kocReturnItem {
325
sub kocReturnItem {
326
    my ( $circ ) = @_;
326
    my ( $circ ) = @_;
327
    $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
327
    $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
328
    my $item = GetBiblioFromItemNumber( undef, $circ->{ 'barcode' } );
328
    my $item = Koha::Items->find({ barcode => $circ->{barcode} });
329
    #warn( Data::Dumper->Dump( [ $circ, $item ], [ qw( circ item ) ] ) );
329
    my $biblio = $item->biblio;
330
    my $borrowernumber = _get_borrowernumber_from_barcode( $circ->{'barcode'} );
330
    my $borrowernumber = _get_borrowernumber_from_barcode( $circ->{'barcode'} );
331
    if ( $borrowernumber ) {
331
    if ( $borrowernumber ) {
332
        my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
332
        my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
333
        C4::Circulation::MarkIssueReturned(
333
        C4::Circulation::MarkIssueReturned(
334
            $borrowernumber,
334
            $borrowernumber,
335
            $item->{'itemnumber'},
335
            $item->itemnumber,
336
            undef,
336
            undef,
337
            $circ->{'date'},
337
            $circ->{'date'},
338
            $borrower->{'privacy'}
338
            $borrower->{'privacy'}
339
        );
339
        );
340
340
341
        ModItem({ onloan => undef }, $item->{'biblionumber'}, $item->{'itemnumber'});
341
        ModItem({ onloan => undef }, $biblio->biblionumber, $item->itemnumber);
342
        ModDateLastSeen( $item->{'itemnumber'} );
342
        ModDateLastSeen( $item->itemnumber );
343
343
344
        push @output, {
344
        push @output, {
345
            return => 1,
345
            return => 1,
346
            title => $item->{ 'title' },
346
            title => $biblio->title,
347
            biblionumber => $item->{'biblionumber'},
347
            biblionumber => $biblio->biblionumber,
348
            barcode => $item->{ 'barcode' },
348
            barcode => $item->barcode,
349
            borrowernumber => $borrower->{'borrowernumber'},
349
            borrowernumber => $borrower->{'borrowernumber'},
350
            firstname => $borrower->{'firstname'},
350
            firstname => $borrower->{'firstname'},
351
            surname => $borrower->{'surname'},
351
            surname => $borrower->{'surname'},
Lines 395-404 sub _get_borrowernumber_from_barcode { Link Here
395
395
396
    return unless $barcode;
396
    return unless $barcode;
397
397
398
    my $item = GetBiblioFromItemNumber( undef, $barcode );
398
    my $item = Koha::Items->find({ barcode => $barcode });
399
    return unless $item->{'itemnumber'};
399
    return unless $item;
400
400
401
    my $issue = C4::Circulation::GetItemIssue( $item->{'itemnumber'} );
401
    my $issue = C4::Circulation::GetItemIssue( $item->itemnumber );
402
    return unless $issue->{'borrowernumber'};
402
    return unless $issue->{'borrowernumber'};
403
    return $issue->{'borrowernumber'};
403
    return $issue->{'borrowernumber'};
404
}
404
}
(-)a/opac/opac-shelves.pl (-2 / +2 lines)
Lines 30-35 use C4::Tags qw( get_tags ); Link Here
30
use C4::XSLT;
30
use C4::XSLT;
31
31
32
use Koha::Biblioitems;
32
use Koha::Biblioitems;
33
use Koha::Items;
33
use Koha::Virtualshelves;
34
use Koha::Virtualshelves;
34
use Koha::RecordProcessor;
35
use Koha::RecordProcessor;
35
36
Lines 170-178 if ( $op eq 'add_form' ) { Link Here
170
        if( my $barcode = $query->param('barcode') ) {
171
        if( my $barcode = $query->param('barcode') ) {
171
            my $item = GetItem( 0, $barcode);
172
            my $item = GetItem( 0, $barcode);
172
            if (defined $item && $item->{itemnumber}) {
173
            if (defined $item && $item->{itemnumber}) {
173
                my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
174
                if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
174
                if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
175
                    my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); };
175
                    my $added = eval { $shelf->add_biblio( $item->{biblionumber}, $loggedinuser ); };
176
                    if ($@) {
176
                    if ($@) {
177
                        push @messages, { type => 'error', code => ref($@), msg => $@ };
177
                        push @messages, { type => 'error', code => ref($@), msg => $@ };
178
                    } elsif ( $added ) {
178
                    } elsif ( $added ) {
(-)a/virtualshelves/shelves.pl (-3 / +1 lines)
Lines 148-155 if ( $op eq 'add_form' ) { Link Here
148
                    next if $barcode eq '';
148
                    next if $barcode eq '';
149
                    my $item = GetItem( 0, $barcode);
149
                    my $item = GetItem( 0, $barcode);
150
                    if (defined $item && $item->{itemnumber}) {
150
                    if (defined $item && $item->{itemnumber}) {
151
                        my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
151
                        my $added = eval { $shelf->add_biblio( $item->{biblionumber}, $loggedinuser ); };
152
                        my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); };
153
                        if ($@) {
152
                        if ($@) {
154
                            push @messages, { item_barcode => $barcode, type => 'alert', code => ref($@), msg => $@ };
153
                            push @messages, { item_barcode => $barcode, type => 'alert', code => ref($@), msg => $@ };
155
                        } elsif ( $added ) {
154
                        } elsif ( $added ) {
156
- 

Return to bug 18276