&SuspendAll
&GetReservesControlBranch
+
+ IsItemOnHoldAndFound
);
@EXPORT_OK = qw( MergeHolds );
}
$const, $priority, $notes, $checkitem,
$found, $waitingdate, $expdate
);
+ my $reserve_id = $sth->{mysql_insertid};
# Send e-mail to librarian if syspref is active
if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
$sth->execute($borrowernumber, $biblionumber, $resdate, $_);
}
- return; # FIXME: why not have a useful return value?
+ return $reserve_id;
}
=head2 GetReserve
# now fix the priority on the others (if the priority wasn't
# already sorted!)....
unless ( $priority == 0 ) {
- _FixPriority({ reserve_id => $reserve_id });
+ _FixPriority({ reserve_id => $reserve_id, biblionumber => $biblionumber });
}
}
};
while ( my ( $mtt, $letter_code ) = each %{ $messagingprefs->{transports} } ) {
- if ( ($mtt eq 'email' and not $to_address) or ($mtt eq 'sms' and not $borrower->{smsalertnumber}) ) {
- # email or sms is requested but not exist
- next;
- }
+ next if (
+ ( $mtt eq 'email' and not $to_address ) # No email address
+ or ( $mtt eq 'sms' and not $borrower->{smsalertnumber} ) # No SMS number
+ or ( $mtt eq 'phone' and C4::Context->preference('TalkingTechItivaPhoneNotification') ) # Notice is handled by TalkingTech_itiva_outbound.pl
+ );
+
&$send_notification($mtt, $letter_code);
$notification_sent++;
}
return @row ? $row[0]+1 : 1;
}
+=head2 IsItemOnHoldAndFound
+
+ my $bool = IsItemFoundHold( $itemnumber );
+
+ Returns true if the item is currently on hold
+ and that hold has a non-null found status ( W, T, etc. )
+
+=cut
+
+sub IsItemOnHoldAndFound {
+ my ($itemnumber) = @_;
+
+ my $rs = Koha::Database->new()->schema()->resultset('Reserve');
+
+ my $found = $rs->count(
+ {
+ itemnumber => $itemnumber,
+ found => { '!=' => undef }
+ }
+ );
+
+ return $found;
+}
+
=head1 AUTHOR
Koha Development Team <http://koha-community.org/>