1 |
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 campaign => |
20 |
refers_to Arh::Model::Campaign, |
21 |
is mandatory, |
22 |
since '0.0.9'; |
23 |
|
24 |
column dimensions => |
25 |
label is _("Dimensions"), |
26 |
hit is _("Separate values with ; (semicolumn)"), |
27 |
type is 'text'; |
28 |
|
29 |
column position => |
30 |
label is _("Place of discovery"), |
31 |
type is 'text'; |
32 |
|
33 |
column description => |
34 |
label is _("Description"), |
35 |
render as 'textarea'; |
36 |
|
37 |
column chronology => |
38 |
label is _("Chronology"), |
39 |
refers_to Arh::Model::Chronology, |
40 |
since '0.0.2'; |
41 |
|
42 |
column location => |
43 |
label is _("Current location"), |
44 |
refers_to Arh::Model::Location; |
45 |
|
46 |
}; |
47 |
|
48 |
# Your model-specific methods go here. |
49 |
|
50 |
sub material { |
51 |
my $self = shift; |
52 |
my $m = Arh::Model::UnitMaterialCollection->new; |
53 |
$m->limit( column => 'unit', value => $self->id ); |
54 |
return $m; |
55 |
} |
56 |
|
57 |
1; |
58 |
|