Revision 93ae5d0f
Von Tamino Steinert vor 5 Monaten hinzugefügt
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
210 | 210 |
|
211 | 211 |
$invoice->post(ar_id => $config->ar_chart_id) || die; |
212 | 212 |
|
213 |
foreach my $item (grep { ($_->recurring_billing_mode eq 'once') && !$_->recurring_billing_invoice_id } @{ $order->orderitems }) { |
|
214 |
$item->update_attributes(recurring_billing_invoice_id => $invoice->id); |
|
213 |
foreach my $item ( |
|
214 |
grep { $_->periodic_invoice_items_config |
|
215 |
&& ($_->periodic_invoice_items_config->periodicity eq 'o') |
|
216 |
&& !$_->periodic_invoice_items_config->once_invoice_id } |
|
217 |
@{ $order->orderitems } |
|
218 |
) { |
|
219 |
$item->periodic_invoice_items_config->update_attributes(once_invoice_id => $invoice->id); |
|
215 | 220 |
} |
216 | 221 |
|
217 | 222 |
SL::DB::PeriodicInvoice->new(config_id => $config->id, |
SL/DB/Order.pm | ||
---|---|---|
628 | 628 |
marge_percent marge_price_factor marge_total |
629 | 629 |
ordnumber parts_id price_factor price_factor_id pricegroup_id |
630 | 630 |
project_id qty reqdate sellprice serialnumber ship subtotal transdate unit |
631 |
optional recurring_billing_mode position
|
|
631 |
optional position |
|
632 | 632 |
)), |
633 | 633 |
custom_variables => \@custom_variables, |
634 | 634 |
); |
635 |
if ( $is_abbr_any->(qw(soso)) && $source_item->periodic_invoice_items_config ) { |
|
636 |
$current_oe_item->periodic_invoice_items_config( |
|
637 |
$source_item->periodic_invoice_items_config->clone_and_reset |
|
638 |
); |
|
639 |
} |
|
635 | 640 |
} elsif (ref($source) eq 'SL::DB::Reclamation') { |
636 | 641 |
$current_oe_item = SL::DB::OrderItem->new( |
637 | 642 |
map({ ( $_ => $source_item->$_ ) } qw( |
SL/DB/OrderItem.pm | ||
---|---|---|
20 | 20 |
use SL::Helper::ShippedQty; |
21 | 21 |
use Rose::DB::Object::Helpers qw(as_tree strip); |
22 | 22 |
|
23 |
__PACKAGE__->meta->add_relationship( |
|
24 |
periodic_invoice_items_config => { |
|
25 |
type => 'one to one', |
|
26 |
class => 'SL::DB::PeriodicInvoiceItemsConfig', |
|
27 |
column_map => { id => 'order_item_id' }, |
|
28 |
}, |
|
29 |
); |
|
30 |
|
|
23 | 31 |
__PACKAGE__->meta->initialize; |
24 | 32 |
|
25 | 33 |
__PACKAGE__->configure_acts_as_list(group_by => [qw(trans_id)]); |
SL/DB/PeriodicInvoicesConfig.pm | ||
---|---|---|
51 | 51 |
); |
52 | 52 |
my @items; |
53 | 53 |
for my $item ($orig_order->items) { |
54 |
next if $item->recurring_billing_mode eq 'never'; |
|
55 |
next if $item->recurring_billing_mode eq 'once' && ( |
|
56 |
$item->recurring_billing_invoice_id |
|
54 |
if ($item->periodic_invoice_items_config) { |
|
55 |
next if $item->periodic_invoice_items_config->periodicity eq 'n'; |
|
56 |
next if $item->periodic_invoice_items_config->periodicity eq 'o' && ( |
|
57 |
$item->periodic_invoice_items_config->once_invoice_id |
|
57 | 58 |
|| $period_start_date != $next_period_start_date |
58 | 59 |
); |
60 |
} |
|
59 | 61 |
|
60 | 62 |
my $new_item = clone($item); |
61 | 63 |
|
t/workflow/order_reclamation.t | ||
---|---|---|
291 | 291 |
id trans_id reclamation_id itime mtime |
292 | 292 |
cusordnumber marge_percent marge_price_factor marge_total optional ordnumber ship subtotal transdate orderer_id |
293 | 293 |
reason_description_ext reason_description_int reason_id |
294 |
recurring_billing_mode recurring_billing_invoice_id |
|
295 | 294 |
); |
296 | 295 |
# sales |
297 | 296 |
pairwise { |
Auch abrufbar als: Unified diff
S:D:PeriodicInvoiceItemsConfig: Bisherige Verwendung umstellen