Revision 2f105e47
Von Moritz Bunkus vor mehr als 3 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
581 | 581 |
sub action_save_and_delivery_order { |
582 | 582 |
my ($self) = @_; |
583 | 583 |
|
584 |
my $errors = $self->save(); |
|
585 |
|
|
586 |
if (scalar @{ $errors }) { |
|
587 |
$self->js->flash('error', $_) foreach @{ $errors }; |
|
588 |
return $self->js->render(); |
|
589 |
} |
|
590 |
|
|
591 |
my $text = $self->type eq sales_order_type() ? $::locale->text('The order has been saved') |
|
592 |
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved') |
|
593 |
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved') |
|
594 |
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved') |
|
595 |
: ''; |
|
596 |
flash_later('info', $text); |
|
597 |
|
|
598 |
my @redirect_params = ( |
|
584 |
$self->save_and_redirect_to( |
|
599 | 585 |
controller => 'oe.pl', |
600 | 586 |
action => 'oe_delivery_order_from_order', |
601 |
id => $self->order->id, |
|
602 | 587 |
); |
603 |
|
|
604 |
$self->redirect_to(@redirect_params); |
|
605 | 588 |
} |
606 | 589 |
|
607 | 590 |
# save the order and redirect to the frontend subroutine for a new |
... | ... | |
609 | 592 |
sub action_save_and_invoice { |
610 | 593 |
my ($self) = @_; |
611 | 594 |
|
612 |
my $errors = $self->save(); |
|
613 |
|
|
614 |
if (scalar @{ $errors }) { |
|
615 |
$self->js->flash('error', $_) foreach @{ $errors }; |
|
616 |
return $self->js->render(); |
|
617 |
} |
|
618 |
|
|
619 |
my $text = $self->type eq sales_order_type() ? $::locale->text('The order has been saved') |
|
620 |
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved') |
|
621 |
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved') |
|
622 |
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved') |
|
623 |
: ''; |
|
624 |
flash_later('info', $text); |
|
625 |
|
|
626 |
my @redirect_params = ( |
|
595 |
$self->save_and_redirect_to( |
|
627 | 596 |
controller => 'oe.pl', |
628 | 597 |
action => 'oe_invoice_from_order', |
629 |
id => $self->order->id, |
|
630 | 598 |
); |
631 |
|
|
632 |
$self->redirect_to(@redirect_params); |
|
633 | 599 |
} |
634 | 600 |
|
635 | 601 |
# workflow from sales quotation to sales order |
... | ... | |
646 | 612 |
sub action_save_and_ap_transaction { |
647 | 613 |
my ($self) = @_; |
648 | 614 |
|
649 |
my $errors = $self->save(); |
|
650 |
|
|
651 |
if (scalar @{ $errors }) { |
|
652 |
$self->js->flash('error', $_) foreach @{ $errors }; |
|
653 |
return $self->js->render(); |
|
654 |
} |
|
655 |
|
|
656 |
my $text = $self->type eq sales_order_type() ? $::locale->text('The order has been saved') |
|
657 |
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved') |
|
658 |
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved') |
|
659 |
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved') |
|
660 |
: ''; |
|
661 |
flash_later('info', $text); |
|
662 |
|
|
663 |
my @redirect_params = ( |
|
615 |
$self->save_and_redirect_to( |
|
664 | 616 |
controller => 'ap.pl', |
665 | 617 |
action => 'add_from_purchase_order', |
666 |
id => $self->order->id, |
|
667 | 618 |
); |
668 |
|
|
669 |
$self->redirect_to(@redirect_params); |
|
670 | 619 |
} |
671 | 620 |
|
672 | 621 |
# set form elements in respect to a changed customer or vendor |
... | ... | |
2111 | 2060 |
: ''; |
2112 | 2061 |
} |
2113 | 2062 |
|
2063 |
sub save_and_redirect_to { |
|
2064 |
my ($self, %params) = @_; |
|
2065 |
|
|
2066 |
my $errors = $self->save(); |
|
2067 |
|
|
2068 |
if (scalar @{ $errors }) { |
|
2069 |
$self->js->flash('error', $_) foreach @{ $errors }; |
|
2070 |
return $self->js->render(); |
|
2071 |
} |
|
2072 |
|
|
2073 |
my $text = $self->type eq sales_order_type() ? $::locale->text('The order has been saved') |
|
2074 |
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved') |
|
2075 |
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved') |
|
2076 |
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved') |
|
2077 |
: ''; |
|
2078 |
flash_later('info', $text); |
|
2079 |
|
|
2080 |
$self->redirect_to(%params, id => $self->order->id); |
|
2081 |
} |
|
2082 |
|
|
2114 | 2083 |
1; |
2115 | 2084 |
|
2116 | 2085 |
__END__ |
Auch abrufbar als: Unified diff
Order-Controller: Umwandlung: gemeinsamen Code in eigene Funktion ausgelagert