Browse Source

Bugg fixing

master
olwen 25 years ago
parent
commit
ebb6122784
  1. 21
      C4/Accounts.pm
  2. 23
      C4/Circulation/Borrower.pm
  3. 6
      C4/Interface/AccountsCDK.pm

21
C4/Accounts.pm

@ -68,12 +68,12 @@ sub checkaccount {
}
$sth->finish;
# output(1,2,"borrower owes $total");
if ($total > 0){
# output(1,2,"borrower owes $total");
if ($total > 5){
reconcileaccount($env,$dbh,$bornumber,$total);
}
}
#if ($total > 0){
# # output(1,2,"borrower owes $total");
# if ($total > 5){
# reconcileaccount($env,$dbh,$bornumber,$total);
# }
#}
# pause();
return($total);
}
@ -106,21 +106,14 @@ sub reconcileaccount {
$line=
$data->{'date'}." ".fmtdec($env,$amount,"52")." ".fmtstr($data->{'description'},"L15");
push @accountlines,$line;
# $text="$line\t$data->{'date'}\t$amount\t$data->{'description'}";
# output (1,$row,$text);
# $row++;
$i++;
}
# $text="Borrower owes \$$total";
# output (1,$row,$text);
#get amount paid and update database
# my ($data,$reason)=&dialog("Amount to pay");
my ($data,$reason)=
&accountsdialog($env,"Payment Entry",$borrower,\@accountlines,$total);
if ($data>0) {
&recordpayment($env,$bornumber,$dbh,$data);
#Check if the borrower still owes
# pause();
#Check if the borrower still owes
$total=&checkaccount($env,$bornumber,$dbh);
}
return($total);

23
C4/Circulation/Borrower.pm

@ -101,8 +101,11 @@ sub findborrower {
$env->{'bornum'} = $bornum;
$env->{'bcard'} = $borrower->{'cardnumber'};
my $borrowers=join(' ',($borrower->{'title'},$borrower->{'firstname'},$borrower->{'surname'}));
$issuesallowed = &checktraps($env,$dbh,$bornum,$borrower);
my $odues;
($issuesallowed,$odues) = &checktraps($env,$dbh,$bornum,$borrower);
debug_msg ($env,"issuesallowed1 = $issuesallowed");
}
debug_msg ($env,"issuesallowed2 = $issuesallowed");
return ($bornum, $issuesallowed,$borrower,$reason);
};
@ -171,6 +174,7 @@ sub checktraps {
my $odues;
while ($traps_done ne "DONE") {
my @traps_set;
debug_msg($env,"entering traps");
my $amount=checkaccount($env,$bornum,$dbh); #from C4::Accounts
if ($amount > 0) { push (@traps_set,"FINES");}
if ($borrower->{'gonenoaddress'} == 1){ push (@traps_set,"GNA");}
@ -187,10 +191,12 @@ sub checktraps {
if (@traps_set[0] ne "" ) {
$issuesallowed,$traps_done =
process_traps($env,$dbh,$bornum,$borrower,$amount,$odues,\@traps_set);
debug_msg($env,"returned issuesallowed $issuesallowed");
} else {
$traps_done = "DONE";
}
}
debug_msg($env,"returning issuesallowed $issuesallowed");
return ($issuesallowed, $odues);
}
@ -200,7 +206,8 @@ sub process_traps {
my $x = 0;
my %traps;
while (@$traps_set[$x] ne "") {
$traps{'@$traps_set[$x]'} = 1;
$traps{@$traps_set[$x]} = 1;
debug_msg($env,"set @$traps_set[$x]");
$x++;
}
my $traps_done;
@ -222,14 +229,18 @@ sub process_traps {
}
$traps_done = "DONE";
}
if ($traps{'GNA'} == 1 ) {
if ($traps{'GNA'} eq 1 ) {
$issuesallowed=0;
}
if (($traps{'FINES'} == 1) && ($amount > 0)) {
$issuesallowed=0;
if ($traps{'FINES'} eq 1) {
if ($amount > 5) {
debug_msg($env,"fines2 $amount");
$issuesallowed=0;
}
}
debug_msg($env,"ia $issuesallowed");
return ($issuesallowed,$traps_done);
}
} # end of process_traps
sub Borenq {

6
C4/Interface/AccountsCDK.pm

@ -72,11 +72,13 @@ sub accountsdialog {
$amountentry->set('Value'=>$amountowing);
my $amount =$amountentry->activate();
debug_msg($env,"accounts $amount");
#debug_msg($env,"accounts $amount");
if (!defined $amount) {
$reason="Finished user";
#debug_msg($env,"escaped");
#$reason="Finished user";
}
#debug_msg($env,"exit");
return($amount,$reason);
}

Loading…
Cancel
Save