Bugzilla – Attachment 97283 Details for
Bug 23354
Add a 'Point of sale' screen to allow anonymous payments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23354: (follow-up) Update for bugs 23049 and 23805
Bug-23354-follow-up-Update-for-bugs-23049-and-2380.patch (text/plain), 9.39 KB, created by
Josef Moravec
on 2020-01-12 20:05:19 UTC
(
hide
)
Description:
Bug 23354: (follow-up) Update for bugs 23049 and 23805
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2020-01-12 20:05:19 UTC
Size:
9.39 KB
patch
obsolete
>From c1f3cb0330c6627c1962a3d9c957195a6e73c764 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 20 Nov 2019 07:53:05 +0000 >Subject: [PATCH] Bug 23354: (follow-up) Update for bugs 23049 and 23805 > >Remove all mentions of accounttype and replace with debit_type_code and >credit_type_code as appropriate. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/Charges/Sales.pm | 5 ++-- > installer/data/mysql/account_credit_types.sql | 3 +- > installer/data/mysql/atomicupdate/bug_23354.perl | 10 +++++-- > .../data/mysql/en/mandatory/sample_notices.sql | 5 ++-- > t/db_dependent/Koha/Charges/Sales.pm | 32 +++++++++------------- > 5 files changed, 29 insertions(+), 26 deletions(-) > >diff --git a/Koha/Charges/Sales.pm b/Koha/Charges/Sales.pm >index bd88423d6a..71e3d9138d 100644 >--- a/Koha/Charges/Sales.pm >+++ b/Koha/Charges/Sales.pm >@@ -20,6 +20,7 @@ package Koha::Charges::Sales; > use Modern::Perl; > > use Koha::Account::Lines; >+use Koha::Account::DebitTypes; > use Koha::Account::Offsets; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Exceptions; >@@ -210,7 +211,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 +236,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}, >diff --git a/installer/data/mysql/account_credit_types.sql b/installer/data/mysql/account_credit_types.sql >index 20e15ebbc7..5cf04abb15 100644 >--- a/installer/data/mysql/account_credit_types.sql >+++ b/installer/data/mysql/account_credit_types.sql >@@ -4,6 +4,7 @@ INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_ > ('FORGIVEN', 'Forgiven', 1, 1), > ('CREDIT', 'Credit', 1, 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'); >diff --git a/installer/data/mysql/atomicupdate/bug_23354.perl b/installer/data/mysql/atomicupdate/bug_23354.perl >index 2e920c459d..717eaa5e42 100644 >--- a/installer/data/mysql/atomicupdate/bug_23354.perl >+++ b/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', '<table> >+('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '[% PROCESS "accounts.inc" %] >+<table> > [% IF ( LibraryName ) %] > <tr> > <th colspan="2" class="centerednames"> >@@ -83,7 +89,7 @@ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, > > [% FOREACH offset IN offsets %] > <tr> >- <td>[% offset.debit.accounttype %]</td> >+ <td>[% PROCESS account_type_description account=offset.debit %]</td> > <td>[% offset.amount * -1 | $Price %]</td> > </tr> > [% END %] >diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql >index a970969bfd..1fea0039ad 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.sql >+++ b/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', '<table> >+('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '[% PROCESS "accounts.inc" %] >+<table> > [% IF ( LibraryName ) %] > <tr> > <th colspan="2" class="centerednames"> >@@ -361,7 +362,7 @@ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, > > [% FOREACH offset IN offsets %] > <tr> >- <td>[% offset.debit.accounttype %]</td> >+ <td>[% PROCESS account_type_description account=offset.debit %]</td> > <td>[% offset.amount * -1 | $Price %]</td> > </tr> > [% END %] >diff --git a/t/db_dependent/Koha/Charges/Sales.pm b/t/db_dependent/Koha/Charges/Sales.pm >index e4dbdd366e..1801867d1d 100644 >--- a/t/db_dependent/Koha/Charges/Sales.pm >+++ b/t/db_dependent/Koha/Charges/Sales.pm >@@ -138,21 +138,19 @@ subtest 'add_item (_get_valid_items) tests' => sub { > 'Exception thrown if `code` parameter is missing'; > > my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); >- my $av = Koha::AuthorisedValue->new( >+ my $dt = Koha::Account::DebitType->new( > { >- category => 'MANUAL_INV', >- authorised_value => 'BOBBYRANDOM', >- lib => 'Test bobbyrandom', >- lib_opac => 'Test bobbyrandom', >+ code => 'BOBBYRANDOM', >+ description => 'Test bobbyrandom', > } > )->store; >- $av->replace_library_limits( [ $library2->branchcode ] ); >+ $dt->replace_library_limits( [ $library2->branchcode ] ); > > throws_ok { $sale->add_item( { code => 'BOBBYRANDOM' } ) } > 'Koha::Exceptions::Account::UnrecognisedType', > 'Exception thrown if passed an item code that is not valid for the cash registers branch'; > >- $av->replace_library_limits(); >+ $dt->replace_library_limits(); > $sale->{valid_items} = undef; # Flush object cache for 'valid_items' > > throws_ok { >@@ -205,20 +203,16 @@ subtest 'purchase tests' => sub { > } > )->store; > >- my $item1 = Koha::AuthorisedValue->new( >+ my $item1 = Koha::Account::DebitType->new( > { >- category => 'MANUAL_INV', >- authorised_value => 'COPYRANDOM', >- lib => 'Copier fee', >- lib_opac => 'Copier fee', >+ code => 'COPYRANDOM', >+ description => 'Copier fee', > } > )->store; >- my $item2 = Koha::AuthorisedValue->new( >+ my $item2 = Koha::Account::DebitType->new( > { >- category => 'MANUAL_INV', >- authorised_value => 'CARDRANDOM', >- lib => 'New card fee', >- lib_opac => 'New card fee', >+ code => 'CARDRANDOM', >+ description => 'New card fee', > } > )->store; > >@@ -250,7 +244,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"); >@@ -258,7 +252,7 @@ subtest 'purchase tests' => sub { > is($credit->payment_type, 'CASH', "payment_type set correctly for payment"); > > my $offsets = Koha::Account::Offsets->search({credit_id => $credit->accountlines_id}); >- is($offsets->count, 2, "One offset was added for each item added"); >+ is($offsets->count, 3, "One offset was added for each item added"); # 2 items + 1 purchase > > #ensure relevant fields are set > #ensure register_id is only ever set with a corresponding payment_type having been set >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23354
:
92066
|
92431
|
92432
|
92433
|
92502
|
92830
|
92831
|
92832
|
92833
|
92834
|
92873
|
92874
|
92875
|
92876
|
92877
|
92878
|
92890
|
92891
|
92892
|
92893
|
92894
|
92895
|
93116
|
93117
|
93118
|
93119
|
93120
|
93121
|
93122
|
93123
|
93124
|
93465
|
93466
|
93467
|
93468
|
93469
|
93470
|
93471
|
93472
|
93473
|
93604
|
93605
|
93606
|
93607
|
93608
|
93609
|
93610
|
93611
|
93612
|
94689
|
94690
|
94691
|
94692
|
94693
|
94694
|
94695
|
94696
|
94697
|
94698
|
94699
|
95678
|
95679
|
95680
|
95681
|
95682
|
95683
|
95684
|
95685
|
95686
|
95687
|
95688
|
95689
|
95690
|
95691
|
95692
|
95693
|
97013
|
97014
|
97015
|
97016
|
97017
|
97018
|
97019
|
97020
|
97021
|
97022
|
97023
|
97024
|
97025
|
97026
|
97027
|
97028
|
97029
|
97169
|
97170
|
97171
|
97188
|
97189
|
97200
|
97201
|
97202
|
97203
|
97204
|
97205
|
97206
|
97207
|
97208
|
97209
|
97210
|
97211
|
97212
|
97213
|
97214
|
97215
|
97216
|
97217
|
97218
|
97219
|
97271
|
97272
|
97273
|
97274
|
97275
|
97276
|
97277
|
97278
|
97279
|
97280
|
97281
|
97282
| 97283 |
97284
|
97285
|
97286
|
97287
|
97288
|
97289
|
97290
|
97291
|
97292
|
97725
|
97726
|
100167