Revision 7f99c4de
Von Tamino Steinert vor etwa 2 Jahren hinzugefügt
SL/Controller/Reclamation.pm | ||
---|---|---|
593 | 593 |
|
594 | 594 |
# workflow from purchase to sales reclamation |
595 | 595 |
sub action_save_and_sales_reclamation { |
596 |
$_[0]->workflow_save_and_sales_or_purchase_reclamation(); |
|
596 |
my ($self) = @_; |
|
597 |
|
|
598 |
$self->save_with_render_error(); |
|
599 |
flash_later('info', t8('The reclamation has been saved')); |
|
600 |
$self->redirect_to( |
|
601 |
controller => 'Reclamation', |
|
602 |
action => 'add_from_reclamation', |
|
603 |
from_id => $self->reclamation->id, |
|
604 |
type => sales_reclamation_type(), |
|
605 |
); |
|
597 | 606 |
} |
598 | 607 |
|
599 | 608 |
# workflow from sales to purchase reclamation |
600 | 609 |
sub action_save_and_purchase_reclamation { |
601 |
$_[0]->workflow_save_and_sales_or_purchase_reclamation(); |
|
610 |
my ($self) = @_; |
|
611 |
|
|
612 |
$self->save_with_render_error(); |
|
613 |
flash_later('info', t8('The reclamation has been saved')); |
|
614 |
$self->redirect_to( |
|
615 |
controller => 'Reclamation', |
|
616 |
action => 'add_from_reclamation', |
|
617 |
from_id => $self->reclamation->id, |
|
618 |
type => purchase_reclamation_type(), |
|
619 |
); |
|
602 | 620 |
} |
603 | 621 |
|
604 | 622 |
# save the reclamation and redirect to the frontend subroutine for a new |
... | ... | |
1739 | 1757 |
} |
1740 | 1758 |
|
1741 | 1759 |
# sales → purchase or purchase → sales |
1742 |
sub workflow_save_and_sales_or_purchase_reclamation {
|
|
1760 |
sub action_add_from_reclamation {
|
|
1743 | 1761 |
my ($self) = @_; |
1744 | 1762 |
|
1745 |
# always save |
|
1746 |
$self->save_with_render_error(); |
|
1763 |
my $destination_type = $::form->{destination_type}; |
|
1747 | 1764 |
|
1748 |
my $destination_type = $::form->{type} eq purchase_reclamation_type() ? sales_reclamation_type() |
|
1749 |
: $::form->{type} eq sales_reclamation_type() ? purchase_reclamation_type() |
|
1750 |
: ''; |
|
1751 |
|
|
1752 |
# check for direct delivery |
|
1753 |
# copy shipto in custom shipto (custom shipto will be copied by new_from() in case) |
|
1754 |
my $custom_shipto; |
|
1755 |
if ( ($::form->{type} eq sales_reclamation_type()) |
|
1756 |
&& ($destination_type eq purchase_reclamation_type()) |
|
1757 |
&& $::form->{use_shipto} |
|
1758 |
&& $self->reclamation->shipto ) { |
|
1759 |
$custom_shipto = $self->reclamation->shipto->clone('SL::DB::Reclamation'); |
|
1760 |
} |
|
1765 |
my $source_reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load; |
|
1761 | 1766 |
|
1762 | 1767 |
$self->reclamation( |
1763 | 1768 |
SL::DB::Reclamation->new_from( |
1764 |
$self->reclamation,
|
|
1765 |
destination_type => $destination_type,
|
|
1769 |
$source_reclamation,
|
|
1770 |
destination_type => $::form->{type},
|
|
1766 | 1771 |
)); |
1767 | 1772 |
|
1768 |
if ($::form->{type} eq sales_reclamation_type() && $destination_type eq purchase_reclamation_type()) { |
|
1773 |
# check for direct delivery |
|
1774 |
# copy shipto in custom shipto (custom shipto will be copied by new_from() in case) |
|
1775 |
if ($::form->{type} eq purchase_reclamation_type()) { |
|
1769 | 1776 |
if ($::form->{use_shipto}) { |
1777 |
my $custom_shipto = $source_reclamation->shipto->clone('SL::DB::Reclamation'); |
|
1770 | 1778 |
$self->reclamation->custom_shipto($custom_shipto) if $custom_shipto; |
1771 | 1779 |
} else { |
1772 | 1780 |
# remove any custom shipto if not wanted |
... | ... | |
1774 | 1782 |
} |
1775 | 1783 |
} |
1776 | 1784 |
|
1777 |
$::form->{type} = $destination_type; |
|
1778 | 1785 |
$self->reinit_after_new_reclamation(); |
1779 | 1786 |
|
1780 | 1787 |
$self->render( |
Auch abrufbar als: Unified diff
Reclamation: [FIX] render von Reklamation to Reklamation