1 |
dpavlin |
2 |
use strict; |
2 |
|
|
use warnings; |
3 |
|
|
|
4 |
|
|
package Arh::Model::Unit; |
5 |
|
|
use Jifty::DBI::Schema; |
6 |
|
|
|
7 |
|
|
use Arh::Record schema { |
8 |
|
|
|
9 |
|
|
column name => |
10 |
|
|
type is 'text', |
11 |
|
|
label is _("Name"), |
12 |
|
|
is mandatory; |
13 |
|
|
|
14 |
|
|
column number => |
15 |
|
|
type is 'text', |
16 |
|
|
label is _("Number"), |
17 |
|
|
is mandatory; |
18 |
|
|
|
19 |
|
|
column dimensions => |
20 |
|
|
label is _("Dimensions"), |
21 |
|
|
hit is _("Separate values with ; (semicolumn)"), |
22 |
|
|
type is 'text'; |
23 |
|
|
|
24 |
|
|
column position => |
25 |
|
|
label is _("Place of discovery"), |
26 |
|
|
type is 'text'; |
27 |
|
|
|
28 |
|
|
column description => |
29 |
dpavlin |
8 |
label is _("Description"), |
30 |
|
|
render as 'textarea'; |
31 |
dpavlin |
2 |
|
32 |
|
|
column chronology => |
33 |
|
|
label is _("Chronology"), |
34 |
|
|
refers_to Arh::Model::Chronology, |
35 |
|
|
since '0.0.2'; |
36 |
|
|
|
37 |
|
|
column location => |
38 |
|
|
label is _("Current location"), |
39 |
|
|
refers_to Arh::Model::Location; |
40 |
|
|
|
41 |
|
|
}; |
42 |
|
|
|
43 |
|
|
# Your model-specific methods go here. |
44 |
|
|
|
45 |
dpavlin |
8 |
sub material { |
46 |
|
|
my $self = shift; |
47 |
|
|
my $m = Arh::Model::UnitMaterialCollection->new; |
48 |
|
|
$m->limit( column => 'unit', value => $self->id ); |
49 |
|
|
return $m; |
50 |
|
|
} |
51 |
|
|
|
52 |
dpavlin |
2 |
1; |
53 |
|
|
|