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

(-)a/Koha/Account/CreditType.pm (+60 lines)
Line 0 Link Here
1
package Koha::Account::CreditType;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
use Koha::Exceptions;
26
27
use base qw(Koha::Object);
28
29
=head1 NAME
30
31
Koha::Account::CreditType - Koha Account credit type Object class
32
33
=head1 API
34
35
=head2 Class Methods
36
37
=cut
38
39
=head3 delete
40
41
=cut
42
43
sub delete {
44
    my ($self) = @_;
45
46
    if(not $self->can_be_deleted) {
47
        Koha::Exceptions::CannotDeleteDefault->throw;
48
    }
49
    return $self->SUPER::delete($self);
50
}
51
52
=head3 type
53
54
=cut
55
56
sub _type {
57
    return 'AccountCreditType';
58
}
59
60
1;
(-)a/Koha/Account/CreditTypes.pm (+52 lines)
Line 0 Link Here
1
package Koha::Account::CreditTypes;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use Koha::Account::CreditType;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::Account::CreditTypes - Koha Account credit types Object set class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 type
41
42
=cut
43
44
sub _type {
45
    return 'AccountCreditType';
46
}
47
48
sub object_class {
49
    return 'Koha::Account::CreditType';
50
}
51
52
1;
(-)a/Koha/Account/DebitType.pm (+60 lines)
Line 0 Link Here
1
package Koha::Account::DebitType;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
use Koha::Exceptions;
26
27
use base qw(Koha::Object);
28
29
=head1 NAME
30
31
Koha::Account::DebitType - Koha Account debit type Object class
32
33
=head1 API
34
35
=head2 Class Methods
36
37
=cut
38
39
=head3 delete
40
41
=cut
42
43
sub delete {
44
    my ($self) = @_;
45
46
    if(not $self->can_be_deleted) {
47
        Koha::Exceptions::CannotDeleteDefault->throw;
48
    }
49
    return $self->SUPER::delete($self);
50
}
51
52
=head3 type
53
54
=cut
55
56
sub _type {
57
    return 'AccountDebitType';
58
}
59
60
1;
(-)a/Koha/Account/DebitTypes.pm (+52 lines)
Line 0 Link Here
1
package Koha::Account::DebitTypes;
2
3
# Copyright ByWater Solutions 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Carp;
23
24
use Koha::Database;
25
26
use Koha::Account::DebitType;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::Account::DebitTypes - Koha Account debit types Object set class
33
34
=head1 API
35
36
=head2 Class Methods
37
38
=cut
39
40
=head3 type
41
42
=cut
43
44
sub _type {
45
    return 'AccountDebitType';
46
}
47
48
sub object_class {
49
    return 'Koha::Account::DebitType';
50
}
51
52
1;
(-)a/Koha/Schema/Result/AccountCreditType.pm (+81 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::AccountCreditType;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::AccountCreditType
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<account_credit_types>
19
20
=cut
21
22
__PACKAGE__->table("account_credit_types");
23
24
=head1 ACCESSORS
25
26
=head2 type_code
27
28
  data_type: 'varchar'
29
  is_nullable: 0
30
  size: 5
31
32
=head2 description
33
34
  data_type: 'varchar'
35
  is_nullable: 1
36
  size: 200
37
38
=head2 can_be_deleted
39
40
  data_type: 'tinyint'
41
  default_value: 1
42
  is_nullable: 0
43
44
=head2 can_be_added_manually
45
46
  data_type: 'tinyint'
47
  default_value: 1
48
  is_nullable: 0
49
50
=cut
51
52
__PACKAGE__->add_columns(
53
  "type_code",
54
  { data_type => "varchar", is_nullable => 0, size => 5 },
55
  "description",
56
  { data_type => "varchar", is_nullable => 1, size => 200 },
57
  "can_be_deleted",
58
  { data_type => "tinyint", default_value => 1, is_nullable => 0 },
59
  "can_be_added_manually",
60
  { data_type => "tinyint", default_value => 1, is_nullable => 0 },
61
);
62
63
=head1 PRIMARY KEY
64
65
=over 4
66
67
=item * L</type_code>
68
69
=back
70
71
=cut
72
73
__PACKAGE__->set_primary_key("type_code");
74
75
76
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-11-23 14:11:07
77
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QwGpcrmSuarm9pnZ+s4VNg
78
79
80
# You can replace this text with custom code or comments, and it will be preserved on regeneration
81
1;
(-)a/Koha/Schema/Result/AccountDebitType.pm (+89 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::AccountDebitType;
3
4
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7
=head1 NAME
8
9
Koha::Schema::Result::AccountDebitType
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<account_debit_types>
19
20
=cut
21
22
__PACKAGE__->table("account_debit_types");
23
24
=head1 ACCESSORS
25
26
=head2 type_code
27
28
  data_type: 'varchar'
29
  is_nullable: 0
30
  size: 5
31
32
=head2 default_amount
33
34
  data_type: 'decimal'
35
  is_nullable: 1
36
  size: [28,6]
37
38
=head2 description
39
40
  data_type: 'varchar'
41
  is_nullable: 1
42
  size: 200
43
44
=head2 can_be_deleted
45
46
  data_type: 'tinyint'
47
  default_value: 1
48
  is_nullable: 0
49
50
=head2 can_be_added_manually
51
52
  data_type: 'tinyint'
53
  default_value: 1
54
  is_nullable: 0
55
56
=cut
57
58
__PACKAGE__->add_columns(
59
  "type_code",
60
  { data_type => "varchar", is_nullable => 0, size => 5 },
61
  "default_amount",
62
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
63
  "description",
64
  { data_type => "varchar", is_nullable => 1, size => 200 },
65
  "can_be_deleted",
66
  { data_type => "tinyint", default_value => 1, is_nullable => 0 },
67
  "can_be_added_manually",
68
  { data_type => "tinyint", default_value => 1, is_nullable => 0 },
69
);
70
71
=head1 PRIMARY KEY
72
73
=over 4
74
75
=item * L</type_code>
76
77
=back
78
79
=cut
80
81
__PACKAGE__->set_primary_key("type_code");
82
83
84
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-11-23 12:41:10
85
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UtAqvoSzWkOVSJTqlbL8VQ
86
87
88
# You can replace this text with custom code or comments, and it will be preserved on regeneration
89
1;
(-)a/Koha/Schema/Result/Accountline.pm (-3 / +11 lines)
Lines 81-86 __PACKAGE__->table("accountlines"); Link Here
81
  is_nullable: 1
81
  is_nullable: 1
82
  size: 80
82
  size: 80
83
83
84
=head2 credit_type
85
86
  data_type: 'varchar'
87
  is_nullable: 1
88
  size: 5
89
84
=head2 amountoutstanding
90
=head2 amountoutstanding
85
91
86
  data_type: 'decimal'
92
  data_type: 'decimal'
Lines 140-145 __PACKAGE__->add_columns( Link Here
140
  { data_type => "varchar", is_nullable => 1, size => 5 },
146
  { data_type => "varchar", is_nullable => 1, size => 5 },
141
  "payment_type",
147
  "payment_type",
142
  { data_type => "varchar", is_nullable => 1, size => 80 },
148
  { data_type => "varchar", is_nullable => 1, size => 80 },
149
  "credit_type",
150
  { data_type => "varchar", is_nullable => 1, size => 5 },
143
  "amountoutstanding",
151
  "amountoutstanding",
144
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
152
  { data_type => "decimal", is_nullable => 1, size => [28, 6] },
145
  "lastincrement",
153
  "lastincrement",
Lines 264-272 __PACKAGE__->belongs_to( Link Here
264
);
272
);
265
273
266
274
267
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-01-03 16:10:04
275
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-02-28 10:13:25
268
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BO7iSB+QzoJNuZ8Uttba6A
276
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eorONnG+aKxpCptCfcl8Aw
269
277
 
270
sub koha_objects_class {
278
sub koha_objects_class {
271
    'Koha::Account::Lines';
279
    'Koha::Account::Lines';
272
}
280
}
(-)a/installer/data/mysql/atomicupdate/bug_XXX.perl (+124 lines)
Line 0 Link Here
1
$DBversion = 'XXX';    # will be replaced by the RM
2
if ( CheckVersion($DBversion) ) {
3
4
    $dbh->do(
5
        qq{
6
            CREATE TABLE IF NOT EXISTS account_debit_types (
7
              type_code varchar(5) NOT NULL,
8
              description varchar(200) NULL,
9
              can_be_deleted tinyint NOT NULL DEFAULT '1',
10
              can_be_added_manually tinyint(4) NOT NULL DEFAULT '1',
11
              default_amount decimal(28, 6) NULL,
12
              PRIMARY KEY (type_code)
13
            ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
14
          }
15
    );
16
17
    $dbh->do(
18
        qq{
19
            CREATE TABLE IF NOT EXISTS account_credit_types (
20
              type_code varchar(5) NOT NULL,
21
              description varchar(200) NULL,
22
              can_be_deleted tinyint NOT NULL DEFAULT '1',
23
              can_be_added_manually tinyint(4) NOT NULL DEFAULT '1',
24
              PRIMARY KEY (type_code)
25
            ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
26
          }
27
    );
28
29
    $dbh->do(
30
        qq{
31
            INSERT IGNORE INTO account_debit_types (
32
              type_code,
33
              default_amount,
34
              description,
35
              can_be_deleted,
36
              can_be_added_manually
37
            )
38
            VALUES
39
              ('A', NULL, 'Account management fee', 0, 1),
40
              ('F', NULL, 'Overdue fine', 0, 1),
41
              ('FU', NULL, 'Accruing overdue fine', 0, 0),
42
              ('L', NULL, 'Lost item', 0, 1),
43
              ('LR', NULL, 'Lost and returned', 0, 0),
44
              ('M', NULL, 'Sundry', 0, 1),
45
              ('N', NULL, 'New card', 0, 1),
46
              ('O', NULL, 'Overdue fine', 0, 0),
47
              ('Rent', NULL, 'Rental fee', 0, 1),
48
              ('Rep', NULL, 'Replacement', 0, 0),
49
              ('Res', NULL, 'Reserve charge', 0, 1)
50
          }
51
    );
52
53
    $dbh->do(
54
        qq{
55
            INSERT IGNORE INTO account_debit_types (
56
              type_code,
57
              default_amount,
58
              description,
59
              can_be_deleted,
60
              can_be_added_manually
61
            )
62
            SELECT
63
              SUBSTR(authorised_value, 1, 5),
64
              lib,
65
              authorised_value,
66
              1,
67
              1
68
            FROM
69
              authorised_values
70
            WHERE
71
              category = 'MANUAL_INV'
72
          }
73
    );
74
75
    $dbh->do(
76
        qq{
77
            INSERT IGNORE INTO account_credit_types (
78
              type_code,
79
              description,
80
              can_be_deleted,
81
              can_be_added_manually
82
            )
83
            VALUES
84
              ('C', 'Credit', 0, 1),
85
              ('CC', 'Credit card', 0, 0),
86
              ('CR', 'Refunded found lost item', 0, 0),
87
              ('FFOR', 'Forgiven overdue fine', 0, 0),
88
              ('FOR', 'Forgiven', 0, 1),
89
              ('OL', 'Other online payment service', 0, 0),
90
              ('Pay', 'Cash', 0, 0),
91
              ('Pay00', 'Cash via SIP2', 0, 0),
92
              ('Pay01', 'VISA via SIP2', 0, 0),
93
              ('Pay02', 'Credit card via SIP2', 0, 0),
94
              ('PayPa', 'PayPal', 0, 0),
95
              ('W', 'Write Off', 0, 0)
96
          }
97
    );
98
99
    $dbh->do(
100
        qq{
101
            ALTER IGNORE TABLE accountlines
102
            ADD
103
              credit_type varchar(5) COLLATE utf8mb4_unicode_ci NULL
104
            AFTER
105
              accounttype
106
          }
107
    );
108
109
    # Add new permission
110
    $dbh->do(
111
        q{
112
            INSERT IGNORE INTO permissions (module_bit, code, description)
113
            VALUES
114
              (
115
                3,
116
                'manage_accounts',
117
                'Manage Account Debit and Credit Types'
118
              )
119
        }
120
    );
121
122
    SetVersion($DBversion);
123
    print "Upgrade to $DBversion done (Bug XXXXX - description)\n";
124
}
(-)a/installer/data/mysql/en/mandatory/account_credit_types.sql (+13 lines)
Line 0 Link Here
1
INSERT INTO account_credit_types (type_code, description, can_be_deleted, can_be_added_manually) VALUES
2
    ('C',   'Credit',   0, 1),
3
    ('CC',  'Credit card',  0, 0),
4
    ('CR',  'Refunded found lost item', 0, 0),
5
    ('FFOR',    'Forgiven overdue fine',    0, 0),
6
    ('FOR', 'Forgiven', 0, 1),
7
    ('OL',  'Other online payment service', 0, 0),
8
    ('Pay', 'Cash', 0, 0),
9
    ('Pay00',   'Cash via SIP2',    0, 0),
10
    ('Pay01',   'VISA via SIP2',    0, 0),
11
    ('Pay02',   'Credit card via SIP2', 0, 0),
12
    ('PayPa',   'PayPal',   0, 0),
13
    ('W',   'Write Off',    0, 0);
(-)a/installer/data/mysql/en/mandatory/account_debit_types.sql (+13 lines)
Line 0 Link Here
1
INSERT INTO account_debit_types (type_code, default_amount, description, can_be_deleted, can_be_added_manually) VALUES
2
    ('A',   NULL,   'Account management fee',   0,  1),
3
    ('F',   NULL,   'Overdue fine', 0,  1),
4
    ('FU',  NULL,   'Accruing overdue fine',    0,  0),
5
    ('L',   NULL,   'Lost item',    0,  1),
6
    ('LR',  NULL,   'Lost and returned',    0,  0),
7
    ('M',   NULL,   'Sundry',   0,  1),
8
    ('N',   NULL,   'New card', 0,  1),
9
    ('O',   NULL,   'Overdue fine', 0,  0),
10
    ('Rent',    NULL,   'Rental fee',   0,  1),
11
    ('Rep', NULL,   'Replacement',  0,  0),
12
    ('Res', NULL,   'Reserve charge',   0,  1),
13
    ('Copie', 0.5,  'Copier fees', 1, 1);
(-)a/installer/data/mysql/en/optional/auth_val.sql (-3 lines)
Lines 48-56 INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('NOT_L Link Here
48
-- restricted status of an item, linked to items.restricted
48
-- restricted status of an item, linked to items.restricted
49
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('RESTRICTED','1','Restricted Access');
49
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('RESTRICTED','1','Restricted Access');
50
50
51
-- manual invoice types
52
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','Copier Fees','.25');
53
54
-- custom borrower notes
51
-- custom borrower notes
55
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_NOTES','ADDR','Address Notes');
52
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_NOTES','ADDR','Address Notes');
56
53
(-)a/installer/data/mysql/kohastructure.sql (-1 / +26 lines)
Lines 2699-2704 CREATE TABLE `messages` ( -- circulation messages left via the patron's check ou Link Here
2699
  CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2699
  CONSTRAINT `messages_borrowernumber` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
2700
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2700
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2701
2701
2702
--
2703
-- Table structure for table `account_credit_types`
2704
--
2705
DROP TABLE IF EXISTS `account_credit_types`;
2706
CREATE TABLE `account_credit_types` (
2707
  `type_code` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
2708
  `description` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
2709
  `can_be_deleted` tinyint(4) NOT NULL DEFAULT '1',
2710
  `can_be_added_manually` tinyint(4) NOT NULL DEFAULT '1',
2711
  PRIMARY KEY (`type_code`)
2712
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2713
2714
--
2715
-- Table structure for table `account_debit_types`
2716
--
2717
DROP TABLE IF EXISTS `account_debit_types`;
2718
CREATE TABLE `account_debit_types` (
2719
  `type_code` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
2720
  `default_amount` decimal(28,6) DEFAULT NULL,
2721
  `description` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
2722
  `can_be_deleted` tinyint(4) NOT NULL DEFAULT '1',
2723
  `can_be_added_manually` tinyint(4) NOT NULL DEFAULT '1',
2724
  PRIMARY KEY (`type_code`)
2725
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2726
2702
--
2727
--
2703
-- Table structure for table `accountlines`
2728
-- Table structure for table `accountlines`
2704
--
2729
--
Lines 2715-2720 CREATE TABLE `accountlines` ( Link Here
2715
  `description` LONGTEXT,
2740
  `description` LONGTEXT,
2716
  `accounttype` varchar(5) default NULL,
2741
  `accounttype` varchar(5) default NULL,
2717
  `payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE
2742
  `payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE
2743
  `credit_type` varchar(5) default NULL,
2718
  `amountoutstanding` decimal(28,6) default NULL,
2744
  `amountoutstanding` decimal(28,6) default NULL,
2719
  `lastincrement` decimal(28,6) default NULL,
2745
  `lastincrement` decimal(28,6) default NULL,
2720
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2746
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
2721
- 

Return to bug 17702