Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ed3be965

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID ed3be96543e7f224f5a406a73b61f4dc7e8a31e2
  • Vorgänger e86ae696
  • Nachfolger 3b70d2a0

Invoice::post selber ar_id setzen lassen, wenn nicht angegeben

Unterschiede anzeigen:

SL/DB/Order.pm
91 91

  
92 92
  croak("Conversion to invoices is only supported for sales records") unless $self->customer_id;
93 93

  
94
  if (!$params{ar_id}) {
95
    my $chart = SL::DB::Manager::Chart->get_all(query   => [ SL::DB::Manager::Chart->link_filter('AR') ],
96
                                                sort_by => 'id ASC',
97
                                                limit   => 1)->[0];
98
    croak("No AR chart found and no parameter `ar_id' given") unless $chart;
99
    $params{ar_id} = $chart->id;
100
  }
101

  
102 94
  my $invoice;
103 95
  if (!$self->db->do_transaction(sub {
104 96
    $invoice = SL::DB::Invoice->new_from($self)->post(%params) || die;
......
149 141
linked to the new invoice via L<SL::DB::RecordLink>. C<$self>'s
150 142
C<closed> attribute is set to C<true>, and C<$self> is saved.
151 143

  
152
The arguments in C<%params> are passed to
153
L<SL::DB::Invoice::post>. One parameter of note is
154
C<$paras{ar_id}>. If set it must be the ID of the accounts receivables
155
chart to post to. If it is not set then the first chart configured for
156
accounts receivables is used.
144
The arguments in C<%params> are passed to L<SL::DB::Invoice::post>.
157 145

  
158 146
Returns the new invoice instance on success and C<undef> on
159 147
failure. The whole process is run inside a transaction. On failure

Auch abrufbar als: Unified diff