Bug 21753: Remove all reference of chargename from scripts

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2018-11-02 09:42:53 +00:00 committed by Nick Clemens
parent 28de85db40
commit aa71519660
6 changed files with 22 additions and 38 deletions

View file

@ -4112,11 +4112,9 @@ sub _CalculateAndUpdateFine {
my $date_returned = $return_date ? dt_from_string($return_date) : dt_from_string(); my $date_returned = $return_date ? dt_from_string($return_date) : dt_from_string();
my ( $amount, $type, $unitcounttotal ) = my ( $amount, $unitcounttotal, $unitcount ) =
C4::Overdues::CalcFine( $item, $borrower->{categorycode}, $control_branchcode, $datedue, $date_returned ); C4::Overdues::CalcFine( $item, $borrower->{categorycode}, $control_branchcode, $datedue, $date_returned );
$type ||= q{};
if ( C4::Context->preference('finesMode') eq 'production' ) { if ( C4::Context->preference('finesMode') eq 'production' ) {
if ( $amount > 0 ) { if ( $amount > 0 ) {
C4::Overdues::UpdateFine({ C4::Overdues::UpdateFine({
@ -4124,7 +4122,6 @@ sub _CalculateAndUpdateFine {
itemnumber => $issue->itemnumber, itemnumber => $issue->itemnumber,
borrowernumber => $issue->borrowernumber, borrowernumber => $issue->borrowernumber,
amount => $amount, amount => $amount,
type => $type,
due => output_pref($datedue), due => output_pref($datedue),
}); });
} }
@ -4138,7 +4135,6 @@ sub _CalculateAndUpdateFine {
itemnumber => $issue->itemnumber, itemnumber => $issue->itemnumber,
borrowernumber => $issue->borrowernumber, borrowernumber => $issue->borrowernumber,
amount => 0, amount => 0,
type => $type,
due => output_pref($datedue), due => output_pref($datedue),
}); });
} }

View file

@ -191,7 +191,7 @@ sub checkoverdues {
=head2 CalcFine =head2 CalcFine
($amount, $chargename, $units_minus_grace, $chargeable_units) = &CalcFine($item, ($amount, $units_minus_grace, $chargeable_units) = &CalcFine($item,
$categorycode, $branch, $categorycode, $branch,
$start_dt, $end_dt ); $start_dt, $end_dt );
@ -216,13 +216,10 @@ defining the date range over which to determine the fine.
Fines scripts should just supply the date range over which to calculate the fine. Fines scripts should just supply the date range over which to calculate the fine.
C<&CalcFine> returns four values: C<&CalcFine> returns three values:
C<$amount> is the fine owed by the patron (see above). C<$amount> is the fine owed by the patron (see above).
C<$chargename> is the chargename field from the applicable record in
the categoryitem table, whatever that is.
C<$units_minus_grace> is the number of chargeable units minus the grace period C<$units_minus_grace> is the number of chargeable units minus the grace period
C<$chargeable_units> is the number of chargeable units (days between start and end dates, Calendar adjusted where needed, C<$chargeable_units> is the number of chargeable units (days between start and end dates, Calendar adjusted where needed,
@ -268,9 +265,8 @@ sub CalcFine {
$amount = $item->{replacementprice} if ( $issuing_rule->cap_fine_to_replacement_price && $item->{replacementprice} && $amount > $item->{replacementprice} ); $amount = $item->{replacementprice} if ( $issuing_rule->cap_fine_to_replacement_price && $item->{replacementprice} && $amount > $item->{replacementprice} );
$debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $issuing_rule->chargename, $units_minus_grace, $chargeable_units); $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $units_minus_grace, $chargeable_units);
return ($amount, $issuing_rule->chargename, $units_minus_grace, $chargeable_units); return ($amount, $units_minus_grace, $chargeable_units);
# FIXME: chargename is NEVER populated anywhere.
} }
@ -470,7 +466,15 @@ sub GetIssuesIteminfo {
=head2 UpdateFine =head2 UpdateFine
&UpdateFine({ issue_id => $issue_id, itemnumber => $itemnumber, borrwernumber => $borrowernumber, amount => $amount, type => $type, $due => $date_due }); &UpdateFine(
{
issue_id => $issue_id,
itemnumber => $itemnumber,
borrowernumber => $borrowernumber,
amount => $amount,
due => $date_due
}
);
(Note: the following is mostly conjecture and guesswork.) (Note: the following is mostly conjecture and guesswork.)
@ -483,8 +487,6 @@ has the book on loan.
C<$amount> is the current amount owed by the patron. C<$amount> is the current amount owed by the patron.
C<$type> will be used in the description of the fine.
C<$due> is the due date formatted to the currently specified date format C<$due> is the due date formatted to the currently specified date format
C<&UpdateFine> looks up the amount currently owed on the given item C<&UpdateFine> looks up the amount currently owed on the given item
@ -508,10 +510,9 @@ sub UpdateFine {
my $itemnum = $params->{itemnumber}; my $itemnum = $params->{itemnumber};
my $borrowernumber = $params->{borrowernumber}; my $borrowernumber = $params->{borrowernumber};
my $amount = $params->{amount}; my $amount = $params->{amount};
my $type = $params->{type};
my $due = $params->{due}; my $due = $params->{due};
$debug and warn "UpdateFine({ itemnumber => $itemnum, borrowernumber => $borrowernumber, type => $type, due => $due, issue_id => $issue_id})"; $debug and warn "UpdateFine({ itemnumber => $itemnum, borrowernumber => $borrowernumber, due => $due, issue_id => $issue_id})";
unless ( $issue_id ) { unless ( $issue_id ) {
carp("No issue_id passed in!"); carp("No issue_id passed in!");
@ -610,7 +611,7 @@ sub UpdateFine {
my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber);
my $desc = ( $type ? "$type " : '' ) . "$title $due"; # FIXEDME, avoid whitespace prefix on empty $type my $desc = "$title $due";
my $accountline = Koha::Account::Line->new( my $accountline = Koha::Account::Line->new(
{ {
@ -639,7 +640,7 @@ sub UpdateFine {
# logging action # logging action
&logaction( &logaction(
"FINES", "FINES",
$type, undef,
$borrowernumber, $borrowernumber,
"due=".$due." amount=".$amount." itemnumber=".$itemnum "due=".$due." amount=".$amount." itemnumber=".$itemnum
) if C4::Context->preference("FinesLog"); ) if C4::Context->preference("FinesLog");

View file

@ -76,7 +76,7 @@ cronlogaction();
my @borrower_fields = my @borrower_fields =
qw(cardnumber categorycode surname firstname email phone address citystate); qw(cardnumber categorycode surname firstname email phone address citystate);
my @item_fields = qw(itemnumber barcode date_due); my @item_fields = qw(itemnumber barcode date_due);
my @other_fields = qw(type days_overdue fine); my @other_fields = qw(days_overdue fine);
my $libname = C4::Context->preference('LibraryName'); my $libname = C4::Context->preference('LibraryName');
my $control = C4::Context->preference('CircControl'); my $control = C4::Context->preference('CircControl');
my $mode = C4::Context->preference('finesMode'); my $mode = C4::Context->preference('finesMode');
@ -122,10 +122,9 @@ for my $overdue ( @{$overdues} ) {
} }
++$counted; ++$counted;
my ( $amount, $type, $unitcounttotal ) = my ( $amount, $unitcounttotal, $unitcount ) =
CalcFine( $overdue, $borrower->{categorycode}, CalcFine( $overdue, $borrower->{categorycode},
$branchcode, $datedue, $today ); $branchcode, $datedue, $today );
$type ||= q{};
# Don't update the fine if today is a holiday. # Don't update the fine if today is a holiday.
# This ensures that dropbox mode will remove the correct amount of fine. # This ensures that dropbox mode will remove the correct amount of fine.
@ -137,7 +136,6 @@ for my $overdue ( @{$overdues} ) {
itemnumber => $overdue->{itemnumber}, itemnumber => $overdue->{itemnumber},
borrowernumber => $overdue->{borrowernumber}, borrowernumber => $overdue->{borrowernumber},
amount => $amount, amount => $amount,
type => $type,
due => output_pref($datedue), due => output_pref($datedue),
} }
); );
@ -149,7 +147,7 @@ for my $overdue ( @{$overdues} ) {
map { defined $borrower->{$_} ? $borrower->{$_} : q{} } map { defined $borrower->{$_} ? $borrower->{$_} : q{} }
@borrower_fields; @borrower_fields;
push @cells, map { $overdue->{$_} } @item_fields; push @cells, map { $overdue->{$_} } @item_fields;
push @cells, $type, $unitcounttotal, $amount; push @cells, $unitcounttotal, $amount;
say {$fh} join $delim, @cells; say {$fh} join $delim, @cells;
} }
} }

View file

@ -188,7 +188,7 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) {
( $datedue_days <= $today_days ) or next; # or it's not overdue, right? ( $datedue_days <= $today_days ) or next; # or it's not overdue, right?
$overdueItemsCounted++; $overdueItemsCounted++;
my ( $amount, $type, $unitcounttotal, $unitcount ) = CalcFine( my ( $amount, $unitcounttotal, $unitcount ) = CalcFine(
$data->[$i], $data->[$i],
$borrower->{'categorycode'}, $borrower->{'categorycode'},
$branchcode, $branchcode,
@ -206,9 +206,6 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) {
next; next;
} }
# FIXME: $type NEVER gets populated by anything.
( defined $type ) or $type = '';
# Don't update the fine if today is a holiday. # Don't update the fine if today is a holiday.
# This ensures that dropbox mode will remove the correct amount of fine. # This ensures that dropbox mode will remove the correct amount of fine.
if ( $mode eq 'production' and !$borrowersalreadyapplied->{$data->[$i]->{'borrowernumber'}}) { if ( $mode eq 'production' and !$borrowersalreadyapplied->{$data->[$i]->{'borrowernumber'}}) {

View file

@ -476,7 +476,6 @@ $dbh->do(
itemnumber => $itemnumber7, itemnumber => $itemnumber7,
borrowernumber => $renewing_borrower->{borrowernumber}, borrowernumber => $renewing_borrower->{borrowernumber},
amount => $fine, amount => $fine,
type => 'FU',
due => Koha::DateUtils::output_pref($five_weeks_ago) due => Koha::DateUtils::output_pref($five_weeks_ago)
} }
); );

View file

@ -114,7 +114,6 @@ my $default = {
#Test GetIssuingRule #Test GetIssuingRule
my $sampleissuingrule1 = { my $sampleissuingrule1 = {
reservecharge => '0.000000', reservecharge => '0.000000',
chargename => undef,
restrictedtype => 0, restrictedtype => 0,
accountsent => 0, accountsent => 0,
maxissueqty => 5, maxissueqty => 5,
@ -173,7 +172,6 @@ my $sampleissuingrule2 = {
overduefinescap => undef, overduefinescap => undef,
accountsent => undef, accountsent => undef,
reservecharge => undef, reservecharge => undef,
chargename => undef,
restrictedtype => undef, restrictedtype => undef,
maxsuspensiondays => 0, maxsuspensiondays => 0,
onshelfholds => 1, onshelfholds => 1,
@ -206,7 +204,6 @@ my $sampleissuingrule3 = {
overduefinescap => undef, overduefinescap => undef,
accountsent => undef, accountsent => undef,
reservecharge => undef, reservecharge => undef,
chargename => undef,
restrictedtype => undef, restrictedtype => undef,
maxsuspensiondays => 0, maxsuspensiondays => 0,
onshelfholds => 1, onshelfholds => 1,
@ -240,14 +237,13 @@ $query = 'INSERT INTO issuingrules (
overduefinescap, overduefinescap,
accountsent, accountsent,
reservecharge, reservecharge,
chargename,
restrictedtype, restrictedtype,
maxsuspensiondays, maxsuspensiondays,
onshelfholds, onshelfholds,
opacitemholds, opacitemholds,
cap_fine_to_replacement_price, cap_fine_to_replacement_price,
article_requests article_requests
) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; ) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
my $sth = $dbh->prepare($query); my $sth = $dbh->prepare($query);
$sth->execute( $sth->execute(
$sampleissuingrule1->{branchcode}, $sampleissuingrule1->{branchcode},
@ -273,7 +269,6 @@ $sth->execute(
$sampleissuingrule1->{overduefinescap}, $sampleissuingrule1->{overduefinescap},
$sampleissuingrule1->{accountsent}, $sampleissuingrule1->{accountsent},
$sampleissuingrule1->{reservecharge}, $sampleissuingrule1->{reservecharge},
$sampleissuingrule1->{chargename},
$sampleissuingrule1->{restrictedtype}, $sampleissuingrule1->{restrictedtype},
$sampleissuingrule1->{maxsuspensiondays}, $sampleissuingrule1->{maxsuspensiondays},
$sampleissuingrule1->{onshelfholds}, $sampleissuingrule1->{onshelfholds},
@ -305,7 +300,6 @@ $sth->execute(
$sampleissuingrule2->{overduefinescap}, $sampleissuingrule2->{overduefinescap},
$sampleissuingrule2->{accountsent}, $sampleissuingrule2->{accountsent},
$sampleissuingrule2->{reservecharge}, $sampleissuingrule2->{reservecharge},
$sampleissuingrule2->{chargename},
$sampleissuingrule2->{restrictedtype}, $sampleissuingrule2->{restrictedtype},
$sampleissuingrule2->{maxsuspensiondays}, $sampleissuingrule2->{maxsuspensiondays},
$sampleissuingrule2->{onshelfholds}, $sampleissuingrule2->{onshelfholds},
@ -337,7 +331,6 @@ $sth->execute(
$sampleissuingrule3->{overduefinescap}, $sampleissuingrule3->{overduefinescap},
$sampleissuingrule3->{accountsent}, $sampleissuingrule3->{accountsent},
$sampleissuingrule3->{reservecharge}, $sampleissuingrule3->{reservecharge},
$sampleissuingrule3->{chargename},
$sampleissuingrule3->{restrictedtype}, $sampleissuingrule3->{restrictedtype},
$sampleissuingrule3->{maxsuspensiondays}, $sampleissuingrule3->{maxsuspensiondays},
$sampleissuingrule3->{onshelfholds}, $sampleissuingrule3->{onshelfholds},