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

(-)a/Koha/LibraryCategories.pm (-52 lines)
Lines 1-52 Link Here
1
package Koha::LibraryCategories;
2
3
# Copyright 2015 Koha Development team
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::LibraryCategory;
27
28
use base qw(Koha::Objects);
29
30
=head1 NAME
31
32
Koha::LibraryCategories - Koha Library Category 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 'Branchcategory';
46
}
47
48
sub object_class {
49
    return 'Koha::LibraryCategory';
50
}
51
52
1;
(-)a/Koha/LibraryCategory.pm (-58 lines)
Lines 1-58 Link Here
1
package Koha::LibraryCategory;
2
3
# Copyright 2015 Koha Development team
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 base qw(Koha::Object);
27
28
=head1 NAME
29
30
Koha::LibraryCategory - Koha Library Category Object class
31
32
=head1 API
33
34
=head2 Class Methods
35
36
=cut
37
38
sub new {
39
    my ( $self, $params ) = @_;
40
    $params->{categorycode} = uc( $params->{categorycode} );
41
    return $self->SUPER::new( $params );
42
}
43
44
sub libraries{
45
    my ( $self, $params ) = @_;
46
    # TODO  This should return Koha::Libraries
47
    return $self->{_result}->branchcodes( $params );
48
}
49
50
=head3 type
51
52
=cut
53
54
sub _type {
55
    return 'Branchcategory';
56
}
57
58
1;
(-)a/Koha/Schema/Result/Branchcategory.pm (-116 lines)
Lines 1-116 Link Here
1
use utf8;
2
package Koha::Schema::Result::Branchcategory;
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::Branchcategory
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<branchcategories>
19
20
=cut
21
22
__PACKAGE__->table("branchcategories");
23
24
=head1 ACCESSORS
25
26
=head2 categorycode
27
28
  data_type: 'varchar'
29
  default_value: (empty string)
30
  is_nullable: 0
31
  size: 10
32
33
=head2 categoryname
34
35
  data_type: 'varchar'
36
  is_nullable: 1
37
  size: 32
38
39
=head2 codedescription
40
41
  data_type: 'mediumtext'
42
  is_nullable: 1
43
44
=head2 categorytype
45
46
  data_type: 'varchar'
47
  is_nullable: 1
48
  size: 16
49
50
=head2 show_in_pulldown
51
52
  data_type: 'tinyint'
53
  default_value: 0
54
  is_nullable: 0
55
56
=cut
57
58
__PACKAGE__->add_columns(
59
  "categorycode",
60
  { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
61
  "categoryname",
62
  { data_type => "varchar", is_nullable => 1, size => 32 },
63
  "codedescription",
64
  { data_type => "mediumtext", is_nullable => 1 },
65
  "categorytype",
66
  { data_type => "varchar", is_nullable => 1, size => 16 },
67
  "show_in_pulldown",
68
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
69
);
70
71
=head1 PRIMARY KEY
72
73
=over 4
74
75
=item * L</categorycode>
76
77
=back
78
79
=cut
80
81
__PACKAGE__->set_primary_key("categorycode");
82
83
=head1 RELATIONS
84
85
=head2 branchrelations
86
87
Type: has_many
88
89
Related object: L<Koha::Schema::Result::Branchrelation>
90
91
=cut
92
93
__PACKAGE__->has_many(
94
  "branchrelations",
95
  "Koha::Schema::Result::Branchrelation",
96
  { "foreign.categorycode" => "self.categorycode" },
97
  { cascade_copy => 0, cascade_delete => 0 },
98
);
99
100
=head2 branchcodes
101
102
Type: many_to_many
103
104
Composing rels: L</branchrelations> -> branchcode
105
106
=cut
107
108
__PACKAGE__->many_to_many("branchcodes", "branchrelations", "branchcode");
109
110
111
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
112
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HU5N7lAiLIz6yC9va3fDbg
113
114
115
# You can replace this text with custom content, and it will be preserved on regeneration
116
1;
(-)a/Koha/Schema/Result/Branchrelation.pm (-116 lines)
Lines 1-115 Link Here
1
use utf8;
2
package Koha::Schema::Result::Branchrelation;
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::Branchrelation
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<branchrelations>
19
20
=cut
21
22
__PACKAGE__->table("branchrelations");
23
24
=head1 ACCESSORS
25
26
=head2 branchcode
27
28
  data_type: 'varchar'
29
  default_value: (empty string)
30
  is_foreign_key: 1
31
  is_nullable: 0
32
  size: 10
33
34
=head2 categorycode
35
36
  data_type: 'varchar'
37
  default_value: (empty string)
38
  is_foreign_key: 1
39
  is_nullable: 0
40
  size: 10
41
42
=cut
43
44
__PACKAGE__->add_columns(
45
  "branchcode",
46
  {
47
    data_type => "varchar",
48
    default_value => "",
49
    is_foreign_key => 1,
50
    is_nullable => 0,
51
    size => 10,
52
  },
53
  "categorycode",
54
  {
55
    data_type => "varchar",
56
    default_value => "",
57
    is_foreign_key => 1,
58
    is_nullable => 0,
59
    size => 10,
60
  },
61
);
62
63
=head1 PRIMARY KEY
64
65
=over 4
66
67
=item * L</branchcode>
68
69
=item * L</categorycode>
70
71
=back
72
73
=cut
74
75
__PACKAGE__->set_primary_key("branchcode", "categorycode");
76
77
=head1 RELATIONS
78
79
=head2 branchcode
80
81
Type: belongs_to
82
83
Related object: L<Koha::Schema::Result::Branch>
84
85
=cut
86
87
__PACKAGE__->belongs_to(
88
  "branchcode",
89
  "Koha::Schema::Result::Branch",
90
  { branchcode => "branchcode" },
91
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
92
);
93
94
=head2 categorycode
95
96
Type: belongs_to
97
98
Related object: L<Koha::Schema::Result::Branchcategory>
99
100
=cut
101
102
__PACKAGE__->belongs_to(
103
  "categorycode",
104
  "Koha::Schema::Result::Branchcategory",
105
  { categorycode => "categorycode" },
106
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
107
);
108
109
110
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
111
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lBOq8k+wurbp633kbi8tVg
112
113
114
# You can replace this text with custom content, and it will be preserved on regeneration
115
1;
116
- 

Return to bug 16735