Bugzilla – Attachment 68426 Details for
Bug 12768
Replacement cost and processing fee management
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12768 [QA Followup] - Only set non-Manual Invoice offset type if manualinvoice isn't actually being used for manual invoices
Bug-12768-QA-Followup---Only-set-non-Manual-Invoic.patch (text/plain), 6.95 KB, created by
Kyle M Hall (khall)
on 2017-10-23 16:36:00 UTC
(
hide
)
Description:
Bug 12768 [QA Followup] - Only set non-Manual Invoice offset type if manualinvoice isn't actually being used for manual invoices
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-10-23 16:36:00 UTC
Size:
6.95 KB
patch
obsolete
>From b1a91a610749fdd4098991e68ba10e22cdbd1c90 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 23 Oct 2017 12:35:46 -0400 >Subject: [PATCH] Bug 12768 [QA Followup] - Only set non-Manual Invoice offset > type if manualinvoice isn't actually being used for manual invoices > >--- > C4/Accounts.pm | 13 ++-- > Koha/Schema/Result/Accountoffset.pm | 135 +++++++++++++++++++++++++----------- > 2 files changed, 103 insertions(+), 45 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 5fcbba0..704ef98 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -159,11 +159,11 @@ sub chargelostitem{ > unless ($existing_charges) { > #add processing fee > if ($processfee && $processfee > 0){ >- manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1); >+ manualinvoice($borrowernumber, $itemnumber, $description, 'PF', $processfee, $processingfeenote, 1, 1); > } > #add replace cost > if ($replacementprice > 0){ >- manualinvoice($borrowernumber, $itemnumber, $description, 'L', $replacementprice, undef, 1); >+ manualinvoice($borrowernumber, $itemnumber, $description, 'L', $replacementprice, undef, 1, 1); > } > } > } >@@ -171,7 +171,7 @@ sub chargelostitem{ > =head2 manualinvoice > > &manualinvoice($borrowernumber, $itemnumber, $description, $type, >- $amount, $note); >+ $amount, $note, $skip_notify, $is_automatic); > > C<$borrowernumber> is the patron's borrower number. > C<$description> is a description of the transaction. >@@ -179,6 +179,8 @@ C<$type> may be one of C<CS>, C<CB>, C<CW>, C<CF>, C<CL>, C<N>, C<L>, > or C<REF>. > C<$itemnumber> is the item involved, if pertinent; otherwise, it > should be the empty string. >+C<$is_automatic> should be true if manual invoice isn't really being used >+to create a manual invoice ( e.g. it's use in chargelostitem is automatic ) > > =cut > >@@ -195,7 +197,7 @@ should be the empty string. > # > > sub manualinvoice { >- my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note, $skip_notify ) = @_; >+ my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note, $skip_notify, $automatic ) = @_; > my $manager_id = 0; > $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; > my $dbh = C4::Context->dbh; >@@ -231,7 +233,8 @@ sub manualinvoice { > )->store(); > > my $offset_type = >- $type eq 'L' ? 'Lost Item' >+ !$automatic ? 'Manual Debit' >+ : $type eq 'L' ? 'Lost Item' > : $type eq 'PF' ? 'Processing Fee' > : 'Manual Debit'; > >diff --git a/Koha/Schema/Result/Accountoffset.pm b/Koha/Schema/Result/Accountoffset.pm >index e9d8c2f..892c095 100644 >--- a/Koha/Schema/Result/Accountoffset.pm >+++ b/Koha/Schema/Result/Accountoffset.pm >@@ -1,12 +1,12 @@ > use utf8; >-package Koha::Schema::Result::Accountoffset; >+package Koha::Schema::Result::AccountOffset; > > # Created by DBIx::Class::Schema::Loader > # DO NOT MODIFY THE FIRST PART OF THIS FILE > > =head1 NAME > >-Koha::Schema::Result::Accountoffset >+Koha::Schema::Result::AccountOffset > > =cut > >@@ -15,40 +15,46 @@ use warnings; > > use base 'DBIx::Class::Core'; > >-=head1 TABLE: C<accountoffsets> >+=head1 TABLE: C<account_offsets> > > =cut > >-__PACKAGE__->table("accountoffsets"); >+__PACKAGE__->table("account_offsets"); > > =head1 ACCESSORS > >-=head2 borrowernumber >+=head2 id > > data_type: 'integer' >- default_value: 0 >- is_foreign_key: 1 >+ is_auto_increment: 1 > is_nullable: 0 > >-=head2 accountno >+=head2 credit_id > >- data_type: 'smallint' >- default_value: 0 >- is_nullable: 0 >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 > >-=head2 offsetaccount >+=head2 debit_id > >- data_type: 'smallint' >- default_value: 0 >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 1 >+ >+=head2 type >+ >+ data_type: 'varchar' >+ is_foreign_key: 1 > is_nullable: 0 >+ size: 16 > >-=head2 offsetamount >+=head2 amount > > data_type: 'decimal' >- is_nullable: 1 >- size: [28,6] >+ is_nullable: 0 >+ size: [26,6] > >-=head2 timestamp >+=head2 created_on > > data_type: 'timestamp' > datetime_undef_if_invalid: 1 >@@ -58,20 +64,17 @@ __PACKAGE__->table("accountoffsets"); > =cut > > __PACKAGE__->add_columns( >- "borrowernumber", >- { >- data_type => "integer", >- default_value => 0, >- is_foreign_key => 1, >- is_nullable => 0, >- }, >- "accountno", >- { data_type => "smallint", default_value => 0, is_nullable => 0 }, >- "offsetaccount", >- { data_type => "smallint", default_value => 0, is_nullable => 0 }, >- "offsetamount", >- { data_type => "decimal", is_nullable => 1, size => [28, 6] }, >- "timestamp", >+ "id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "credit_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "debit_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ "type", >+ { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 16 }, >+ "amount", >+ { data_type => "decimal", is_nullable => 0, size => [26, 6] }, >+ "created_on", > { > data_type => "timestamp", > datetime_undef_if_invalid => 1, >@@ -80,27 +83,79 @@ __PACKAGE__->add_columns( > }, > ); > >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("id"); >+ > =head1 RELATIONS > >-=head2 borrowernumber >+=head2 credit >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Accountline> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "credit", >+ "Koha::Schema::Result::Accountline", >+ { accountlines_id => "credit_id" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ >+=head2 debit >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Accountline> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "debit", >+ "Koha::Schema::Result::Accountline", >+ { accountlines_id => "debit_id" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ >+=head2 type > > Type: belongs_to > >-Related object: L<Koha::Schema::Result::Borrower> >+Related object: L<Koha::Schema::Result::AccountOffsetType> > > =cut > > __PACKAGE__->belongs_to( >- "borrowernumber", >- "Koha::Schema::Result::Borrower", >- { borrowernumber => "borrowernumber" }, >+ "type", >+ "Koha::Schema::Result::AccountOffsetType", >+ { type => "type" }, > { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OTfcUiJCPb5aU/gjqAb/bA >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-20 16:27:04 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tPPrIug2c7PbDO7LCxCJAA > > >-# You can replace this text with custom content, and it will be preserved on regeneration >+# You can replace this text with custom code or comments, and it will be preserved on regeneration > 1; >-- >2.10.2
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 12768
:
34333
|
34334
|
36350
|
36505
|
36506
|
36552
|
36553
|
36554
|
36555
|
38365
|
38367
|
38368
|
38375
|
39298
|
39299
|
39300
|
39999
|
40000
|
40001
|
40002
|
42157
|
42158
|
43181
|
43546
|
64775
|
64776
|
66760
|
66761
|
67875
|
67876
|
67877
|
67878
|
67891
|
67892
|
67893
|
67894
|
67895
|
67896
|
67897
|
68035
|
68036
|
68037
|
68038
|
68039
|
68040
|
68041
|
68042
|
68076
|
68264
|
68265
|
68266
|
68267
|
68268
|
68269
|
68270
|
68271
|
68272
|
68273
|
68274
|
68332
|
68415
|
68416
|
68417
|
68426
|
68427