Bugzilla – Attachment 77113 Details for
Bug 19166
Add the ability to add adjustments to an invoice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19166: (follow-up) Adjust table and files and QA issues
Bug-19166-follow-up-Adjust-table-and-files-and-QA-.patch (text/plain), 22.93 KB, created by
Nick Clemens (kidclamp)
on 2018-07-19 13:12:51 UTC
(
hide
)
Description:
Bug 19166: (follow-up) Adjust table and files and QA issues
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-07-19 13:12:51 UTC
Size:
22.93 KB
patch
obsolete
>From 3b8d798f2681246f31c06d0ef842595ac14ab08b Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 16 Jul 2018 14:08:17 +0000 >Subject: [PATCH] Bug 19166: (follow-up) Adjust table and files and QA issues > >Move to aqinvoice_adjustment >Move to Koha::Acquisition::Invoice::Adjustments >Test if variable exists before count >--- > C4/Budgets.pm | 6 +- > Koha/InvoiceAdjustment.pm | 44 -------------- > Koha/InvoiceAdjustments.pm | 51 ---------------- > Koha/Schema/Result/Aqbudget.pm | 19 +++++- > Koha/Schema/Result/Aqinvoice.pm | 19 +++++- > acqui/invoice.pl | 10 ++-- > acqui/ordered.pl | 4 +- > acqui/spent.pl | 4 +- > installer/data/mysql/atomicupdate/bug_19166.perl | 6 +- > installer/data/mysql/kohastructure.sql | 38 ++++++------ > .../intranet-tmpl/prog/en/modules/acqui/invoice.tt | 2 +- > .../intranet-tmpl/prog/en/modules/acqui/ordered.tt | 2 +- > .../intranet-tmpl/prog/en/modules/acqui/spent.tt | 4 +- > t/db_dependent/Budgets.t | 12 ++-- > t/db_dependent/Koha/InvoiceAdjustments.t | 67 ---------------------- > 15 files changed, 78 insertions(+), 210 deletions(-) > delete mode 100644 Koha/InvoiceAdjustment.pm > delete mode 100644 Koha/InvoiceAdjustments.pm > delete mode 100644 t/db_dependent/Koha/InvoiceAdjustments.t > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index 8e7cc86..e0b7dc1 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -22,7 +22,7 @@ use strict; > use C4::Context; > use Koha::Database; > use Koha::Patrons; >-use Koha::InvoiceAdjustments; >+use Koha::Acquisition::Invoice::Adjustments; > use C4::Debug; > use vars qw(@ISA @EXPORT); > >@@ -350,7 +350,7 @@ sub GetBudgetSpent { > my ($shipmentcost_sum) = $sth->fetchrow_array; > $sum += $shipmentcost_sum; > >- my $adjustments = Koha::InvoiceAdjustments->search({budget_id => $budget_id, closedate => { '!=' => undef } },{ join => 'invoiceid' }); >+ my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $budget_id, closedate => { '!=' => undef } },{ join => 'invoiceid' }); > while ( my $adj = $adjustments->next ){ > $sum += $adj->adjustment; > } >@@ -371,7 +371,7 @@ sub GetBudgetOrdered { > $sth->execute($budget_id); > my $sum = 0 + $sth->fetchrow_array; > >- my $adjustments = Koha::InvoiceAdjustments->search({budget_id => $budget_id, encumber_open => 1, closedate => undef},{ join => 'invoiceid' }); >+ my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $budget_id, encumber_open => 1, closedate => undef},{ join => 'invoiceid' }); > while ( my $adj = $adjustments->next ){ > $sum += $adj->adjustment; > } >diff --git a/Koha/InvoiceAdjustment.pm b/Koha/InvoiceAdjustment.pm >deleted file mode 100644 >index 2c02f43..0000000 >--- a/Koha/InvoiceAdjustment.pm >+++ /dev/null >@@ -1,44 +0,0 @@ >-package Koha::InvoiceAdjustment; >- >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it under the >-# terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 3 of the License, or (at your option) any later >-# version. >-# >-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >-# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >- >-use Modern::Perl; >- >-use Carp; >- >-use Koha::Database; >- >-use base qw(Koha::Object); >- >-=head1 NAME >- >-Koha::InvoiceAdjustment - Koha Invoice Adjustment class >- >-=head1 API >- >-=head2 Class Methods >- >-=cut >- >-=head3 type >- >-=cut >- >-sub _type { >- return 'InvoiceAdjustment'; >-} >- >-1; >diff --git a/Koha/InvoiceAdjustments.pm b/Koha/InvoiceAdjustments.pm >deleted file mode 100644 >index e3f6fbb..0000000 >--- a/Koha/InvoiceAdjustments.pm >+++ /dev/null >@@ -1,51 +0,0 @@ >-package Koha::InvoiceAdjustments; >- >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it under the >-# terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 3 of the License, or (at your option) any later >-# version. >-# >-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >-# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >- >-use Modern::Perl; >-use Koha::InvoiceAdjustment; >- >-use Carp; >- >-use Koha::Database; >- >-use Koha::Rating; >- >-use base qw(Koha::Objects); >- >-=head1 NAME >- >-Koha::InvoiceAdjustments - Koha Invoice Adjustments Object set class >- >-=head1 API >- >-=head2 Class Methods >- >-=cut >- >-=head3 type >- >-=cut >- >-sub _type { >- return 'InvoiceAdjustment'; >-} >- >-sub object_class { >- return 'Koha::InvoiceAdjustment'; >-} >- >-1; >diff --git a/Koha/Schema/Result/Aqbudget.pm b/Koha/Schema/Result/Aqbudget.pm >index 68a93af..1cdb64c 100644 >--- a/Koha/Schema/Result/Aqbudget.pm >+++ b/Koha/Schema/Result/Aqbudget.pm >@@ -212,6 +212,21 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 aqinvoice_adjustments >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AqinvoiceAdjustment> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "aqinvoice_adjustments", >+ "Koha::Schema::Result::AqinvoiceAdjustment", >+ { "foreign.budget_id" => "self.budget_id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 aqinvoices > > Type: has_many >@@ -283,8 +298,8 @@ Composing rels: L</aqbudgetborrowers> -> borrowernumber > __PACKAGE__->many_to_many("borrowernumbers", "aqbudgetborrowers", "borrowernumber"); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9MY8aD6YBjuLy8c7tDnZeg >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-07-16 13:50:45 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zB7ox8a4KdDGq5fsbQfLGQ > > > # You can replace this text with custom content, and it will be preserved on regeneration >diff --git a/Koha/Schema/Result/Aqinvoice.pm b/Koha/Schema/Result/Aqinvoice.pm >index 3ec1475..b760947 100644 >--- a/Koha/Schema/Result/Aqinvoice.pm >+++ b/Koha/Schema/Result/Aqinvoice.pm >@@ -113,6 +113,21 @@ __PACKAGE__->set_primary_key("invoiceid"); > > =head1 RELATIONS > >+=head2 aqinvoice_adjustments >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::AqinvoiceAdjustment> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "aqinvoice_adjustments", >+ "Koha::Schema::Result::AqinvoiceAdjustment", >+ { "foreign.invoiceid" => "self.invoiceid" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > =head2 aqorders > > Type: has_many >@@ -184,8 +199,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SAUxWSdpMJK4atxhfgCAGg >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-07-16 13:50:45 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mpdxTbkz/8WInG5Wp4q7Ug > > > # You can replace this text with custom content, and it will be preserved on regeneration >diff --git a/acqui/invoice.pl b/acqui/invoice.pl >index 4fe4b22..bdf9485 100755 >--- a/acqui/invoice.pl >+++ b/acqui/invoice.pl >@@ -38,7 +38,7 @@ use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Currencies; > use Koha::DateUtils; > use Koha::Misc::Files; >-use Koha::InvoiceAdjustments; >+use Koha::Acquisition::Invoice::Adjustments; > > my $input = new CGI; > my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( >@@ -111,7 +111,7 @@ elsif ( $op && $op eq 'delete' ) { > } > elsif ( $op && $op eq 'del_adj' ) { > my $adjustment_id = $input->param('adjustment_id'); >- my $del_adj = Koha::InvoiceAdjustments->find( $adjustment_id ); >+ my $del_adj = Koha::Acquisition::Invoice::Adjustments->find( $adjustment_id ); > $del_adj->delete() if ($del_adj); > } > elsif ( $op && $op eq 'mod_adj' ) { >@@ -126,7 +126,7 @@ elsif ( $op && $op eq 'mod_adj' ) { > for( my $i=0; $i < scalar @adjustment; $i++ ){ > if( $adjustment_id[$i] eq 'new' ){ > next unless ( $adjustment[$i] || $reason[$i] ); >- my $new_adj = Koha::InvoiceAdjustment->new({ >+ my $new_adj = Koha::Acquisition::Invoice::Adjustment->new({ > invoiceid => $invoiceid, > adjustment => $adjustment[$i], > reason => $reason[$i], >@@ -137,7 +137,7 @@ elsif ( $op && $op eq 'mod_adj' ) { > $new_adj->store(); > } > else { >- my $old_adj = Koha::InvoiceAdjustments->find( $adjustment_id[$i] ); >+ my $old_adj = Koha::Acquisition::Invoice::Adjustments->find( $adjustment_id[$i] ); > unless ( $old_adj->adjustment == $adjustment[$i] && $old_adj->reason eq $reason[$i] && $old_adj->budget_id == $budget_id[$i] && $old_adj->encumber_open == $e_open{$adjustment_id[$i]} && $old_adj->note eq $note[$i] ){ > $old_adj->timestamp(undef); > $old_adj->adjustment( $adjustment[$i] ); >@@ -201,7 +201,7 @@ foreach my $budget (@$budgets) { > push @budgets_loop, \%line; > } > >-my $adjustments = Koha::InvoiceAdjustments->search({ invoiceid => $details->{'invoiceid'} }); >+my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({ invoiceid => $details->{'invoiceid'} }); > if ( $adjustments ) { $template->param( adjustments => $adjustments ); } > > $template->param( >diff --git a/acqui/ordered.pl b/acqui/ordered.pl >index c78ac66..e393490 100755 >--- a/acqui/ordered.pl >+++ b/acqui/ordered.pl >@@ -32,7 +32,7 @@ use Modern::Perl; > use CGI qw ( -utf8 ); > use C4::Auth; > use C4::Output; >-use Koha::InvoiceAdjustments; >+use Koha::Acquisition::Invoice::Adjustments; > > my $dbh = C4::Context->dbh; > my $input = new CGI; >@@ -97,7 +97,7 @@ while ( my $data = $sth->fetchrow_hashref ) { > } > } > >-my $adjustments = Koha::InvoiceAdjustments->search({budget_id => $fund_id, closedate => undef, encumber_open => 1 }, { join => 'invoiceid' } ); >+my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $fund_id, closedate => undef, encumber_open => 1 }, { join => 'invoiceid' } ); > while ( my $adj = $adjustments->next ){ > $total += $adj->adjustment; > } >diff --git a/acqui/spent.pl b/acqui/spent.pl >index dfc5f85..988b8c2 100755 >--- a/acqui/spent.pl >+++ b/acqui/spent.pl >@@ -34,7 +34,7 @@ use C4::Auth; > use C4::Output; > use Modern::Perl; > use CGI qw ( -utf8 ); >-use Koha::InvoiceAdjustments; >+use Koha::Acquisition::Invoice::Adjustments; > > my $dbh = C4::Context->dbh; > my $input = new CGI; >@@ -119,7 +119,7 @@ while (my $data = $sth->fetchrow_hashref) { > } > $sth->finish; > >-my $adjustments = Koha::InvoiceAdjustments->search({budget_id => $bookfund, closedate => { '!=' => undef } }, { join => 'invoiceid' } ); >+my $adjustments = Koha::Acquisition::Invoice::Adjustments->search({budget_id => $bookfund, closedate => { '!=' => undef } }, { join => 'invoiceid' } ); > while ( my $adj = $adjustments->next ){ > $total += $adj->adjustment; > } >diff --git a/installer/data/mysql/atomicupdate/bug_19166.perl b/installer/data/mysql/atomicupdate/bug_19166.perl >index 6088e99..5a3794e 100644 >--- a/installer/data/mysql/atomicupdate/bug_19166.perl >+++ b/installer/data/mysql/atomicupdate/bug_19166.perl >@@ -1,7 +1,7 @@ > $DBversion = 'XXX'; # will be replaced by the RM > if( CheckVersion( $DBversion ) ) { > $dbh->do( " >- CREATE TABLE IF NOT EXISTS invoice_adjustments ( >+ CREATE TABLE IF NOT EXISTS aqinvoice_adjustments ( > adjustment_id int(11) NOT NULL AUTO_INCREMENT, > invoiceid int(11) NOT NULL, > adjustment decimal(28,6), >@@ -11,8 +11,8 @@ if( CheckVersion( $DBversion ) ) { > encumber_open smallint(1) NOT NULL default 1, > timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, > PRIMARY KEY (adjustment_id), >- CONSTRAINT invoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT invoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE >+ CONSTRAINT aqinvoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT aqinvoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci > " ); > $dbh->do("INSERT IGNORE INTO authorised_value_categories (category_name) VALUES ('ADJ_REASON')"); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 750b949..78fe7ff 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -824,25 +824,6 @@ CREATE TABLE `import_items` ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >--- Table structure for table 'invoice_adjustments' >--- >- >-DROP TABLE IF EXISTS invoice_adjustments; >-CREATE TABLE IF NOT EXISTS invoice_adjustments ( >- adjustment_id int(11) NOT NULL AUTO_INCREMENT, -- primary key for adjustments >- invoiceid int(11) NOT NULL, -- foreign key to link an adjustment to an invoice >- adjustment decimal(28,6), -- amount of adjustment >- reason varchar(80) default NULL, -- reason for adjustment defined by authorised values in ADJ_REASON category >- note mediumtext default NULL, -- text to explain adjustment >- budget_id int(11) default NULL, -- optional link to budget to apply adjustment to >- encumber_open smallint(1) NOT NULL default 1, -- whether or not to encumber the finds when invoice is still open, 1 = yes, 0 = no >- timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- timestamp of last adjustment to adjustment >- PRIMARY KEY (adjustment_id), >- CONSTRAINT invoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT invoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE >-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >- >--- > -- Table structure for table `issuingrules` > -- > >@@ -3160,6 +3141,25 @@ CREATE TABLE aqinvoices ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >+-- Table structure for table 'aqinvoice_adjustments' >+-- >+ >+DROP TABLE IF EXISTS aqinvoice_adjustments; >+CREATE TABLE IF NOT EXISTS aqinvoice_adjustments ( >+ adjustment_id int(11) NOT NULL AUTO_INCREMENT, -- primary key for adjustments >+ invoiceid int(11) NOT NULL, -- foreign key to link an adjustment to an invoice >+ adjustment decimal(28,6), -- amount of adjustment >+ reason varchar(80) default NULL, -- reason for adjustment defined by authorised values in ADJ_REASON category >+ note mediumtext default NULL, -- text to explain adjustment >+ budget_id int(11) default NULL, -- optional link to budget to apply adjustment to >+ encumber_open smallint(1) NOT NULL default 1, -- whether or not to encumber the finds when invoice is still open, 1 = yes, 0 = no >+ timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- timestamp of last adjustment to adjustment >+ PRIMARY KEY (adjustment_id), >+ CONSTRAINT aqinvoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT aqinvoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ >+-- > -- Table structure for table `aqorders` > -- > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >index 16b8d02..85a23c5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >@@ -92,7 +92,7 @@ > <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated"> > <fieldset class="rows"> > <input type="hidden" name="invoiceid" value="[% invoiceid %]" /> >- [% IF (adjustments.count > 0) %] >+ [% IF (adjustments && adjustments.count > 0) %] > <table id="invoice_adj_table"> > <tr> > <th>Id</th> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt >index 174edb8..f1418cd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt >@@ -73,7 +73,7 @@ > [% END %] > </tbody> > <tfoot> >- [% IF ( adjustments.count > 0 ) %] >+ [% IF ( adjustments && adjustments.count > 0 ) %] > [% FOREACH adjustment IN adjustments %] > <tr> > <td></td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt >index bf41136..b045c53 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt >@@ -77,7 +77,7 @@ > [% END %] > > <tfoot> >- [% IF shipmentcosts.size || ( adjustments.count > 0 ) %] >+ [% IF shipmentcosts.size || ( adjustments && adjustments.count > 0 ) %] > <tr valign="top"> > <td colspan="9"> Sub total </td> > <td class="data"> [% subtotal %] </td> >@@ -92,7 +92,7 @@ > </tr> > [% END %] > [% END %] >- [% IF ( adjustments.count > 0 ) %] >+ [% IF ( adjustments && adjustments.count > 0 ) %] > [% FOREACH adjustment IN adjustments %] > <tr> > <td></td> >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index 9c74895..e28e20c 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -821,7 +821,7 @@ subtest 'GetBudgetSpent and GetBudgetOrdered' => sub { > is( $ordered, 0, "New budget, no orders/invoices, should be nothing ordered"); > > my $inv_adj_1 = $builder->build({ >- source => 'InvoiceAdjustment', >+ source => 'AqinvoiceAdjustment', > value => { > invoiceid => $invoice->{invoiceid}, > adjustment => 3, >@@ -836,7 +836,7 @@ subtest 'GetBudgetSpent and GetBudgetOrdered' => sub { > is( $ordered, 0, "After adding invoice adjustment on open invoice not encumbered, should be nothing ordered"); > > my $inv_adj_2 = $builder->build({ >- source => 'InvoiceAdjustment', >+ source => 'AqinvoiceAdjustment', > value => { > invoiceid => $invoice->{invoiceid}, > adjustment => 3, >@@ -857,7 +857,7 @@ subtest 'GetBudgetSpent and GetBudgetOrdered' => sub { > } > }); > my $inv_adj_3 = $builder->build({ >- source => 'InvoiceAdjustment', >+ source => 'AqinvoiceAdjustment', > value => { > invoiceid => $invoice_2->{invoiceid}, > adjustment => 3, >@@ -866,7 +866,7 @@ subtest 'GetBudgetSpent and GetBudgetOrdered' => sub { > } > }); > my $inv_adj_4 = $builder->build({ >- source => 'InvoiceAdjustment', >+ source => 'AqinvoiceAdjustment', > value => { > invoiceid => $invoice_2->{invoiceid}, > adjustment => 3, >@@ -887,7 +887,7 @@ subtest 'GetBudgetSpent and GetBudgetOrdered' => sub { > } > }); > my $inv_adj_5 = $builder->build({ >- source => 'InvoiceAdjustment', >+ source => 'AqinvoiceAdjustment', > value => { > invoiceid => $invoice->{invoiceid}, > adjustment => 3, >@@ -896,7 +896,7 @@ subtest 'GetBudgetSpent and GetBudgetOrdered' => sub { > } > }); > my $inv_adj_6 = $builder->build({ >- source => 'InvoiceAdjustment', >+ source => 'AqinvoiceAdjustment', > value => { > invoiceid => $invoice_2->{invoiceid}, > adjustment => 3, >diff --git a/t/db_dependent/Koha/InvoiceAdjustments.t b/t/db_dependent/Koha/InvoiceAdjustments.t >deleted file mode 100644 >index 7fadf3e..0000000 >--- a/t/db_dependent/Koha/InvoiceAdjustments.t >+++ /dev/null >@@ -1,67 +0,0 @@ >-#!/usr/bin/perl >- >-# Copyright 2015 Koha Development team >-# >-# This file is part of Koha >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >- >-use Test::More tests => 6; >- >-use Koha::Database; >- >-use t::lib::TestBuilder; >- >-BEGIN { >- use_ok('Koha::InvoiceAdjustments'); >-} >- >-my $schema = Koha::Database->new->schema; >-$schema->storage->txn_begin; >- >-my $builder = t::lib::TestBuilder->new; >-my $nb_of_adjs = Koha::InvoiceAdjustments->search->count; >-my $budget_id = $builder->build({source=>'Aqbudget'})->{budget_id}; >-my $invoice_id = $builder->build({source=>'Aqinvoice'})->{invoiceid}; >- >-my $new_adj = Koha::InvoiceAdjustment->new({ >- note => 'noted', >- invoiceid => $invoice_id, >- adjustment => '3', >- reason => 'unreasonable', >- budget_id => $budget_id, >-})->store; >- >-like( $new_adj->adjustment_id, qr|^\d+$|, 'Adding a new adjustment should have set the adjustment_id'); >- >-my $new_adj2 = Koha::InvoiceAdjustment->new({ >- note => 'not noted', >- invoiceid => $invoice_id, >- adjustment => '-3', >- reason => 'unreasonable', >- budget_id => $budget_id, >-})->store; >- >-ok( $new_adj->adjustment_id < $new_adj2->adjustment_id, 'Adding a new adjustment should increment'); >-is( Koha::InvoiceAdjustments->search->count, $nb_of_adjs + 2, 'The 2 adjustments should have been added' ); >- >-my $retrieved_adj = Koha::InvoiceAdjustments->find( $new_adj->adjustment_id ); >-is( $retrieved_adj->reason, $new_adj->reason, 'Find an adjustment by id should return the correct adjustment' ); >- >-$retrieved_adj->delete; >-is( Koha::InvoiceAdjustments->search->count, $nb_of_adjs + 1, 'Delete should have deleted the adjustment' ); >- >-$schema->storage->txn_rollback; >-- >2.1.4
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 19166
:
66475
|
66476
|
67599
|
67600
|
67601
|
67602
|
67890
|
70413
|
70414
|
70415
|
70416
|
72702
|
72703
|
72704
|
72705
|
72744
|
72978
|
73481
|
73482
|
73483
|
73484
|
73485
|
73486
|
73487
|
74742
|
74743
|
74744
|
74745
|
74746
|
74747
|
74748
|
74843
|
74893
|
74894
|
74895
|
74896
|
74897
|
74898
|
74899
|
74900
|
75014
|
75043
|
76994
|
76995
|
76996
|
76997
|
76998
|
76999
|
77000
|
77001
|
77002
|
77003
|
77004
|
77104
|
77105
|
77106
|
77107
|
77108
|
77109
|
77110
|
77111
|
77112
|
77113
|
77114
|
77115
|
77116
|
77117
|
77118
|
77119
|
77120
|
77121
|
77122
|
77123
|
77124
|
77125
|
77126
|
77127
|
77128
|
77129
|
77130
|
77131
|
77132
|
77133
|
77134
|
77329