|
Lines 48-59
BEGIN {
Link Here
|
| 48 |
&GetNotifyId |
48 |
&GetNotifyId |
| 49 |
&NumberNotifyId |
49 |
&NumberNotifyId |
| 50 |
&AmountNotify |
50 |
&AmountNotify |
| 51 |
&UpdateAccountLines |
|
|
| 52 |
&UpdateFine |
51 |
&UpdateFine |
| 53 |
&GetOverdueDelays |
52 |
&GetOverdueDelays |
| 54 |
&GetOverduerules |
53 |
&GetOverduerules |
| 55 |
&GetFine |
54 |
&GetFine |
| 56 |
&CreateItemAccountLine |
|
|
| 57 |
&ReplacementCost2 |
55 |
&ReplacementCost2 |
| 58 |
|
56 |
|
| 59 |
&CheckItemNotify |
57 |
&CheckItemNotify |
|
Lines 602-612
sub UpdateFine {
Link Here
|
| 602 |
my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); |
600 |
my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); |
| 603 |
my $desc = ($type ? "$type " : '') . "$title $due"; # FIXEDME, avoid whitespace prefix on empty $type |
601 |
my $desc = ($type ? "$type " : '') . "$title $due"; # FIXEDME, avoid whitespace prefix on empty $type |
| 604 |
my $query = "INSERT INTO accountlines |
602 |
my $query = "INSERT INTO accountlines |
| 605 |
(borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement,accountno) |
603 |
(borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement,accountno,branchcode) |
| 606 |
VALUES (?,?,now(),?,?,'FU',?,?,?)"; |
604 |
VALUES (?,?,now(),?,?,'FU',?,?,?,?)"; |
| 607 |
my $sth2 = $dbh->prepare($query); |
605 |
my $sth2 = $dbh->prepare($query); |
| 608 |
$debug and print STDERR "UpdateFine query: $query\nw/ args: $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno\n"; |
606 |
$debug and print STDERR "UpdateFine query: $query\nw/ args: $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno\n"; |
| 609 |
$sth2->execute($borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno); |
607 |
$sth2->execute($borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno, C4::Context->userenv->{'branch'}); |
| 610 |
} |
608 |
} |
| 611 |
# logging action |
609 |
# logging action |
| 612 |
&logaction( |
610 |
&logaction( |
|
Lines 865-968
sub GetNotifyId {
Link Here
|
| 865 |
return ($notify_id); |
863 |
return ($notify_id); |
| 866 |
} |
864 |
} |
| 867 |
|
865 |
|
| 868 |
=head2 CreateItemAccountLine |
|
|
| 869 |
|
| 870 |
() = &CreateItemAccountLine($borrowernumber, $itemnumber, $date, $amount, |
| 871 |
$description, $accounttype, $amountoutstanding, |
| 872 |
$timestamp, $notify_id, $level); |
| 873 |
|
| 874 |
update the account lines with file number or with file level |
| 875 |
|
| 876 |
C<$items> is a reference-to-hash whose keys are all of the fields |
| 877 |
from the items tables of the Koha database. Thus, |
| 878 |
|
| 879 |
C<$itemnumber> contains the item number |
| 880 |
|
| 881 |
C<$borrowernumber> contains the borrower number |
| 882 |
|
| 883 |
C<$date> contains the date of the day |
| 884 |
|
| 885 |
C<$amount> contains item price |
| 886 |
|
| 887 |
C<$description> contains the descritpion of accounttype |
| 888 |
|
| 889 |
C<$accounttype> contains the account type |
| 890 |
|
| 891 |
C<$amountoutstanding> contains the $amountoutstanding |
| 892 |
|
| 893 |
C<$timestamp> contains the timestamp with time and the date of the day |
| 894 |
|
| 895 |
C<$notify_id> contains the file number |
| 896 |
|
| 897 |
C<$level> contains the file level |
| 898 |
|
| 899 |
=cut |
| 900 |
|
| 901 |
sub CreateItemAccountLine { |
| 902 |
my ( |
| 903 |
$borrowernumber, $itemnumber, $date, $amount, |
| 904 |
$description, $accounttype, $amountoutstanding, $timestamp, |
| 905 |
$notify_id, $level |
| 906 |
) = @_; |
| 907 |
my $dbh = C4::Context->dbh; |
| 908 |
my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); |
| 909 |
my $query = "INSERT into accountlines |
| 910 |
(borrowernumber,accountno,itemnumber,date,amount,description,accounttype,amountoutstanding,timestamp,notify_id,notify_level) |
| 911 |
VALUES |
| 912 |
(?,?,?,?,?,?,?,?,?,?,?)"; |
| 913 |
|
| 914 |
my $sth = $dbh->prepare($query); |
| 915 |
$sth->execute( |
| 916 |
$borrowernumber, $nextaccntno, $itemnumber, |
| 917 |
$date, $amount, $description, |
| 918 |
$accounttype, $amountoutstanding, $timestamp, |
| 919 |
$notify_id, $level |
| 920 |
); |
| 921 |
} |
| 922 |
|
| 923 |
=head2 UpdateAccountLines |
| 924 |
|
| 925 |
() = &UpdateAccountLines($notify_id,$notify_level,$borrowernumber,$itemnumber); |
| 926 |
|
| 927 |
update the account lines with file number or with file level |
| 928 |
|
| 929 |
C<$items> is a reference-to-hash whose keys are all of the fields |
| 930 |
from the items tables of the Koha database. Thus, |
| 931 |
|
| 932 |
C<$itemnumber> contains the item number |
| 933 |
|
| 934 |
C<$notify_id> contains the file number |
| 935 |
|
| 936 |
C<$notify_level> contains the file level |
| 937 |
|
| 938 |
C<$borrowernumber> contains the borrowernumber |
| 939 |
|
| 940 |
=cut |
| 941 |
|
| 942 |
sub UpdateAccountLines { |
| 943 |
my ( $notify_id, $notify_level, $borrowernumber, $itemnumber ) = @_; |
| 944 |
my $query; |
| 945 |
if ( $notify_id eq '' ) { |
| 946 |
$query = qq|UPDATE accountlines |
| 947 |
SET notify_level=? |
| 948 |
WHERE borrowernumber=? AND itemnumber=? |
| 949 |
AND (accounttype='FU' or accounttype='O')|; |
| 950 |
} else { |
| 951 |
$query = qq|UPDATE accountlines |
| 952 |
SET notify_id=?, notify_level=? |
| 953 |
WHERE borrowernumber=? |
| 954 |
AND itemnumber=? |
| 955 |
AND (accounttype='FU' or accounttype='O')|; |
| 956 |
} |
| 957 |
|
| 958 |
my $sth = C4::Context->dbh->prepare($query); |
| 959 |
if ( $notify_id eq '' ) { |
| 960 |
$sth->execute( $notify_level, $borrowernumber, $itemnumber ); |
| 961 |
} else { |
| 962 |
$sth->execute( $notify_id, $notify_level, $borrowernumber, $itemnumber ); |
| 963 |
} |
| 964 |
} |
| 965 |
|
| 966 |
=head2 GetItems |
866 |
=head2 GetItems |
| 967 |
|
867 |
|
| 968 |
($items) = &GetItems($itemnumber); |
868 |
($items) = &GetItems($itemnumber); |