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

(-)a/Koha/AudioAlert.pm (-1 / +1 lines)
Lines 66-72 sub move { Link Here
66
66
67
=cut
67
=cut
68
68
69
sub type {
69
sub _type {
70
    return 'AudioAlert';
70
    return 'AudioAlert';
71
}
71
}
72
72
(-)a/Koha/AudioAlerts.pm (-1 / +1 lines)
Lines 136-142 sub fix_precedences { Link Here
136
136
137
=cut
137
=cut
138
138
139
sub type {
139
sub _type {
140
    return 'AudioAlert';
140
    return 'AudioAlert';
141
}
141
}
142
142
(-)a/Koha/AuthorisedValue.pm (-1 / +1 lines)
Lines 164-170 sub _avb_resultset { Link Here
164
164
165
=cut
165
=cut
166
166
167
sub type {
167
sub _type {
168
    return 'AuthorisedValue';
168
    return 'AuthorisedValue';
169
}
169
}
170
170
(-)a/Koha/AuthorisedValues.pm (-1 / +1 lines)
Lines 79-85 sub categories { Link Here
79
79
80
=cut
80
=cut
81
81
82
sub type {
82
sub _type {
83
    return 'AuthorisedValue';
83
    return 'AuthorisedValue';
84
}
84
}
85
85
(-)a/Koha/Biblio.pm (-1 / +1 lines)
Lines 58-64 sub subtitles { Link Here
58
58
59
=cut
59
=cut
60
60
61
sub type {
61
sub _type {
62
    return 'Biblio';
62
    return 'Biblio';
63
}
63
}
64
64
(-)a/Koha/Biblioitem.pm (-1 / +1 lines)
Lines 37-43 Koha::Biblioitem - Koha Biblioitem Object class Link Here
37
37
38
=cut
38
=cut
39
39
40
sub type {
40
sub _type {
41
    return 'Biblioitem';
41
    return 'Biblioitem';
42
}
42
}
43
43
(-)a/Koha/Biblioitems.pm (-1 / +1 lines)
Lines 39-45 Koha::Biblioitem - Koha Biblioitem Object class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'Biblioitem';
43
    return 'Biblioitem';
44
}
44
}
45
45
(-)a/Koha/Biblios.pm (-1 / +1 lines)
Lines 41-47 Koha::Biblios - Koha Biblio object set class Link Here
41
41
42
=cut
42
=cut
43
43
44
sub type {
44
sub _type {
45
    return 'Biblio';
45
    return 'Biblio';
46
}
46
}
47
47
(-)a/Koha/Borrower.pm (-1 / +1 lines)
Lines 51-57 sub guarantor { Link Here
51
51
52
=cut
52
=cut
53
53
54
sub type {
54
sub _type {
55
    return 'Borrower';
55
    return 'Borrower';
56
}
56
}
57
57
(-)a/Koha/Borrowers.pm (-1 / +1 lines)
Lines 41-47 Koha::Borrower - Koha Borrower Object class Link Here
41
41
42
=cut
42
=cut
43
43
44
sub type {
44
sub _type {
45
    return 'Borrower';
45
    return 'Borrower';
46
}
46
}
47
47
(-)a/Koha/Cities.pm (-1 / +1 lines)
Lines 39-45 Koha::Cities - Koha City Object set class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'City';
43
    return 'City';
44
}
44
}
45
45
(-)a/Koha/City.pm (-1 / +1 lines)
Lines 37-43 Koha::City - Koha City Object class Link Here
37
37
38
=cut
38
=cut
39
39
40
sub type {
40
sub _type {
41
    return 'City';
41
    return 'City';
42
}
42
}
43
43
(-)a/Koha/Config/SysPref.pm (-1 / +1 lines)
Lines 39-45 Koha::Config::SysPref - Koha System Preference Object class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'Systempreference';
43
    return 'Systempreference';
44
}
44
}
45
45
(-)a/Koha/Config/SysPrefs.pm (-1 / +1 lines)
Lines 41-47 Koha::Config::SysPrefs - Koha System Preference object set class Link Here
41
41
42
=cut
42
=cut
43
43
44
sub type {
44
sub _type {
45
    return 'Systempreference';
45
    return 'Systempreference';
46
}
46
}
47
47
(-)a/Koha/Hold.pm (-1 / +1 lines)
Lines 251-257 sub is_suspended { Link Here
251
251
252
=cut
252
=cut
253
253
254
sub type {
254
sub _type {
255
    return 'Reserve';
255
    return 'Reserve';
256
}
256
}
257
257
(-)a/Koha/Holds.pm (-1 / +1 lines)
Lines 53-59 sub waiting { Link Here
53
53
54
=cut
54
=cut
55
55
56
sub type {
56
sub _type {
57
    return 'Reserve';
57
    return 'Reserve';
58
}
58
}
59
59
(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 111-117 sub last_returned_by { Link Here
111
111
112
=cut
112
=cut
113
113
114
sub type {
114
sub _type {
115
    return 'Item';
115
    return 'Item';
116
}
116
}
117
117
(-)a/Koha/Items.pm (-1 / +1 lines)
Lines 41-47 Koha::Items - Koha Item object set class Link Here
41
41
42
=cut
42
=cut
43
43
44
sub type {
44
sub _type {
45
    return 'Item';
45
    return 'Item';
46
}
46
}
47
47
(-)a/Koha/Localization.pm (-1 / +1 lines)
Lines 21-27 use Koha::Database; Link Here
21
21
22
use base qw(Koha::Object);
22
use base qw(Koha::Object);
23
23
24
sub type {
24
sub _type {
25
    return 'Localization';
25
    return 'Localization';
26
}
26
}
27
27
(-)a/Koha/Localizations.pm (-1 / +1 lines)
Lines 23-29 use Koha::Localization; Link Here
23
23
24
use base qw(Koha::Objects);
24
use base qw(Koha::Objects);
25
25
26
sub type {
26
sub _type {
27
    return 'Localization';
27
    return 'Localization';
28
}
28
}
29
29
(-)a/Koha/Object.pm (-11 / +11 lines)
Lines 57-68 sub new { Link Here
57
57
58
    if ($attributes) {
58
    if ($attributes) {
59
        $self->{_result} =
59
        $self->{_result} =
60
          Koha::Database->new()->schema()->resultset( $class->type() )
60
          Koha::Database->new()->schema()->resultset( $class->_type() )
61
          ->new($attributes);
61
          ->new($attributes);
62
    }
62
    }
63
63
64
    croak("No type found! Koha::Object must be subclassed!")
64
    croak("No _type found! Koha::Object must be subclassed!")
65
      unless $class->type();
65
      unless $class->_type();
66
66
67
    bless( $self, $class );
67
    bless( $self, $class );
68
68
Lines 81-91 sub _new_from_dbic { Link Here
81
    # DBIC result row
81
    # DBIC result row
82
    $self->{_result} = $dbic_row;
82
    $self->{_result} = $dbic_row;
83
83
84
    croak("No type found! Koha::Object must be subclassed!")
84
    croak("No _type found! Koha::Object must be subclassed!")
85
      unless $class->type();
85
      unless $class->_type();
86
86
87
    croak( "DBIC result type " . ref( $self->{_result} ) . " isn't of the type " . $class->type() )
87
    croak( "DBIC result _type " . ref( $self->{_result} ) . " isn't of the _type " . $class->_type() )
88
      unless ref( $self->{_result} ) eq "Koha::Schema::Result::" . $class->type();
88
      unless ref( $self->{_result} ) eq "Koha::Schema::Result::" . $class->_type();
89
89
90
    bless( $self, $class );
90
    bless( $self, $class );
91
91
Lines 230-236 sub _result { Link Here
230
230
231
    # If we don't have a dbic row at this point, we need to create an empty one
231
    # If we don't have a dbic row at this point, we need to create an empty one
232
    $self->{_result} ||=
232
    $self->{_result} ||=
233
      Koha::Database->new()->schema()->resultset( $self->type() )->new({});
233
      Koha::Database->new()->schema()->resultset( $self->_type() )->new({});
234
234
235
    return $self->{_result};
235
    return $self->{_result};
236
}
236
}
Lines 279-292 sub AUTOLOAD { Link Here
279
    return;
279
    return;
280
}
280
}
281
281
282
=head3 type
282
=head3 _type
283
283
284
This method must be defined in the child class. The value is the name of the DBIC resultset.
284
This method must be defined in the child class. The value is the name of the DBIC resultset.
285
For example, for borrowers, the type method will return "Borrower".
285
For example, for borrowers, the _type method will return "Borrower".
286
286
287
=cut
287
=cut
288
288
289
sub type { }
289
sub _type { }
290
290
291
sub DESTROY { }
291
sub DESTROY { }
292
292
(-)a/Koha/Objects.pm (-8 / +6 lines)
Lines 23-30 use Carp; Link Here
23
23
24
use Koha::Database;
24
use Koha::Database;
25
25
26
our $type;
27
28
=head1 NAME
26
=head1 NAME
29
27
30
Koha::Objects - Koha Object set base class
28
Koha::Objects - Koha Object set base class
Lines 229-252 sub _resultset { Link Here
229
227
230
    if ( ref($self) ) {
228
    if ( ref($self) ) {
231
        $self->{_resultset} ||=
229
        $self->{_resultset} ||=
232
          Koha::Database->new()->schema()->resultset( $self->type() );
230
          Koha::Database->new()->schema()->resultset( $self->_type() );
233
231
234
        return $self->{_resultset};
232
        return $self->{_resultset};
235
    }
233
    }
236
    else {
234
    else {
237
        return Koha::Database->new()->schema()->resultset( $self->type() );
235
        return Koha::Database->new()->schema()->resultset( $self->_type() );
238
    }
236
    }
239
}
237
}
240
238
241
=head3 type
239
=head3 _type
242
240
243
The type method must be set for all child classes.
241
The _type method must be set for all child classes.
244
The value returned by it should be the DBIC resultset name.
242
The value returned by it should be the DBIC resultset name.
245
For example, for holds, type should return 'Reserve'.
243
For example, for holds, _type should return 'Reserve'.
246
244
247
=cut
245
=cut
248
246
249
sub type { }
247
sub _type { }
250
248
251
=head3 object_class
249
=head3 object_class
252
250
(-)a/Koha/Patron/Categories.pm (-1 / +1 lines)
Lines 39-45 Koha::Patron::Categories - Koha Patron Category Object set class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'Category';
43
    return 'Category';
44
}
44
}
45
45
(-)a/Koha/Patron/Category.pm (-1 / +1 lines)
Lines 181-187 sub _catb_resultset { Link Here
181
181
182
=cut
182
=cut
183
183
184
sub type {
184
sub _type {
185
    return 'Category';
185
    return 'Category';
186
}
186
}
187
187
(-)a/Koha/Serial.pm (-1 / +1 lines)
Lines 39-45 Koha::Serial - Koha Serial Object class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'Serial';
43
    return 'Serial';
44
}
44
}
45
45
(-)a/Koha/Serials.pm (-1 / +1 lines)
Lines 41-47 Koha::Serial - Koha Serial Object class Link Here
41
41
42
=cut
42
=cut
43
43
44
sub type {
44
sub _type {
45
    return 'Serial';
45
    return 'Serial';
46
}
46
}
47
47
(-)a/Koha/Virtualshelf.pm (-1 / +1 lines)
Lines 273-279 sub can_biblios_be_removed { Link Here
273
    return 0;
273
    return 0;
274
}
274
}
275
275
276
sub type {
276
sub _type {
277
    return 'Virtualshelve';
277
    return 'Virtualshelve';
278
}
278
}
279
279
(-)a/Koha/Virtualshelfcontent.pm (-1 / +1 lines)
Lines 38-44 Koha::Virtualshelfcontent - Koha Virtualshelfcontent Object class Link Here
38
38
39
=cut
39
=cut
40
40
41
sub type {
41
sub _type {
42
    return 'Virtualshelfcontent';
42
    return 'Virtualshelfcontent';
43
}
43
}
44
44
(-)a/Koha/Virtualshelfcontents.pm (-1 / +1 lines)
Lines 39-45 Koha::Virtualshelfcontents - Koha Virtualshelfcontents Object class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'Virtualshelfcontent';
43
    return 'Virtualshelfcontent';
44
}
44
}
45
45
(-)a/Koha/Virtualshelfshare.pm (-1 / +1 lines)
Lines 67-73 sub has_expired { Link Here
67
    return $has_expired == 1 ? 1 : 0
67
    return $has_expired == 1 ? 1 : 0
68
}
68
}
69
69
70
sub type {
70
sub _type {
71
    return 'Virtualshelfshare';
71
    return 'Virtualshelfshare';
72
}
72
}
73
73
(-)a/Koha/Virtualshelfshares.pm (-1 / +1 lines)
Lines 39-45 Koha::Virtualshelfshares - Koha Virtualshelfshares Object class Link Here
39
39
40
=cut
40
=cut
41
41
42
sub type {
42
sub _type {
43
    return 'Virtualshelfshare';
43
    return 'Virtualshelfshare';
44
}
44
}
45
45
(-)a/Koha/Virtualshelves.pm (-2 / +1 lines)
Lines 119-125 sub get_some_shelves { Link Here
119
    );
119
    );
120
}
120
}
121
121
122
sub type {
122
sub _type {
123
    return 'Virtualshelve';
123
    return 'Virtualshelve';
124
}
124
}
125
125
126
- 

Return to bug 15446