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

(-)a/C4/Installer.pm (+1 lines)
Lines 327-332 sub load_sql_in_order { Link Here
327
    push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/userpermissions.sql";
327
    push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/userpermissions.sql";
328
    push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/audio_alerts.sql";
328
    push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/audio_alerts.sql";
329
    push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/mandatory/refund_lost_item_fee_rules.sql";
329
    push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/mandatory/refund_lost_item_fee_rules.sql";
330
    push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/mandatory/account_offset_types.sql";
330
    foreach my $file (@fnames) {
331
    foreach my $file (@fnames) {
331
        #      warn $file;
332
        #      warn $file;
332
        undef $/;
333
        undef $/;
(-)a/Koha/Schema/Result/AccountOffset.pm (-3 / +19 lines)
Lines 44-49 __PACKAGE__->table("account_offsets"); Link Here
44
=head2 type
44
=head2 type
45
45
46
  data_type: 'varchar'
46
  data_type: 'varchar'
47
  is_foreign_key: 1
47
  is_nullable: 0
48
  is_nullable: 0
48
  size: 16
49
  size: 16
49
50
Lines 70-76 __PACKAGE__->add_columns( Link Here
70
  "debit_id",
71
  "debit_id",
71
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
72
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
72
  "type",
73
  "type",
73
  { data_type => "varchar", is_nullable => 0, size => 16 },
74
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 16 },
74
  "amount",
75
  "amount",
75
  { data_type => "decimal", is_nullable => 0, size => [26, 6] },
76
  { data_type => "decimal", is_nullable => 0, size => [26, 6] },
76
  "created_on",
77
  "created_on",
Lines 136-144 __PACKAGE__->belongs_to( Link Here
136
  },
137
  },
137
);
138
);
138
139
140
=head2 type
141
142
Type: belongs_to
143
144
Related object: L<Koha::Schema::Result::AccountOffsetType>
145
146
=cut
147
148
__PACKAGE__->belongs_to(
149
  "type",
150
  "Koha::Schema::Result::AccountOffsetType",
151
  { type => "type" },
152
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
153
);
154
139
155
140
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-02-15 16:13:26
156
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-09-01 11:00:44
141
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CQ2SRBUEiVgEVhe88acqqA
157
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EFxhLJ1SMRwknCaS5srYZA
142
158
143
159
144
# You can replace this text with custom code or comments, and it will be preserved on regeneration
160
# You can replace this text with custom code or comments, and it will be preserved on regeneration
(-)a/Koha/Schema/Result/AccountOffsetType.pm (+74 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::AccountOffsetType;
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::AccountOffsetType
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<account_offset_types>
19
20
=cut
21
22
__PACKAGE__->table("account_offset_types");
23
24
=head1 ACCESSORS
25
26
=head2 type
27
28
  data_type: 'varchar'
29
  is_nullable: 0
30
  size: 16
31
32
=cut
33
34
__PACKAGE__->add_columns(
35
  "type",
36
  { data_type => "varchar", is_nullable => 0, size => 16 },
37
);
38
39
=head1 PRIMARY KEY
40
41
=over 4
42
43
=item * L</type>
44
45
=back
46
47
=cut
48
49
__PACKAGE__->set_primary_key("type");
50
51
=head1 RELATIONS
52
53
=head2 account_offsets
54
55
Type: has_many
56
57
Related object: L<Koha::Schema::Result::AccountOffset>
58
59
=cut
60
61
__PACKAGE__->has_many(
62
  "account_offsets",
63
  "Koha::Schema::Result::AccountOffset",
64
  { "foreign.type" => "self.type" },
65
  { cascade_copy => 0, cascade_delete => 0 },
66
);
67
68
69
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-09-01 11:00:44
70
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PSvAX6W0Sv/MOy6pA/GB5Q
71
72
73
# You can replace this text with custom code or comments, and it will be preserved on regeneration
74
1;
(-)a/installer/data/mysql/account_offset_types.sql (+11 lines)
Line 0 Link Here
1
INSERT INTO account_offset_types ( type ) VALUES
2
('Writeoff'),
3
('Payment'),
4
('Lost Item'),
5
('Manual Debit'),
6
('Reverse Payment'),
7
('Forgiven'),
8
('Dropbox'),
9
('Rental Fee'),
10
('Fine Update'),
11
('Fine');
(-)a/installer/data/mysql/atomicupdate/bug_14826.sql (-2 / +19 lines)
Lines 1-4 Link Here
1
DROP TABLE IF EXISTS `accountoffsets`;
1
CREATE TABLE `account_offset_types` (
2
  `type` varchar(16) NOT NULL, -- The type of offset this is
3
  PRIMARY KEY (`type`)
4
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
5
2
CREATE TABLE IF NOT EXISTS `account_offsets` (
6
CREATE TABLE IF NOT EXISTS `account_offsets` (
3
  `id` int(11) NOT NULL auto_increment, -- unique identifier for each offset
7
  `id` int(11) NOT NULL auto_increment, -- unique identifier for each offset
4
  `credit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline the increased the patron's balance
8
  `credit_id` int(11) NULL DEFAULT NULL, -- The id of the accountline the increased the patron's balance
Lines 8-12 CREATE TABLE IF NOT EXISTS `account_offsets` ( Link Here
8
  `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP,
12
  `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP,
9
  PRIMARY KEY (`id`),
13
  PRIMARY KEY (`id`),
10
  CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
14
  CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
11
  CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE
15
  CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
16
  CONSTRAINT `account_offsets_ibfk_t` FOREIGN KEY (`type`) REFERENCES `account_offset_types` (`type`) ON DELETE CASCADE ON UPDATE CASCADE
12
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
17
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
18
19
INSERT INTO account_offset_types ( type ) VALUES
20
('Writeoff'),
21
('Payment'),
22
('Lost Item'),
23
('Manual Debit'),
24
('Reverse Payment'),
25
('Forgiven'),
26
('Dropbox'),
27
('Rental Fee'),
28
('Fine Update'),
29
('Fine');
(-)a/installer/data/mysql/kohastructure.sql (-1 / +12 lines)
Lines 2735-2740 CREATE TABLE `accountlines` ( Link Here
2735
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2735
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2736
2736
2737
--
2737
--
2738
-- Table structure for table `account_offset_types`
2739
--
2740
2741
DROP TABLE IF EXISTS `account_offset_types`;
2742
CREATE TABLE `account_offset_types` (
2743
  `type` varchar(16) NOT NULL, -- The type of offset this is
2744
  PRIMARY KEY (`type`)
2745
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2746
2747
--
2738
-- Table structure for table `account_offsets`
2748
-- Table structure for table `account_offsets`
2739
--
2749
--
2740
2750
Lines 2748-2754 CREATE TABLE `account_offsets` ( Link Here
2748
  `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP,
2758
  `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP,
2749
  PRIMARY KEY (`id`),
2759
  PRIMARY KEY (`id`),
2750
  CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2760
  CONSTRAINT `account_offsets_ibfk_p` FOREIGN KEY (`credit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2751
  CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE
2761
  CONSTRAINT `account_offsets_ibfk_f` FOREIGN KEY (`debit_id`) REFERENCES `accountlines` (`accountlines_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2762
  CONSTRAINT `account_offsets_ibfk_t` FOREIGN KEY (`type`) REFERENCES `account_offset_types` (`type`) ON DELETE CASCADE ON UPDATE CASCADE
2752
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2763
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2753
2764
2754
--
2765
--
(-)a/misc/devel/populate_db.pl (-1 / +1 lines)
Lines 106-111 my @sample_files_mandatory = ( Link Here
106
    "$data_dir/sysprefs.sql",
106
    "$data_dir/sysprefs.sql",
107
    "$data_dir/userflags.sql",
107
    "$data_dir/userflags.sql",
108
    "$data_dir/userpermissions.sql",
108
    "$data_dir/userpermissions.sql",
109
    "$data_dir/account_offset_types.sql",
109
);
110
);
110
my @sample_lang_files_mandatory    = ( glob $root . "/installer/data/mysql/$lang/mandatory/*.sql" );
111
my @sample_lang_files_mandatory    = ( glob $root . "/installer/data/mysql/$lang/mandatory/*.sql" );
111
my @sample_lang_files_optional     = ( glob $root . "/installer/data/mysql/$lang/optional/*.sql" );
112
my @sample_lang_files_optional     = ( glob $root . "/installer/data/mysql/$lang/optional/*.sql" );
112
- 

Return to bug 14826