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

(-)a/C4/Circulation.pm (-32 / +36 lines)
Lines 571-577 sub itemissues { Link Here
571
=head2 CanBookBeIssued
571
=head2 CanBookBeIssued
572
572
573
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
573
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
574
                                      $barcode, $duedatespec, $inprocess );
574
                      $barcode, $duedatespec, $inprocess, $ignore_reserves );
575
575
576
Check if a book can be issued.
576
Check if a book can be issued.
577
577
Lines 585-591 C<$issuingimpossible> and C<$needsconfirmation> are some hashref. Link Here
585
585
586
=item C<$duedatespec> is a C4::Dates object.
586
=item C<$duedatespec> is a C4::Dates object.
587
587
588
=item C<$inprocess>
588
=item C<$inprocess> boolean switch
589
=item C<$ignore_reserves> boolean switch
589
590
590
=back
591
=back
591
592
Lines 662-668 if the borrower borrows to much things Link Here
662
=cut
663
=cut
663
664
664
sub CanBookBeIssued {
665
sub CanBookBeIssued {
665
    my ( $borrower, $barcode, $duedate, $inprocess ) = @_;
666
    my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves ) = @_;
666
    my %needsconfirmation;    # filled with problems that needs confirmations
667
    my %needsconfirmation;    # filled with problems that needs confirmations
667
    my %issuingimpossible;    # filled with problems that causes the issue to be IMPOSSIBLE
668
    my %issuingimpossible;    # filled with problems that causes the issue to be IMPOSSIBLE
668
    my $item = GetItem(GetItemnumberFromBarcode( $barcode ));
669
    my $item = GetItem(GetItemnumberFromBarcode( $barcode ));
Lines 869-905 sub CanBookBeIssued { Link Here
869
        $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'};
870
        $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'};
870
    }
871
    }
871
872
872
    # See if the item is on reserve.
873
    unless ( $ignore_reserves ) {
873
    my ( $restype, $res, undef ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
874
        # See if the item is on reserve.
874
    if ($restype) {
875
        my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
875
		my $resbor = $res->{'borrowernumber'};
876
        if ($restype) {
876
		my ( $resborrower ) = C4::Members::GetMember( borrowernumber => $resbor );
877
            my $resbor = $res->{'borrowernumber'};
877
		my $branches  = GetBranches();
878
            if ( $resbor ne $borrower->{'borrowernumber'} ) {
878
		my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
879
                my ( $resborrower ) = C4::Members::GetMember( borrowernumber => $resbor );
879
        if ( $resbor ne $borrower->{'borrowernumber'} && $restype eq "Waiting" )
880
                my $branchname = GetBranchName( $res->{'branchcode'} );
880
        {
881
                if ( $restype eq "Waiting" )
881
            # The item is on reserve and waiting, but has been
882
                {
882
            # reserved by some other patron.
883
                    # The item is on reserve and waiting, but has been
883
            $needsconfirmation{RESERVE_WAITING} = 1;
884
                    # reserved by some other patron.
884
            $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
885
                    $needsconfirmation{RESERVE_WAITING} = 1;
885
            $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
886
                    $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
886
            $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
887
                    $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
887
            $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
888
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
888
            $needsconfirmation{'resbranchname'} = $branchname;
889
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
889
            $needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'});
890
                    $needsconfirmation{'resbranchname'} = $branchname;
890
        }
891
                    $needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'});
891
        elsif ( $restype eq "Reserved" ) {
892
                }
892
            # The item is on reserve for someone else.
893
                elsif ( $restype eq "Reserved" ) {
893
            $needsconfirmation{RESERVED} = 1;
894
                    # The item is on reserve for someone else.
894
            $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
895
                    $needsconfirmation{RESERVED} = 1;
895
            $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
896
                    $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
896
            $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
897
                    $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
897
            $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
898
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
898
            $needsconfirmation{'resbranchname'} = $branchname;
899
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
899
            $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'});
900
                    $needsconfirmation{'resbranchname'} = $branchname;
901
                    $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'});
902
                }
903
            }
900
        }
904
        }
901
    }
905
    }
902
	return ( \%issuingimpossible, \%needsconfirmation );
906
    return ( \%issuingimpossible, \%needsconfirmation );
903
}
907
}
904
908
905
=head2 AddIssue
909
=head2 AddIssue
(-)a/C4/SIP/ILS/Transaction/Checkout.pm (-1 / +7 lines)
Lines 58-64 sub do_checkout { Link Here
58
	$debug and warn "do_checkout: patron (" . $patron_barcode . ")";
58
	$debug and warn "do_checkout: patron (" . $patron_barcode . ")";
59
	my $borrower = $self->{patron}->getmemberdetails_object();
59
	my $borrower = $self->{patron}->getmemberdetails_object();
60
	$debug and warn "do_checkout borrower: . " . Dumper $borrower;
60
	$debug and warn "do_checkout borrower: . " . Dumper $borrower;
61
	my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $borrower, $barcode );
61
	my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued(
62
        $borrower,
63
        $barcode,
64
        undef,
65
        0,
66
        C4::Context->preference("AllowItemsOnHoldCheckout")
67
    );
62
	my $noerror=1;
68
	my $noerror=1;
63
    if (scalar keys %$issuingimpossible) {
69
    if (scalar keys %$issuingimpossible) {
64
        foreach (keys %$issuingimpossible) {
70
        foreach (keys %$issuingimpossible) {
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 333-335 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo');
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo');
335
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo');
335
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo');
336
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 4654-4659 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4654
    print "Upgrade done (Added support for local cover images)\n";
4654
    print "Upgrade done (Added support for local cover images)\n";
4655
    SetVersion($DBversion);
4655
    SetVersion($DBversion);
4656
}
4656
}
4657
$DBversion = "3.07.00.XXX";
4658
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4659
	$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo')");
4660
    print "Upgrade to $DBversion add 'AllowItemsOnHoldCheckout' syspref \n";
4661
    SetVersion ($DBversion);
4662
}
4663
4657
=head1 FUNCTIONS
4664
=head1 FUNCTIONS
4658
4665
4659
=head2 DropAllForeignKeys($table)
4666
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 112-117 Circulation: Link Here
112
                  no: "Don't allow"
112
                  no: "Don't allow"
113
            - staff to manually override the renewal limit and renew a checkout when it would go over the renewal limit.
113
            - staff to manually override the renewal limit and renew a checkout when it would go over the renewal limit.
114
        -
114
        -
115
            - pref: AllowItemsOnHoldCheckout
116
              choices:
117
                  yes: Allow
118
                  no: "Don't allow"
119
            - checkouts of items items reserved to someone else. If allowed do not generate RESERVE_WAITING and RESERVED warning. This allows self checkouts for those items.
120
        -
115
            - pref: AllFinesNeedOverride
121
            - pref: AllFinesNeedOverride
116
              choices:
122
              choices:
117
                  yes: Require
123
                  yes: Require
(-)a/opac/sco/sco-main.pl (-3 / +14 lines)
Lines 132-138 elsif ( $op eq "checkout" ) { Link Here
132
    my $impossible  = {};
132
    my $impossible  = {};
133
    my $needconfirm = {};
133
    my $needconfirm = {};
134
    if ( !$confirmed ) {
134
    if ( !$confirmed ) {
135
        ( $impossible, $needconfirm ) = CanBookBeIssued( $borrower, $barcode );
135
        ( $impossible, $needconfirm ) = CanBookBeIssuedCheckout(
136
            $borrower,
137
            $barcode,
138
            undef,
139
            0,
140
            C4::Context->preference("AllowItemsOnHoldCheckout")
141
        );
136
    }
142
    }
137
    $confirm_required = scalar keys %$needconfirm;
143
    $confirm_required = scalar keys %$needconfirm;
138
144
Lines 213-219 if ($borrower->{cardnumber}) { Link Here
213
    my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
219
    my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
214
    foreach my $it (@$issueslist) {
220
    foreach my $it (@$issueslist) {
215
        $it->{date_due_display} = format_date($it->{date_due});
221
        $it->{date_due_display} = format_date($it->{date_due});
216
        my ($renewokay, $renewerror) = CanBookBeIssued($borrower, $it->{'barcode'},'','');
222
        my ($renewokay, $renewerror) = CanBookBeIssued(
223
            $borrower,
224
            $it->{'barcode'},
225
            undef,
226
            0,
227
            C4::Context->preference("AllowItemsOnHoldCheckout")
228
        );
217
        $it->{'norenew'} = 1 if $renewokay->{'NO_MORE_RENEWALS'};
229
        $it->{'norenew'} = 1 if $renewokay->{'NO_MORE_RENEWALS'};
218
        push @issues, $it;
230
        push @issues, $it;
219
    }
231
    }
220
- 

Return to bug 7090