Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 03f99ac0

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 03f99ac07f3fb178e2848e5a1db14c85dbbf72ee
  • Vorgänger a3844d90
  • Nachfolger 5c4d0dd6

Records: js-save Aufrufe angepasst und vereinheitlicht

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1764 1764
        action => [
1765 1765
          t8('Save'),
1766 1766
          id       => 'save_action',
1767
          call     => [ 'kivi.DeliveryOrder.save', { action             => 'save',
1768
                                                     warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1769
                                                     warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
1770
          ],
1767
          call     => [ 'kivi.DeliveryOrder.save', {
1768
              action             => 'save',
1769
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1770
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
1771
            }],
1771 1772
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
1772 1773
                    : $self->order->delivered ? t8('This record has already been delivered.')
1773 1774
                    :                        undef,
1774 1775
        ],
1775 1776
        action => [
1776 1777
          t8('Save as new'),
1777
          call     => [ 'kivi.DeliveryOrder.save', { action             => 'save_as_new',
1778
                                                     warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
1779
          ],
1778
          call     => [ 'kivi.DeliveryOrder.save', {
1779
              action             => 'save_as_new',
1780
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1781
            }],
1780 1782
          disabled => !$may_edit_create                        ? t8('You do not have the permissions to access this function.')
1781 1783
                    : $self->type eq 'supplier_delivery_order' ? t8('Need a workflow for Supplier Delivery Order')
1782 1784
                    : $self->type eq 'rma_delivery_order'      ? t8('Need a workflow for RMA Delivery Order.')
......
1815 1817
        ],
1816 1818
        action => [
1817 1819
          t8('Save and Delivery Order'),
1818
          call     => [ 'kivi.DeliveryOrder.save', { action             => 'save_and_delivery_order',
1819
                                                     warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1820
                                                     warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
1821
          ],
1820
          call     => [ 'kivi.DeliveryOrder.save', {
1821
              action             => 'save_and_delivery_order',
1822
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1823
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
1824
            }],
1822 1825
          only_if  => $self->type_data->show_menu("save_and_delivery_order"),
1823 1826
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
1824 1827
        ],
1825 1828
        action => [
1826 1829
          t8('Save and Invoice'),
1827
          call     => [ 'kivi.DeliveryOrder.save', { action             => 'save_and_invoice',
1828
                                                     warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
1829
          ],
1830
          call     => [ 'kivi.DeliveryOrder.save', {
1831
              action             => 'save_and_invoice',
1832
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1833
            }],
1830 1834
          only_if  => $self->type_data->show_menu("save_and_invoice"),
1831 1835
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
1832 1836
        ],
1833 1837
        action => [
1834 1838
          t8('Save and AP Transaction'),
1835
          call     => [ 'kivi.DeliveryOrder.save', { action             => 'save_and_ap_transaction',
1836
                                                     warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
1837
          ],
1839
          call     => [ 'kivi.DeliveryOrder.save', {
1840
              action             => 'save_and_ap_transaction',
1841
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1842
            }],
1838 1843
          only_if  => $self->type_data->show_menu("save_and_ap_transaction"),
1839 1844
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
1840 1845
        ],
......
1847 1852
        ],
1848 1853
        action => [
1849 1854
          t8('Save and preview PDF'),
1850
           call    => [ 'kivi.DeliveryOrder.save', { action             => 'preview_pdf',
1851
                                                     warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1852
                                                     warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
1853
          ],
1855
           call    => [ 'kivi.DeliveryOrder.save', {
1856
               action             => 'preview_pdf',
1857
               warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1858
               warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
1859
             }],
1854 1860
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
1855 1861
        ],
1856 1862
        action => [
......
1863 1869
        action => [
1864 1870
          t8('Save and E-mail'),
1865 1871
          id       => 'save_and_email_action',
1866
          call     => [ 'kivi.DeliveryOrder.save', { action             => 'save_and_show_email_dialog',
1867
                                                     warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1868
                                                     warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
1869
          ],
1872
          call     => [ 'kivi.DeliveryOrder.save', {
1873
              action             => 'save_and_show_email_dialog',
1874
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
1875
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
1876
            }],
1870 1877
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
1871 1878
                    : !$self->order->id ? t8('This object has not been saved yet.')
1872 1879
                    :                     undef,
......
1897 1904
        action => [
1898 1905
          t8('Transfer out'),
1899 1906
          id       => 'transfer_out_action',
1900
          call     => [ 'kivi.DeliveryOrder.save', { action => 'transfer_stock' } ],
1907
          call     => [ 'kivi.DeliveryOrder.save', {
1908
              action => 'transfer_stock',
1909
            }],
1901 1910
          disabled => !$may_edit_create       ? t8('You do not have the permissions to access this function.')
1902 1911
                    : !$self->order->id       ? t8('This object has not been saved yet.')
1903 1912
                    : $self->order->delivered ? t8('The parts for this order have already been transferred')
......
1908 1917
        action => [
1909 1918
          t8('Transfer in'),
1910 1919
          id       => 'transfer_in_action',
1911
          call     => [ 'kivi.DeliveryOrder.save', { action => 'transfer_stock' } ],
1920
          call     => [ 'kivi.DeliveryOrder.save', {
1921
              action => 'transfer_stock',
1922
            }],
1912 1923
          disabled => !$may_edit_create       ? t8('You do not have the permissions to access this function.')
1913 1924
                    : !$self->order->id       ? t8('This object has not been saved yet.')
1914 1925
                    : $self->order->delivered ? t8('The parts for this order have already been transferred')
......
1919 1930
        action => [
1920 1931
          t8('Undo Transfer'),
1921 1932
          id       => 'undo_transfer_action',
1922
          call     => [ 'kivi.DeliveryOrder.save', { action => 'undo_transfers' } ],
1933
          call     => [ 'kivi.DeliveryOrder.save', {
1934
              action => 'undo_transfers',
1935
            }],
1923 1936
          disabled => !$may_edit_create       ? t8('You do not have the permissions to access this function.')
1924 1937
                    : !$self->order->id       ? t8('This object has not been saved yet.')
1925 1938
                    : undef,
SL/Controller/Order.pm
38 38
use SL::DB::Helper::Record qw(get_object_name_from_type get_class_from_type);
39 39
use SL::Model::Record;
40 40
use SL::DB::Order::TypeData qw(:types);
41
use SL::DB::DeliveryOrder::TypeData qw(:types);
41 42
use SL::DB::Reclamation::TypeData qw(:types);
42 43

  
43 44
use SL::Helper::CreatePDF qw(:all);
......
2228 2229
      combobox => [
2229 2230
        action => [
2230 2231
          t8('Save'),
2231
          call      => [ 'kivi.Order.save', { action             => 'save',
2232
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2233
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2234
          ],
2232
          call      => [ 'kivi.Order.save', {
2233
              action             => 'save',
2234
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2235
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2236
            }],
2235 2237
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'],
2236 2238
                         @req_trans_cost_art, @req_cusordnumber,
2237 2239
          ],
......
2240 2242
        ],
2241 2243
        action => [
2242 2244
          t8('Save and Close'),
2243
          call      => [ 'kivi.Order.save', { action             => 'save',
2244
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2245
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2246
                                              back_to_caller     => 1 },
2247
          ],
2245
          call      => [ 'kivi.Order.save', {
2246
              action             => 'save',
2247
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2248
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2249
              form_params        => [
2250
                { name => 'back_to_caller', value => 1 },
2251
              ],
2252
            }],
2248 2253
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'],
2249 2254
                         @req_trans_cost_art, @req_cusordnumber,
2250 2255
          ],
......
2253 2258
        ],
2254 2259
        action => [
2255 2260
          t8('Create Sub-Version'),
2256
          call      => [ 'kivi.Order.save', { action => 'add_subversion' }, ],
2261
          call      => [ 'kivi.Order.save', { action => 'add_subversion' } ],
2257 2262
          only_if   => $::instance_conf->get_lock_oe_subversions,
2258 2263
          disabled => !$may_edit_create  ? t8('You do not have the permissions to access this function.')
2259 2264
                    : !$is_final_version ? t8('This sub-version is not yet finalized')
......
2261 2266
        ],
2262 2267
        action => [
2263 2268
          t8('Save as new'),
2264
          call      => [ 'kivi.Order.save', { action             => 'save_as_new',
2265
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2266
          ],
2269
          call      => [ 'kivi.Order.save', {
2270
              action             => 'save_as_new',
2271
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2272
            }],
2267 2273
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2268 2274
                         @req_trans_cost_art, @req_cusordnumber,
2269 2275
          ],
......
2318 2324
        ],
2319 2325
        action => [
2320 2326
          t8('Save and Delivery Order'),
2321
          call      => [ 'kivi.Order.save', { action             => 'save_and_delivery_order',
2322
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2323
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2324
          ],
2327
          call      => [ 'kivi.Order.save', {
2328
              action             => 'save_and_delivery_order',
2329
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2330
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2331
            }],
2325 2332
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2326 2333
                         @req_trans_cost_art, @req_cusordnumber,
2327 2334
          ],
......
2341 2348
        ],
2342 2349
        action => [
2343 2350
          t8('Save and Supplier Delivery Order'),
2344
          call      => [ 'kivi.Order.save', { action             => 'save_and_supplier_delivery_order',
2345
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2346
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2347
          ],
2351
          call      => [ 'kivi.Order.save', {
2352
              action             => 'save_and_new_record',
2353
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2354
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2355
              form_params        => [
2356
                { name => 'to_type', value => SUPPLIER_DELIVERY_ORDER_TYPE() },
2357
              ],
2358
            }],
2348 2359
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2349 2360
                         @req_trans_cost_art, @req_cusordnumber,
2350 2361
          ],
......
2353 2364
        ],
2354 2365
        action => [
2355 2366
          t8('Save and Reclamation'),
2356
          call      => [ 'kivi.Order.save', { action             => 'save_and_reclamation',
2357
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2358
          ],
2367
          call      => [ 'kivi.Order.save', {
2368
              action             => 'save_and_new_record',
2369
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2370
              form_params        => [
2371
                { name => 'to_type',
2372
                  value => $self->order->is_sales ? SALES_RECLAMATION_TYPE()
2373
                                                  : PURCHASE_RECLAMATION_TYPE() },
2374
              ],
2375
            }],
2359 2376
          only_if   =>$self->type_data->show_menu('save_and_reclamation')
2360 2377
        ],
2361 2378
        action => [
2362 2379
          t8('Save and Invoice'),
2363
          call      => [ 'kivi.Order.save', { action             => 'save_and_invoice',
2364
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2365
          ],
2380
          call      => [ 'kivi.Order.save', {
2381
              action             => 'save_and_invoice',
2382
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2383
            }],
2366 2384
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2367 2385
                         @req_trans_cost_art, @req_cusordnumber,
2368 2386
          ],
......
2371 2389
        ],
2372 2390
        action => [
2373 2391
          ($has_invoice_for_advance_payment ? t8('Save and Further Invoice for Advance Payment') : t8('Save and Invoice for Advance Payment')),
2374
          call      => [ 'kivi.Order.save', { action             => 'save_and_invoice_for_advance_payment',
2375
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2376
          ],
2392
          call      => [ 'kivi.Order.save', {
2393
              action             => 'save_and_invoice_for_advance_payment',
2394
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2395
            }],
2377 2396
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2378 2397
                         @req_trans_cost_art, @req_cusordnumber,
2379 2398
          ],
......
2384 2403
        ],
2385 2404
        action => [
2386 2405
          t8('Save and Final Invoice'),
2387
          call      => [ 'kivi.Order.save', { action             => 'save_and_final_invoice',
2388
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2389
          ],
2406
          call      => [ 'kivi.Order.save', {
2407
              action             => 'save_and_final_invoice',
2408
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2409
            }],
2390 2410
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2391 2411
                         @req_trans_cost_art, @req_cusordnumber,
2392 2412
          ],
......
2397 2417
        ],
2398 2418
        action => [
2399 2419
          t8('Save and AP Transaction'),
2400
          call      => [ 'kivi.Order.save', { action             => 'save_and_ap_transaction',
2401
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2402
          ],
2420
          call      => [ 'kivi.Order.save', {
2421
              action             => 'save_and_ap_transaction',
2422
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2423
            }],
2403 2424
          only_if   => $self->type_data->show_menu('save_and_ap_transaction'),
2404 2425
          disabled  => !$may_edit_create  ? t8('You do not have the permissions to access this function.') : undef,
2405 2426
        ],
......
2412 2433
        ],
2413 2434
        action => [
2414 2435
          t8('Save and preview PDF'),
2415
          call     => [ 'kivi.Order.save', { action             => 'preview_pdf',
2416
                                             warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2417
                                             warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2418
          ],
2436
          call     => [ 'kivi.Order.save', {
2437
              action             => 'preview_pdf',
2438
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2439
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2440
            }],
2419 2441
          checks   => [ @req_trans_cost_art, @req_cusordnumber ],
2420 2442
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
2421 2443
                    : $is_final_version ? t8('This record is the final version. Please create a new sub-version') : undef,
......
2432 2454
        action => [
2433 2455
          ($is_final_version ? t8('E-mail') : t8('Save and E-mail')),
2434 2456
          id       => 'save_and_email_action',
2435
          call     => [ 'kivi.Order.save', { action             => 'save_and_show_email_dialog',
2436
                                             warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2437
                                             warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2438
          ],
2457
          call     => [ 'kivi.Order.save', {
2458
              action             => 'save_and_show_email_dialog',
2459
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2460
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2461
            }],
2439 2462
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
2440 2463
                    : !$self->order->id ? t8('This object has not been saved yet.')
2441 2464
                    : undef,
SL/Controller/Reclamation.pm
41 41
use SL::DB::Invoice;
42 42
use SL::Model::Record;
43 43
use SL::DB::Order::TypeData qw(:types);
44
use SL::DB::DeliveryOrder::TypeData qw(:types);
44 45
use SL::DB::Reclamation::TypeData qw(:types);
45 46

  
46 47
use List::Util qw(first sum0);
......
1968 1969
      combobox => [
1969 1970
        action => [
1970 1971
          t8('Save'),
1971
          call      => [
1972
            'kivi.Reclamation.save', 'save',
1973
            $::instance_conf->get_reclamation_warn_duplicate_parts,
1974
            $::instance_conf->get_reclamation_warn_no_reqdate,
1975
          ],
1972
          call      => [ 'kivi.Reclamation.save', {
1973
              action             => 'save',
1974
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
1975
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
1976
            }],
1976 1977
          checks    => [
1977 1978
            ['kivi.validate_form','#reclamation_form'],
1978 1979
          ],
1979 1980
        ],
1980 1981
        action => [
1981 1982
          t8('Save as new'),
1982
          call      => [
1983
            'kivi.Reclamation.save', 'save_as_new',
1984
            $::instance_conf->get_reclamation_warn_duplicate_parts,
1985
          ],
1983
          call      => [ 'kivi.Reclamation.save', {
1984
              action             => 'save_as_new',
1985
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
1986
            }],
1986 1987
          disabled  => !$self->reclamation->id ? t8('This object has not been saved yet.') : undef,
1987 1988
        ],
1988 1989
      ], # end of combobox "Save"
......
1993 1994
        ],
1994 1995
        action => [
1995 1996
          t8('Save and Sales Reclamation'),
1996
          call      => [
1997
            'kivi.Reclamation.save', 'save_and_sales_reclamation',
1998
            $::instance_conf->get_reclamation_warn_duplicate_parts,
1999
            $::instance_conf->get_reclamation_warn_no_reqdate,
2000
          ],
1997
          call      => [ 'kivi.Reclamation.save', {
1998
              action             => 'save_and_new_record',
1999
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2000
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2001
              form_params        => [
2002
                { name => 'to_type', value => SALES_RECLAMATION_TYPE() },
2003
              ],
2004
            }],
2001 2005
          only_if  => $self->type_data->show_menu('save_and_sales_reclamation'),
2002 2006
        ],
2003 2007
        action => [
2004 2008
          t8('Save and Purchase Reclamation'),
2005
          call      => [ 'kivi.Reclamation.purchase_reclamation_check_for_direct_delivery' ],
2009
          call      => [ 'kivi.Reclamation.purchase_reclamation_check_for_direct_delivery', {
2010
              action             => 'save_and_new_record',
2011
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2012
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2013
              form_params        => [
2014
                { name => 'to_type', value => PURCHASE_RECLAMATION_TYPE() },
2015
              ],
2016
            }
2017
          ],
2006 2018
          only_if  => $self->type_data->show_menu('save_and_purchase_reclamation'),
2007 2019
        ],
2008 2020
        action => [
2009 2021
          t8('Save and Order'),
2010
          call      => [
2011
            'kivi.Reclamation.save', 'save_and_order',
2012
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2013
            $::instance_conf->get_reclamation_warn_no_reqdate,
2014
          ],
2022
          call      => [ 'kivi.Reclamation.save', {
2023
              action             => 'save_and_new_record',
2024
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2025
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2026
              form_params        => [
2027
                { name => 'to_type',
2028
                  value => $self->reclamation->is_sales ? SALES_ORDER_TYPE()
2029
                                                        : PURCHASE_ORDER_TYPE() },
2030
              ],
2031
            }],
2015 2032
        ],
2016 2033
        action => [
2017 2034
          t8('Save and RMA Delivery Order'),
2018
          call      => [
2019
            'kivi.Reclamation.save', 'save_and_delivery_order',
2020
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2021
            $::instance_conf->get_reclamation_warn_no_reqdate,
2022
          ],
2035
          call      => [ 'kivi.Reclamation.save', {
2036
              action             => 'save_and_new_record',
2037
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2038
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2039
              form_params        => [
2040
                { name => 'to_type', value => RMA_DELIVERY_ORDER_TYPE() },
2041
              ],
2042
            }],
2023 2043
          only_if  => $self->type_data->show_menu('save_and_rma_delivery_order'),
2024 2044
        ],
2025 2045
        action => [
2026 2046
          t8('Save and Supplier Delivery Order'),
2027
          call      => [
2028
            'kivi.Reclamation.save', 'save_and_delivery_order',
2029
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2030
            $::instance_conf->get_reclamation_warn_no_reqdate,
2031
          ],
2047
          call      => [ 'kivi.Reclamation.save', {
2048
              action             => 'save_and_new_record',
2049
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2050
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2051
              form_params        => [
2052
                { name => 'to_type', value => SUPPLIER_DELIVERY_ORDER_TYPE() },
2053
              ],
2054
            }],
2032 2055
          only_if  => $self->type_data->show_menu('save_and_supplier_delivery_order'),
2033 2056
        ],
2034 2057
        action => [
2035 2058
          t8('Save and Credit Note'),
2036
          call      => [
2037
            'kivi.Reclamation.save', 'save_and_credit_note',
2038
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2039
            $::instance_conf->get_reclamation_warn_no_reqdate,
2040
          ],
2059
          call      => [ 'kivi.Reclamation.save', {
2060
              action             => 'save_and_credit_note',
2061
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2062
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2063
              form_params        => [
2064
                { name => 'to_type', value => 'credit_note' },
2065
              ],
2066
            }],
2041 2067
          only_if  => $self->type_data->show_menu('save_and_credit_note'),
2042 2068
        ],
2043 2069
      ], # end of combobox "Workflow"
......
2048 2074
        ],
2049 2075
        action => [
2050 2076
          t8('Save and preview PDF'),
2051
           call => [
2052
             'kivi.Reclamation.save', 'preview_pdf',
2053
             $::instance_conf->get_reclamation_warn_duplicate_parts,
2054
             $::instance_conf->get_reclamation_warn_no_reqdate,
2055
           ],
2077
          call      => [ 'kivi.Reclamation.save', {
2078
              action             => 'preview_pdf',
2079
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2080
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2081
            }],
2056 2082
        ],
2057 2083
        action => [
2058 2084
          t8('Save and print'),
......
2065 2091
        action => [
2066 2092
          t8('Save and E-mail'),
2067 2093
          id   => 'save_and_email_action',
2068
          call => [
2069
            'kivi.Reclamation.save', 'save_and_show_email_dialog',
2070
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2071
            $::instance_conf->get_reclamation_warn_no_reqdate,
2072
          ],
2094
          call      => [ 'kivi.Reclamation.save', {
2095
              action             => 'save_and_show_email_dialog',
2096
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2097
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2098
            }],
2073 2099
          disabled => !$self->reclamation->id ? t8('This object has not been saved yet.') : undef,
2074 2100
        ],
2075 2101
        action => [
js/kivi.DeliveryOrder.js
51 51
    const action             = params.action;
52 52
    const warn_on_duplicates = params.warn_on_duplicates;
53 53
    const warn_on_reqdate    = params.warn_on_reqdate;
54
    const form_params        = params.form_params;
54 55

  
55 56
    if (warn_on_duplicates && !ns.check_duplicate_parts()) return;
56 57
    if (warn_on_reqdate    && !ns.check_valid_reqdate())   return;
......
58 59
    var data = $('#order_form').serializeArray();
59 60
    data.push({ name: 'action', value: 'DeliveryOrder/' + action });
60 61

  
62
    if (form_params) {
63
      if (Array.isArray(form_params)) {
64
        form_params.forEach(function(item) {
65
          data.push(item);
66
        });
67
      } else {
68
        data.push(form_params);
69
      }
70
    }
71

  
61 72
    $.post("controller.pl", data, kivi.eval_json_result);
62 73
  };
63 74

  
js/kivi.Order.js
51 51
    const action             = params.action;
52 52
    const warn_on_duplicates = params.warn_on_duplicates;
53 53
    const warn_on_reqdate    = params.warn_on_reqdate;
54
    const back_to_caller     = params.back_to_caller;
54
    const form_params        = params.form_params;
55 55

  
56 56
    if (warn_on_duplicates && !ns.check_duplicate_parts()) return;
57 57
    if (warn_on_reqdate    && !ns.check_valid_reqdate())   return;
......
59 59
    var data = $('#order_form').serializeArray();
60 60
    data.push({ name: 'action', value: 'Order/' + action });
61 61

  
62
    if (back_to_caller) data.push({ name: 'back_to_caller', value: '1' });
63
    if (params.convert_to_purchase_delivery_order_selected_items_only) data.push({ name: 'convert_to_purchase_delivery_order_selected_items_only', value: '1' });
62
    if (form_params) {
63
      if (Array.isArray(form_params)) {
64
        form_params.forEach(function(item) {
65
          data.push(item);
66
        });
67
      } else {
68
        data.push(form_params);
69
      }
70
    }
64 71

  
65 72
    if (params.data)
66 73
      data = $.merge(data, params.data);
......
976 983

  
977 984
  ns.convert_to_purchase_delivery_order = function() {
978 985
    var params = $("body").data("convert_to_purchase_delivery_order_item_selection_params");
979
    params.convert_to_purchase_delivery_order_selected_items_only = 1;
986
    params.form_params.convert_to_purchase_delivery_order_selected_items_only = 1;
980 987

  
981 988
    var $dlg    = $("#convert_to_purchase_delivery_order_item_selection");
982 989
    params.data = $dlg.find("tbody input").serializeArray();
js/kivi.Reclamation.js
63 63
    }
64 64
  };
65 65

  
66
  ns.save = function(action, warn_on_duplicates, warn_on_reqdate) {
66
  ns.save = function(params) {
67 67
    if (!ns.check_cv()) return;
68

  
69
    const action             = params.action;
70
    const warn_on_duplicates = params.warn_on_duplicates;
71
    const warn_on_reqdate    = params.warn_on_reqdate;
72
    const form_params        = params.form_params;
73

  
68 74
    if (warn_on_duplicates && !ns.check_duplicate_parts()) return;
69 75
    if (warn_on_reqdate    && !ns.check_valid_reqdate())   return;
70 76
    if (!ns.check_valid_reasons())                     return;
71 77

  
72 78
    var data = $('#reclamation_form').serializeArray();
73 79
    data.push({ name: 'action', value: 'Reclamation/' + action });
80
    if (form_params) {
81
      if (Array.isArray(form_params)) {
82
        form_params.forEach(function(item) {
83
          data.push(item);
84
        });
85
      } else {
86
        data.push(form_params);
87
      }
88
    }
74 89

  
75 90
    $.post("controller.pl", data, kivi.eval_json_result);
76 91
  };
......
692 707
    kivi.SalesPurchase.edit_custom_shipto();
693 708
  };
694 709

  
695
  ns.purchase_reclamation_check_for_direct_delivery = function() {
710
  ns.purchase_reclamation_check_for_direct_delivery = function(save_params) {
696 711
    if ($('#type').val() != 'sales_reclamation') {
697 712
      return alert(kivi.t8("Error: This is not a sales reclamation."));
698 713
    }
......
703 718
      empty = false;
704 719
      shipto = $('#reclamation_shipto_id option:selected').text();
705 720
    } else {
706
      $('#shipto_inputs [id^="shipto"]').each(function(idx, elt) {
721
      $('#shipto_inputs [id^="shipto"]').each(function(_idx, elt) {
707 722
        if (!empty)                                     return;
708 723
        if (/^shipto_to_copy/.test($(elt).prop('id')))  return;
709 724
        if (/^shiptocp_gender/.test($(elt).prop('id'))) return;
......
714 729
        }
715 730
      });
716 731
      var shipto_elements = [];
717
      $([$('#shiptoname').val(), $('#shiptostreet').val(), $('#shiptozipcode').val(), $('#shiptocity').val()]).each(function(idx, elt) {
732
      $([$('#shiptoname').val(), $('#shiptostreet').val(), $('#shiptozipcode').val(), $('#shiptocity').val()]).each(function(_idx, elt) {
718 733
        if (elt !== '') shipto_elements.push(elt);
719 734
      });
720 735
      shipto = shipto_elements.join('; ');
721 736
    }
722 737

  
723 738
    if (!empty) {
724
      ns.direct_delivery_dialog(shipto);
739
      ns.direct_delivery_dialog(shipto, save_params);
725 740
    } else {
726
      ns.save('save_and_purchase_reclamation');
741
      ns.save(save_params);
727 742
    }
728 743
  };
729 744

  
730
  ns.direct_delivery_callback = function(accepted) {
745
  ns.direct_delivery_callback = function(accepted, save_params) {
731 746
    $('#direct-delivery-dialog').dialog('close');
732 747

  
733 748
    if (accepted) {
734 749
      $('<input type="hidden" name="use_shipto">').appendTo('#reclamation_form').val('1');
735 750
    }
736 751

  
737
    ns.save('save_and_purchase_reclamation');
752
    ns.save(save_params);
738 753
  };
739 754

  
740
  ns.direct_delivery_dialog = function(shipto) {
755
  ns.direct_delivery_dialog = function(shipto, save_params) {
741 756
    $('#direct-delivery-dialog').remove();
742 757

  
758
    var save_params_string = '{';
759
    if (save_params) {
760
      const action             = save_params.action;
761
      const warn_on_duplicates = save_params.warn_on_duplicates;
762
      const warn_on_reqdate    = save_params.warn_on_reqdate;
763
      const form_params        = save_params.form_params;
764

  
765

  
766
      console.log(form_params)
767
      console.log(Array.isArray(form_params))
768
      if (action)
769
        save_params_string += `'action':'${action}',`;
770
      if (warn_on_duplicates)
771
        save_params_string += `'warn_on_duplicates':'${warn_on_duplicates}',`;
772
      if (warn_on_reqdate)
773
        save_params_string += `'warn_on_reqdate':'${warn_on_reqdate}',`;
774
      if (Array.isArray(form_params)) {
775
        save_params_string += 'form_params:['
776
        form_params.forEach(function(item) {
777
          save_params_string += `{'name':'${item.name}','value':'${item.value}'},`;
778
        });
779
        save_params_string += ']';
780
      } else {
781
        save_params_string += `'form_params':{'name':'${form_params.name}','value':'${form_params.value}'}`;
782
      }
783
    }
784
    save_params_string += '}';
785

  
786
    console.log(save_params_string);
787

  
743 788
    var text1 = kivi.t8('You have entered or selected the following shipping address for this customer:');
744 789
    var text2 = kivi.t8('Do you want to carry this shipping address over to the new purchase reclamation so that the vendor can deliver the goods directly to your customer?');
745 790
    var html  = '<div id="direct-delivery-dialog"><p>' + text1 + '</p><p>' + shipto + '</p><p>' + text2 + '</p>';
746 791
    html      = html + '<hr><p>';
747
    html      = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.Reclamation.direct_delivery_callback(true)">';
792
    html      = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.Reclamation.direct_delivery_callback(true,' + save_params_string + ')">';
748 793
    html      = html + '&nbsp;';
749
    html      = html + '<input type="button" value="' + kivi.t8('No')  + '" size="30" onclick="kivi.Reclamation.direct_delivery_callback(false)">';
794
    html      = html + '<input type="button" value="' + kivi.t8('No')  + '" size="30" onclick="kivi.Reclamation.direct_delivery_callback(false,' + save_params_string + ')">';
750 795
    html      = html + '</p></div>';
751 796
    $(html).hide().appendTo('#reclamation_form');
752 797

  

Auch abrufbar als: Unified diff