Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 037f501d

Von Bernd Bleßmann vor 12 Monaten hinzugefügt

  • ID 037f501dc9dff1a865c94e919842541011fc95c9
  • Vorgänger ca26d442
  • Nachfolger 4979985b

Angebots-Eingang: Controller

Unterschiede anzeigen:

SL/Controller/Order.pm
209 209
    return $self->js->render();
210 210
  }
211 211

  
212
  my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been deleted')
213
           : $self->type eq sales_order_type()        ? $::locale->text('The order confirmation has been deleted')
214
           : $self->type eq purchase_order_type()     ? $::locale->text('The order has been deleted')
215
           : $self->type eq sales_quotation_type()    ? $::locale->text('The quotation has been deleted')
216
           : $self->type eq request_quotation_type()  ? $::locale->text('The rfq has been deleted')
212
  my $text = $self->type eq sales_order_intake_type()        ? $::locale->text('The order intake has been deleted')
213
           : $self->type eq sales_order_type()               ? $::locale->text('The order confirmation has been deleted')
214
           : $self->type eq purchase_order_type()            ? $::locale->text('The order has been deleted')
215
           : $self->type eq sales_quotation_type()           ? $::locale->text('The quotation has been deleted')
216
           : $self->type eq request_quotation_type()         ? $::locale->text('The rfq has been deleted')
217
           : $self->type eq purchase_quotation_intake_type() ? $::locale->text('The quotation intake has been deleted')
217 218
           : '';
218 219
  flash_later('info', $text);
219 220

  
......
236 237
    return $self->js->render();
237 238
  }
238 239

  
239
  my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been saved')
240
           : $self->type eq sales_order_type()        ? $::locale->text('The order confirmation has been saved')
241
           : $self->type eq purchase_order_type()     ? $::locale->text('The order has been saved')
242
           : $self->type eq sales_quotation_type()    ? $::locale->text('The quotation has been saved')
243
           : $self->type eq request_quotation_type()  ? $::locale->text('The rfq has been saved')
240
  my $text = $self->type eq sales_order_intake_type()         ? $::locale->text('The order intake has been saved')
241
           : $self->type eq sales_order_type()                ? $::locale->text('The order confirmation has been saved')
242
           : $self->type eq purchase_order_type()             ? $::locale->text('The order has been saved')
243
           : $self->type eq sales_quotation_type()            ? $::locale->text('The quotation has been saved')
244
           : $self->type eq request_quotation_type()          ? $::locale->text('The rfq has been saved')
245
           : $self->type eq purchase_quotation_intake_type()  ? $::locale->text('The quotation intake has been saved')
244 246
           : '';
245 247
  flash_later('info', $text);
246 248

  
......
1713 1715
#
1714 1716

  
1715 1717
sub init_valid_types {
1716
  [ sales_order_intake_type(), sales_order_type(), purchase_order_type(), sales_quotation_type(), request_quotation_type() ];
1718
  [ sales_order_intake_type(), sales_order_type(), purchase_order_type(), sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type() ];
1717 1719
}
1718 1720

  
1719 1721
sub init_type {
......
1729 1731
sub init_cv {
1730 1732
  my ($self) = @_;
1731 1733

  
1732
  my $cv = (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(),    sales_quotation_type())) ? 'customer'
1733
         : (any { $self->type eq $_ } (purchase_order_type(), request_quotation_type()))                          ? 'vendor'
1734
  my $cv = (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(),       sales_quotation_type()))           ? 'customer'
1735
         : (any { $self->type eq $_ } (purchase_order_type(),     request_quotation_type(), purchase_quotation_intake_type())) ? 'vendor'
1734 1736
         : die "Not a valid type for order";
1735 1737

  
1736 1738
  return $cv;
......
1790 1792
  my ($self) = @_;
1791 1793

  
1792 1794
  my $right_for = { map { $_ => $_.'_edit' . ' | ' . $_.'_view' } @{$self->valid_types} };
1793
  $right_for->{ sales_order_intake_type() } = 'sales_order_edit | sales_order_view';
1795
  $right_for->{ sales_order_intake_type()        } = 'sales_order_edit | sales_order_view';
1796
  $right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit | request_quotation_view';
1794 1797

  
1795 1798
  my $right   = $right_for->{ $self->type };
1796 1799
  $right    ||= 'DOES_NOT_EXIST';
......
1802 1805
  my ($self) = @_;
1803 1806

  
1804 1807
  my $right_for = { map { $_ => $_.'_edit' } @{$self->valid_types} };
1805
  $right_for->{ sales_order_intake_type() } = 'sales_order_edit';
1808
  $right_for->{ sales_order_intake_type()        } = 'sales_order_edit';
1809
  $right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit';
1806 1810

  
1807 1811
  my $right   = $right_for->{ $self->type };
1808 1812
  $right    ||= 'DOES_NOT_EXIST';
......
1952 1956
  my $order;
1953 1957
  $order   = SL::DB::Order->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
1954 1958
  $order ||= SL::DB::Order->new(orderitems  => [],
1955
                                quotation   => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type())),
1956
                                intake      => (any { $self->type eq $_ } (sales_order_intake_type())),
1959
                                quotation   => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type())),
1960
                                intake      => (any { $self->type eq $_ } (sales_order_intake_type(), purchase_quotation_intake_type())),
1957 1961
                                currency_id => $::instance_conf->get_currency_id(),);
1958 1962

  
1959 1963
  my $cv_id_method = $self->cv . '_id';
......
2387 2391
sub setup_edit_action_bar {
2388 2392
  my ($self, %params) = @_;
2389 2393

  
2390
  my $deletion_allowed = (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type()))
2394
  my $deletion_allowed = (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type()))
2391 2395
                      || (($self->type eq sales_order_type())        && $::instance_conf->get_sales_order_show_delete)
2392 2396
                      || (($self->type eq sales_order_intake_type()) && $::instance_conf->get_sales_order_show_delete)
2393 2397
                      || (($self->type eq purchase_order_type())     && $::instance_conf->get_purchase_order_show_delete);
......
2409 2413

  
2410 2414
  my $right_for         = { map { $_ => $_.'_edit' } @{$self->valid_types} };
2411 2415
  $right_for->{ sales_order_intake_type() } = 'sales_order_edit';
2416
  $right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit';
2412 2417
  my $right             = $right_for->{ $self->type };
2413 2418
  $right              ||= 'DOES_NOT_EXIST';
2414 2419
  my $may_edit_create   = $::auth->assert($right, 'may fail');
......
2473 2478
          t8('Save and Quotation'),
2474 2479
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_quotation_type()), '#order_form' ],
2475 2480
          checks   => [ @req_trans_cost_art, @req_cusordnumber ],
2476
          only_if  => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type())),
2481
          only_if  => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type(), purchase_quotation_intake_type())),
2477 2482
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2478 2483
        ],
2479 2484
        action => [
......
2482 2487
          only_if  => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), sales_quotation_type(), purchase_order_type())),
2483 2488
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2484 2489
        ],
2490
        action => [
2491
          t8('Save and Purchase Quotation Intake'),
2492
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => purchase_quotation_intake_type()), '#order_form' ],
2493
          only_if  => (any { $self->type eq $_ } (request_quotation_type())),
2494
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2495
        ],
2485 2496
        action => [
2486 2497
          t8('Save and Sales Order Intake'),
2487 2498
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_order_intake_type()), '#order_form' ],
......
2492 2503
          t8('Save and Sales Order Confirmation'),
2493 2504
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_order_type()), '#order_form' ],
2494 2505
          checks   => [ @req_trans_cost_art ],
2495
          only_if  => (any { $self->type eq $_ } (sales_quotation_type(), sales_order_intake_type(), request_quotation_type(), purchase_order_type())),
2506
          only_if  => (any { $self->type eq $_ } (sales_quotation_type(), sales_order_intake_type(), request_quotation_type(), purchase_order_type(), purchase_quotation_intake_type())),
2496 2507
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2497 2508
        ],
2498 2509
        action => [
2499 2510
          t8('Save and Purchase Order'),
2500 2511
          call      => [ 'kivi.Order.purchase_check_for_direct_delivery', { to_type => purchase_order_type() } ],
2501 2512
          checks    => [ @req_trans_cost_art, @req_cusordnumber ],
2502
          only_if   => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type())),
2513
          only_if   => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type(), purchase_quotation_intake_type())),
2503 2514
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2504 2515
        ],
2505 2516
        action => [
......
2553 2564
                         @req_trans_cost_art, @req_cusordnumber,
2554 2565
          ],
2555 2566
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2556
          not_if    => (any { $self->type eq $_ } (sales_order_intake_type())),
2567
          not_if    => (any { $self->type eq $_ } (sales_order_intake_type(), purchase_quotation_intake_type())),
2557 2568
        ],
2558 2569
        action => [
2559 2570
          ($has_invoice_for_advance_payment ? t8('Save and Further Invoice for Advance Payment') : t8('Save and Invoice for Advance Payment')),
......
2797 2808
  # $::locale->text("Add Purchase Order");
2798 2809
  # $::locale->text("Add Quotation");
2799 2810
  # $::locale->text("Add Request for Quotation");
2811
  # $::locale->text("Add Purchase Quotation Intake");
2800 2812
  # $::locale->text("Edit Sales Order Intake");
2801 2813
  # $::locale->text("Edit Sales Order");
2802 2814
  # $::locale->text("Edit Purchase Order");
2803 2815
  # $::locale->text("Edit Quotation");
2804 2816
  # $::locale->text("Edit Request for Quotation");
2817
  # $::locale->text("Edit Purchase Quotation Intake");
2805 2818

  
2806 2819
  $action = ucfirst(lc($action));
2807
  return $self->type eq sales_order_intake_type() ? $::locale->text("$action Sales Order Intake")
2808
       : $self->type eq sales_order_type()        ? $::locale->text("$action Sales Order")
2809
       : $self->type eq purchase_order_type()     ? $::locale->text("$action Purchase Order")
2810
       : $self->type eq sales_quotation_type()    ? $::locale->text("$action Quotation")
2811
       : $self->type eq request_quotation_type()  ? $::locale->text("$action Request for Quotation")
2820
  return $self->type eq sales_order_intake_type()        ? $::locale->text("$action Sales Order Intake")
2821
       : $self->type eq sales_order_type()               ? $::locale->text("$action Sales Order")
2822
       : $self->type eq purchase_order_type()            ? $::locale->text("$action Purchase Order")
2823
       : $self->type eq sales_quotation_type()           ? $::locale->text("$action Quotation")
2824
       : $self->type eq request_quotation_type()         ? $::locale->text("$action Request for Quotation")
2825
       : $self->type eq purchase_quotation_intake_type() ? $::locale->text("$action Purchase Quotation Intake")
2812 2826
       : '';
2813 2827
}
2814 2828

  
......
2906 2920
  'request_quotation';
2907 2921
}
2908 2922

  
2923
sub purchase_quotation_intake_type {
2924
  'purchase_quotation_intake';
2925
}
2926

  
2909 2927
sub nr_key {
2910
  return $_[0]->type eq sales_order_intake_type() ? 'ordnumber'
2911
       : $_[0]->type eq sales_order_type()        ? 'ordnumber'
2912
       : $_[0]->type eq purchase_order_type()     ? 'ordnumber'
2913
       : $_[0]->type eq sales_quotation_type()    ? 'quonumber'
2914
       : $_[0]->type eq request_quotation_type()  ? 'quonumber'
2928
  return $_[0]->type eq sales_order_intake_type()        ? 'ordnumber'
2929
       : $_[0]->type eq sales_order_type()               ? 'ordnumber'
2930
       : $_[0]->type eq purchase_order_type()            ? 'ordnumber'
2931
       : $_[0]->type eq sales_quotation_type()           ? 'quonumber'
2932
       : $_[0]->type eq request_quotation_type()         ? 'quonumber'
2933
       : $_[0]->type eq purchase_quotation_intake_type() ? 'quonumber'
2915 2934
       : '';
2916 2935
}
2917 2936

  
......
2925 2944
    return $self->js->render();
2926 2945
  }
2927 2946

  
2928
  my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been saved')
2929
           : $self->type eq sales_order_type()        ? $::locale->text('The order confirmation has been saved')
2930
           : $self->type eq purchase_order_type()     ? $::locale->text('The order has been saved')
2931
           : $self->type eq sales_quotation_type()    ? $::locale->text('The quotation has been saved')
2932
           : $self->type eq request_quotation_type()  ? $::locale->text('The rfq has been saved')
2947
  my $text = $self->type eq sales_order_intake_type()        ? $::locale->text('The order intake has been saved')
2948
           : $self->type eq sales_order_type()               ? $::locale->text('The order confirmation has been saved')
2949
           : $self->type eq purchase_order_type()            ? $::locale->text('The order has been saved')
2950
           : $self->type eq sales_quotation_type()           ? $::locale->text('The quotation has been saved')
2951
           : $self->type eq request_quotation_type()         ? $::locale->text('The rfq has been saved')
2952
           : $self->type eq purchase_quotation_intake_type() ? $::locale->text('The quotation intake has been saved')
2933 2953
           : '';
2934 2954
  flash_later('info', $text);
2935 2955

  

Auch abrufbar als: Unified diff