Revision f65440cb
Von Moritz Bunkus vor fast 4 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
598 | 598 |
); |
599 | 599 |
} |
600 | 600 |
|
601 |
# workflow from sales order to sales quotation |
|
602 |
sub action_sales_quotation { |
|
603 |
$_[0]->workflow_sales_quotation(); |
|
604 |
} |
|
605 |
|
|
601 | 606 |
# workflow from sales quotation to sales order |
602 | 607 |
sub action_sales_order { |
603 | 608 |
$_[0]->workflow_sales_or_purchase_order(); |
... | ... | |
1580 | 1585 |
return $errors; |
1581 | 1586 |
} |
1582 | 1587 |
|
1588 |
sub workflow_sales_quotation { |
|
1589 |
my ($self) = @_; |
|
1590 |
|
|
1591 |
# always save |
|
1592 |
my $errors = $self->save(); |
|
1593 |
|
|
1594 |
if (scalar @{ $errors }) { |
|
1595 |
$self->js->flash('error', $_) for @{ $errors }; |
|
1596 |
return $self->js->render(); |
|
1597 |
} |
|
1598 |
|
|
1599 |
my $destination_type = sales_quotation_type(); |
|
1600 |
|
|
1601 |
$self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type)); |
|
1602 |
$self->{converted_from_oe_id} = delete $::form->{id}; |
|
1603 |
|
|
1604 |
# set item ids to new fake id, to identify them as new items |
|
1605 |
foreach my $item (@{$self->order->items_sorted}) { |
|
1606 |
$item->{new_fake_id} = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); |
|
1607 |
} |
|
1608 |
|
|
1609 |
# change form type |
|
1610 |
$::form->{type} = $destination_type; |
|
1611 |
$self->type($self->init_type); |
|
1612 |
$self->cv ($self->init_cv); |
|
1613 |
$self->check_auth; |
|
1614 |
|
|
1615 |
$self->recalc(); |
|
1616 |
$self->get_unalterable_data(); |
|
1617 |
$self->pre_render(); |
|
1618 |
|
|
1619 |
# trigger rendering values for second row as hidden, because they |
|
1620 |
# are loaded only on demand. So we need to keep the values from the |
|
1621 |
# source. |
|
1622 |
$_->{render_second_row} = 1 for @{ $self->order->items_sorted }; |
|
1623 |
|
|
1624 |
$self->render( |
|
1625 |
'order/form', |
|
1626 |
title => $self->get_title_for('edit'), |
|
1627 |
%{$self->{template_args}} |
|
1628 |
); |
|
1629 |
} |
|
1630 |
|
|
1583 | 1631 |
sub workflow_sales_or_purchase_order { |
1584 | 1632 |
my ($self) = @_; |
1585 | 1633 |
|
... | ... | |
1738 | 1786 |
action => [ |
1739 | 1787 |
t8('Workflow'), |
1740 | 1788 |
], |
1789 |
action => [ |
|
1790 |
t8('Save and Quotation'), |
|
1791 |
submit => [ '#order_form', { action => "Order/sales_quotation" } ], |
|
1792 |
only_if => (any { $self->type eq $_ } (sales_order_type())), |
|
1793 |
], |
|
1741 | 1794 |
action => [ |
1742 | 1795 |
t8('Save and Sales Order'), |
1743 | 1796 |
submit => [ '#order_form', { action => "Order/sales_order" } ], |
... | ... | |
2150 | 2203 |
|
2151 | 2204 |
=item * credit limit |
2152 | 2205 |
|
2153 |
=item * more workflows (quotation, rfq)
|
|
2206 |
=item * more workflows (rfq) |
|
2154 | 2207 |
|
2155 | 2208 |
=item * price sources: little symbols showing better price / better discount |
2156 | 2209 |
|
Auch abrufbar als: Unified diff
Order-Controller: Workflow Verkaufsauftrag → Verkaufsangebot