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

(-)a/Koha/Schema/Result/AccountDebitType.pm (-4 / +12 lines)
Lines 35-46 __PACKAGE__->table("account_debit_types"); Link Here
35
  is_nullable: 1
35
  is_nullable: 1
36
  size: 200
36
  size: 200
37
37
38
=head2 can_be_added_manually
38
=head2 can_be_invoiced
39
39
40
  data_type: 'tinyint'
40
  data_type: 'tinyint'
41
  default_value: 1
41
  default_value: 1
42
  is_nullable: 0
42
  is_nullable: 0
43
43
44
=head2 can_be_sold
45
46
  data_type: 'tinyint'
47
  default_value: 0
48
  is_nullable: 0
49
44
=head2 default_amount
50
=head2 default_amount
45
51
46
  data_type: 'decimal'
52
  data_type: 'decimal'
Lines 66-73 __PACKAGE__->add_columns( Link Here
66
  { data_type => "varchar", is_nullable => 0, size => 80 },
72
  { data_type => "varchar", is_nullable => 0, size => 80 },
67
  "description",
73
  "description",
68
  { data_type => "varchar", is_nullable => 1, size => 200 },
74
  { data_type => "varchar", is_nullable => 1, size => 200 },
69
  "can_be_added_manually",
75
  "can_be_invoiced",
70
  { data_type => "tinyint", default_value => 1, is_nullable => 0 },
76
  { data_type => "tinyint", default_value => 1, is_nullable => 0 },
77
  "can_be_sold",
78
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
71
  "default_amount",
79
  "default_amount",
72
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
80
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
73
  "is_system",
81
  "is_system",
Lines 121-128 __PACKAGE__->has_many( Link Here
121
);
129
);
122
130
123
131
124
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-23 13:48:17
132
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-17 12:22:04
125
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uDKsz1QUF6zY+haOVVQZNw
133
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8FIMJZ+JAmqa+Dx7oymBjw
126
134
127
__PACKAGE__->add_columns(
135
__PACKAGE__->add_columns(
128
    '+is_system' => { is_boolean => 1 }
136
    '+is_system' => { is_boolean => 1 }
(-)a/admin/debit_types.pl (-2 / +4 lines)
Lines 76-82 if ( $op eq 'add_form' ) { Link Here
76
}
76
}
77
elsif ( $op eq 'add_validate' ) {
77
elsif ( $op eq 'add_validate' ) {
78
    my $description           = $input->param('description');
78
    my $description           = $input->param('description');
79
    my $can_be_added_manually = $input->param('can_be_added_manually') || 0;
79
    my $can_be_invoiced = $input->param('can_be_invoiced') || 0;
80
    my $can_be_sold = $input->param('can_be_sold') || 0;
80
    my $default_amount        = $input->param('default_amount') || undef;
81
    my $default_amount        = $input->param('default_amount') || undef;
81
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
82
    my @branches = grep { $_ ne q{} } $input->multi_param('branches');
82
83
Lines 84-90 elsif ( $op eq 'add_validate' ) { Link Here
84
        $debit_type = Koha::Account::DebitType->new( { code => $code } );
85
        $debit_type = Koha::Account::DebitType->new( { code => $code } );
85
    }
86
    }
86
    $debit_type->description($description);
87
    $debit_type->description($description);
87
    $debit_type->can_be_added_manually($can_be_added_manually);
88
    $debit_type->can_be_invoiced($can_be_invoiced);
89
    $debit_type->can_be_sold($can_be_sold);
88
    $debit_type->default_amount($default_amount);
90
    $debit_type->default_amount($default_amount);
89
91
90
    try {
92
    try {
(-)a/installer/data/mysql/account_debit_types.sql (-15 / +15 lines)
Lines 1-15 Link Here
1
INSERT INTO account_debit_types ( code, description, can_be_added_manually, default_amount, is_system ) VALUES
1
INSERT INTO account_debit_types ( code, description, can_be_invoiced, can_be_sold, default_amount, is_system ) VALUES
2
('ACCOUNT', 'Account creation fee', 0, NULL, 1),
2
('ACCOUNT', 'Account creation fee', 0, 0, NULL, 1),
3
('ACCOUNT_RENEW', 'Account renewal fee', 0, NULL, 1),
3
('ACCOUNT_RENEW', 'Account renewal fee', 0, 0, NULL, 1),
4
('LOST', 'Lost item', 1, NULL, 1),
4
('LOST', 'Lost item', 1, 0, NULL, 1),
5
('MANUAL', 'Manual fee', 1, NULL, 0),
5
('MANUAL', 'Manual fee', 1, 0, NULL, 0),
6
('NEW_CARD', 'New card fee', 1, NULL, 1),
6
('NEW_CARD', 'New card fee', 1, 0, NULL, 1),
7
('OVERDUE', 'Overdue fine', 0, NULL, 1),
7
('OVERDUE', 'Overdue fine', 0, 0, NULL, 1),
8
('PROCESSING', 'Lost item processing fee', 0, NULL, 1),
8
('PROCESSING', 'Lost item processing fee', 0, 0, NULL, 1),
9
('PAYOUT', 'Payment from library to patron', 0, NULL, 1),
9
('PAYOUT', 'Payment from library to patron', 0, 0, NULL, 1),
10
('RENT', 'Rental fee', 0, NULL, 1),
10
('RENT', 'Rental fee', 0, 0, NULL, 1),
11
('RENT_DAILY', 'Daily rental fee', 0, NULL, 1),
11
('RENT_DAILY', 'Daily rental fee', 0, 0, NULL, 1),
12
('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1),
12
('RENT_RENEW', 'Renewal of rental item', 0, 0, NULL, 1),
13
('RENT_DAILY_RENEW', 'Rewewal of daily rental item', 0, NULL, 1),
13
('RENT_DAILY_RENEW', 'Rewewal of daily rental item', 0, 0, NULL, 1),
14
('RESERVE', 'Hold fee', 0, NULL, 1),
14
('RESERVE', 'Hold fee', 0, 0, NULL, 1),
15
('RESERVE_EXPIRED', 'Hold waiting too long', 0, NULL, 1);
15
('RESERVE_EXPIRED', 'Hold waiting too long', 0, 0, NULL, 1);
(-)a/installer/data/mysql/atomicupdate/bug_23354.perl (+22 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
    # Updating field in account_debit_types
9
    unless ( column_exists('account_debit_types', 'can_be_invoiced') ) {
10
        $dbh->do(
11
            qq{
12
                ALTER TABLE account_debit_types
13
                CHANGE COLUMN
14
                  can_be_added_manually can_be_invoiced tinyint(1) NOT NULL DEFAULT 1
15
              }
16
        );
17
    }
18
    unless ( column_exists('account_debit_types', 'can_be_sold') ) {
19
        $dbh->do(
20
            qq{
21
                ALTER IGNORE TABLE account_debit_types
22
                ADD
23
                  can_be_sold tinyint(1) DEFAULT 0
24
                AFTER
25
                  can_be_invoiced
26
              }
27
        );
28
    }
29
8
    $dbh->do(q{
30
    $dbh->do(q{
9
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
31
INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
10
('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '<table>
32
('pos', 'RECEIPT', '', 'Point of sale receipt', 0, 'Receipt', '<table>
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2654-2660 DROP TABLE IF EXISTS `account_debit_types`; Link Here
2654
CREATE TABLE `account_debit_types` (
2654
CREATE TABLE `account_debit_types` (
2655
  `code` varchar(80) NOT NULL,
2655
  `code` varchar(80) NOT NULL,
2656
  `description` varchar(200) DEFAULT NULL,
2656
  `description` varchar(200) DEFAULT NULL,
2657
  `can_be_added_manually` tinyint(4) NOT NULL DEFAULT 1,
2657
  `can_be_invoiced` tinyint(1) NOT NULL DEFAULT 1, -- boolean flag to denote if this debit type is available for manual invoicing
2658
  `can_be_sold` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this debit type is available at point of sale
2658
  `default_amount` decimal(28,6) DEFAULT NULL,
2659
  `default_amount` decimal(28,6) DEFAULT NULL,
2659
  `is_system` tinyint(1) NOT NULL DEFAULT 0,
2660
  `is_system` tinyint(1) NOT NULL DEFAULT 0,
2660
  `archived` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this till is archived or not
2661
  `archived` tinyint(1) NOT NULL DEFAULT 0, -- boolean flag to denote if this till is archived or not
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt (-6 / +21 lines)
Lines 83-93 Link Here
83
                                    <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% debit_type.description | html %]" /> <span class="required">Required</span>
83
                                    <input type="text" name="description" id="description" required="required" class="required" size="80" maxlength="100" value="[% debit_type.description | html %]" /> <span class="required">Required</span>
84
                                </li>
84
                                </li>
85
                                <li>
85
                                <li>
86
                                    <label for="can_be_added_manually">Can be added manually? </label>
86
                                    <label for="can_be_invoiced">Can be manually invoiced? </label>
87
                                    [% IF debit_type.can_be_added_manually %]
87
                                    [% IF debit_type.can_be_invoiced %]
88
                                        <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
88
                                        <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" checked="checked" value="1" />
89
                                    [% ELSE %]
89
                                    [% ELSE %]
90
                                        <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
90
                                        <input type="checkbox" name="can_be_invoiced" id="can_be_invoiced" value="1" />
91
                                    [% END %]
92
                                </li>
93
                                <li>
94
                                    <label for="can_be_sold">Can be sold? </label>
95
                                    [% IF debit_type.can_be_sold %]
96
                                        <input type="checkbox" name="can_be_sold" id="can_be_sold" checked="checked" value="1" />
97
                                    [% ELSE %]
98
                                        <input type="checkbox" name="can_be_sold" id="can_be_sold" value="1" />
91
                                    [% END %]
99
                                    [% END %]
92
                                </li>
100
                                </li>
93
                                <li>
101
                                <li>
Lines 128-134 Link Here
128
                                <th>Code</th>
136
                                <th>Code</th>
129
                                <th>Description</th>
137
                                <th>Description</th>
130
                                <th>Default amount</th>
138
                                <th>Default amount</th>
131
                                <th>Can be added manually</th>
139
                                <th>Available for</th>
132
                                <th>Library limitations</th>
140
                                <th>Library limitations</th>
133
                                <th>Actions</th>
141
                                <th>Actions</th>
134
                            </thead>
142
                            </thead>
Lines 140-146 Link Here
140
                                    <td>[% debit_type.code | html %]</td>
148
                                    <td>[% debit_type.code | html %]</td>
141
                                    <td>[% debit_type.description | html %]</td>
149
                                    <td>[% debit_type.description | html %]</td>
142
                                    <td>[% debit_type.default_amount | $Price %]</td>
150
                                    <td>[% debit_type.default_amount | $Price %]</td>
143
                                    <td>[% IF debit_type.can_be_added_manually %]Yes[% ELSE %]No[% END %]</td>
151
                                    <td>[% IF debit_type.can_be_invoiced && debit_type.can_be_sold %]
152
                                        <i class="fa fa-id-card-o"></i> Invoicing, <i class="fa fa-shopping-cart"></i> Sale
153
                                        [% ELSIF debit_type.can_be_invoiced %]
154
                                        <i class="fa fa-id-card-o"></i> Invoicing
155
                                        [% ELSIF debit_type.can_be_sold %]
156
                                        <i class="fa fa-shopping-cart"></i> Sale
157
                                        [% END %]
158
                                    </td>
144
                                    <td>
159
                                    <td>
145
                                        [% IF debit_type.library_limits.count > 0 %]
160
                                        [% IF debit_type.library_limits.count > 0 %]
146
                                            [% library_limits_str = "" %]
161
                                            [% library_limits_str = "" %]
(-)a/members/maninvoice.pl (-1 / +1 lines)
Lines 126-132 else { Link Here
126
    );
126
    );
127
127
128
    my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
128
    my @debit_types = Koha::Account::DebitTypes->search_with_library_limits(
129
        { can_be_added_manually => 1, archived => 0 },
129
        { can_be_invoiced => 1, archived => 0 },
130
        {}, $library_id );
130
        {}, $library_id );
131
    $template->param( debit_types => \@debit_types );
131
    $template->param( debit_types => \@debit_types );
132
    $template->param(
132
    $template->param(
(-)a/pos/pay.pl (-2 / +1 lines)
Lines 56-62 else { Link Here
56
56
57
my $invoice_types =
57
my $invoice_types =
58
  Koha::Account::DebitTypes->search_with_library_limits(
58
  Koha::Account::DebitTypes->search_with_library_limits(
59
    { can_be_added_manually => 1 },
59
    { can_be_sold => 1 },
60
    {}, $library_id );
60
    {}, $library_id );
61
$template->param( invoice_types => $invoice_types );
61
$template->param( invoice_types => $invoice_types );
62
62
63
- 

Return to bug 23354