Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 731ecd0c

Von Tamino Steinert vor 12 Monaten hinzugefügt

  • ID 731ecd0cdcc5de81a369cb158459c3d6b679bc2e
  • Vorgänger 7ea6670d
  • Nachfolger 22d2337c

S:C:DeliveryOrder: Workflow zu Rechnung und Reklamation hinzugefügt

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
25 25
use SL::DB::Printer;
26 26
use SL::DB::Language;
27 27
use SL::DB::Reclamation;
28
use SL::DB::Reclamation::TypeData qw(:types);
28 29
use SL::DB::RecordLink;
29 30
use SL::DB::Shipto;
30 31
use SL::DB::Translation;
......
81 82

  
82 83
__PACKAGE__->run_before('get_unalterable_data',
83 84
  only => [ qw(
84
    save save_as_new save_and_new_record save_and_invoice
85
    save save_as_new workflow_new_record workflow_invoice
85 86
    save_and_ap_transaction print send_email
86 87
    ) ]);
87 88

  
......
528 529
  $self->redirect_to(@redirect_params);
529 530
}
530 531

  
531
sub action_save_and_new_record {
532
sub action_workflow_new_record {
532 533
  my ($self) = @_;
533 534
  my $to_type = $::form->{to_type};
534 535
  my $to_controller = get_object_name_from_type($to_type);
535 536

  
536
  $self->save();
537

  
538 537
  my %additional_params = ();
539 538
  if ($::form->{only_selected_item_positions}) { # ids can be unset before save
540 539
    my $item_positions = $::form->{selected_item_positions} || [];
......
556 555

  
557 556
# save the order and redirect to the frontend subroutine for a new
558 557
# invoice
559
sub action_save_and_invoice {
560
  my ($self) = @_;
561

  
562
  $self->save_and_redirect_to(
563
    controller => 'oe.pl',
564
    action     => 'oe_invoice_from_order',
565
  );
566
}
567

  
568
# workflow from purchase order to ap transaction
569
sub action_save_and_ap_transaction {
558
sub action_workflow_invoice {
570 559
  my ($self) = @_;
571 560

  
572
  $self->save_and_redirect_to(
573
    controller => 'ap.pl',
574
    action     => 'add_from_purchase_order',
561
  $self->redirect_to(
562
    controller => 'do.pl',
563
    action     => 'invoice_from_delivery_order_controller',
564
    from_id    => $self->order->id,
575 565
  );
576 566
}
577 567

  
......
1807 1797
    $self->type_data->rights('edit') || 'DOES_NOT_EXIST', 1
1808 1798
  );
1809 1799

  
1800
  my $confirmation_on_workflow = $self->order->delivered ? undef
1801
    : ( $self->order->is_sales && $::instance_conf->get_sales_delivery_order_check_stocked)    ? t8('This record has not been stocked out. Proceed?')
1802
    : (!$self->order->is_sales && $::instance_conf->get_purchase_delivery_order_check_stocked) ? t8('This record has not been stocked in. Proceed?')
1803
    : undef;
1804

  
1810 1805
  for my $bar ($::request->layout->get('actionbar')) {
1811 1806
    $bar->add(
1812 1807
      combobox => [
......
1841 1836
          t8('Workflow'),
1842 1837
        ],
1843 1838
        action => [
1844
          t8('Save and Invoice'),
1839
          t8('Create Invoice'),
1845 1840
          call     => [ 'kivi.DeliveryOrder.save', {
1846
              action             => 'save_and_invoice',
1841
              action             => 'workflow_invoice',
1847 1842
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1848 1843
            }],
1849
          only_if  => $self->type_data->show_menu("save_and_invoice"),
1850
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
1844
          only_if  => $self->type_data->show_menu("workflow_invoice"),
1845
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
1846
                    : !$self->order->id ? t8('This object has not been saved yet.')
1847
                    : undef,
1848
          confirm  =>   $confirmation_on_workflow,
1851 1849
        ],
1852 1850
        action => [
1853
          t8('Save and AP Transaction'),
1854
          call     => [ 'kivi.DeliveryOrder.save', {
1855
              action             => 'save_and_ap_transaction',
1851
          t8('Create Reclamation'),
1852
          call      => [ 'kivi.DeliveryOrder.save', {
1853
              action             => 'workflow_new_record',
1856 1854
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1855
              form_params        => [
1856
                { name => 'to_type',
1857
                  value => $self->order->is_sales ? SALES_RECLAMATION_TYPE()
1858
                                                  : PURCHASE_RECLAMATION_TYPE() },
1859
              ],
1857 1860
            }],
1858
          only_if  => $self->type_data->show_menu("save_and_ap_transaction"),
1859
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
1861
          only_if  => $self->type_data->show_menu('workflow_reclamation'),
1862
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
1863
                    : !$self->order->id ? t8('This object has not been saved yet.')
1864
                    : undef,
1865
          confirm  => $confirmation_on_workflow,
1860 1866
        ],
1861 1867

  
1862 1868
      ], # end of combobox "Workflow"
......
2128 2134
  return $_[0]->type_data->properties("nr_key");
2129 2135
}
2130 2136

  
2131
sub save_and_redirect_to {
2132
  my ($self, %params) = @_;
2133

  
2134
  $self->save();
2135

  
2136
  flash_later('info', $self->type_data->text("saved"));
2137

  
2138
  $self->redirect_to(%params, id => $self->order->id);
2139
}
2140

  
2141 2137
sub save_history {
2142 2138
  my ($self, $addition) = @_;
2143 2139

  

Auch abrufbar als: Unified diff