Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 037f501d

Von Bernd Bleßmann vor etwa 1 Jahr 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

  
SL/DB/Order.pm
143 143
sub type {
144 144
  my $self = shift;
145 145

  
146
  return 'sales_order_intake' if $self->customer_id &&   $self->intake;
147
  return 'sales_order'        if $self->customer_id && ! $self->quotation;
148
  return 'purchase_order'     if $self->vendor_id   && ! $self->quotation;
149
  return 'sales_quotation'    if $self->customer_id &&   $self->quotation;
150
  return 'request_quotation'  if $self->vendor_id   &&   $self->quotation;
146
  return 'sales_order_intake'        if $self->customer_id &&   $self->intake;
147
  return 'sales_order'               if $self->customer_id && ! $self->quotation;
148
  return 'purchase_order'            if $self->vendor_id   && ! $self->quotation;
149
  return 'sales_quotation'           if $self->customer_id &&   $self->quotation;
150
  return 'request_quotation'         if $self->vendor_id   &&   $self->quotation  && ! $self->intake;
151
  return 'purchase_quotation_intake' if $self->vendor_id   &&   $self->quotation  &&   $self->intake;
151 152

  
152 153
  return;
153 154
}
js/kivi.Order.js
860 860
    var number_info = '';
861 861
    if ($('#type').val() == 'sales_order_intake' || $('#type').val() == 'sales_order' || $('#type').val() == 'purchase_order') {
862 862
      number_info = $('#order_ordnumber').val();
863
    } else if ($('#type').val() == 'sales_quotation' || $('#type').val() == 'request_quotation') {
863
    } else if ($('#type').val() == 'sales_quotation' || $('#type').val() == 'request_quotation' || $('#type').val() == 'purchase_quotation_intake') {
864 864
      number_info = $('#order_quonumber').val();
865 865
    }
866 866

  
867 867
    var name_info = '';
868 868
    if ($('#type').val() == 'sales_order_intake' || $('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation') {
869 869
      name_info = $('#order_customer_id_name').val();
870
    } else if ($('#type').val() == 'purchase_order' || $('#type').val() == 'request_quotation') {
870
    } else if ($('#type').val() == 'purchase_order' || $('#type').val() == 'request_quotation' || $('#type').val() == 'purchase_quotation_intake') {
871 871
      name_info = $('#order_vendor_id_name').val();
872 872
    }
873 873

  
menus/user/90-purchase-quotation-intake.yaml
1
- parent: ap
2
  id: ap_add_purchase_quotation_intake_experimental
3
  name: Add Purchase Quotation Intake
4
  icon: rfq_add
5
  order: 150
6
  access: request_quotation_edit & client/feature_experimental_order
7
  params:
8
    action: Order/add
9
    type: purchase_quotation_intake
10
- parent: ap_reports
11
  id: ap_reports_purchase_quotation_intakes
12
  name: Purchase Quotation Intakes
13
  icon: rfq_report
14
  order: 150
15
  access: request_quotation_edit | request_quotation_view
16
  module: oe.pl
17
  params:
18
    action: search
19
    type: purchase_quotation_intake
templates/design40_webpages/order/tabs/_price_sources_dialog.html
8 8
[% IF (FORM.type == "sales_order" || FORM.type == "sales_order_intake" || FORM.type == "sales_quotation") %]
9 9
  [% SET price_editable = AUTH.assert('sales_edit_prices', 1) %]
10 10
[% END %]
11
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation") %]
11
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation" || FORM.type == "purchase_quotation_intake") %]
12 12
  [% SET price_editable = AUTH.assert('purchase_edit_prices', 1) %]
13 13
[% END %]
14 14
[% SET exfactor = price_source.record.exchangerate ? 1 / price_source.record.exchangerate : 1 %]
templates/design40_webpages/order/tabs/_row.html
95 95
    [% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") %]
96 96
      [% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('sales_edit_prices', 1) %]
97 97
    [% END %]
98
    [% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation") %]
98
    [% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation" || SELF.type == "purchase_quotation_intake") %]
99 99
      [% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('purchase_edit_prices', 1) %]
100 100
    [% END %]
101 101
    <td>
templates/design40_webpages/order/tabs/basic_data.html
250 250
        </td>
251 251
      </tr>
252 252
    [% END %]
253
    [% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") %]
253
    [% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") %]
254 254
      [% SET quo_nr_txt = 'Quotation Number' %]
255 255
    [% ELSE %]
256 256
      [% SET quo_nr_txt = 'RFQ Number' %]
......
278 278
    [% END %]
279 279
    [% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "purchase_order") %]
280 280
      [% SET transdate_txt = 'Order Date' %]
281
    [% ELSIF SELF.type == "sales_quotation" %]
281
    [% ELSIF (SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") %]
282 282
      [% SET transdate_txt = 'Quotation Date' %]
283 283
    [% ELSE %]
284 284
      [% SET transdate_txt = 'RFQ Date' %]
......
376 376
    [% PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id) %]
377 377
  [% END %]
378 378
  <tfoot>
379
    [% IF (SELF.type == "sales_quotation") || (SELF.type == "request_quotation") %]
379
    [% IF (SELF.type == "sales_quotation") || (SELF.type == "request_quotation")  || (SELF.type == "purchase_quotation_intake") %]
380 380
      [% SET add_col = 0 %]
381 381
    [% ELSE %]
382 382
      [% SET add_col = 1 %]
templates/webpages/order/tabs/_price_sources_dialog.html
8 8
[% IF (FORM.type == "sales_order" || FORM.type == "sales_order_intake" || FORM.type == "sales_quotation") %]
9 9
  [% SET price_editable = AUTH.assert('sales_edit_prices', 1) %]
10 10
[% END %]
11
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation") %]
11
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation" || FORM.type == "purchase_quotation_intake") %]
12 12
  [% SET price_editable = AUTH.assert('purchase_edit_prices', 1) %]
13 13
[% END %]
14 14
[% SET exfactor = price_source.record.exchangerate ? 1 / price_source.record.exchangerate : 1 %]
templates/webpages/order/tabs/_row.html
103 103
    [% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") %]
104 104
      [% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('sales_edit_prices', 1) %]
105 105
    [% END %]
106
    [% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation") %]
106
    [% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation" || SELF.type == "purchase_quotation_intake") %]
107 107
      [% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('purchase_edit_prices', 1) %]
108 108
    [% END %]
109 109
    <td>
templates/webpages/order/tabs/basic_data.html
192 192
          </tr>
193 193
          [%- END -%]
194 194

  
195
          [%- IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") -%]
195
          [%- IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") -%]
196 196
            [%- SET quo_nr_txt = 'Quotation Number' -%]
197 197
          [%- ELSE -%]
198 198
            [%- SET quo_nr_txt = 'RFQ Number' -%]
......
222 222

  
223 223
          [%- IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
224 224
            [%- SET transdate_txt = 'Order Date' -%]
225
          [%- ELSIF SELF.type == "sales_quotation" -%]
225
          [%- ELSIF (SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") -%]
226 226
            [%- SET transdate_txt = 'Quotation Date' -%]
227 227
          [%- ELSE -%]
228 228
            [%- SET transdate_txt = 'RFQ Date' -%]

Auch abrufbar als: Unified diff