Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dd70c54f

Von Sven Schöling vor fast 2 Jahren hinzugefügt

  • ID dd70c54facfde6def860a5190bed42fe3a0b6e91
  • Vorgänger 7b799eae
  • Nachfolger ebc1082f

LinkRecord: close_quotations nicht mehr im link record post save hook ausführen

Das war Teil der link_record behandlung, ist aber so unintuitiv, dass es
jetzt vom Controller an den Model::Record gegeben wird.

Unterschiede anzeigen:

SL/DB/DeliveryOrder.pm
70 70
    $self,
71 71
    \@allowed_record_sources,
72 72
    \@allowed_item_sources,
73
    close_source_quotations => 1,
74 73
  );
75 74
}
76 75

  
SL/DB/Helper/RecordLink.pm
15 15
our @EXPORT_OK = qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF set_record_link_conversions);
16 16

  
17 17
sub link_records {
18
  my ($self, $allowed_linked_records, $allowed_linked_record_items, %flags) = @_;
18
  my ($self, $allowed_linked_records, $allowed_linked_record_items) = @_;
19 19

  
20 20
  my %allowed_linked_records = map {$_ => 1} @$allowed_linked_records;
21 21
  my %allowed_linked_record_items = map {$_ => 1} @$allowed_linked_record_items;
......
30 30
  for my $id (listify($from_record_ids)) {
31 31
    my $from_record = $from_record_type->new(id => $id)->load;
32 32
    $from_record->link_to_record($self);
33

  
34
    close_quotations($from_record, %flags);
35 33
  }
36 34

  
37 35
  #clear converted_from;
......
62 60
}
63 61

  
64 62

  
65
sub close_quotations {
66
  my ($from_record, %flags) = @_;
67

  
68
  return unless $flags{close_source_quotations};
69
  return unless 'SL::DB::Order' eq  ref $from_record;
70
  return unless $from_record->type =~ /quotation/;
71

  
72
  $from_record->update_attributes(closed => 1);
73
}
74

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

  
......
115 103
        $self,
116 104
        [ qw(SL::DB::Order) ],        # list of allowed record sources
117 105
        [ qw(SL::DB::OrderItem) ],    # list of allowed record item sources
118
        close_source_quotations => 1, # if the link source is a quotation - close it
119 106
      )
120 107
    }
121 108

  
SL/DB/Order.pm
150 150
    $self,
151 151
    \@allowed_record_sources,
152 152
    \@allowed_item_sources,
153
    close_source_quotations => 1,
154 153
  );
155 154
}
156 155

  

Auch abrufbar als: Unified diff