View | Details | Raw Unified | Return to bug 23354
Collapse All | Expand All

(-)a/Koha/Charges/Sales.pm (-2 / +2 lines)
Lines 210-216 sub purchase { Link Here
210
                my $debit = Koha::Account::Line->new(
210
                my $debit = Koha::Account::Line->new(
211
                    {
211
                    {
212
                        amount            => $amount,
212
                        amount            => $amount,
213
                        accounttype       => $item->{code},
213
                        debit_type_code   => $item->{code},
214
                        amountoutstanding => 0,
214
                        amountoutstanding => 0,
215
                        note              => $item->{quantity},
215
                        note              => $item->{quantity},
216
                        manager_id        => $self->{staff_id},
216
                        manager_id        => $self->{staff_id},
Lines 235-241 sub purchase { Link Here
235
            $credit = Koha::Account::Line->new(
235
            $credit = Koha::Account::Line->new(
236
                {
236
                {
237
                    amount            => 0 - $total_owed,
237
                    amount            => 0 - $total_owed,
238
                    accounttype       => 'Purchase',
238
                    credit_type_code  => 'PURCHASE',
239
                    payment_type      => $self->{payment_type},
239
                    payment_type      => $self->{payment_type},
240
                    amountoutstanding => 0,
240
                    amountoutstanding => 0,
241
                    manager_id        => $self->{staff_id},
241
                    manager_id        => $self->{staff_id},
(-)a/installer/data/mysql/account_credit_types.sql (-1 / +2 lines)
Lines 5-10 INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_ Link Here
5
('CREDIT', 'Credit', 1, 1),
5
('CREDIT', 'Credit', 1, 1),
6
('DISCOUNT', 'A discount applied to a patrons fine', 0, 1),
6
('DISCOUNT', 'A discount applied to a patrons fine', 0, 1),
7
('REFUND', 'A refund applied to a patrons fine', 0, 1),
7
('REFUND', 'A refund applied to a patrons fine', 0, 1),
8
('LOST_RETURN', 'Lost item fee refund', 0, 1);
8
('LOST_RETURN', 'Lost item fee refund', 0, 1),
9
('PURCHASE', 'Purchase', 0, 1);
9
10
10
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('PAYMENT_TYPE','CASH','Cash');
11
INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('PAYMENT_TYPE','CASH','Cash');
(-)a/installer/data/mysql/atomicupdate/bug_23354.perl (-2 / +8 lines)
Lines 5-10 if( CheckVersion( $DBversion ) ) { Link Here
5
        INSERT IGNORE INTO account_offset_types ( type ) VALUES ( 'Purchase' );
5
        INSERT IGNORE INTO account_offset_types ( type ) VALUES ( 'Purchase' );
6
    });
6
    });
7
7
8
    $dbh->do(q{
9
        INSERT INTO account_credit_types ( code, description, can_be_added_manually, is_system )
10
        VALUES ('PURCHASE', 'Purchase', 0, 1);
11
    });
12
8
    my $sth = $dbh->prepare(q{
13
    my $sth = $dbh->prepare(q{
9
        SELECT COUNT(*) FROM authorised_values WHERE category = 'PAYMENT_TYPE' AND authorised_value = 'CASH'
14
        SELECT COUNT(*) FROM authorised_values WHERE category = 'PAYMENT_TYPE' AND authorised_value = 'CASH'
10
    });
15
    });
Lines 40-46 if( CheckVersion( $DBversion ) ) { Link Here
40
45
41
    $dbh->do(q{
46
    $dbh->do(q{
42
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
47
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
43
('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '<table>
48
('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '[% PROCESS "accounts.inc" %]
49
<table>
44
[% IF ( LibraryName ) %]
50
[% IF ( LibraryName ) %]
45
 <tr>
51
 <tr>
46
    <th colspan="2" class="centerednames">
52
    <th colspan="2" class="centerednames">
Lines 83-89 INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, Link Here
83
89
84
  [% FOREACH offset IN offsets %]
90
  [% FOREACH offset IN offsets %]
85
    <tr>
91
    <tr>
86
        <td>[% offset.debit.accounttype %]</td>
92
        <td>[% PROCESS account_type_description account=offset.debit %]</td>
87
        <td>[% offset.amount * -1 | $Price %]</td>
93
        <td>[% offset.amount * -1 | $Price %]</td>
88
    </tr>
94
    </tr>
89
  [% END %]
95
  [% END %]
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (-2 / +3 lines)
Lines 318-324 INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title` Link Here
318
('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');
318
('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');
319
319
320
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
320
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
321
('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '<table>
321
('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '[% PROCESS "accounts.inc" %]
322
<table>
322
[% IF ( LibraryName ) %]
323
[% IF ( LibraryName ) %]
323
 <tr>
324
 <tr>
324
    <th colspan="2" class="centerednames">
325
    <th colspan="2" class="centerednames">
Lines 361-367 INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, Link Here
361
362
362
  [% FOREACH offset IN offsets %]
363
  [% FOREACH offset IN offsets %]
363
    <tr>
364
    <tr>
364
        <td>[% offset.debit.accounttype %]</td>
365
        <td>[% PROCESS account_type_description account=offset.debit %]</td>
365
        <td>[% offset.amount * -1 | $Price %]</td>
366
        <td>[% offset.amount * -1 | $Price %]</td>
366
    </tr>
367
    </tr>
367
  [% END %]
368
  [% END %]
(-)a/t/db_dependent/Koha/Charges/Sales.pm (-2 / +1 lines)
Lines 250-256 subtest 'purchase tests' => sub { Link Here
250
250
251
    is(ref($credit), 'Koha::Account::Line', "Koha::Account::Line returned");
251
    is(ref($credit), 'Koha::Account::Line', "Koha::Account::Line returned");
252
    ok($credit->is_credit, "return is a credit for payment");
252
    ok($credit->is_credit, "return is a credit for payment");
253
    is($credit->accounttype, 'Purchase', "accounttype set correctly to 'Purchase' for payment");
253
    is($credit->credit_type_code, 'PURCHASE', "credit_type_code set correctly to 'PURCHASE' for payment");
254
    is($credit->amount, -5.00, "amount is calculated correctly for payment");
254
    is($credit->amount, -5.00, "amount is calculated correctly for payment");
255
    is($credit->amountoutstanding, 0.00, "amountoutstanding is set to zero for payment");
255
    is($credit->amountoutstanding, 0.00, "amountoutstanding is set to zero for payment");
256
    is($credit->manager_id, $staff->borrowernumber, "manager_id set correctionly for payment");
256
    is($credit->manager_id, $staff->borrowernumber, "manager_id set correctionly for payment");
257
- 

Return to bug 23354