|
Lines 55-64
BEGIN {
Link Here
|
| 55 |
&UpdateFine |
55 |
&UpdateFine |
| 56 |
&GetFine |
56 |
&GetFine |
| 57 |
&get_chargeable_units |
57 |
&get_chargeable_units |
| 58 |
&CheckItemNotify |
|
|
| 59 |
&GetOverduesForBranch |
58 |
&GetOverduesForBranch |
| 60 |
&RemoveNotifyLine |
|
|
| 61 |
&AddNotifyLine |
| 62 |
&GetOverdueMessageTransportTypes |
59 |
&GetOverdueMessageTransportTypes |
| 63 |
&parse_overdues_letter |
60 |
&parse_overdues_letter |
| 64 |
); |
61 |
); |
|
Lines 808-834
sub GetBranchcodesWithOverdueRules {
Link Here
|
| 808 |
return @$branchcodes; |
805 |
return @$branchcodes; |
| 809 |
} |
806 |
} |
| 810 |
|
807 |
|
| 811 |
=head2 CheckItemNotify |
|
|
| 812 |
|
| 813 |
Sql request to check if the document has alreday been notified |
| 814 |
this function is not exported, only used with GetOverduesForBranch |
| 815 |
|
| 816 |
=cut |
| 817 |
|
| 818 |
sub CheckItemNotify { |
| 819 |
my ($notify_id,$notify_level,$itemnumber) = @_; |
| 820 |
my $dbh = C4::Context->dbh; |
| 821 |
my $sth = $dbh->prepare(" |
| 822 |
SELECT COUNT(*) |
| 823 |
FROM notifys |
| 824 |
WHERE notify_id = ? |
| 825 |
AND notify_level = ? |
| 826 |
AND itemnumber = ? "); |
| 827 |
$sth->execute($notify_id,$notify_level,$itemnumber); |
| 828 |
my $notified = $sth->fetchrow; |
| 829 |
return ($notified); |
| 830 |
} |
| 831 |
|
| 832 |
=head2 GetOverduesForBranch |
808 |
=head2 GetOverduesForBranch |
| 833 |
|
809 |
|
| 834 |
Sql request for display all information for branchoverdues.pl |
810 |
Sql request for display all information for branchoverdues.pl |
|
Lines 881-958
sub GetOverduesForBranch {
Link Here
|
| 881 |
AND (issues.branchcode = ? ) |
857 |
AND (issues.branchcode = ? ) |
| 882 |
AND (issues.date_due < NOW()) |
858 |
AND (issues.date_due < NOW()) |
| 883 |
"; |
859 |
"; |
| 884 |
my @getoverdues; |
|
|
| 885 |
my $i = 0; |
| 886 |
my $sth; |
| 887 |
if ($location) { |
860 |
if ($location) { |
| 888 |
$sth = $dbh->prepare("$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname"); |
861 |
my $q = "$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname"; |
| 889 |
$sth->execute($branch, $location); |
862 |
return @{ $dbh->selectall_arrayref($q, { Slice => {} }, $branch, $location ) }; |
| 890 |
} else { |
863 |
} else { |
| 891 |
$sth = $dbh->prepare("$select ORDER BY borrowers.surname, borrowers.firstname"); |
864 |
my $q = "$select ORDER BY borrowers.surname, borrowers.firstname"; |
| 892 |
$sth->execute($branch); |
865 |
return @{ $dbh->selectall_arrayref($q, { Slice => {} }, $branch ) }; |
| 893 |
} |
866 |
} |
| 894 |
while ( my $data = $sth->fetchrow_hashref ) { |
|
|
| 895 |
#check if the document has already been notified |
| 896 |
my $countnotify = CheckItemNotify($data->{'notify_id'}, $data->{'notify_level'}, $data->{'itemnumber'}); |
| 897 |
if ($countnotify eq '0') { |
| 898 |
$getoverdues[$i] = $data; |
| 899 |
$i++; |
| 900 |
} |
| 901 |
} |
| 902 |
return (@getoverdues); |
| 903 |
} |
| 904 |
|
| 905 |
|
| 906 |
=head2 AddNotifyLine |
| 907 |
|
| 908 |
&AddNotifyLine($borrowernumber, $itemnumber, $overduelevel, $method, $notifyId) |
| 909 |
|
| 910 |
Create a line into notify, if the method is phone, the notification_send_date is implemented to |
| 911 |
|
| 912 |
=cut |
| 913 |
|
| 914 |
sub AddNotifyLine { |
| 915 |
my ( $borrowernumber, $itemnumber, $overduelevel, $method, $notifyId ) = @_; |
| 916 |
my $dbh = C4::Context->dbh; |
| 917 |
if ( $method eq "phone" ) { |
| 918 |
my $sth = $dbh->prepare( |
| 919 |
"INSERT INTO notifys (borrowernumber,itemnumber,notify_date,notify_send_date,notify_level,method,notify_id) |
| 920 |
VALUES (?,?,now(),now(),?,?,?)" |
| 921 |
); |
| 922 |
$sth->execute( $borrowernumber, $itemnumber, $overduelevel, $method, |
| 923 |
$notifyId ); |
| 924 |
} |
| 925 |
else { |
| 926 |
my $sth = $dbh->prepare( |
| 927 |
"INSERT INTO notifys (borrowernumber,itemnumber,notify_date,notify_level,method,notify_id) |
| 928 |
VALUES (?,?,now(),?,?,?)" |
| 929 |
); |
| 930 |
$sth->execute( $borrowernumber, $itemnumber, $overduelevel, $method, |
| 931 |
$notifyId ); |
| 932 |
} |
| 933 |
return 1; |
| 934 |
} |
| 935 |
|
| 936 |
=head2 RemoveNotifyLine |
| 937 |
|
| 938 |
&RemoveNotifyLine( $borrowernumber, $itemnumber, $notify_date ); |
| 939 |
|
| 940 |
Cancel a notification |
| 941 |
|
| 942 |
=cut |
| 943 |
|
| 944 |
sub RemoveNotifyLine { |
| 945 |
my ( $borrowernumber, $itemnumber, $notify_date ) = @_; |
| 946 |
my $dbh = C4::Context->dbh; |
| 947 |
my $sth = $dbh->prepare( |
| 948 |
"DELETE FROM notifys |
| 949 |
WHERE |
| 950 |
borrowernumber=? |
| 951 |
AND itemnumber=? |
| 952 |
AND notify_date=?" |
| 953 |
); |
| 954 |
$sth->execute( $borrowernumber, $itemnumber, $notify_date ); |
| 955 |
return 1; |
| 956 |
} |
867 |
} |
| 957 |
|
868 |
|
| 958 |
=head2 GetOverdueMessageTransportTypes |
869 |
=head2 GetOverdueMessageTransportTypes |