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, undef ) = 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 lines)
Lines 330-332 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
330
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('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
331
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
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');
332
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo');
332
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo');
333
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 4620-4625 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4620
}
4620
}
4621
4621
4622
4622
4623
$DBversion = "3.07.00.XXX";
4624
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4625
	$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')");
4626
    print "Upgrade to $DBversion add 'AllowItemsOnHoldCheckout' syspref \n";
4627
    SetVersion ($DBversion);
4628
}
4629
4623
=head1 FUNCTIONS
4630
=head1 FUNCTIONS
4624
4631
4625
=head2 DropAllForeignKeys($table)
4632
=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