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

(-)a/C4/Circulation.pm (-32 / +36 lines)
Lines 570-576 sub itemissues { Link Here
570
=head2 CanBookBeIssued
570
=head2 CanBookBeIssued
571
571
572
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
572
  ( $issuingimpossible, $needsconfirmation ) =  CanBookBeIssued( $borrower, 
573
                                      $barcode, $duedatespec, $inprocess );
573
                      $barcode, $duedatespec, $inprocess, $ignore_reserves );
574
574
575
Check if a book can be issued.
575
Check if a book can be issued.
576
576
Lines 584-590 C<$issuingimpossible> and C<$needsconfirmation> are some hashref. Link Here
584
584
585
=item C<$duedatespec> is a C4::Dates object.
585
=item C<$duedatespec> is a C4::Dates object.
586
586
587
=item C<$inprocess>
587
=item C<$inprocess> boolean switch
588
=item C<$ignore_reserves> boolean switch
588
589
589
=back
590
=back
590
591
Lines 661-667 if the borrower borrows to much things Link Here
661
=cut
662
=cut
662
663
663
sub CanBookBeIssued {
664
sub CanBookBeIssued {
664
    my ( $borrower, $barcode, $duedate, $inprocess ) = @_;
665
    my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves ) = @_;
665
    my %needsconfirmation;    # filled with problems that needs confirmations
666
    my %needsconfirmation;    # filled with problems that needs confirmations
666
    my %issuingimpossible;    # filled with problems that causes the issue to be IMPOSSIBLE
667
    my %issuingimpossible;    # filled with problems that causes the issue to be IMPOSSIBLE
667
    my $item = GetItem(GetItemnumberFromBarcode( $barcode ));
668
    my $item = GetItem(GetItemnumberFromBarcode( $barcode ));
Lines 868-904 sub CanBookBeIssued { Link Here
868
        $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'};
869
        $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'};
869
    }
870
    }
870
871
871
    # See if the item is on reserve.
872
    unless ( $ignore_reserves ) {
872
    my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
873
        # See if the item is on reserve.
873
    if ($restype) {
874
        my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
874
		my $resbor = $res->{'borrowernumber'};
875
        if ($restype) {
875
		my ( $resborrower ) = C4::Members::GetMember( borrowernumber => $resbor );
876
            my $resbor = $res->{'borrowernumber'};
876
		my $branches  = GetBranches();
877
            if ( $resbor ne $borrower->{'borrowernumber'} ) {
877
		my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
878
                my ( $resborrower ) = C4::Members::GetMember( borrowernumber => $resbor );
878
        if ( $resbor ne $borrower->{'borrowernumber'} && $restype eq "Waiting" )
879
                my $branchname = GetBranchName( $res->{'branchcode'} );
879
        {
880
                if ( $restype eq "Waiting" )
880
            # The item is on reserve and waiting, but has been
881
                {
881
            # reserved by some other patron.
882
                    # The item is on reserve and waiting, but has been
882
            $needsconfirmation{RESERVE_WAITING} = 1;
883
                    # reserved by some other patron.
883
            $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
884
                    $needsconfirmation{RESERVE_WAITING} = 1;
884
            $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
885
                    $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
885
            $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
886
                    $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
886
            $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
887
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
887
            $needsconfirmation{'resbranchname'} = $branchname;
888
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
888
            $needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'});
889
                    $needsconfirmation{'resbranchname'} = $branchname;
889
        }
890
                    $needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'});
890
        elsif ( $restype eq "Reserved" ) {
891
                }
891
            # The item is on reserve for someone else.
892
                elsif ( $restype eq "Reserved" ) {
892
            $needsconfirmation{RESERVED} = 1;
893
                    # The item is on reserve for someone else.
893
            $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
894
                    $needsconfirmation{RESERVED} = 1;
894
            $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
895
                    $needsconfirmation{'resfirstname'} = $resborrower->{'firstname'};
895
            $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
896
                    $needsconfirmation{'ressurname'} = $resborrower->{'surname'};
896
            $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
897
                    $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
897
            $needsconfirmation{'resbranchname'} = $branchname;
898
                    $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
898
            $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'});
899
                    $needsconfirmation{'resbranchname'} = $branchname;
900
                    $needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'});
901
                }
902
            }
899
        }
903
        }
900
    }
904
    }
901
	return ( \%issuingimpossible, \%needsconfirmation );
905
    return ( \%issuingimpossible, \%needsconfirmation );
902
}
906
}
903
907
904
=head2 AddIssue
908
=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 / +1 lines)
Lines 328-331 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
328
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL);
328
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL);
329
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
329
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
330
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
330
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
331
331
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 4550-4555 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4550
    SetVersion ($DBversion);
4550
    SetVersion ($DBversion);
4551
}
4551
}
4552
4552
4553
$DBversion = "3.06.00.XXX";
4554
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4555
	$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')");
4556
    print "Upgrade to $DBversion add 'AllowItemsOnHoldCheckout' syspref \n";
4557
    SetVersion ($DBversion);
4558
}
4559
4553
=head1 FUNCTIONS
4560
=head1 FUNCTIONS
4554
4561
4555
=head2 DropAllForeignKeys($table)
4562
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 105-110 Circulation: Link Here
105
                  no: "Don't allow"
105
                  no: "Don't allow"
106
            - staff to manually override the renewal limit and renew a checkout when it would go over the renewal limit.
106
            - staff to manually override the renewal limit and renew a checkout when it would go over the renewal limit.
107
        -
107
        -
108
            - pref: AllowItemsOnHoldCheckout
109
              choices:
110
                  yes: Allow
111
                  no: "Don't allow"
112
            - 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.
113
        -
108
            - pref: AllFinesNeedOverride
114
            - pref: AllFinesNeedOverride
109
              choices:
115
              choices:
110
                  yes: Require
116
                  yes: Require
(-)a/opac/sco/sco-main.pl (-3 / +14 lines)
Lines 116-122 elsif ( $op eq "checkout" ) { Link Here
116
    my $impossible  = {};
116
    my $impossible  = {};
117
    my $needconfirm = {};
117
    my $needconfirm = {};
118
    if ( !$confirmed ) {
118
    if ( !$confirmed ) {
119
        ( $impossible, $needconfirm ) = CanBookBeIssued( $borrower, $barcode );
119
        ( $impossible, $needconfirm ) = CanBookBeIssuedCheckout(
120
            $borrower,
121
            $barcode,
122
            undef,
123
            0,
124
            C4::Context->preference("AllowItemsOnHoldCheckout")
125
        );
120
    }
126
    }
121
    $confirm_required = scalar keys %$needconfirm;
127
    $confirm_required = scalar keys %$needconfirm;
122
128
Lines 197-203 if ($borrower->{cardnumber}) { Link Here
197
    my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
203
    my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
198
    foreach my $it (@$issueslist) {
204
    foreach my $it (@$issueslist) {
199
        $it->{date_due_display} = format_date($it->{date_due});
205
        $it->{date_due_display} = format_date($it->{date_due});
200
        my ($renewokay, $renewerror) = CanBookBeIssued($borrower, $it->{'barcode'},'','');
206
        my ($renewokay, $renewerror) = CanBookBeIssued(
207
            $borrower,
208
            $it->{'barcode'},
209
            undef,
210
            0,
211
            C4::Context->preference("AllowItemsOnHoldCheckout")
212
        );
201
        $it->{'norenew'} = 1 if $renewokay->{'NO_MORE_RENEWALS'};
213
        $it->{'norenew'} = 1 if $renewokay->{'NO_MORE_RENEWALS'};
202
        push @issues, $it;
214
        push @issues, $it;
203
    }
215
    }
204
- 

Return to bug 7090