Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 01738ec3

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 01738ec3125b2da5cad52dcb4493dcf35e19760b
  • Vorgänger 7b783822
  • Nachfolger deccb439

TypeData: nutzte Konstanten anstatt String für Typen

Unterschiede anzeigen:

SL/Controller/Order.pm
36 36
use SL::DB::Helper::RecordLink qw(set_record_link_conversions);
37 37
use SL::DB::Helper::TypeDataProxy;
38 38
use SL::Model::Record;
39
use SL::DB::Order::TypeData qw(:types);
40
use SL::DB::Reclamation::TypeData qw(:types);
39 41

  
40 42
use SL::Helper::CreatePDF qw(:all);
41 43
use SL::Helper::PrintOptions;
......
99 101

  
100 102
  my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
101 103
  my %params;
102
  my $target_type = $reclamation->is_sales ? 'sales_order'
103
                                           : 'purchase_order';
104
  my $target_type = $reclamation->is_sales ? SALES_ORDER_TYPE()
105
                                           : PURCHASE_ORDER_TYPE();
104 106
  my $order = SL::Model::Record->new_from_workflow($reclamation, $target_type);
105 107
  $self->{converted_from_reclamation_id} = $::form->{from_id};
106 108

  
......
197 199
  my ($self) = @_;
198 200

  
199 201
  SL::Model::Record->delete($self->order);
200
  my $text = $self->type eq sales_order_intake_type()        ? $::locale->text('The order intake has been deleted')
201
           : $self->type eq sales_order_type()               ? $::locale->text('The order confirmation has been deleted')
202
           : $self->type eq purchase_order_type()            ? $::locale->text('The order has been deleted')
203
           : $self->type eq sales_quotation_type()           ? $::locale->text('The quotation has been deleted')
204
           : $self->type eq request_quotation_type()         ? $::locale->text('The rfq has been deleted')
205
           : $self->type eq purchase_quotation_intake_type() ? $::locale->text('The quotation intake has been deleted')
202
  my $text = $self->type eq SALES_ORDER_INTAKE_TYPE()        ? $::locale->text('The order intake has been deleted')
203
           : $self->type eq SALES_ORDER_TYPE()               ? $::locale->text('The order confirmation has been deleted')
204
           : $self->type eq PURCHASE_ORDER_TYPE()            ? $::locale->text('The order has been deleted')
205
           : $self->type eq SALES_QUOTATION_TYPE()           ? $::locale->text('The quotation has been deleted')
206
           : $self->type eq REQUEST_QUOTATION_TYPE()         ? $::locale->text('The rfq has been deleted')
207
           : $self->type eq PURCHASE_QUOTATION_INTAKE_TYPE() ? $::locale->text('The quotation intake has been deleted')
206 208
           : '';
207 209
  flash_later('info', $text);
208 210

  
......
220 222

  
221 223
  $self->save();
222 224

  
223
  my $text = $self->type eq sales_order_intake_type()         ? $::locale->text('The order intake has been saved')
224
           : $self->type eq sales_order_type()                ? $::locale->text('The order confirmation has been saved')
225
           : $self->type eq purchase_order_type()             ? $::locale->text('The order has been saved')
226
           : $self->type eq sales_quotation_type()            ? $::locale->text('The quotation has been saved')
227
           : $self->type eq request_quotation_type()          ? $::locale->text('The rfq has been saved')
228
           : $self->type eq purchase_quotation_intake_type()  ? $::locale->text('The quotation intake has been saved')
225
  my $text = $self->type eq SALES_ORDER_INTAKE_TYPE()         ? $::locale->text('The order intake has been saved')
226
           : $self->type eq SALES_ORDER_TYPE()                ? $::locale->text('The order confirmation has been saved')
227
           : $self->type eq PURCHASE_ORDER_TYPE()             ? $::locale->text('The order has been saved')
228
           : $self->type eq SALES_QUOTATION_TYPE()            ? $::locale->text('The quotation has been saved')
229
           : $self->type eq REQUEST_QUOTATION_TYPE()          ? $::locale->text('The rfq has been saved')
230
           : $self->type eq PURCHASE_QUOTATION_INTAKE_TYPE()  ? $::locale->text('The quotation intake has been saved')
229 231
           : '';
230 232
  flash_later('info', $text);
231 233

  
......
752 754
  $config  ||= SL::DB::Manager::PeriodicInvoicesConfig->find_by(oe_id => $::form->{id}) if $::form->{id};
753 755

  
754 756
  my $has_active_periodic_invoices =
755
       $self->type eq sales_order_type()
757
       $self->type eq SALES_ORDER_TYPE()
756 758
    && $config
757 759
    && $config->active
758 760
    && (!$config->end_date || ($config->end_date > DateTime->today_local))
......
796 798
  # can't use save_and_redirect_to, because id is set!
797 799
  $self->save();
798 800

  
799
  my $to_type = $self->order->is_sales ? 'sales_reclamation'
800
                                       : 'purchase_reclamation';
801
  my $to_type = $self->order->is_sales ? SALES_RECLAMATION_TYPE()
802
                                       : PURCHASE_RECLAMATION_TYPE();
801 803
  $self->redirect_to(
802 804
    controller => 'Reclamation',
803 805
    action     => 'add_from_order',
......
865 867
  my $destination_type = $::form->{to_type} ? $::form->{to_type} : '';
866 868

  
867 869
  my $from_side        = $self->order->is_sales ? 'sales' : 'purchase';
868
  my $to_side          = (any { $destination_type eq $_ } (sales_order_intake_type(), sales_order_type(), sales_quotation_type())) ? 'sales' : 'purchase';
870
  my $to_side          = (any { $destination_type eq $_ } (SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE(), SALES_QUOTATION_TYPE())) ? 'sales' : 'purchase';
869 871

  
870 872
  # check for direct delivery
871 873
  # copy shipto in custom shipto (custom shipto will be copied by new_from() in case)
......
878 880
  $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
879 881

  
880 882
  # no linked records to quotations from the same side (sales -> sales or purchase -> purchase)
881
  if (    (any { $destination_type eq $_ } (sales_quotation_type(), request_quotation_type()))
883
  if (    (any { $destination_type eq $_ } (SALES_QUOTATION_TYPE(), REQUEST_QUOTATION_TYPE()))
882 884
       && $from_side eq $to_side) {
883 885
    delete $::form->{id};
884 886
    delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids);
......
1630 1632
#
1631 1633

  
1632 1634
sub init_valid_types {
1633
  [ sales_order_intake_type(), sales_order_type(), purchase_order_type(), sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type() ];
1635
  $_[0]->type_data->valid_types;
1634 1636
}
1635 1637

  
1636 1638
sub init_type {
......
1646 1648
sub init_cv {
1647 1649
  my ($self) = @_;
1648 1650

  
1649
  my $cv = (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(),       sales_quotation_type()))           ? 'customer'
1650
         : (any { $self->type eq $_ } (purchase_order_type(),     request_quotation_type(), purchase_quotation_intake_type())) ? 'vendor'
1651
  my $cv = (any { $self->type eq $_ } (SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE(),       SALES_QUOTATION_TYPE()))           ? 'customer'
1652
         : (any { $self->type eq $_ } (PURCHASE_ORDER_TYPE(),     REQUEST_QUOTATION_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE())) ? 'vendor'
1651 1653
         : die "Not a valid type for order";
1652 1654

  
1653 1655
  return $cv;
......
1707 1709
  my ($self) = @_;
1708 1710

  
1709 1711
  my $right_for = { map { $_ => $_.'_edit' . ' | ' . $_.'_view' } @{$self->valid_types} };
1710
  $right_for->{ sales_order_intake_type()        } = 'sales_order_edit | sales_order_view';
1711
  $right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit | request_quotation_view';
1712
  $right_for->{ SALES_ORDER_INTAKE_TYPE()        } = 'sales_order_edit | sales_order_view';
1713
  $right_for->{ PURCHASE_QUOTATION_INTAKE_TYPE() } = 'request_quotation_edit | request_quotation_view';
1712 1714

  
1713 1715
  my $right   = $right_for->{ $self->type };
1714 1716
  $right    ||= 'DOES_NOT_EXIST';
......
1720 1722
  my ($self) = @_;
1721 1723

  
1722 1724
  my $right_for = { map { $_ => $_.'_edit' } @{$self->valid_types} };
1723
  $right_for->{ sales_order_intake_type()        } = 'sales_order_edit';
1724
  $right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit';
1725
  $right_for->{ SALES_ORDER_INTAKE_TYPE()        } = 'sales_order_edit';
1726
  $right_for->{ PURCHASE_QUOTATION_INTAKE_TYPE() } = 'request_quotation_edit';
1725 1727

  
1726 1728
  my $right   = $right_for->{ $self->type };
1727 1729
  $right    ||= 'DOES_NOT_EXIST';
......
1871 1873
  my $order;
1872 1874
  $order   = SL::DB::Order->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
1873 1875
  $order ||= SL::DB::Order->new(orderitems  => [],
1874
                                quotation   => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type())),
1875
                                intake      => (any { $self->type eq $_ } (sales_order_intake_type(), purchase_quotation_intake_type())),
1876
                                quotation   => (any { $self->type eq $_ } (SALES_QUOTATION_TYPE(), REQUEST_QUOTATION_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE())),
1877
                                intake      => (any { $self->type eq $_ } (SALES_ORDER_INTAKE_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE())),
1876 1878
                                currency_id => $::instance_conf->get_currency_id(),);
1877 1879

  
1878 1880
  my $cv_id_method = $self->cv . '_id';
......
2199 2201
    $item->active_discount_source($price_source->discount_from_source($item->active_discount_source));
2200 2202
  }
2201 2203

  
2202
  if (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), purchase_order_type())) {
2204
  if (any { $self->type eq $_ } (SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE(), PURCHASE_ORDER_TYPE())) {
2203 2205
    # Calculate shipped qtys here to prevent calling calculate for every item via the items method.
2204 2206
    # Do not use write_to_objects to prevent order->delivered to be set, because this should be
2205 2207
    # the value from db, which can be set manually or is set when linked delivery orders are saved.
......
2218 2220
                                                } } @all_objects;
2219 2221
  }
2220 2222

  
2221
  if (   (any { $self->type eq $_ } (sales_quotation_type(), sales_order_intake_type(), sales_order_type()))
2223
  if (   (any { $self->type eq $_ } (SALES_QUOTATION_TYPE(), SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE()))
2222 2224
      && $::instance_conf->get_transport_cost_reminder_article_number_id ) {
2223 2225
    $self->{template_args}->{transport_cost_reminder_article} = SL::DB::Part->new(id => $::instance_conf->get_transport_cost_reminder_article_number_id)->load;
2224 2226
  }
......
2236 2238
sub setup_edit_action_bar {
2237 2239
  my ($self, %params) = @_;
2238 2240

  
2239
  my $deletion_allowed = (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type()))
2240
                      || (($self->type eq sales_order_type())        && $::instance_conf->get_sales_order_show_delete)
2241
                      || (($self->type eq sales_order_intake_type()) && $::instance_conf->get_sales_order_show_delete)
2242
                      || (($self->type eq purchase_order_type())     && $::instance_conf->get_purchase_order_show_delete);
2241
  my $deletion_allowed = (any { $self->type eq $_ } (SALES_QUOTATION_TYPE(), REQUEST_QUOTATION_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE()))
2242
                      || (($self->type eq SALES_ORDER_TYPE())        && $::instance_conf->get_sales_order_show_delete)
2243
                      || (($self->type eq SALES_ORDER_INTAKE_TYPE()) && $::instance_conf->get_sales_order_show_delete)
2244
                      || (($self->type eq PURCHASE_ORDER_TYPE())     && $::instance_conf->get_purchase_order_show_delete);
2243 2245

  
2244 2246
  my @req_trans_cost_art = qw(kivi.Order.check_transport_cost_article_presence) x!!$::instance_conf->get_transport_cost_reminder_article_number_id;
2245
  my @req_cusordnumber   = qw(kivi.Order.check_cusordnumber_presence)           x(( any {$self->type eq $_} (sales_order_intake_type(), sales_order_type()) ) && $::instance_conf->get_order_warn_no_cusordnumber);
2247
  my @req_cusordnumber   = qw(kivi.Order.check_cusordnumber_presence)           x(( any {$self->type eq $_} (SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE()) ) && $::instance_conf->get_order_warn_no_cusordnumber);
2246 2248

  
2247 2249
  my $has_invoice_for_advance_payment;
2248
  if ($self->order->id && $self->type eq sales_order_type()) {
2250
  if ($self->order->id && $self->type eq SALES_ORDER_TYPE()) {
2249 2251
    my $lr = $self->order->linked_records(direction => 'to', to => ['Invoice']);
2250 2252
    $has_invoice_for_advance_payment = any {'SL::DB::Invoice' eq ref $_ && "invoice_for_advance_payment" eq $_->type} @$lr;
2251 2253
  }
2252 2254

  
2253 2255
  my $has_final_invoice;
2254
  if ($self->order->id && $self->type eq sales_order_type()) {
2256
  if ($self->order->id && $self->type eq SALES_ORDER_TYPE()) {
2255 2257
    my $lr = $self->order->linked_records(direction => 'to', to => ['Invoice']);
2256 2258
    $has_final_invoice               = any {'SL::DB::Invoice' eq ref $_ && "final_invoice" eq $_->type} @$lr;
2257 2259
  }
2258 2260

  
2259 2261
  my $right_for         = { map { $_ => $_.'_edit' } @{$self->valid_types} };
2260
  $right_for->{ sales_order_intake_type() } = 'sales_order_edit';
2261
  $right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit';
2262
  $right_for->{ SALES_ORDER_INTAKE_TYPE() } = 'sales_order_edit';
2263
  $right_for->{ PURCHASE_QUOTATION_INTAKE_TYPE() } = 'request_quotation_edit';
2262 2264
  my $right             = $right_for->{ $self->type };
2263 2265
  $right              ||= 'DOES_NOT_EXIST';
2264 2266
  my $may_edit_create   = $::auth->assert($right, 'may fail');
......
2321 2323
        ],
2322 2324
        action => [
2323 2325
          t8('Save and Quotation'),
2324
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_quotation_type()), '#order_form' ],
2326
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => SALES_QUOTATION_TYPE()), '#order_form' ],
2325 2327
          checks   => [ @req_trans_cost_art, @req_cusordnumber ],
2326
          only_if  => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type(), purchase_quotation_intake_type())),
2328
          only_if  => (any { $self->type eq $_ } (SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE(), REQUEST_QUOTATION_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE())),
2327 2329
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2328 2330
        ],
2329 2331
        action => [
2330 2332
          t8('Save and RFQ'),
2331
          call     => [ 'kivi.Order.purchase_check_for_direct_delivery', { to_type => request_quotation_type() } ],
2332
          only_if  => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), sales_quotation_type(), purchase_order_type())),
2333
          call     => [ 'kivi.Order.purchase_check_for_direct_delivery', { to_type => REQUEST_QUOTATION_TYPE() } ],
2334
          only_if  => (any { $self->type eq $_ } (SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE(), SALES_QUOTATION_TYPE(), PURCHASE_ORDER_TYPE())),
2333 2335
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2334 2336
        ],
2335 2337
        action => [
2336 2338
          t8('Save and Purchase Quotation Intake'),
2337
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => purchase_quotation_intake_type()), '#order_form' ],
2338
          only_if  => (any { $self->type eq $_ } (request_quotation_type())),
2339
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => PURCHASE_QUOTATION_INTAKE_TYPE()), '#order_form' ],
2340
          only_if  => (any { $self->type eq $_ } (REQUEST_QUOTATION_TYPE())),
2339 2341
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2340 2342
        ],
2341 2343
        action => [
2342 2344
          t8('Save and Sales Order Intake'),
2343
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_order_intake_type()), '#order_form' ],
2344
          only_if  => (any { $self->type eq $_ } (sales_quotation_type())),
2345
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => SALES_ORDER_INTAKE_TYPE()), '#order_form' ],
2346
          only_if  => (any { $self->type eq $_ } (SALES_QUOTATION_TYPE())),
2345 2347
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2346 2348
        ],
2347 2349
        action => [
2348 2350
          t8('Save and Sales Order Confirmation'),
2349
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_order_type()), '#order_form' ],
2351
          call     => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => SALES_ORDER_TYPE()), '#order_form' ],
2350 2352
          checks   => [ @req_trans_cost_art ],
2351
          only_if  => (any { $self->type eq $_ } (sales_quotation_type(), sales_order_intake_type(), request_quotation_type(), purchase_order_type(), purchase_quotation_intake_type())),
2353
          only_if  => (any { $self->type eq $_ } (SALES_QUOTATION_TYPE(), SALES_ORDER_INTAKE_TYPE(), REQUEST_QUOTATION_TYPE(), PURCHASE_ORDER_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE())),
2352 2354
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2353 2355
        ],
2354 2356
        action => [
2355 2357
          t8('Save and Purchase Order'),
2356
          call      => [ 'kivi.Order.purchase_check_for_direct_delivery', { to_type => purchase_order_type() } ],
2358
          call      => [ 'kivi.Order.purchase_check_for_direct_delivery', { to_type => PURCHASE_ORDER_TYPE() } ],
2357 2359
          checks    => [ @req_trans_cost_art, @req_cusordnumber ],
2358
          only_if   => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type(), purchase_quotation_intake_type())),
2360
          only_if   => (any { $self->type eq $_ } (SALES_ORDER_INTAKE_TYPE(), SALES_ORDER_TYPE(), REQUEST_QUOTATION_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE())),
2359 2361
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2360 2362
        ],
2361 2363
        action => [
......
2367 2369
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2368 2370
                         @req_trans_cost_art, @req_cusordnumber,
2369 2371
          ],
2370
          only_if   => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type())),
2372
          only_if   => (any { $self->type eq $_ } (SALES_ORDER_TYPE(), PURCHASE_ORDER_TYPE())),
2371 2373
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2372 2374
        ],
2373 2375
        action => [
......
2390 2392
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2391 2393
                         @req_trans_cost_art, @req_cusordnumber,
2392 2394
          ],
2393
          only_if   => (any { $self->type eq $_ } (purchase_order_type())),
2395
          only_if   => (any { $self->type eq $_ } (PURCHASE_ORDER_TYPE())),
2394 2396
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2395 2397
        ],
2396 2398
        action => [
......
2398 2400
          call      => [ 'kivi.Order.save', { action             => 'save_and_reclamation',
2399 2401
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2400 2402
          ],
2401
          only_if   => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type()))
2403
          only_if   => (any { $self->type eq $_ } (SALES_ORDER_TYPE(), PURCHASE_ORDER_TYPE()))
2402 2404
        ],
2403 2405
        action => [
2404 2406
          t8('Save and Invoice'),
......
2409 2411
                         @req_trans_cost_art, @req_cusordnumber,
2410 2412
          ],
2411 2413
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2412
          not_if    => (any { $self->type eq $_ } (sales_order_intake_type(), purchase_quotation_intake_type())),
2414
          not_if    => (any { $self->type eq $_ } (SALES_ORDER_INTAKE_TYPE(), PURCHASE_QUOTATION_INTAKE_TYPE())),
2413 2415
        ],
2414 2416
        action => [
2415 2417
          ($has_invoice_for_advance_payment ? t8('Save and Further Invoice for Advance Payment') : t8('Save and Invoice for Advance Payment')),
......
2422 2424
          disabled  => !$may_edit_create  ? t8('You do not have the permissions to access this function.')
2423 2425
                     : $has_final_invoice ? t8('This order has already a final invoice.')
2424 2426
                     :                      undef,
2425
          only_if   => (any { $self->type eq $_ } (sales_order_type())),
2427
          only_if   => (any { $self->type eq $_ } (SALES_ORDER_TYPE())),
2426 2428
        ],
2427 2429
        action => [
2428 2430
          t8('Save and Final Invoice'),
......
2435 2437
          disabled  => !$may_edit_create  ? t8('You do not have the permissions to access this function.')
2436 2438
                     : $has_final_invoice ? t8('This order has already a final invoice.')
2437 2439
                     :                      undef,
2438
          only_if   => (any { $self->type eq $_ } (sales_order_type())) && $has_invoice_for_advance_payment,
2440
          only_if   => (any { $self->type eq $_ } (SALES_ORDER_TYPE())) && $has_invoice_for_advance_payment,
2439 2441
        ],
2440 2442
        action => [
2441 2443
          t8('Save and AP Transaction'),
2442 2444
          call      => [ 'kivi.Order.save', { action             => 'save_and_ap_transaction',
2443 2445
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2444 2446
          ],
2445
          only_if   => (any { $self->type eq $_ } (purchase_order_type())),
2447
          only_if   => (any { $self->type eq $_ } (PURCHASE_ORDER_TYPE())),
2446 2448
          disabled  => !$may_edit_create  ? t8('You do not have the permissions to access this function.') : undef,
2447 2449
        ],
2448 2450

  
......
2632 2634
sub get_periodic_invoices_status {
2633 2635
  my ($self, $config) = @_;
2634 2636

  
2635
  return                      if $self->type ne sales_order_type();
2637
  return                      if $self->type ne SALES_ORDER_TYPE();
2636 2638
  return t8('not configured') if !$config;
2637 2639

  
2638 2640
  my $active = ('HASH' eq ref $config)                           ? $config->{active}
......
2662 2664
  # $::locale->text("Edit Purchase Quotation Intake");
2663 2665

  
2664 2666
  $action = ucfirst(lc($action));
2665
  return $self->type eq sales_order_intake_type()        ? $::locale->text("$action Sales Order Intake")
2666
       : $self->type eq sales_order_type()               ? $::locale->text("$action Sales Order")
2667
       : $self->type eq purchase_order_type()            ? $::locale->text("$action Purchase Order")
2668
       : $self->type eq sales_quotation_type()           ? $::locale->text("$action Quotation")
2669
       : $self->type eq request_quotation_type()         ? $::locale->text("$action Request for Quotation")
2670
       : $self->type eq purchase_quotation_intake_type() ? $::locale->text("$action Purchase Quotation Intake")
2667
  return $self->type eq SALES_ORDER_INTAKE_TYPE()        ? $::locale->text("$action Sales Order Intake")
2668
       : $self->type eq SALES_ORDER_TYPE()               ? $::locale->text("$action Sales Order")
2669
       : $self->type eq PURCHASE_ORDER_TYPE()            ? $::locale->text("$action Purchase Order")
2670
       : $self->type eq SALES_QUOTATION_TYPE()           ? $::locale->text("$action Quotation")
2671
       : $self->type eq REQUEST_QUOTATION_TYPE()         ? $::locale->text("$action Request for Quotation")
2672
       : $self->type eq PURCHASE_QUOTATION_INTAKE_TYPE() ? $::locale->text("$action Purchase Quotation Intake")
2671 2673
       : '';
2672 2674
}
2673 2675

  
......
2745 2747
  return ($price_src, $discount_src);
2746 2748
}
2747 2749

  
2748
sub sales_order_intake_type {
2749
  'sales_order_intake';
2750
}
2751

  
2752
sub sales_order_type {
2753
  'sales_order';
2754
}
2755

  
2756
sub purchase_order_type {
2757
  'purchase_order';
2758
}
2759

  
2760
sub sales_quotation_type {
2761
  'sales_quotation';
2762
}
2763

  
2764
sub request_quotation_type {
2765
  'request_quotation';
2766
}
2767

  
2768
sub purchase_quotation_intake_type {
2769
  'purchase_quotation_intake';
2770
}
2771

  
2772 2750
sub nr_key {
2773
  return $_[0]->type eq sales_order_intake_type()        ? 'ordnumber'
2774
       : $_[0]->type eq sales_order_type()               ? 'ordnumber'
2775
       : $_[0]->type eq purchase_order_type()            ? 'ordnumber'
2776
       : $_[0]->type eq sales_quotation_type()           ? 'quonumber'
2777
       : $_[0]->type eq request_quotation_type()         ? 'quonumber'
2778
       : $_[0]->type eq purchase_quotation_intake_type() ? 'quonumber'
2751
  return $_[0]->type eq SALES_ORDER_INTAKE_TYPE()        ? 'ordnumber'
2752
       : $_[0]->type eq SALES_ORDER_TYPE()               ? 'ordnumber'
2753
       : $_[0]->type eq PURCHASE_ORDER_TYPE()            ? 'ordnumber'
2754
       : $_[0]->type eq SALES_QUOTATION_TYPE()           ? 'quonumber'
2755
       : $_[0]->type eq REQUEST_QUOTATION_TYPE()         ? 'quonumber'
2756
       : $_[0]->type eq PURCHASE_QUOTATION_INTAKE_TYPE() ? 'quonumber'
2779 2757
       : '';
2780 2758
}
2781 2759

  
......
2784 2762

  
2785 2763
  $self->save();
2786 2764

  
2787
  my $text = $self->type eq sales_order_intake_type()        ? $::locale->text('The order intake has been saved')
2788
           : $self->type eq sales_order_type()               ? $::locale->text('The order confirmation has been saved')
2789
           : $self->type eq purchase_order_type()            ? $::locale->text('The order has been saved')
2790
           : $self->type eq sales_quotation_type()           ? $::locale->text('The quotation has been saved')
2791
           : $self->type eq request_quotation_type()         ? $::locale->text('The rfq has been saved')
2792
           : $self->type eq purchase_quotation_intake_type() ? $::locale->text('The quotation intake has been saved')
2765
  my $text = $self->type eq SALES_ORDER_INTAKE_TYPE()        ? $::locale->text('The order intake has been saved')
2766
           : $self->type eq SALES_ORDER_TYPE()               ? $::locale->text('The order confirmation has been saved')
2767
           : $self->type eq PURCHASE_ORDER_TYPE()            ? $::locale->text('The order has been saved')
2768
           : $self->type eq SALES_QUOTATION_TYPE()           ? $::locale->text('The quotation has been saved')
2769
           : $self->type eq REQUEST_QUOTATION_TYPE()         ? $::locale->text('The rfq has been saved')
2770
           : $self->type eq PURCHASE_QUOTATION_INTAKE_TYPE() ? $::locale->text('The quotation intake has been saved')
2793 2771
           : '';
2794 2772
  flash_later('info', $text);
2795 2773

  

Auch abrufbar als: Unified diff