Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 45823f3f

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 45823f3f9c9322bf575784c54b67859c1213a810
  • Vorgänger 854d733e
  • Nachfolger e0e425b7

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