Lines 53-62
BEGIN {
Link Here
|
53 |
&UpdateFine |
53 |
&UpdateFine |
54 |
&GetFine |
54 |
&GetFine |
55 |
&get_chargeable_units |
55 |
&get_chargeable_units |
56 |
&CheckItemNotify |
|
|
57 |
&GetOverduesForBranch |
56 |
&GetOverduesForBranch |
58 |
&RemoveNotifyLine |
|
|
59 |
&AddNotifyLine |
60 |
&GetOverdueMessageTransportTypes |
57 |
&GetOverdueMessageTransportTypes |
61 |
&parse_overdues_letter |
58 |
&parse_overdues_letter |
62 |
); |
59 |
); |
Lines 792-818
sub GetBranchcodesWithOverdueRules {
Link Here
|
792 |
return @$branchcodes; |
789 |
return @$branchcodes; |
793 |
} |
790 |
} |
794 |
|
791 |
|
795 |
=head2 CheckItemNotify |
|
|
796 |
|
797 |
Sql request to check if the document has alreday been notified |
798 |
this function is not exported, only used with GetOverduesForBranch |
799 |
|
800 |
=cut |
801 |
|
802 |
sub CheckItemNotify { |
803 |
my ($notify_id,$notify_level,$itemnumber) = @_; |
804 |
my $dbh = C4::Context->dbh; |
805 |
my $sth = $dbh->prepare(" |
806 |
SELECT COUNT(*) |
807 |
FROM notifys |
808 |
WHERE notify_id = ? |
809 |
AND notify_level = ? |
810 |
AND itemnumber = ? "); |
811 |
$sth->execute($notify_id,$notify_level,$itemnumber); |
812 |
my $notified = $sth->fetchrow; |
813 |
return ($notified); |
814 |
} |
815 |
|
816 |
=head2 GetOverduesForBranch |
792 |
=head2 GetOverduesForBranch |
817 |
|
793 |
|
818 |
Sql request for display all information for branchoverdues.pl |
794 |
Sql request for display all information for branchoverdues.pl |
Lines 865-942
sub GetOverduesForBranch {
Link Here
|
865 |
AND (issues.branchcode = ? ) |
841 |
AND (issues.branchcode = ? ) |
866 |
AND (issues.date_due < NOW()) |
842 |
AND (issues.date_due < NOW()) |
867 |
"; |
843 |
"; |
868 |
my @getoverdues; |
|
|
869 |
my $i = 0; |
870 |
my $sth; |
871 |
if ($location) { |
844 |
if ($location) { |
872 |
$sth = $dbh->prepare("$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname"); |
845 |
my $q = "$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname"; |
873 |
$sth->execute($branch, $location); |
846 |
return @{ $dbh->selectall_arrayref($q, { Slice => {} }, $branch, $location ) }; |
874 |
} else { |
847 |
} else { |
875 |
$sth = $dbh->prepare("$select ORDER BY borrowers.surname, borrowers.firstname"); |
848 |
my $q = "$select ORDER BY borrowers.surname, borrowers.firstname"; |
876 |
$sth->execute($branch); |
849 |
return @{ $dbh->selectall_arrayref($q, { Slice => {} }, $branch ) }; |
877 |
} |
850 |
} |
878 |
while ( my $data = $sth->fetchrow_hashref ) { |
|
|
879 |
#check if the document has already been notified |
880 |
my $countnotify = CheckItemNotify($data->{'notify_id'}, $data->{'notify_level'}, $data->{'itemnumber'}); |
881 |
if ($countnotify eq '0') { |
882 |
$getoverdues[$i] = $data; |
883 |
$i++; |
884 |
} |
885 |
} |
886 |
return (@getoverdues); |
887 |
} |
888 |
|
889 |
|
890 |
=head2 AddNotifyLine |
891 |
|
892 |
&AddNotifyLine($borrowernumber, $itemnumber, $overduelevel, $method, $notifyId) |
893 |
|
894 |
Create a line into notify, if the method is phone, the notification_send_date is implemented to |
895 |
|
896 |
=cut |
897 |
|
898 |
sub AddNotifyLine { |
899 |
my ( $borrowernumber, $itemnumber, $overduelevel, $method, $notifyId ) = @_; |
900 |
my $dbh = C4::Context->dbh; |
901 |
if ( $method eq "phone" ) { |
902 |
my $sth = $dbh->prepare( |
903 |
"INSERT INTO notifys (borrowernumber,itemnumber,notify_date,notify_send_date,notify_level,method,notify_id) |
904 |
VALUES (?,?,now(),now(),?,?,?)" |
905 |
); |
906 |
$sth->execute( $borrowernumber, $itemnumber, $overduelevel, $method, |
907 |
$notifyId ); |
908 |
} |
909 |
else { |
910 |
my $sth = $dbh->prepare( |
911 |
"INSERT INTO notifys (borrowernumber,itemnumber,notify_date,notify_level,method,notify_id) |
912 |
VALUES (?,?,now(),?,?,?)" |
913 |
); |
914 |
$sth->execute( $borrowernumber, $itemnumber, $overduelevel, $method, |
915 |
$notifyId ); |
916 |
} |
917 |
return 1; |
918 |
} |
919 |
|
920 |
=head2 RemoveNotifyLine |
921 |
|
922 |
&RemoveNotifyLine( $borrowernumber, $itemnumber, $notify_date ); |
923 |
|
924 |
Cancel a notification |
925 |
|
926 |
=cut |
927 |
|
928 |
sub RemoveNotifyLine { |
929 |
my ( $borrowernumber, $itemnumber, $notify_date ) = @_; |
930 |
my $dbh = C4::Context->dbh; |
931 |
my $sth = $dbh->prepare( |
932 |
"DELETE FROM notifys |
933 |
WHERE |
934 |
borrowernumber=? |
935 |
AND itemnumber=? |
936 |
AND notify_date=?" |
937 |
); |
938 |
$sth->execute( $borrowernumber, $itemnumber, $notify_date ); |
939 |
return 1; |
940 |
} |
851 |
} |
941 |
|
852 |
|
942 |
=head2 GetOverdueMessageTransportTypes |
853 |
=head2 GetOverdueMessageTransportTypes |