if ( C4::Context->preference("IndependentBranches") ) {
my $userenv = C4::Context->userenv;
if ( ($userenv) && ( $userenv->{flags} % 2 != 1 ) ) {
- $issuingimpossible{ITEMNOTSAMEBRANCH} = 1
- if ( $item->{C4::Context->preference("HomeOrHoldingBranch")} ne $userenv->{branch} );
+ if ( $item->{C4::Context->preference("HomeOrHoldingBranch")} ne $userenv->{branch} ){
+ $issuingimpossible{ITEMNOTSAMEBRANCH} = 1;
+ $issuingimpossible{'itemhomebranch'} = $item->{C4::Context->preference("HomeOrHoldingBranch")};
+ }
$needsconfirmation{BORRNOTSAMEBRANCH} = GetBranchName( $borrower->{'branchcode'} )
if ( $borrower->{'branchcode'} ne $userenv->{branch} );
}
$error = "too_many";
}
- my $resstatus = C4::Reserves::GetReserveStatus($itemnumber);
- if ( $resstatus eq "Waiting" or $resstatus eq "Reserved" ) {
+ my ( $resfound, $resrec, undef ) = C4::Reserves::CheckReserves( $itemnumber );
+
+ if ( $resfound ) { # '' when no hold was found
$renewokay = 0;
$error = "on_reserve";
}
sub CreateBranchTransferLimit {
my ( $toBranch, $fromBranch, $code ) = @_;
-
+ return unless defined($toBranch) && defined($fromBranch);
my $limitType = C4::Context->preference("BranchTransferLimitsType");
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("INSERT INTO branch_transfer_limits ( $limitType, toBranch, fromBranch ) VALUES ( ?, ?, ? )");
- $sth->execute( $code, $toBranch, $fromBranch );
+ return $sth->execute( $code, $toBranch, $fromBranch );
}
=head2 DeleteBranchTransferLimits
sub DeleteBranchTransferLimits {
my $branch = shift;
+ return unless $branch;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("DELETE FROM branch_transfer_limits WHERE fromBranch = ?");
- $sth->execute($branch);
+ return $sth->execute($branch);
}
sub ReturnLostItem{