Revision a2a0b82c
Von Cem Aydin vor 3 Monaten hinzugefügt
SL/DB/Reclamation.pm | ||
---|---|---|
26 | 26 |
use SL::Locale::String qw(t8); |
27 | 27 |
use SL::RecordLinks; |
28 | 28 |
use Rose::DB::Object::Helpers qw(as_tree strip); |
29 |
use SL::DB::Helper::LegacyPrinting qw(map_keys_to_arrays format_as_number); |
|
29 | 30 |
|
30 | 31 |
__PACKAGE__->meta->add_relationship( |
31 | 32 |
|
... | ... | |
233 | 234 |
return $delivery_order; |
234 | 235 |
} |
235 | 236 |
|
237 |
sub add_legacy_template_arrays { |
|
238 |
my ($self, $print_form) = @_; |
|
239 |
|
|
240 |
# for now using the keys that are used in the latex template: template/print/marei/sales_reclamation.tex |
|
241 |
# (nested keys: part.partnumber, reason.description) |
|
242 |
my @keys = qw( position part.partnumber description longdescription reqdate serialnumber projectnumber reason.description |
|
243 |
reason_description_ext qty_as_number unit sellprice_as_number discount_as_number discount_as_percent linetotal ); |
|
244 |
|
|
245 |
my @tax_keys = qw( tax.taxdescription amount ); |
|
246 |
|
|
247 |
my %template_arrays; |
|
248 |
map_keys_to_arrays($self->items_sorted, \@keys, \%template_arrays); |
|
249 |
map_keys_to_arrays($self->taxes, \@tax_keys, \%template_arrays); |
|
250 |
|
|
251 |
format_as_number([ qw(linetotal) ], \%template_arrays); |
|
252 |
$print_form->{TEMPLATE_ARRAYS} = \%template_arrays; |
|
253 |
} |
|
254 |
|
|
236 | 255 |
#TODO(Werner): überprüfen ob alle Felder richtig gestetzt werden |
237 | 256 |
sub new_from { |
238 | 257 |
my ($class, $source, %params) = @_; |
... | ... | |
571 | 590 |
|
572 | 591 |
At the moment only sales quotations and sales reclamations can be converted. |
573 | 592 |
|
593 |
=head2 C<add_legacy_template_arrays $print_form> |
|
594 |
|
|
595 |
For printing OpenDocument documents we need to extract loop variables (items and |
|
596 |
taxes) from the Rose DB object and add them to the form, in the format that the |
|
597 |
built-in template parser expects. |
|
598 |
|
|
599 |
<$print_form> Print form used in the controller. |
|
600 |
|
|
574 | 601 |
=head2 C<new_from $source, %params> |
575 | 602 |
|
576 | 603 |
Creates a new C<SL::DB::Reclamation> instance and copies as much |
Auch abrufbar als: Unified diff
Reclamation Controller: Support für Drucken via internem Kivi parser hinzugefügt
Dazu werden die benötigten Druck Variablen aus dem Rose DB objekt
ins template array geschrieben.
Helfer Funktionen unter SL/DB/Helper/LegacyPrinting.pm erstellt.
Siehe auch perldoc in dieser Datei.