Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 36d7ceb2

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 36d7ceb2d203115fe890f1a47e252e20c5e5a1d2
  • Vorgänger f596739c
  • Nachfolger e2e5606d

S:Presenter:Record: Alias Funktion "show" in verwendeten Objekten

Verknüpfte Belege nutzt folgende Objekte:
DeliveryOrder, Dunning, EmailJournal, GL, Invoice, Letter, Order,
Reclamation, RequirementSpec, ShopOrder

Unterschiede anzeigen:

SL/Presenter/Reclamation.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(html_tag);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(sales_reclamation purchase_reclamation);
our @EXPORT_OK = qw(show sales_reclamation purchase_reclamation);
use Carp;
sub sales_reclamation {
my ($reclamation, %params) = @_;
sub show {goto &reclamation};
return _reclamation_record($reclamation, 'sales_reclamation', %params);
}
sub sales_reclamation {goto &reclamation}
sub purchase_reclamation {goto &reclamation}
sub purchase_reclamation {
sub reclamation {
my ($reclamation, %params) = @_;
return _reclamation_record($reclamation, 'purchase_reclamation', %params);
}
sub _reclamation_record {
my ($reclamation, $type, %params) = @_;
$params{display} ||= 'inline';
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = escape($reclamation->record_number);
unless ($params{no_link}) {
my $id = $reclamation->id;
$text = html_tag('a', $text, href => escape("controller.pl?action=Reclamation/edit&type=${type}&id=${id}"));
my $href = 'controller.pl?action=Reclamation/edit&id=' . escape($reclamation->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
......
my $object = SL::DB::Manager::Reclamation->get_first(
where => [ SL::DB::Manager::Reclamation->type_filter('sales_reclamation') ]
);
my $html = SL::Presenter::Reclamation::sales_reclamation(
$object, display => 'inline'
);
my $html = SL::Presenter::Reclamation::sales_reclamation($object);
# Purchase reclamations:
my $object = SL::DB::Manager::Reclamation->get_first(
where => [ SL::DB::Manager::Reclamation->type_filter('purchase_reclamation') ]
);
my $html = SL::Presenter::Reclamation::purchase_reclamation(
my $html = SL::Presenter::Reclamation::purchase_reclamation($object);
# or for all types:
my $html = SL::Presenter::Reclamation::reclamation(
$object, display => 'inline'
);
my $html = $object->presenter->show();
=head1 FUNCTIONS
=over 4
=item C<sales_reclamation $object, %params>
=item C<show $object %params>
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the sales reclamation object C<$object>.
C<%params> can include:
Alias for C<reclamation $object %params>.
=over 2
=item * display
=item C<sales_reclamation $object, %params>
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's
reclamation number linked to the corresponding 'edit' action.
Alias for C<reclamation $object %params>.
=item * no_link
=item C<purchase_reclamation $object, %params>
If falsish (the default) then the reclamation number will be linked to the
"edit reclamation" dialog from the sales menu.
Alias for C<reclamation $object %params>.
=back
=item C<purchase_reclamation $object, %params>
=item C<reclamation $object %params>
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the purchase reclamation object C<$object>.
L<SL::Presenter::EscapedText>) of the sales reclamation object C<$object>.
C<%params> can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's reclamation number
linked to the corresponding 'edit' action.
=item * no_link
If falsish (the default) then the reclamation number will be linked to the
"edit reclamation" dialog from the purchase menu.
"edit reclamation" dialog.
=back
When C<$params{no_link}> is falsish, other C<%params> get passed to
L<SL::Presenter::Tag/link_tag> .
=back
=head1 BUGS

Auch abrufbar als: Unified diff