Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e8be6fb9

Von Sven Schöling vor etwa 1 Jahr hinzugefügt

  • ID e8be6fb900a218e2dc7f78d118b74e2352713347
  • Vorgänger 25233b5b
  • Nachfolger 3bc7e852

RecordLink: set_record_link_conversions um die internen states zu setzen

Unterschiede anzeigen:

SL/DB/Helper/RecordLink.pm
12 12
use constant RECORD_ITEM_ID       => 'converted_from_record_item_id';
13 13
use constant RECORD_ITEM_TYPE_REF => 'converted_from_record_item_type_ref';
14 14

  
15
our @EXPORT_OK = qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
16

  
15
our @EXPORT_OK = qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF set_record_link_conversions);
17 16

  
18 17
sub link_records {
19 18
  my ($self, $allowed_linked_records, $allowed_linked_record_items, %flags) = @_;
......
73 72
  $from_record->update_attributes(closed => 1);
74 73
}
75 74

  
75
sub set_record_link_conversions {
76
  my ($record, $from_type, $from_ids, $item_type, $item_ids) = @_;
77

  
78
  return unless listify($from_ids);
79

  
80
  $record->{ RECORD_TYPE_REF() } = $from_type;
81
  $record->{ RECORD_ID() } = $from_ids;
82

  
83
  my $idx = 0;
84
  my $items = $record->sorted_items;
85

  
86
  croak "more item ids than items in record" if @$item_ids > @$items;
87

  
88
  for my $idx (0..$#$item_ids) {
89
    my $item = $items->[$idx];
90

  
91
    $item->{ RECORD_ITEM_TYPE_REF() } = $item_type;
92
    $item->{ RECORD_ITEM_ID() }       = $item_ids->[$idx];
93
  }
94
}
95

  
76 96

  
77 97
1;
78 98

  

Auch abrufbar als: Unified diff