Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9ce44b6f

Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt

  • ID 9ce44b6f09f77fc51a69e4536fa44dee68d0ab85
  • Vorgänger 6b50c021
  • Nachfolger 5c8a0b36

Auftrags-Controller: Warnung bei fehlendem Transportkosten-Artikel …

bei VK-Angebot und -Auftrag, wenn in der Mandanten-Konfiguration angegeben.

Unterschiede anzeigen:

SL/Controller/Order.pm
1873 1873
                                                } } @all_objects;
1874 1874
  }
1875 1875

  
1876
  if (   (any { $self->type eq $_ } (sales_quotation_type(), sales_order_type()))
1877
      && $::instance_conf->get_transport_cost_reminder_article_number_id ) {
1878
    $self->{template_args}->{transport_cost_reminder_article} = SL::DB::Part->new(id => $::instance_conf->get_transport_cost_reminder_article_number_id)->load;
1879
  }
1880

  
1876 1881
  $self->get_item_cvpartnumber($_) for @{$self->order->items_sorted};
1877 1882

  
1878 1883
  $::request->{layout}->use_javascript("${_}.js") for qw(kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery
......
1887 1892
                      || (($self->type eq sales_order_type())    && $::instance_conf->get_sales_order_show_delete)
1888 1893
                      || (($self->type eq purchase_order_type()) && $::instance_conf->get_purchase_order_show_delete);
1889 1894

  
1895
  my @req_trans_cost_art = qw(kivi.Order.check_transport_cost_article_presence) x!!$::instance_conf->get_transport_cost_reminder_article_number_id;
1896

  
1890 1897
  for my $bar ($::request->layout->get('actionbar')) {
1891 1898
    $bar->add(
1892 1899
      combobox => [
......
1895 1902
          call      => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts,
1896 1903
                                                    $::instance_conf->get_order_warn_no_deliverydate,
1897 1904
                                                                                                      ],
1898
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'] ],
1905
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'], @req_trans_cost_art ],
1899 1906
        ],
1900 1907
        action => [
1901 1908
          t8('Save as new'),
1902 1909
          call      => [ 'kivi.Order.save', 'save_as_new', $::instance_conf->get_order_warn_duplicate_parts ],
1903
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
1910
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', @req_trans_cost_art ],
1904 1911
          disabled  => !$self->order->id ? t8('This object has not been saved yet.') : undef,
1905 1912
        ],
1906 1913
      ], # end of combobox "Save"
......
1912 1919
        action => [
1913 1920
          t8('Save and Quotation'),
1914 1921
          submit   => [ '#order_form', { action => "Order/sales_quotation" } ],
1922
          checks   => [ @req_trans_cost_art ],
1915 1923
          only_if  => (any { $self->type eq $_ } (sales_order_type())),
1916 1924
        ],
1917 1925
        action => [
......
1922 1930
        action => [
1923 1931
          t8('Save and Sales Order'),
1924 1932
          submit   => [ '#order_form', { action => "Order/sales_order" } ],
1933
          checks   => [ @req_trans_cost_art ],
1925 1934
          only_if  => (any { $self->type eq $_ } (sales_quotation_type(), purchase_order_type())),
1926 1935
        ],
1927 1936
        action => [
1928 1937
          t8('Save and Purchase Order'),
1929 1938
          call      => [ 'kivi.Order.purchase_order_check_for_direct_delivery' ],
1939
          checks    => [ @req_trans_cost_art ],
1930 1940
          only_if   => (any { $self->type eq $_ } (sales_order_type(), request_quotation_type())),
1931 1941
        ],
1932 1942
        action => [
......
1934 1944
          call      => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts,
1935 1945
                                                                       $::instance_conf->get_order_warn_no_deliverydate,
1936 1946
                                                                                                                        ],
1937
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
1947
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', @req_trans_cost_art ],
1938 1948
          only_if   => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type()))
1939 1949
        ],
1940 1950
        action => [
1941 1951
          t8('Save and Invoice'),
1942 1952
          call      => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
1943
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
1953
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', @req_trans_cost_art ],
1944 1954
        ],
1945 1955
        action => [
1946 1956
          t8('Save and AP Transaction'),
......
1956 1966
        ],
1957 1967
        action => [
1958 1968
          t8('Save and preview PDF'),
1959
           call => [ 'kivi.Order.save', 'preview_pdf', $::instance_conf->get_order_warn_duplicate_parts,
1960
                                                       $::instance_conf->get_order_warn_no_deliverydate,
1961
                                                                                                         ],
1969
          call   => [ 'kivi.Order.save', 'preview_pdf', $::instance_conf->get_order_warn_duplicate_parts,
1970
                                                        $::instance_conf->get_order_warn_no_deliverydate,
1971
                    ],
1972
          checks => [ @req_trans_cost_art ],
1962 1973
        ],
1963 1974
        action => [
1964 1975
          t8('Save and print'),
1965
          call => [ 'kivi.Order.show_print_options', $::instance_conf->get_order_warn_duplicate_parts,
1966
                                                     $::instance_conf->get_order_warn_no_deliverydate,
1967
                                                                                                      ],
1976
          call   => [ 'kivi.Order.show_print_options', $::instance_conf->get_order_warn_duplicate_parts,
1977
                                                       $::instance_conf->get_order_warn_no_deliverydate,
1978
                    ],
1979
          checks => [ @req_trans_cost_art ],
1968 1980
        ],
1969 1981
        action => [
1970 1982
          t8('Save and E-mail'),
......
2416 2428
=item * optional client/user behaviour
2417 2429

  
2418 2430
(transactions has to be set - department has to be set -
2419
 force project if enabled in client config - transport cost reminder)
2431
 force project if enabled in client config)
2420 2432

  
2421 2433
=back
2422 2434

  
js/kivi.Order.js
844 844
    $.post("controller.pl", data, kivi.eval_json_result);
845 845
  };
846 846

  
847
  ns.check_transport_cost_article_presence = function() {
848
    var $form          = $('#order_form');
849
    var wanted_part_id = $form.data('transport-cost-reminder-article-id');
850

  
851
    if (!wanted_part_id) return true
852

  
853
    var id_arr = $('[name="order.orderitems[].parts_id"]').map(function() { return this.value; }).get();
854
    id_arr = $.grep(id_arr, function(elt) {
855
      return ((elt*1) === wanted_part_id);
856
    });
857

  
858
    if (id_arr.length) return true;
859

  
860
    var description = $form.data('transport-cost-reminder-article-description');
861
    return confirm(kivi.t8("The transport cost article '#1' is missing. Do you want to continue anyway?", [ description ]));
862
  };
863

  
847 864
});
848 865

  
849 866
$(function() {
templates/webpages/order/form.html
15 15

  
16 16
<div id="shipto_dialog" class="hidden"></div>
17 17

  
18
<form method="post" action="controller.pl" id="order_form">
18
<form method="post" action="controller.pl" id="order_form"
19
      data-transport-cost-reminder-article-id="[% HTML.escape(transport_cost_reminder_article.id) %]"
20
      data-transport-cost-reminder-article-description="[% HTML.escape(transport_cost_reminder_article.displayable_name) %]">
19 21
  [% L.hidden_tag('callback',             FORM.callback) %]
20 22
  [% L.hidden_tag('type',                 FORM.type) %]
21 23
  [% L.hidden_tag('id',                   SELF.order.id) %]

Auch abrufbar als: Unified diff