Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a31c242b

Von Sven Schöling vor mehr als 1 Jahr hinzugefügt

  • ID a31c242ba2cd8539d437aa50d7b8e4f04d6594e0
  • Vorgänger 4989537e
  • Nachfolger c888c8a7

RecordLink: post save hook für alle Hauptbelege

Unterschiede anzeigen:

SL/DB/DeliveryOrder.pm
13 13
use SL::DB::Helper::FlattenToForm;
14 14
use SL::DB::Helper::LinkedRecords;
15 15
use SL::DB::Helper::TransNumberGenerator;
16
use SL::DB::Helper::RecordLink qw(RECORD_ID RECORD_TYPE_REF);
16 17

  
17 18
use SL::DB::Part;
18 19
use SL::DB::Unit;
......
45 46
__PACKAGE__->attr_sorted('items');
46 47

  
47 48
__PACKAGE__->before_save('_before_save_set_donumber');
49
__PACKAGE__->after_save('_after_save_link_records');
48 50

  
49 51
# hooks
50 52

  
......
56 58
  return 1;
57 59
}
58 60

  
61
sub _after_save_link_records {
62
  my ($self) = @_;
63

  
64
  my @allowed_record_sources = qw(SL::DB::Reclamation SL::DB::Order);
65
  my @allowed_item_sources = qw(SL::DB::ReclamationItem SL::DB::OrderItem);
66

  
67
  SL::DB::Helper::RecordLink::link_records(
68
    $self,
69
    \@allowed_record_sources,
70
    \@allowed_item_sources,
71
    close_source_quotations => 1,
72
  );
73
}
74

  
59 75
# methods
60 76

  
61 77
sub items { goto &orderitems; }
SL/DB/Invoice.pm
16 16
use SL::DB::Helper::PDF_A;
17 17
use SL::DB::Helper::PriceTaxCalculator;
18 18
use SL::DB::Helper::PriceUpdater;
19
use SL::DB::Helper::RecordLink qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
19 20
use SL::DB::Helper::SalesPurchaseInvoice;
20 21
use SL::DB::Helper::TransNumberGenerator;
21 22
use SL::DB::Helper::ZUGFeRD;
......
77 78
__PACKAGE__->attr_sorted('items');
78 79

  
79 80
__PACKAGE__->before_save('_before_save_set_invnumber');
81
__PACKAGE__->after_save('_after_save_link_records');
80 82

  
81 83
# hooks
82 84

  
......
88 90
  return 1;
89 91
}
90 92

  
93
sub _after_save_link_records {
94
  my ($self) = @_;
95

  
96
  my @allowed_record_sources = qw(SL::DB::Reclamation SL::DB::Order SL::DB::DeliveryOrder);
97
  my @allowed_item_sources = qw(SL::DB::ReclamationItem SL::DB::OrderItem SL::DB::DeliveryOrderItem);
98

  
99
  SL::DB::Helper::RecordLink::link_records(
100
    $self,
101
    \@allowed_record_sources,
102
    \@allowed_item_sources,
103
    close_source_quotations => 1,
104
  );
105
}
106

  
91 107
# methods
92 108

  
93 109
sub items { goto &invoiceitems; }
SL/DB/Order.pm
20 20
use SL::DB::Helper::PriceUpdater;
21 21
use SL::DB::Helper::TransNumberGenerator;
22 22
use SL::DB::Helper::Payment qw(forex);
23
use SL::DB::Helper::RecordLink qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
23 24
use SL::Locale::String qw(t8);
24 25
use SL::RecordLinks;
25 26
use Rose::DB::Object::Helpers qw(as_tree strip);
......
77 78
__PACKAGE__->before_save('_before_save_create_new_project');
78 79
__PACKAGE__->before_save('_before_save_remove_empty_custom_shipto');
79 80
__PACKAGE__->before_save('_before_save_set_custom_shipto_module');
81
__PACKAGE__->after_save('_after_save_link_records');
80 82

  
81 83
# hooks
82 84

  
......
134 136
  return 1;
135 137
}
136 138

  
139
sub _after_save_link_records {
140
  my ($self) = @_;
141

  
142
  my @allowed_record_sources = qw(SL::DB::Reclamation SL::DB::Order);
143
  my @allowed_item_sources = qw(SL::DB::ReclamationItem SL::DB::OrderItem);
144

  
145
  SL::DB::Helper::RecordLink::link_records(
146
    $self,
147
    \@allowed_record_sources,
148
    \@allowed_item_sources,
149
    close_source_quotations => 1,
150
  );
151
}
152

  
153

  
137 154
# methods
138 155

  
139 156
sub items { goto &orderitems; }
SL/DB/PurchaseInvoice.pm
11 11
use SL::DB::Helper::AttrSorted;
12 12
use SL::DB::Helper::LinkedRecords;
13 13
use SL::DB::Helper::Payment qw(:ALL);
14
use SL::DB::Helper::RecordLink qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
14 15
use SL::DB::Helper::SalesPurchaseInvoice;
15 16
use SL::Locale::String qw(t8);
16 17
use Rose::DB::Object::Helpers qw(has_loaded_related forget_related as_tree strip);
......
57 58
__PACKAGE__->attr_html('notes');
58 59
__PACKAGE__->attr_sorted('items');
59 60

  
61
__PACKAGE__->after_save('_after_save_link_records');
62

  
63
# hooks
64

  
65
sub _after_save_link_records {
66
  my ($self) = @_;
67

  
68
  my @allowed_record_sources = qw(SL::DB::Reclamation SL::DB::Order);
69
  my @allowed_item_sources = qw(SL::DB::ReclamationItem SL::DB::OrderItem);
70

  
71
  SL::DB::Helper::RecordLink::link_records(
72
    $self,
73
    \@allowed_record_sources,
74
    \@allowed_item_sources,
75
    close_source_quotations => 1,
76
  );
77
}
78

  
79
# methods
80

  
60 81
sub items { goto &invoiceitems; }
61 82
sub add_items { goto &add_invoiceitems; }
62 83
sub record_number { goto &invnumber; };

Auch abrufbar als: Unified diff