# first make sure the borrower hasn't already been charged for this item (for this issuance)
my $existing_charges = $account->lines->search(
{
- itemnumber => $itemnumber,
- accounttype => 'LOST',
- issue_id => $issue_id
+ itemnumber => $itemnumber,
+ debit_type_code => 'LOST',
+ issue_id => $issue_id
}
)->count();
date => \'NOW()',
amount => $amount,
description => $desc,
- accounttype => $type,
+ debit_type_code => $type,
amountoutstanding => $amountleft,
itemnumber => $itemnum || undef,
issue_id => $issue_id,
borrowernumber => $borrowernumber,
amount => $amount,
description => $desc,
- accounttype => $type,
+ debit_type_code => $type,
amountoutstanding => $amountleft,
note => $note,
itemnumber => $itemnum,
# check for overdue fine
my $accountlines = Koha::Account::Lines->search(
{
- borrowernumber => $borrowernumber,
- itemnumber => $item,
- accounttype => 'OVERDUE',
- status => 'UNRETURNED'
+ borrowernumber => $borrowernumber,
+ itemnumber => $item,
+ debit_type_code => 'OVERDUE',
+ status => 'UNRETURNED'
}
);
return 0 unless $accountlines->count; # no warning, there's just nothing to fix
# check for charge made for lost book
my $accountlines = Koha::Account::Lines->search(
{
- itemnumber => $itemnumber,
- accounttype => 'LOST',
- status => [ undef, { '<>' => 'RETURNED' } ]
+ itemnumber => $itemnumber,
+ debit_type_code => 'LOST',
+ status => [ undef, { '<>' => 'RETURNED' } ]
},
{
order_by => { -desc => [ 'date', 'accountlines_id' ] }
my $overdues = Koha::Account::Lines->search(
{
borrowernumber => $borrowernumber,
- accounttype => [ 'OVERDUE', 'M' ],
+ debit_type_code => [ 'OVERDUE', 'M' ],
amountoutstanding => { '<>' => 0 }
}
);
my ( $itemnum, $borrowernumber ) = @_;
my $dbh = C4::Context->dbh();
my $query = q|SELECT sum(amountoutstanding) as fineamount FROM accountlines
- where accounttype like 'OVERDUE'
+ WHERE debit_type_code LIKE 'OVERDUE'
AND amountoutstanding > 0 AND borrowernumber=?|;
my @query_param;
push @query_param, $borrowernumber;
LEFT JOIN itemtypes ON itemtypes.itemtype = $itype_link
LEFT JOIN branches ON branches.branchcode = issues.branchcode
WHERE (accountlines.amountoutstanding != '0.000000')
- AND (accountlines.accounttype = 'OVERDUE' )
+ AND (accountlines.debit_type_code = 'OVERDUE' )
AND (accountlines.status = 'UNRETURNED' )
AND (issues.branchcode = ? )
AND (issues.date_due < NOW())
# Same logic exists in Koha::Account::Line::apply
if ( $new_amountoutstanding == 0
&& $fine->itemnumber
- && $fine->accounttype
- && ( $fine->accounttype eq 'LOST' ) )
+ && $fine->debit_type_code
+ && ( $fine->debit_type_code eq 'LOST' ) )
{
C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber );
}
if ( $fine->amountoutstanding == 0
&& $fine->itemnumber
- && $fine->accounttype
- && ( $fine->accounttype eq 'LOST' ) )
+ && $fine->debit_type_code
+ && ( $fine->debit_type_code eq 'LOST' ) )
{
C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber );
}
);
$debit_type can be any of:
- - overdue
- - lost_item
- - new_card
- account
- account_renew
+ - hold_expired
+ - lost_item
- sundry
+ - new_card
+ - overdue
- processing
- rent
- rent_daily
- - rent_renewal
- - rent_daily_renewal
+ - rent_renew
+ - rent_daily_renew
- reserve
- - manual
+ - manual_debit
=cut
my ( $self, $params ) = @_;
# amount should always be a positive value
- my $amount = $params->{amount};
+ my $amount = $params->{amount};
unless ( $amount > 0 ) {
Koha::Exceptions::Account::AmountNotPositive->throw(
- error => 'Debit amount passed is not positive'
- );
+ error => 'Debit amount passed is not positive' );
}
- my $description = $params->{description} // q{};
- my $note = $params->{note} // q{};
- my $user_id = $params->{user_id};
- my $interface = $params->{interface};
- my $library_id = $params->{library_id};
- my $type = $params->{type};
- my $item_id = $params->{item_id};
- my $issue_id = $params->{issue_id};
+ my $description = $params->{description} // q{};
+ my $note = $params->{note} // q{};
+ my $user_id = $params->{user_id};
+ my $interface = $params->{interface};
+ my $library_id = $params->{library_id};
+ my $type = $params->{type};
+ my $item_id = $params->{item_id};
+ my $issue_id = $params->{issue_id};
- unless ( $interface ) {
+ unless ($interface) {
Koha::Exceptions::MissingParameter->throw(
- error => 'The interface parameter is mandatory'
- );
+ error => 'The interface parameter is mandatory' );
}
my $schema = Koha::Database->new->schema;
);
}
- my $account_type = $Koha::Account::account_type_debit->{$type};
+ my $debit_type_code = $Koha::Account::account_type_debit->{$type};
my $line;
-
$schema->txn_do(
sub {
# Insert the account line
$line = Koha::Account::Line->new(
- { borrowernumber => $self->{patron_id},
+ {
+ borrowernumber => $self->{patron_id},
date => \'NOW()',
amount => $amount,
description => $description,
- accounttype => $account_type,
+ debit_type_code => $debit_type_code,
amountoutstanding => $amount,
payment_type => undef,
note => $note,
itemnumber => $item_id,
issue_id => $issue_id,
branchcode => $library_id,
- ( $type eq 'overdue' ? ( status => 'UNRETURNED' ) : ()),
+ ( $type eq 'overdue' ? ( status => 'UNRETURNED' ) : () ),
}
)->store();
# Record the account offset
my $account_offset = Koha::Account::Offset->new(
- { debit_id => $line->id,
- type => $Koha::Account::offset_type->{$type},
- amount => $amount
+ {
+ debit_id => $line->id,
+ type => $Koha::Account::offset_type->{$type},
+ amount => $amount
}
)->store();
"FINES", 'CREATE',
$self->{patron_id},
Dumper(
- { action => "create_$type",
+ {
+ action => "create_$type",
borrowernumber => $self->{patron_id},
amount => $amount,
description => $description,
amountoutstanding => $amount,
- accounttype => $account_type,
+ debit_type_code => $debit_type_code,
note => $note,
itemnumber => $item_id,
manager_id => $user_id,
push @not_fines, ( 'RENT', 'RENT_DAILY', 'RENT_RENEW', 'RENT_DAILY_RENEW' )
unless C4::Context->preference('RentalsInNoissuesCharge');
unless ( C4::Context->preference('ManInvInNoissuesCharge') ) {
- my @man_inv = Koha::Account::DebitTypes->search({ system => 0 })->get_column('code');
+ my @man_inv = Koha::Account::DebitTypes->search({ is_system => 0 })->get_column('code');
push @not_fines, @man_inv;
}
return $self->lines->search(
{
- debit_type => { -not_in => \@not_fines }
+ debit_type_code => { -not_in => \@not_fines }
},
)->total_outstanding;
}
our $account_type_debit = {
'account' => 'ACCOUNT',
'account_renew' => 'ACCOUNT_RENEW',
- 'overdue' => 'OVERDUE',
+ 'hold_expired' => 'HE',
'lost_item' => 'LOST',
- 'new_card' => 'N',
'sundry' => 'M',
+ 'new_card' => 'N',
+ 'overdue' => 'OVERDUE',
'processing' => 'PF',
'rent' => 'RENT',
'rent_daily' => 'RENT_DAILY',
'rent_renew' => 'RENT_RENEW',
'rent_daily_renew' => 'RENT_DAILY_RENEW',
'reserve' => 'Res',
- 'manual_debit' => 'M',
- 'hold_expired' => 'HE'
+ 'manual_debit' => 'M'
};
=head1 AUTHORS
# Same logic exists in Koha::Account::pay
if ( $debit->amountoutstanding == 0
&& $debit->itemnumber
- && $debit->accounttype
- && $debit->accounttype eq 'LOST' )
+ && $debit->debit_type_code
+ && $debit->debit_type_code eq 'LOST' )
{
C4::Circulation::ReturnLostItem( $self->borrowernumber, $debit->itemnumber );
}
);
}
- my $account_type = $self->accounttype;
- my $account_status = $self->status;
+ my $debit_type_code = $self->debit_type_code;
+ my $account_status = $self->status;
unless (
(
exists(
$Koha::Account::Line::allowed_update->{$update_type}
- ->{$account_type}
+ ->{$debit_type_code}
)
&& ( $Koha::Account::Line::allowed_update->{$update_type}
- ->{$account_type} eq $account_status )
+ ->{$debit_type_code} eq $account_status )
)
)
{
Koha::Exceptions::Account::UnrecognisedType->throw(
- error => 'Update type not allowed on this accounttype' );
+ error => 'Update type not allowed on this debit_type' );
}
my $schema = Koha::Database->new->schema;
my $difference = $amount - $amount_before;
my $new_outstanding = $amount_outstanding_before + $difference;
- my $offset_type = $account_type;
+ my $offset_type = $debit_type_code;
$offset_type .= ( $difference > 0 ) ? "_INCREASE" : "_DECREASE";
# Catch cases that require patron refunds
amount => $amount,
description => undef,
amountoutstanding => $new_outstanding,
- accounttype => $self->accounttype,
+ debit_type_code => $self->debit_type_code,
note => undef,
itemnumber => $self->itemnumber,
manager_id => undef,
is_nullable: 1
size: 80
-=head2 debit_type
+=head2 debit_type_code
data_type: 'varchar'
is_foreign_key: 1
is_nullable: 1
- size: 16
+ size: 64
=head2 status
{ data_type => "longtext", is_nullable => 1 },
"accounttype",
{ data_type => "varchar", is_nullable => 1, size => 80 },
- "debit_type",
- { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 16 },
+ "debit_type_code",
+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 64 },
"status",
{ data_type => "varchar", is_nullable => 1, size => 16 },
"payment_type",
},
);
-=head2 debit_type
+=head2 debit_type_code
Type: belongs_to
=cut
__PACKAGE__->belongs_to(
- "debit_type",
+ "debit_type_code",
"Koha::Schema::Result::AccountDebitType",
- { code => "debit_type" },
+ { code => "debit_type_code" },
{
is_deferrable => 1,
join_type => "LEFT",
);
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-11 10:47:58
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RKg4gDSu0WwJ1C9YmDv3pw
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-08 11:15:31
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1Vgkg0JR7RqmkniOmUoUhQ
sub koha_objects_class {
'Koha::Account::Lines';
my $accountlines = Koha::Account::Lines->search(
{
itemnumber => $item->{itemnumber},
- accounttype => 'LOST',
+ debit_type_code => 'LOST',
status => [ undef, { '<>' => 'RETURNED' } ],
amountoutstanding => 0
},
$DBversion = 'XXX'; # will be replaced by the RM
if ( CheckVersion($DBversion) ) {
+ # Adding account_debit_types
$dbh->do(
qq{
CREATE TABLE IF NOT EXISTS account_debit_types (
}
);
+ # Adding ac_debit_types_branches
$dbh->do(
qq{
CREATE TABLE IF NOT EXISTS ac_debit_types_branches (
}
);
+ # Populating account_debit_types
$dbh->do(
qq{
INSERT IGNORE INTO account_debit_types (
}
);
+ # Moving MANUAL_INV to account_debit_types
$dbh->do(
qq{
INSERT IGNORE INTO account_debit_types (
}
);
- $dbh->do(
- qq{
- ALTER IGNORE TABLE accountlines
- ADD
- debit_type varchar(64) DEFAULT NULL
- AFTER
- accounttype
- }
- );
+ # Adding debit_type_code to accountlines
+ unless ( column_exists('accountlines', 'debit_type_code') ) {
+ $dbh->do(
+ qq{
+ ALTER IGNORE TABLE accountlines
+ ADD
+ debit_type_code varchar(64) DEFAULT NULL
+ AFTER
+ accounttype
+ }
+ );
+ }
- $dbh->do(
- qq{
- ALTER TABLE accountlines ADD CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type`) REFERENCES `account_debit_types` (`code`) ON DELETE SET NULL ON UPDATE CASCADE
- }
- );
+ # Linking debit_type_code in accountlines to code in account_debit_types
+ unless ( foreign_key_exists( 'accountlines', 'accountlines_ibfk_debit_type' ) ) {
+ $dbh->do(
+ qq{
+ ALTER TABLE accountlines ADD CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE RESTRICT ON UPDATE CASCADE
+ }
+ );
+ }
+ # Adding a check constraints to accountlines
$dbh->do(
qq{
- ALTER TABLE accountlines ADD CONSTRAINT `accountlines_check_type` CHECK (accounttype IS NOT NULL OR debit_type IS NOT NULL)
+ ALTER TABLE accountlines ADD CONSTRAINT `accountlines_check_type` CHECK (accounttype IS NOT NULL OR debit_type_code IS NOT NULL)
}
);
+ # Populating debit_type_code
$dbh->do(
qq{
- UPDATE accountlines SET debit_type = accounttype, accounttype = NULL WHERE accounttype IN (SELECT code from account_debit_types)
+ UPDATE accountlines SET debit_type_code = accounttype, accounttype = NULL WHERE accounttype IN (SELECT code from account_debit_types)
}
);
- # Clean up MANUAL_INV
+ # Remove MANUAL_INV
$dbh->do(
qq{
DELETE FROM authorised_values WHERE category = 'MANUAL_INV'
`amount` decimal(28,6) default NULL,
`description` LONGTEXT,
`accounttype` varchar(80) default NULL,
- `debit_type` varchar(64) default NULL,
+ `debit_type_code` varchar(64) default NULL,
`status` varchar(16) default NULL,
`payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE
`amountoutstanding` decimal(28,6) default NULL,
PRIMARY KEY (`accountlines_id`),
KEY `acctsborridx` (`borrowernumber`),
KEY `timeidx` (`timestamp`),
- KEY `debit_type` (`debit_type`),
+ KEY `debit_type_code` (`debit_type_code`),
KEY `itemnumber` (`itemnumber`),
KEY `branchcode` (`branchcode`),
KEY `manager_id` (`manager_id`),
CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `accountlines_ibfk_branches` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
- CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type`) REFERENCES `account_debit_types` (`code`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `accountlines_check_type` CHECK (`accounttype` IS NOT NULL OR `debit_type_code` IS NOT NULL)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
, [% account.description | html %]
[% END %]
- [% IF ( account.itemnumber AND account.accounttype != 'OVERDUE' ) %]
+ [% IF ( account.itemnumber AND account.debit_type_code != 'OVERDUE' ) %]
<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>
[% END %]
</td>
[% END %]
<input type="hidden" name="itemnumber[% line.accountlines_id | html %]" value="[% line.itemnumber | html %]" />
<input type="hidden" name="description[% line.accountlines_id | html %]" value="[% line.description | html %]" />
- <input type="hidden" name="accounttype[% line.accountlines_id | html %]" value="[% line.accounttype | html %]" />
+ <input type="hidden" name="debit_type_code[% line.accountlines_id | html %]" value="[% line.debit_type_code | html %]" />
<input type="hidden" name="amount[% line.accountlines_id | html %]" value="[% line.amount | html %]" />
<input type="hidden" name="accountlines_id[% line.accountlines_id | html %]" value="[% line.accountlines_id | html %]" />
<input type="hidden" name="amountoutstanding[% line.accountlines_id | html %]" value="[% line.amountoutstanding | html %]" />
<input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
<input type="hidden" name="description" id="description" value="[% description | html %]" />
- <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype | html %]" />
+ <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
<input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
<input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
<input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
<td>
[% individual_description | html %]
</td>
- <td>[% accounttype | html %]</td>
+ <td>[% debit_type_code | html %]</td>
<td class="debit">[% amount | format('%.2f') %]</td>
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
</tr></tbody>
<input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
<input type="hidden" name="description" id="description" value="[% description | html %]" />
- <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype | html %]" />
+ <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
<input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
<input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
<input type="hidden" name="title" id="title" value="[% title | html %]" />
<tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
<tbody><tr>
<td>[% description | html %] [% title | html %]</td>
- <td>[% accounttype | html %]</td>
+ <td>[% debit_type_code | html %]</td>
<td class="debit">[% amount | format('%.2f') %]</td>
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
</tr></tbody>
[% USE Price %]
[% USE ItemTypes %]
[% SET footerjs = 1 %]
+[% PROCESS 'accounts.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Reports [% IF ( do_it ) %]› Cash register statistics › Results[% ELSE %]› Cash register statistics[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<option value="FORW">Write off</option>
[% END %]
- [% IF transaction_type == "F" %]
- <option value="F" selected="selected">Fine</option>
- [% ELSE %]
- <option value="F">Fine</option>
- [% END %]
-
- [% IF transaction_type == "FU" %]
- <option value="FU" selected="selected">Accruing fine</option>
- [% ELSE %]
- <option value="FU">Accruing fine</option>
- [% END %]
-
[% IF transaction_type == "PAY" %]
<option value="PAY" selected="selected">Payment</option>
[% ELSE %]
<option value="PAY">Payment</option>
[% END %]
- [% IF transaction_type == "A" %]
- <option value="A" selected="selected">Account management fee</option>
- [% ELSE %]
- <option value="A">Account management fee</option>
- [% END %]
-
- [% IF transaction_type == "M" %]
- <option value="M" selected="selected">Sundry</option>
- [% ELSE %]
- <option value="M">Sundry</option>
- [% END %]
-
- [% IF transaction_type == "L" %]
- <option value="L" selected="selected">Lost item</option>
- [% ELSE %]
- <option value="L">Lost item</option>
- [% END %]
-
- [% IF transaction_type == "N" %]
- <option value="N" selected="selected">New card</option>
- [% ELSE %]
- <option value="N">New card</option>
- [% END %]
-
- [% FOREACH manualinv IN manualinv_types %]
- [% value_manualinv = manualinv.authorised_value|truncate(5, '') %]
- [% IF transaction_type == value_manualinv %]
- <option value="[% value_manualinv | html %]" selected="selected">[% manualinv.authorised_value | html %]</option>
+ [% FOREACH debit_type IN debit_types %]
+ [% IF transaction_type == debit_type.code %]
+ <option value="[% debit_type.code | html %]" selected="selected">[% debit_type.description | html %]</option>
[% ELSE %]
- <option value="[% value_manualinv | html %]">[% manualinv.authorised_value | html %]</option>
+ <option value="[% debit_type.code | html %]">[% debit_type.description | html %]</option>
[% END %]
[% END %]
</select>
<td>
[% IF loopresul.accounttype == "ACT" %]
<span>All payments to the library</span>
- [% ELSIF loopresul.accounttype == "C" || loopresul.accounttype == "CR" %]
- <span>Credit</span>
- [% ELSIF loopresul.accounttype == "FORW" || loopresul.accounttype == "W" %]
- <span>Write off</span>
- [% ELSIF loopresul.accounttype == "F" %]
- <span>Fine</span>
- [% ELSIF loopresul.accounttype == "FU" %]
- <span>Accruing fine</span>
- [% ELSIF loopresul.accounttype == "Pay" %]
- <span>Payment</span>
- [% ELSIF loopresul.accounttype == "A" %]
- <span>Account management fee</span>
- [% ELSIF loopresul.accounttype == "M" %]
- <span>Sundry</span>
- [% ELSIF loopresul.accounttype == "LOST" %]
- <span>Lost item</span>
- [% ELSIF loopresul.accounttype == "N" %]
- <span>New card</span>
[% ELSE %]
- [% FOREACH manualinv IN manualinv_types %]
- [% value_manualinv = manualinv.authorised_value|truncate(5, '') %]
- [% IF loopresul.accounttype == value_manualinv %]
- <span>[% manualinv.authorised_value | html %]</span>
- [% LAST %]
- [% END %]
- [% END %]
+ [%- PROCESS account_type_description account=loopresul -%]
[% END %]
</td>
<td>[% loopresul.note | html %]</td>
</form>
[%- BLOCK account_type_description -%]
- [%- SWITCH account.accounttype -%]
- [%- CASE 'Pay' -%]<span>Payment
- [%- CASE 'VOID' -%]<span>Voided
- [%- CASE 'N' -%]<span>New card
- [%- CASE 'OVERDUE' -%]<span>Fine
- [%- CASE 'ACCOUNT' -%]<span>Account creation fee
- [%- CASE 'ACCOUNT_RENEW' -%]<span>Account renewal fee
- [%- CASE 'M' -%]<span>Sundry
- [%- CASE 'LOST' -%]<span>Lost item
- [%- CASE 'W' -%]<span>Writeoff
- [%- CASE 'HE' -%]<span>Hold waiting too long
- [%- CASE 'RENT' -%]<span>Rental fee
- [%- CASE 'RENT_DAILY' -%]<span>Daily rental fee
- [%- CASE 'RENT_RENEW' -%]<span>Renewal of rental item
- [%- CASE 'RENT_DAILT_RENEW' -%]<span>Renewal of dailt rental item
- [%- CASE 'FOR' -%]<span>Forgiven
- [%- CASE 'PF' -%]<span>Lost item processing fee
- [%- CASE 'PAY' -%]<span>Payment
- [%- CASE 'WO' -%]<span>Writeoff
- [%- CASE 'C' -%]<span>Credit
- [%- CASE 'LOST_RETURN' -%]<span>Lost item fee refund
- [%- CASE 'Res' -%]<span>Hold fee
- [%- CASE -%]<span>[% account.accounttype | html %]
+ <span>
+ [%- IF account.accounttype -%]
+ [%- SWITCH account.accounttype -%]
+ [%- CASE 'Pay' -%]Payment
+ [%- CASE 'W' -%]Writeoff
+ [%- CASE 'FOR' -%]Forgiven
+ [%- CASE 'PAY' -%]Payment
+ [%- CASE 'WO' -%]Writeoff
+ [%- CASE 'C' -%]Credit
+ [%- CASE 'LOST_RETURN' -%]Lost item fee refund
+ [%- CASE -%][% account.accounttype | html %]
+ [%- END -%]
+ [%- ELSIF account.debit_type -%]
+ [%- SWITCH account.debit_type -%]
+ [%- CASE 'ACCOUNT' -%]Account creation fee
+ [%- CASE 'ACCOUNT_RENEW' -%]Account renewal fee
+ [%- CASE 'HE' -%]Hold waiting too long
+ [%- CASE 'LOST' -%]Lost item
+ [%- CASE 'M' -%]Sundry
+ [%- CASE 'N' -%]New card
+ [%- CASE 'OVERDUE' -%]Fine
+ [%- CASE 'PF' -%]Lost item processing fee
+ [%- CASE 'RENT' -%]Rental fee
+ [%- CASE 'RENT_DAILY' -%]Daily rental fee
+ [%- CASE 'RENT_RENEW' -%]Renewal of rental item
+ [%- CASE 'RENT_DAILY_RENEW' -%]Rewewal of daily rental item
+ [%- CASE 'Res' -%]Hold fee
+ [%- CASE -%][% account.debit_type.description | html %]
+ [%- END -%]
[%- END -%]
- [%- PROCESS account_status_description account=account -%]</span>
+ [%- PROCESS account_status_description account=account -%]
+ </span>
[%- END -%]
[%- BLOCK account_status_description -%]
. "borrowernumber=$borrowernumber"
. "&amount=" . $accountline->amount
. "&amountoutstanding=" . $accountline->amountoutstanding
- . "&accounttype=" . $accountline->accounttype
+ . "&debit_type_code=" . $accountline->debit_type_code
. "&accountlines_id=" . $accountlines_id
. "&change_given=" . $change_given
. "&writeoff_individual=1"
"/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber";
$redirect .= q{&};
$redirect .= "$action=1";
- $redirect .= get_for_redirect( 'accounttype', "accounttype$line_no", 0 );
+ $redirect .= get_for_redirect( 'debit_type_code', "debit_type_code$line_no", 0 );
$redirect .= get_for_redirect( 'amount', "amount$line_no", 1 );
$redirect .=
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 );
} elsif ($writeoff_individual) {
$template->param( writeoff_individual => 1 );
}
- my $accounttype = $input->param('accounttype');
- $accountlines_id = $input->param('accountlines_id');
+ my $debit_type_code = $input->param('debit_type_code');
+ $accountlines_id = $input->param('accountlines_id');
my $amount = $input->param('amount');
my $amountoutstanding = $input->param('amountoutstanding');
my $itemnumber = $input->param('itemnumber');
my $title = $input->param('title');
$total_due = $amountoutstanding;
$template->param(
- accounttype => $accounttype,
+ debit_type_code => $debit_type_code,
accountlines_id => $accountlines_id,
amount => $amount,
amountoutstanding => $amountoutstanding,
'amount' => sprintf( "%.2f", $accountline->{'amount'} ),
'amountoutstanding' =>
sprintf( "%.2f", $accountline->{'amountoutstanding'} ),
- accounttype => $accountline->{accounttype},
- 'note' => $accountline->{'note'},
+ 'debit_type_code' => $accountline->{'debit_type_code'},
+ 'note' => $accountline->{'note'},
);
my @account_offsets = Koha::Account::Offsets->search( { debit_id => $accountline_object->id } );
my $desc = "staticfine";
my $query = "INSERT INTO accountlines
- (borrowernumber,itemnumber,date,amount,description,accounttype,status,amountoutstanding)
+ (borrowernumber,itemnumber,date,amount,description,debit_type_code,status,amountoutstanding)
VALUES (?,?,now(),?,?,'OVERDUE','RETURNED',?)";
my $sth2 = $dbh->prepare($query);
$bigdebug and warn "query: $query\nw/ args: $borrowernumber, $itemnumber, $amount, $desc, $amount\n";
{
borrowernumber => $patron->borrowernumber,
amountoutstanding => { '>' => 0 },
- accounttype => [ 'OVERDUE', 'LOST' ],
+ debit_type_code => [ 'OVERDUE', 'LOST' ],
itemnumber => $issue->{itemnumber}
},
);
{
borrowernumber => $patron->borrowernumber,
amountoutstanding => { '>' => 0 },
- accounttype => { 'LIKE' => 'RENT_%' },
+ debit_type_code => { 'LIKE' => 'RENT_%' },
itemnumber => $issue->{itemnumber}
}
);
# Note that this should not be needed but since we do not have proper exception handling here we do it this way
patron_has_hold_fee => Koha::Account::Lines->search(
{
- borrowernumber => $borrower->{borrowernumber},
- accounttype => 'Res',
- description => $item->biblio->title,
- date => $dtf->format_date(dt_from_string)
+ borrowernumber => $borrower->{borrowernumber},
+ debit_type_code => 'Res',
+ description => $item->biblio->title,
+ date => $dtf->format_date(dt_from_string)
}
)->count,
);
use DateTime;
use Koha::DateUtils;
use Text::CSV::Encoded;
+use List::Util qw/any/;
+
+use Koha::Account::DebitTypes;
my $input = new CGI;
my $dbh = C4::Context->dbh;
my $fromDate = dt_from_string;
my $toDate = dt_from_string;
-my $query_manualinv = "SELECT id, authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'";
-my $sth_manualinv = $dbh->prepare($query_manualinv) or die "Unable to prepare query" . $dbh->errstr;
-$sth_manualinv->execute() or die "Unable to execute query " . $sth_manualinv->errstr;
-my $manualinv_types = $sth_manualinv->fetchall_arrayref({});
-
+my @debit_types =
+ Koha::Account::DebitTypes->search()->as_list;
if ($do_it) {
$whereTType = q{};
} elsif ($transaction_type eq 'ACT') { #Active
$whereTType = q{ AND accounttype IN ('Pay','C') };
- } else { #Single transac type
- if ($transaction_type eq 'FORW') {
- $whereTType = q{ AND accounttype IN ('FOR','W') };
+ } elsif ($transaction_type eq 'FORW') {
+ $whereTType = q{ AND accounttype IN ('FOR','W') };
+ } else {
+ if ( any { $transaction_type eq $_->code } @debit_types ) {
+ $whereTType = q{ AND debit_type_code = ? };
+ push @extra_params, $transaction_type;
} else {
$whereTType = q{ AND accounttype = ? };
push @extra_params, $transaction_type;
SELECT round(amount,2) AS amount, description,
bo.surname AS bsurname, bo.firstname AS bfirstname, m.surname AS msurname, m.firstname AS mfirstname,
bo.cardnumber, br.branchname, bo.borrowernumber,
- al.borrowernumber, DATE(al.date) as date, al.accounttype, al.amountoutstanding, al.note,
+ al.borrowernumber, DATE(al.date) as date, al.accounttype, al.debit_type_code, al.amountoutstanding, al.note,
bi.title, bi.biblionumber, i.barcode, i.itype
FROM accountlines al
LEFT JOIN borrowers bo ON (al.borrowernumber = bo.borrowernumber)
$row->{branchname},
$row->{date},
$row->{accounttype},
+ $row->{debit_type},
$row->{note},
$row->{amount},
$row->{title},
endDate => $toDate,
transaction_type => $transaction_type,
branchloop => Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed,
- manualinv_types => $manualinv_types,
+ debit_types => \@debit_types,
CGIsepChoice => GetDelimiterChoices,
);
use t::lib::Mocks;
use Koha::Account;
+use Koha::Account::DebitTypes;
use Koha::Account::Lines;
use Koha::Account::Offsets;
use Koha::Notice::Messages;
borrowernumber => $patron->{borrowernumber}
}
);
-is( $accountline->accounttype, $type, 'Accountline type set correctly for manualinvoice' );
+is( $accountline->debit_type_code, $type, 'Debit type set correctly for manualinvoice' );
is( $accountline->amount, $amount, 'Accountline amount set correctly for manualinvoice' );
ok( $accountline->description =~ /^$description/, 'Accountline description set correctly for manualinvoice' );
is( $accountline->note, $note, 'Accountline note set correctly for manualinvoice' );
my $writeoff = Koha::Account::Lines->find( $id );
- is( $writeoff->accounttype, 'W', 'Type is correct' );
+ is( $writeoff->accounttype, 'W', 'Type is correct for writeoff' );
is( $writeoff->description, 'Writeoff', 'Description is correct' );
is( $writeoff->amount, '-42.000000', 'Amount is correct' );
};
t::lib::Mocks::mock_preference('useDefaultReplacementCost', '0');
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
ok( !$lostfine, "No lost fine if no replacementcost or default when pref off");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
ok( $lostfine->amount == 6.12, "Lost fine equals replacementcost when pref off and no default set");
ok( !$procfee, "No processing fee if no processing fee");
$lostfine->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
ok( !$procfee, "No processing fee if no processing fee");
$lostfine->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
ok( !$lostfine, "No lost fine if no replacementcost and no default set when pref off");
ok( $procfee->amount == 8.16, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and no default set");
ok( $procfee->amount == 8.16, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
ok( !$lostfine, "No lost fine if no replacementcost but default set when pref off");
ok( $procfee->amount == 2.04, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
ok( $lostfine->amount == 6.12 , "Lost fine equals replacementcost when pref off and default set");
ok( $procfee->amount == 2.04, "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
t::lib::Mocks::mock_preference('useDefaultReplacementCost', '1');
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
ok( !$lostfine, "No lost fine if no replacementcost or default when pref on");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber1, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber1, debit_type_code => 'PF' });
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
is( $lostfine->amount(), "16.320000", "Lost fine is default if no replacementcost but default set when pref on");
ok( !$procfee, "No processing fee if no processing fee");
$lostfine->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber2, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber2, debit_type_code => 'PF' });
is( $lostfine->amount, "6.120000" , "Lost fine equals replacementcost when pref on and default set");
ok( !$procfee, "No processing fee if no processing fee");
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
ok( !$lostfine, "No lost fine if no replacementcost and default not set when pref on");
is( $procfee->amount, "8.160000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber3, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber3, debit_type_code => 'PF' });
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and no default set");
is( $procfee->amount, "8.160000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_3, "Processing fee issue id is correct" );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
is( $lostfine->amount, "4.080000", "Lost fine is default if no replacementcost but default set when pref on");
is( $procfee->amount, "2.040000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
$lostfine->delete();
$procfee->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
is( $lostfine->amount, "6.120000", "Lost fine equals replacementcost when pref on and default set");
is( $procfee->amount, "2.040000", "Processing fee if processing fee");
is( $procfee->issue_id, $cli_issue_id_4, "Processing fee issue id is correct" );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
- my $lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- my $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ my $lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ my $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
ok( $lostfines->count == 1 , "Lost fine cannot be double charged for the same issue_id");
ok( $procfees->count == 1, "Processing fee cannot be double charged for the same issue_id");
MarkIssueReturned($cli_borrowernumber, $cli_itemnumber4);
$cli_issue_id_4X = $builder->build({ source => 'Issue', value => { borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4 } })->{issue_id};
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 6.12, "Perdedor");
- $lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $lostfines = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ $procfees = Koha::Account::Lines->search({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
ok( $lostfines->count == 2 , "Lost fine can be charged twice for the same item if they are distinct issue_id's");
ok( $procfees->count == 2, "Processing fee can be charged twice for the same item if they are distinct issue_id's");
$lostfines->delete();
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, '1.99', "Perdedor");
# Lost Item Fee
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
ok($lostfine, "Lost fine created");
is($lostfine->manager_id, $staff_id, "Lost fine manager_id set correctly");
is($lostfine->issue_id, $cli_issue_id_4X, "Lost fine issue_id set correctly");
is($lostfine->branchcode, $branchcode, "Lost fine branchcode set correctly");
# Processing Fee
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
ok($procfee, "Processing fee created");
is($procfee->manager_id, $staff_id, "Processing fee manager_id set correctly");
is($procfee->issue_id, $cli_issue_id_4X, "Processing fee issue_id set correctly");
t::lib::Mocks::mock_preference( 'FinesLog', 0 );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No logs were added' );
$lostfine->delete();
$procfee->delete();
t::lib::Mocks::mock_preference( 'FinesLog', 1 );
C4::Accounts::chargelostitem( $cli_borrowernumber, $cli_itemnumber4, 0, "Perdedor");
- $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'LOST' });
- $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, accounttype => 'PF' });
+ $lostfine = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'LOST' });
+ $procfee = Koha::Account::Lines->find({ borrowernumber => $cli_borrowernumber, itemnumber => $cli_itemnumber4, debit_type_code => 'PF' });
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Logs were added' );
$lostfine->delete();
$procfee->delete();
interface => 'commandline'
}
);
- Koha::Account::DebitTypes->new(
+ Koha::Account::DebitTypes->find_or_create(
{
code => 'Copie',
description => 'Fee for copie',
borrowernumber => $patron->borrowernumber,
date => $today,
description => 'a Manual invoice fee',
- debit_type => 'Copie',
+ debit_type_code => 'Copie',
amountoutstanding => $manual,
interface => 'commandline'
}
);
my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
- is( $line->accounttype, 'OVERDUE', 'Account line type is OVERDUE' );
+ is( $line->debit_type_code, 'OVERDUE', 'Account line type is OVERDUE' );
is( $line->status, 'UNRETURNED', 'Account line status is UNRETURNED' );
is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
is( $line->amount, '15.000000', 'Account line amount is 15.00' );
LostItem( $item_1->itemnumber, 'test', 1 );
$line = Koha::Account::Lines->find($line->id);
- is( $line->accounttype, 'OVERDUE', 'Account type remains as OVERDUE' );
+ is( $line->debit_type_code, 'OVERDUE', 'Account type remains as OVERDUE' );
isnt( $line->status, 'UNRETURNED', 'Account status correctly changed from UNRETURNED to RETURNED' );
my $item = Koha::Items->find($item_1->itemnumber);
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
my $lost_fee_line = $lost_fee_lines->next;
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right LOST amount is generated' );
$lost_fee_line->discard_changes; # reload from DB
is( $lost_fee_line->amountoutstanding + 0, 0, 'Lost fee has no outstanding amount' );
- is( $lost_fee_line->accounttype,
+ is( $lost_fee_line->debit_type_code,
'LOST', 'Lost fee now still has account type of LOST' );
is( $lost_fee_line->status, 'RETURNED', "Lost fee now has account status of RETURNED");
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
my $lost_fee_line = $lost_fee_lines->next;
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right LOST amount is generated' );
$lost_fee_line->discard_changes;
is( $lost_fee_line->amountoutstanding + 0, 0, 'Lost fee has no outstanding amount' );
- is( $lost_fee_line->accounttype,
+ is( $lost_fee_line->debit_type_code,
'LOST', 'Lost fee now still has account type of LOST' );
is( $lost_fee_line->status, 'RETURNED', "Lost fee now has account status of RETURNED");
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
my $lost_fee_line = $lost_fee_lines->next;
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right LOST amount is generated' );
$lost_fee_line->discard_changes;
is( $lost_fee_line->amountoutstanding + 0, 0, 'Lost fee has no outstanding amount' );
- is( $lost_fee_line->accounttype,
+ is( $lost_fee_line->debit_type_code,
'LOST', 'Lost fee now still has account type of LOST' );
is( $lost_fee_line->status, 'RETURNED', "Lost fee now has account status of RETURNED");
LostItem( $item->itemnumber, 1 );
my $processing_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'PF' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'PF' } );
is( $processing_fee_lines->count, 1, 'Only one processing fee produced' );
my $processing_fee_line = $processing_fee_lines->next;
is( $processing_fee_line->amount + 0,
$processfee_amount, 'The right PF amountoutstanding is generated' );
my $lost_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item->itemnumber, accounttype => 'LOST' } );
+ { borrowernumber => $patron->id, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } );
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
my $lost_fee_line = $lost_fee_lines->next;
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right LOST amount is generated' );
$lost_fee_line->discard_changes;
is( $lost_fee_line->amountoutstanding + 0, 0, 'Lost fee has no outstanding amount' );
- is( $lost_fee_line->accounttype,
+ is( $lost_fee_line->debit_type_code,
'LOST', 'Lost fee now still has account type of LOST' );
is( $lost_fee_line->status, 'RETURNED', "Lost fee now has account status of RETURNED");
LostItem( $item_id, 1 );
my $lost_fee_lines = Koha::Account::Lines->search(
- { borrowernumber => $patron->id, itemnumber => $item_id, accounttype => 'LOST' } );
+ { borrowernumber => $patron->id, itemnumber => $item_id, debit_type_code => 'LOST' } );
is( $lost_fee_lines->count, 1, 'Only one lost item fee produced' );
my $lost_fee_line = $lost_fee_lines->next;
is( $lost_fee_line->amount + 0, $replacement_amount, 'The right LOST amount is generated' );
is( $account->balance, $manual_debit_amount - $payment_amount, 'Balance is PF - payment (LOST_RETURN)' );
- my $manual_debit = Koha::Account::Lines->search({ borrowernumber => $patron->id, accounttype => 'OVERDUE', status => 'UNRETURNED' })->next;
+ my $manual_debit = Koha::Account::Lines->search({ borrowernumber => $patron->id, debit_type_code => 'OVERDUE', status => 'UNRETURNED' })->next;
is( $manual_debit->amountoutstanding + 0, $manual_debit_amount - $payment_amount, 'reconcile_balance was called' );
};
};
my $accountline = Koha::Account::Line->new(
{
borrowernumber => $patron->{borrowernumber},
- accounttype => 'OVERDUE',
+ debit_type_code => 'OVERDUE',
status => 'UNRETURNED',
itemnumber => $item->itemnumber,
amount => 99.00,
## Run again, with exemptfine enabled
$accountline->set(
{
- accounttype => 'OVERDUE',
+ debit_type_code => 'OVERDUE',
status => 'UNRETURNED',
amountoutstanding => 99.00,
}
my $accountline = Koha::Account::Line->new(
{
borrowernumber => $patron->id,
- accounttype => 'L',
+ debit_type_code => 'LOST',
status => undef,
itemnumber => $item->itemnumber,
amount => 99.00,
is( $lines->count, 2 );
my $line = $lines->next;
- is( $line->accounttype, 'RENT', 'The issue of item with issuing charge generates an accountline of the correct type' );
+ is( $line->debit_type_code, 'RENT', 'The issue of item with issuing charge generates an accountline of the correct type' );
is( $line->branchcode, $library->id, 'AddIssuingCharge correctly sets branchcode' );
is( $line->description, '', 'AddIssue does not set a hardcoded description for the accountline' );
$line = $lines->next;
- is( $line->accounttype, 'RENT_RENEW', 'The renewal of item with issuing charge generates an accountline of the correct type' );
+ is( $line->debit_type_code, 'RENT_RENEW', 'The renewal of item with issuing charge generates an accountline of the correct type' );
is( $line->branchcode, $library->id, 'AddRenewal correctly sets branchcode' );
is( $line->description, '', 'AddRenewal does not set a hardcoded description for the accountline' );
my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->id })->next();
is( $accountline->amountoutstanding, "10.000000", "Found 10.00 amount outstanding" );
-is( $accountline->accounttype, "LOST", "Account type is LOST" );
+is( $accountline->debit_type_code, "LOST", "Debit type is LOST" );
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id })->next();
is( $offset->type, 'Lost Item', 'Got correct offset type' );
my $issue_id = $original_checkout->issue_id;
my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id });
is( $account_lines->count, 1, '1 account line should exist for this issue_id' );
- is( $account_lines->next->accounttype, 'RENT', 'patron has been charged the rentalcharge' );
+ is( $account_lines->next->debit_type_code, 'RENT', 'patron has been charged the rentalcharge' );
$account_lines->delete;
# Create an existing entry in old_issue
'No log was added'
);
is(
- $line_1->accounttype,
+ $line_1->debit_type_code,
$Koha::Account::account_type_debit->{'rent'},
'Account type is correctly set'
);
'Log was added'
);
is(
- $line_2->accounttype,
+ $line_2->debit_type_code,
$Koha::Account::account_type_debit->{'rent'},
'Account type is correctly set'
);
borrowernumber => $patron->id,
itemnumber => $item->id,
date => \'NOW()',
- accounttype => 'LOST',
+ debit_type_code => 'LOST',
interface => 'cli',
amount => '1',
amountoutstanding => '1',
borrowernumber => $patron->id,
itemnumber => $item->id,
date => \'NOW()',
- accounttype => 'LOST',
+ debit_type_code => 'LOST',
interface => 'cli',
amount => '1',
amountoutstanding => '1',
borrowernumber => $patron->id,
itemnumber => $item->id,
date => \'NOW()',
- accounttype => 'LOST',
+ debit_type_code => 'LOST',
interface => 'cli',
amount => '1',
amountoutstanding => '1',
}
)->store;
-my $defaults = Koha::Account::DebitType::defaults;
-my $number_of_system_types = scalar @{$defaults};
my $retrieved_debit_types_all = Koha::Account::DebitTypes->search();
try {
$retrieved_debit_types_all->delete;
my $line = Koha::Account::Line->new(
{
borrowernumber => $patron->{borrowernumber},
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
interface => 'commandline',
{
borrowernumber => $patron->{borrowernumber},
itemnumber => $item->itemnumber,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
interface => 'commandline',
my $debit_1 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
amountoutstanding => 10,
my $debit_2 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
amountoutstanding => 10,
my $credit_1 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => -10,
amountoutstanding => -10,
my $credit_2 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => -10,
amountoutstanding => -10,
my $credit_3 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => -100,
amountoutstanding => -100,
my $debit = Koha::Account::Line->new(
{
borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
interface => 'commandline',
my $debit_1 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
amountoutstanding => 10,
my $debit_2 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 100,
amountoutstanding => 100,
my $credit_2 = $account->add_credit({ amount => 20, interface => 'commandline' });
my $debit_3 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 100,
amountoutstanding => 100,
borrowernumber => $patron->borrowernumber,
manager_id => $staff->borrowernumber,
itemnumber => $item->itemnumber,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
interface => 'commandline',
my $debit_1 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "RETURNED",
amount => 10,
amountoutstanding => 10,
my $debit_2 = Koha::Account::Line->new(
{ borrowernumber => $patron->id,
- accounttype => "OVERDUE",
+ debit_type_code => "OVERDUE",
status => "UNRETURNED",
amount => 100,
amountoutstanding => 100,
qr/Update type not recognised/, 'Exception thrown for unrecognised type';
throws_ok { $debit_1->adjust( { amount => 50, type => 'overdue_update', interface => 'commandline' } ) }
- qr/Update type not allowed on this accounttype/,
+ qr/Update type not allowed on this debit_type/,
'Exception thrown for type conflict';
# Increment an unpaid fine
my @debits = $account->outstanding_debits;
is( scalar @debits, 3, '3 enrolment fees' );
- is( $debits[0]->accounttype, 'ACCOUNT', 'Account type set correctly' );
- is( $debits[1]->accounttype, 'ACCOUNT', 'Account type set correctly' );
- is( $debits[2]->accounttype, 'ACCOUNT_RENEW', 'Account type set correctly' );
+ is( $debits[0]->debit_type_code, 'ACCOUNT', 'Account type set correctly' );
+ is( $debits[1]->debit_type_code, 'ACCOUNT', 'Account type set correctly' );
+ is( $debits[2]->debit_type_code, 'ACCOUNT_RENEW', 'Account type set correctly' );
$schema->storage->txn_rollback;
};
is( ref($line), 'Koha::Account::Line' , 'Returns a Koha::Account::Line object');
ok( $line->is_debit, 'Generates a debit line' );
- is( $line->accounttype, 'Res' , 'generates Res accounttype');
+ is( $line->debit_type_code, 'Res' , 'generates Res debit_type');
is( $line->borrowernumber, $patron->id , 'generated line belongs to the passed patron');
is( $line->amount, $fee , 'amount set correctly');
is( $line->amountoutstanding, $fee , 'amountoutstanding set correctly');
date => \'NOW()',
amount => 50,
description => "A description",
- accounttype => "N", # New card
+ debit_type_code => "N", # New card
amountoutstanding => 50,
manager_id => $patron->borrowernumber,
branchcode => $library->id,
date => \'NOW()',
amount => 50.01,
description => "A description",
- accounttype => "N", # New card
+ debit_type_code => "N", # New card
amountoutstanding => 50.01,
manager_id => $patron->borrowernumber,
branchcode => $library->id,
date => \'NOW()',
amount => 10,
description => "A description",
- accounttype => "N", # New card
+ debit_type_code => "N", # New card
amountoutstanding => 10,
manager_id => $patron->borrowernumber,
interface => 'test',
date => \'NOW()',
amount => 15,
description => "A description",
- accounttype => "N", # New card
+ debit_type_code => "N", # New card
amountoutstanding => 15,
manager_id => $patron->borrowernumber,
interface => 'test',
date => \'NOW()',
amount => 100,
description => "A description",
- accounttype => "N", # New card
+ debit_type_code => "N", # New card
amountoutstanding => 100,
manager_id => $patron->borrowernumber,
interface => 'test',