Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 320b8908

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

  • ID 320b8908a1875b0e157b36d71060d18997a4c0ae
  • Vorgänger 3bc7e852
  • Nachfolger c84c3960

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
12 12
use SL::DB::Helper::AttrSorted;
13 13
use SL::DB::Helper::LinkedRecords;
14 14
use SL::DB::Helper::Payment qw(:ALL);
15
use SL::DB::Helper::RecordLink qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF);
15 16
use SL::DB::Helper::SalesPurchaseInvoice;
16 17
use SL::Locale::String qw(t8);
17 18
use Rose::DB::Object::Helpers qw(has_loaded_related forget_related as_tree strip);
......
58 59
__PACKAGE__->attr_html('notes');
59 60
__PACKAGE__->attr_sorted('items');
60 61

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

  
64
# hooks
65

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

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

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

  
80
# methods
81

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

Auch abrufbar als: Unified diff