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

  
SL/DB/DeliveryOrder/TypeData.pm
28 28
      attachment => t8("sales_delivery_order_list"),
29 29
    },
30 30
    show_menu => {
31
      save_and_ap_transaction => 0,
32
      save_and_invoice        => 0,
33
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
31
      workflow_invoice     => 1,
32
      workflow_reclamation => 1,
33
      delete => sub { $::instance_conf->get_sales_delivery_order_show_delete },
34 34
    },
35 35
    properties => {
36 36
      customervendor => "customer",
......
64 64
      attachment => t8("purchase_delivery_order_list"),
65 65
    },
66 66
    show_menu => {
67
      save_and_ap_transaction => 0,
68
      save_and_invoice        => 0,
69
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
67
      workflow_invoice     => 1,
68
      workflow_reclamation => 1,
69
      delete => sub { $::instance_conf->get_sales_delivery_order_show_delete },
70 70
    },
71 71
    properties => {
72 72
      customervendor => "vendor",
......
100 100
      attachment => t8("supplier_delivery_order_list"),
101 101
    },
102 102
    show_menu => {
103
      save_and_ap_transaction => 0,
104
      save_and_invoice        => 0,
105
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
103
      workflow_invoice     => 0,
104
      workflow_reclamation => 0,
105
      delete => sub { $::instance_conf->get_sales_delivery_order_show_delete },
106 106
    },
107 107
    properties => {
108 108
      customervendor => "vendor",
......
136 136
      attachment => t8("rma_delivery_order_list"),
137 137
    },
138 138
    show_menu => {
139
      save_and_ap_transaction => 0,
140
      save_and_invoice        => 0,
141
      delete                  => sub { $::instance_conf->get_sales_delivery_order_show_delete },
139
      workflow_invoice     => 0,
140
      workflow_reclamation => 0,
141
      delete => sub { $::instance_conf->get_sales_delivery_order_show_delete },
142 142
    },
143 143
    properties => {
144 144
      customervendor => "customer",
bin/mozilla/do.pl
1137 1137
  $main::lxdebug->leave_sub();
1138 1138
}
1139 1139

  
1140
sub invoice_from_delivery_order_controller {
1141
  $main::lxdebug->enter_sub();
1142
  my $form     = $main::form;
1143

  
1144
  my $from_id = delete $form->{from_id};
1145
  my $delivery_order = SL::DB::DeliveryOrder->new(id => $from_id)->load;
1146

  
1147
  $delivery_order->flatten_to_form($form, format_amounts => 1);
1148

  
1149
  &invoice;
1150
  $main::lxdebug->leave_sub();
1151
}
1152

  
1140 1153
sub invoice {
1141 1154
  $main::lxdebug->enter_sub();
1142 1155

  
locale/de/all
845 845
  'Create Dataset'              => 'Neue Datenbank anlegen',
846 846
  'Create Date'                 => 'Erstelldatum',
847 847
  'Create HTML'                 => 'HTML erzeugen',
848
  'Create Invoice'              => 'Rechnung erstellen',
848 849
  'Create PDF'                  => 'PDF erzeugen',
850
  'Create Reclamation'          => 'Reklamation erstellen',
849 851
  'Create Sub-Version'          => 'Unterversion erzeugen',
850 852
  'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen',
851 853
  'Create a new client'         => 'Einen neuen Mandanten anlegen',
locale/en/all
845 845
  'Create Dataset'              => '',
846 846
  'Create Date'                 => '',
847 847
  'Create HTML'                 => '',
848
  'Create Invoice'              => '',
848 849
  'Create PDF'                  => '',
850
  'Create Reclamation'          => '',
849 851
  'Create Sub-Version'          => '',
850 852
  'Create a new background job' => '',
851 853
  'Create a new client'         => '',

Auch abrufbar als: Unified diff