#use warnings; FIXME - Bug 2505
use Date::Calc qw/Today Date_to_Days/;
use Date::Manip qw/UnixDate/;
+use List::MoreUtils qw( uniq );
+
use C4::Circulation;
use C4::Context;
use C4::Accounts;
&GetOverduesForBranch
&RemoveNotifyLine
&AddNotifyLine
+ &GetOverdueMessageTransportTypes
);
# subs to remove
push @EXPORT, qw(
push @EXPORT, qw(
&GetIssuesIteminfo
);
- # subs to move to Members.pm
- push @EXPORT, qw(
- &CheckBorrowerDebarred
- );
+
+ # &GetIssuingRules - delete.
+ # use C4::Circulation::GetIssuingRule instead.
+
# subs to move to Biblio.pm
push @EXPORT, qw(
&GetItems
return @branches;
}
-=head2 CheckBorrowerDebarred
-
- ($debarredstatus) = &CheckBorrowerDebarred($borrowernumber);
-
-Check if the borrowers is already debarred
-
-C<$debarredstatus> return 0 for not debarred and return 1 for debarred
-
-C<$borrowernumber> contains the borrower number
-
-=cut
-
-# FIXME: Shouldn't this be in C4::Members?
-sub CheckBorrowerDebarred {
- my ($borrowernumber) = @_;
- my $dbh = C4::Context->dbh;
- my $query = qq|
- SELECT debarred
- FROM borrowers
- WHERE borrowernumber=?
- AND debarred > NOW()
- |;
- my $sth = $dbh->prepare($query);
- $sth->execute($borrowernumber);
- my $debarredstatus = $sth->fetchrow;
- return $debarredstatus;
-}
-
-
=head2 CheckItemNotify
Sql request to check if the document has alreday been notified
my $dbh = C4::Context->dbh;
my $select = "
SELECT
+ borrowers.cardnumber,
borrowers.borrowernumber,
borrowers.surname,
borrowers.firstname,
return 1;
}
+=head2 GetOverdueMessageTransportTypes
+
+ my $message_transport_types = GetOverdueMessageTransportTypes( $branchcode, $categorycode, $letternumber);
+
+ return a arrayref with all message_transport_type for given branchcode, categorycode and letternumber(1,2 or 3)
+
+=cut
+
+sub GetOverdueMessageTransportTypes {
+ my ( $branchcode, $categorycode, $letternumber ) = @_;
+ return unless $categorycode and $letternumber;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("
+ SELECT message_transport_type FROM overduerules_transport_types
+ WHERE branchcode = ? AND categorycode = ? AND letternumber = ?
+ ");
+ $sth->execute( $branchcode, $categorycode, $letternumber );
+ my @mtts;
+ while ( my $mtt = $sth->fetchrow ) {
+ push @mtts, $mtt;
+ }
+
+ # Put 'print' in first if exists
+ # It avoid to sent a print notice with an email or sms template is no email or sms is defined
+ @mtts = uniq( 'print', @mtts )
+ if grep {/^print$/} @mtts;
+
+ return \@mtts;
+}
+
1;
__END__