Revision f33995ff
Von Kivitendo Admin vor etwa 11 Jahren hinzugefügt
SL/Presenter/Part.pm | ||
---|---|---|
5 | 5 |
use SL::DB::Part; |
6 | 6 |
|
7 | 7 |
use Exporter qw(import); |
8 |
our @EXPORT = qw(part_picker); |
|
8 |
our @EXPORT = qw(part_picker part); |
|
9 |
|
|
10 |
use Carp; |
|
11 |
|
|
12 |
sub part { |
|
13 |
my ($self, $part, %params) = @_; |
|
14 |
|
|
15 |
$params{display} ||= 'inline'; |
|
16 |
|
|
17 |
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; |
|
18 |
|
|
19 |
my $text = join '', ( |
|
20 |
$params{no_link} ? '' : '<a href="ic.pl?action=edit&id=' . $self->escape($part->id) . '">', |
|
21 |
$self->escape($part->partnumber), |
|
22 |
$params{no_link} ? '' : '</a>', |
|
23 |
); |
|
24 |
return $self->escaped_text($text); |
|
25 |
} |
|
9 | 26 |
|
10 | 27 |
sub part_picker { |
11 | 28 |
my ($self, $name, $value, %params) = @_; |
... | ... | |
31 | 48 |
|
32 | 49 |
=head1 NAME |
33 | 50 |
|
34 |
SL::Presenter::Part - Part lelated presenter stuff
|
|
51 |
SL::Presenter::Part - Part related presenter stuff
|
|
35 | 52 |
|
36 | 53 |
=head1 SYNOPSIS |
37 | 54 |
|
38 |
see L<SL::Presenter> |
|
55 |
# Create an html link for editing/opening a part/service/assembly |
|
56 |
my $object = my $object = SL::DB::Manager::Part->get_first; |
|
57 |
my $html = SL::Presenter->get->part($object, display => 'inline'); |
|
58 |
|
|
59 |
see also L<SL::Presenter> |
|
39 | 60 |
|
40 | 61 |
=head1 DESCRIPTION |
41 | 62 |
|
... | ... | |
43 | 64 |
|
44 | 65 |
=head1 FUNCTIONS |
45 | 66 |
|
67 |
=over 2 |
|
68 |
|
|
69 |
=item C<part, $object, %params> |
|
70 |
|
|
71 |
Returns a rendered version (actually an instance of |
|
72 |
L<SL::Presenter::EscapedText>) of the part object C<$object> |
|
73 |
|
|
74 |
C<%params> can include: |
|
75 |
|
|
46 | 76 |
=over 4 |
47 | 77 |
|
78 |
=item * display |
|
79 |
|
|
80 |
Either C<inline> (the default) or C<table-cell>. At the moment both |
|
81 |
representations are identical and produce the part's name linked |
|
82 |
to the corresponding 'edit' action. |
|
83 |
|
|
84 |
=back |
|
85 |
|
|
86 |
=back |
|
87 |
|
|
88 |
=over 2 |
|
89 |
|
|
48 | 90 |
=item C<part_picker $name, $value, %params> |
49 | 91 |
|
50 | 92 |
All-in-one picker widget for parts. The name will be both id and name |
Auch abrufbar als: Unified diff
Presenter für Part hinzugefügt
Presenter Code um HTML Links für Artikel, Dienstleistungen und
Erzeugnisse zu erstellen.