@@ -, +, @@
---
Koha/Charges/Sales.pm | 4 ++--
installer/data/mysql/account_credit_types.sql | 3 ++-
installer/data/mysql/atomicupdate/bug_23354.perl | 10 ++++++++--
installer/data/mysql/en/mandatory/sample_notices.sql | 5 +++--
t/db_dependent/Koha/Charges/Sales.pm | 2 +-
5 files changed, 16 insertions(+), 8 deletions(-)
--- a/Koha/Charges/Sales.pm
+++ a/Koha/Charges/Sales.pm
@@ -210,7 +210,7 @@ sub purchase {
my $debit = Koha::Account::Line->new(
{
amount => $amount,
- accounttype => $item->{code},
+ debit_type_code => $item->{code},
amountoutstanding => 0,
note => $item->{quantity},
manager_id => $self->{staff_id},
@@ -235,7 +235,7 @@ sub purchase {
$credit = Koha::Account::Line->new(
{
amount => 0 - $total_owed,
- accounttype => 'Purchase',
+ credit_type_code => 'PURCHASE',
payment_type => $self->{payment_type},
amountoutstanding => 0,
manager_id => $self->{staff_id},
--- a/installer/data/mysql/account_credit_types.sql
+++ a/installer/data/mysql/account_credit_types.sql
@@ -5,6 +5,7 @@ INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_
('CREDIT', 'Credit', 1, 1),
('DISCOUNT', 'A discount applied to a patrons fine', 0, 1),
('REFUND', 'A refund applied to a patrons fine', 0, 1),
-('LOST_RETURN', 'Lost item fee refund', 0, 1);
+('LOST_RETURN', 'Lost item fee refund', 0, 1),
+('PURCHASE', 'Purchase', 0, 1);
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('PAYMENT_TYPE','CASH','Cash');
--- a/installer/data/mysql/atomicupdate/bug_23354.perl
+++ a/installer/data/mysql/atomicupdate/bug_23354.perl
@@ -5,6 +5,11 @@ if( CheckVersion( $DBversion ) ) {
INSERT IGNORE INTO account_offset_types ( type ) VALUES ( 'Purchase' );
});
+ $dbh->do(q{
+ INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_system )
+ VALUES ('PURCHASE', 'Purchase', 0, 1);
+ });
+
my $sth = $dbh->prepare(q{
SELECT COUNT(*) FROM authorised_values WHERE category = 'PAYMENT_TYPE' AND authorised_value = 'CASH'
});
@@ -40,7 +45,8 @@ if( CheckVersion( $DBversion ) ) {
$dbh->do(q{
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
-('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '
+('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '[% PROCESS "accounts.inc" %]
+
[% IF ( LibraryName ) %]
@@ -83,7 +89,7 @@ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`,
[% FOREACH offset IN offsets %]
|
- [% offset.debit.accounttype %] |
+ [% PROCESS account_type_description account=offset.debit %] |
[% offset.amount * -1 | $Price %] |
[% END %]
--- a/installer/data/mysql/en/mandatory/sample_notices.sql
+++ a/installer/data/mysql/en/mandatory/sample_notices.sql
@@ -318,7 +318,8 @@ INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`
('circulation', 'SR_SLIP', '', 'Stock rotation slip', 0, 'Stock rotation report', 'Stock rotation report for [% branch.name %]:\r\n\r\n[% IF branch.items.size %][% branch.items.size %] items to be processed for this branch.\r\n[% ELSE %]No items to be processed for this branch\r\n[% END %][% FOREACH item IN branch.items %][% IF item.reason != \'in-demand\' %]Title: [% item.title %]\r\nAuthor: [% item.author %]\r\nCallnumber: [% item.callnumber %]\r\nLocation: [% item.location %]\r\nBarcode: [% item.barcode %]\r\nOn loan?: [% item.onloan %]\r\nStatus: [% item.reason %]\r\nCurrent library: [% item.branch.branchname %] [% item.branch.branchcode %]\r\n\r\n[% END %][% END %]', 'email');
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
-('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '
+('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '[% PROCESS "accounts.inc" %]
+
[% IF ( LibraryName ) %]
@@ -361,7 +362,7 @@ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`,
[% FOREACH offset IN offsets %]
|
- [% offset.debit.accounttype %] |
+ [% PROCESS account_type_description account=offset.debit %] |
[% offset.amount * -1 | $Price %] |
[% END %]
--- a/t/db_dependent/Koha/Charges/Sales.pm
+++ a/t/db_dependent/Koha/Charges/Sales.pm
@@ -250,7 +250,7 @@ subtest 'purchase tests' => sub {
is(ref($credit), 'Koha::Account::Line', "Koha::Account::Line returned");
ok($credit->is_credit, "return is a credit for payment");
- is($credit->accounttype, 'Purchase', "accounttype set correctly to 'Purchase' for payment");
+ is($credit->credit_type_code, 'PURCHASE', "credit_type_code set correctly to 'PURCHASE' for payment");
is($credit->amount, -5.00, "amount is calculated correctly for payment");
is($credit->amountoutstanding, 0.00, "amountoutstanding is set to zero for payment");
is($credit->manager_id, $staff->borrowernumber, "manager_id set correctionly for payment");
--