Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 86dd8400

Von Tamino Steinert vor 10 Monaten hinzugefügt

  • ID 86dd84005bfb913d21cdc4163b18f96a2270eb31
  • Vorgänger 41b0c57d
  • Nachfolger f37d4ebc

S:M:Record: Helferfunktionen zum Erstellen von Belegen und Positionen

Unterschiede anzeigen:

SL/Model/Record.pm
17 17
use SL::DB::DeliveryOrder::TypeData qw(:types);
18 18
use SL::DB::Reclamation::TypeData qw(:types);
19 19
use SL::DB::Helper::Record qw(
20
  get_class_from_type get_type_data_proxy_from_type
20
  get_class_from_type get_items_class_from_type get_type_data_proxy_from_type
21 21
);
22 22

  
23 23
use SL::Util qw(trim);
......
72 72
  );
73 73
}
74 74

  
75
sub create_new_record {
76
  my ($class, $type) = @_;
77
  my $record_class = get_class_from_type($type);
78
  # add_items adds items to an record with no items for saving, but they cannot
79
  # be retrieved via items until the record is saved. Adding empty items to new
80
  # record here solves this problem.
81
  return $record_class->new(
82
    items        => [],
83
    record_type  => $type,
84
    currency_id  => $::instance_conf->get_currency_id(),
85
  );
86
}
87

  
88
sub create_new_record_item {
89
  my ($class, $record_type) = @_;
90
  my $items_class = get_items_class_from_type($record_type);
91
  # add_custom_variables adds cvars to an item with no cvars for saving, but
92
  # they cannot be retrieved via custom_variables until the record/record_item is
93
  # saved. Adding empty custom_variables to new item here solves this problem.
94
  return $items_class->new(custom_variables => []);
95
}
96

  
75 97
sub new_from_workflow {
76 98
  my ($class, $source_object, $target_type, %flags) = @_;
77 99

  

Auch abrufbar als: Unified diff