Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 524ae79f

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 524ae79f08a8cc89b6b04a0bcf238ed0639bd98a
  • Vorgänger 2a82da61
  • Nachfolger eee22124

S:C:Reclamation: nutze Helferfunktion zum Auslesen der Verknüpfungsinfo

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
25 25
use SL::DB::Shipto;
26 26
use SL::DB::Translation;
27 27
use SL::DB::ValidityToken;
28
use SL::DB::Helper::RecordLink qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
28
use SL::DB::Helper::RecordLink qw(set_record_link_conversions RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
29 29
use SL::DB::Helper::TypeDataProxy;
30 30
use SL::DB::Helper::Record qw(get_object_name_from_type get_class_from_type);
31 31

  
......
81 81
                          save_and_credit_note
82 82
                        )]);
83 83

  
84
__PACKAGE__->run_before('get_record_links_data_from_form',
85
                        only => [qw(
86
                          save save_as_new print preview_pdf send_email
87
                          save_and_show_email_dialog
88
                          save_and_new_record
89
                          save_and_credit_note
90
                        )]);
91

  
92 84
#
93 85
# actions
94 86
#
......
1569 1561
  }
1570 1562
}
1571 1563

  
1572
# get data for record_links from form and store it in the object
1573
sub get_record_links_data_from_form {
1574
  my ($self) = @_;
1575

  
1576
  my $reclamation = $self->reclamation;
1577

  
1578
  $reclamation->{RECORD_ID()} = delete $::form->{converted_from_record_id};
1579
  $reclamation->{RECORD_TYPE_REF()} = delete $::form->{converted_from_record_type_ref};
1580

  
1581
  my $from_record_item_ids = delete $::form->{converted_from_record_item_ids} ;
1582
  my $from_record_item_type_refs = delete $::form->{converted_from_record_item_type_refs} ;
1583

  
1584
  if (scalar @{ $from_record_item_ids || [] }) {
1585
    for my $idx (0 .. $#{ $reclamation->items_sorted }) {
1586
      my $reclamation_item = $reclamation->items_sorted->[$idx];
1587
      $reclamation_item->{RECORD_ITEM_ID()} = $from_record_item_ids->[$idx];
1588
      $reclamation_item->{RECORD_ITEM_TYPE_REF()} = $from_record_item_type_refs->[$idx];
1589
    }
1590
  }
1591
}
1592

  
1593 1564
# save the reclamation
1594 1565
#
1595 1566
# And delete items that are deleted in the form.
1596 1567
sub save {
1597 1568
  my ($self) = @_;
1598 1569

  
1570
  set_record_link_conversions($self->reclamation,
1571
    delete $::form->{RECORD_TYPE_REF()}
1572
      => delete $::form->{RECORD_ID()},
1573
    delete $::form->{RECORD_ITEM_TYPE_REF()}
1574
      => delete $::form->{RECORD_ITEM_ID()},
1575
  );
1576

  
1599 1577
  my $items_to_delete  = scalar @{ $self->item_ids_to_delete || [] }
1600 1578
                       ? SL::DB::Manager::ReclamationItem->get_all(where => [id => $self->item_ids_to_delete])
1601 1579
                       : undef;

Auch abrufbar als: Unified diff