Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision eb0fa244

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID eb0fa24414d2c4308d3d1bf9d19535aac6d5b7cd
  • Vorgänger 7d50ae35
  • Nachfolger 69aed970

Records: js-save Aufrufe angepasst und vereinheitlicht

Unterschiede anzeigen:

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

  
42 43
use SL::Helper::CreatePDF qw(:all);
......
2203 2204
      combobox => [
2204 2205
        action => [
2205 2206
          t8('Save'),
2206
          call      => [ 'kivi.Order.save', { action             => 'save',
2207
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2208
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2209
          ],
2207
          call      => [ 'kivi.Order.save', {
2208
              action             => 'save',
2209
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2210
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2211
            }],
2210 2212
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'],
2211 2213
                         @req_trans_cost_art, @req_cusordnumber,
2212 2214
          ],
......
2215 2217
        ],
2216 2218
        action => [
2217 2219
          t8('Save and Close'),
2218
          call      => [ 'kivi.Order.save', { action             => 'save',
2219
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2220
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2221
                                              back_to_caller     => 1 },
2222
          ],
2220
          call      => [ 'kivi.Order.save', {
2221
              action             => 'save',
2222
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2223
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2224
              form_params        => [
2225
                { name => 'back_to_caller', value => 1 },
2226
              ],
2227
            }],
2223 2228
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'],
2224 2229
                         @req_trans_cost_art, @req_cusordnumber,
2225 2230
          ],
......
2228 2233
        ],
2229 2234
        action => [
2230 2235
          t8('Create Sub-Version'),
2231
          call      => [ 'kivi.Order.save', { action => 'add_subversion' }, ],
2236
          call      => [ 'kivi.Order.save', { action => 'add_subversion' } ],
2232 2237
          only_if   => $::instance_conf->get_lock_oe_subversions,
2233 2238
          disabled => !$may_edit_create  ? t8('You do not have the permissions to access this function.')
2234 2239
                    : !$is_final_version ? t8('This sub-version is not yet finalized')
......
2236 2241
        ],
2237 2242
        action => [
2238 2243
          t8('Save as new'),
2239
          call      => [ 'kivi.Order.save', { action             => 'save_as_new',
2240
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2241
          ],
2244
          call      => [ 'kivi.Order.save', {
2245
              action             => 'save_as_new',
2246
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2247
            }],
2242 2248
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2243 2249
                         @req_trans_cost_art, @req_cusordnumber,
2244 2250
          ],
......
2281 2287
        ],
2282 2288
        action => [
2283 2289
          t8('Save and Delivery Order'),
2284
          call      => [ 'kivi.Order.save', { action             => 'save_and_delivery_order',
2285
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2286
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2287
          ],
2290
          call      => [ 'kivi.Order.save', {
2291
              action             => 'save_and_delivery_order',
2292
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2293
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2294
            }],
2288 2295
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2289 2296
                         @req_trans_cost_art, @req_cusordnumber,
2290 2297
          ],
......
2304 2311
        ],
2305 2312
        action => [
2306 2313
          t8('Save and Supplier Delivery Order'),
2307
          call      => [ 'kivi.Order.save', { action             => 'save_and_supplier_delivery_order',
2308
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2309
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2310
          ],
2314
          call      => [ 'kivi.Order.save', {
2315
              action             => 'save_and_new_record',
2316
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2317
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2318
              form_params        => [
2319
                { name => 'to_type', value => SUPPLIER_DELIVERY_ORDER_TYPE() },
2320
              ],
2321
            }],
2311 2322
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2312 2323
                         @req_trans_cost_art, @req_cusordnumber,
2313 2324
          ],
......
2316 2327
        ],
2317 2328
        action => [
2318 2329
          t8('Save and Reclamation'),
2319
          call      => [ 'kivi.Order.save', { action             => 'save_and_reclamation',
2320
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2321
          ],
2330
          call      => [ 'kivi.Order.save', {
2331
              action             => 'save_and_new_record',
2332
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2333
              form_params        => [
2334
                { name => 'to_type',
2335
                  value => $self->order->is_sales ? SALES_RECLAMATION_TYPE()
2336
                                                  : PURCHASE_RECLAMATION_TYPE() },
2337
              ],
2338
            }],
2322 2339
          only_if   =>$self->type_data->show_menu('save_and_reclamation')
2323 2340
        ],
2324 2341
        action => [
2325 2342
          t8('Save and Invoice'),
2326
          call      => [ 'kivi.Order.save', { action             => 'save_and_invoice',
2327
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2328
          ],
2343
          call      => [ 'kivi.Order.save', {
2344
              action             => 'save_and_invoice',
2345
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2346
            }],
2329 2347
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2330 2348
                         @req_trans_cost_art, @req_cusordnumber,
2331 2349
          ],
......
2334 2352
        ],
2335 2353
        action => [
2336 2354
          ($has_invoice_for_advance_payment ? t8('Save and Further Invoice for Advance Payment') : t8('Save and Invoice for Advance Payment')),
2337
          call      => [ 'kivi.Order.save', { action             => 'save_and_invoice_for_advance_payment',
2338
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2339
          ],
2355
          call      => [ 'kivi.Order.save', {
2356
              action             => 'save_and_invoice_for_advance_payment',
2357
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2358
            }],
2340 2359
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2341 2360
                         @req_trans_cost_art, @req_cusordnumber,
2342 2361
          ],
......
2347 2366
        ],
2348 2367
        action => [
2349 2368
          t8('Save and Final Invoice'),
2350
          call      => [ 'kivi.Order.save', { action             => 'save_and_final_invoice',
2351
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2352
          ],
2369
          call      => [ 'kivi.Order.save', {
2370
              action             => 'save_and_final_invoice',
2371
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2372
            }],
2353 2373
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2354 2374
                         @req_trans_cost_art, @req_cusordnumber,
2355 2375
          ],
......
2360 2380
        ],
2361 2381
        action => [
2362 2382
          t8('Save and AP Transaction'),
2363
          call      => [ 'kivi.Order.save', { action             => 'save_and_ap_transaction',
2364
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2365
          ],
2383
          call      => [ 'kivi.Order.save', {
2384
              action             => 'save_and_ap_transaction',
2385
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2386
            }],
2366 2387
          only_if   => $self->type_data->show_menu('save_and_ap_transaction'),
2367 2388
          disabled  => !$may_edit_create  ? t8('You do not have the permissions to access this function.') : undef,
2368 2389
        ],
......
2375 2396
        ],
2376 2397
        action => [
2377 2398
          t8('Save and preview PDF'),
2378
          call     => [ 'kivi.Order.save', { action             => 'preview_pdf',
2379
                                             warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2380
                                             warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2381
          ],
2399
          call     => [ 'kivi.Order.save', {
2400
              action             => 'preview_pdf',
2401
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2402
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2403
            }],
2382 2404
          checks   => [ @req_trans_cost_art, @req_cusordnumber ],
2383 2405
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
2384 2406
                    : $is_final_version ? t8('This record is the final version. Please create a new sub-version') : undef,
......
2395 2417
        action => [
2396 2418
          ($is_final_version ? t8('E-mail') : t8('Save and E-mail')),
2397 2419
          id       => 'save_and_email_action',
2398
          call     => [ 'kivi.Order.save', { action             => 'save_and_show_email_dialog',
2399
                                             warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2400
                                             warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2401
          ],
2420
          call     => [ 'kivi.Order.save', {
2421
              action             => 'save_and_show_email_dialog',
2422
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2423
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2424
            }],
2402 2425
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
2403 2426
                    : !$self->order->id ? t8('This object has not been saved yet.')
2404 2427
                    : 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);
......
1953 1954
      combobox => [
1954 1955
        action => [
1955 1956
          t8('Save'),
1956
          call      => [
1957
            'kivi.Reclamation.save', 'save',
1958
            $::instance_conf->get_reclamation_warn_duplicate_parts,
1959
            $::instance_conf->get_reclamation_warn_no_reqdate,
1960
          ],
1957
          call      => [ 'kivi.Reclamation.save', {
1958
              action             => 'save',
1959
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
1960
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
1961
            }],
1961 1962
          checks    => [
1962 1963
            ['kivi.validate_form','#reclamation_form'],
1963 1964
          ],
1964 1965
        ],
1965 1966
        action => [
1966 1967
          t8('Save as new'),
1967
          call      => [
1968
            'kivi.Reclamation.save', 'save_as_new',
1969
            $::instance_conf->get_reclamation_warn_duplicate_parts,
1970
          ],
1968
          call      => [ 'kivi.Reclamation.save', {
1969
              action             => 'save_as_new',
1970
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
1971
            }],
1971 1972
          disabled  => !$self->reclamation->id ? t8('This object has not been saved yet.') : undef,
1972 1973
        ],
1973 1974
      ], # end of combobox "Save"
......
1978 1979
        ],
1979 1980
        action => [
1980 1981
          t8('Save and Sales Reclamation'),
1981
          call      => [
1982
            'kivi.Reclamation.save', 'save_and_sales_reclamation',
1983
            $::instance_conf->get_reclamation_warn_duplicate_parts,
1984
            $::instance_conf->get_reclamation_warn_no_reqdate,
1985
          ],
1982
          call      => [ 'kivi.Reclamation.save', {
1983
              action             => 'save_and_new_record',
1984
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
1985
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
1986
              form_params        => [
1987
                { name => 'to_type', value => SALES_RECLAMATION_TYPE() },
1988
              ],
1989
            }],
1986 1990
          only_if  => $self->type_data->show_menu('save_and_sales_reclamation'),
1987 1991
        ],
1988 1992
        action => [
1989 1993
          t8('Save and Purchase Reclamation'),
1990
          call      => [ 'kivi.Reclamation.purchase_reclamation_check_for_direct_delivery' ],
1994
          call      => [ 'kivi.Reclamation.purchase_reclamation_check_for_direct_delivery', {
1995
              action             => 'save_and_new_record',
1996
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
1997
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
1998
              form_params        => [
1999
                { name => 'to_type', value => PURCHASE_RECLAMATION_TYPE() },
2000
              ],
2001
            }
2002
          ],
1991 2003
          only_if  => $self->type_data->show_menu('save_and_purchase_reclamation'),
1992 2004
        ],
1993 2005
        action => [
1994 2006
          t8('Save and Order'),
1995
          call      => [
1996
            'kivi.Reclamation.save', 'save_and_order',
1997
            $::instance_conf->get_reclamation_warn_duplicate_parts,
1998
            $::instance_conf->get_reclamation_warn_no_reqdate,
1999
          ],
2007
          call      => [ 'kivi.Reclamation.save', {
2008
              action             => 'save_and_new_record',
2009
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2010
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2011
              form_params        => [
2012
                { name => 'to_type',
2013
                  value => $self->reclamation->is_sales ? SALES_ORDER_TYPE()
2014
                                                        : PURCHASE_ORDER_TYPE() },
2015
              ],
2016
            }],
2000 2017
        ],
2001 2018
        action => [
2002 2019
          t8('Save and RMA Delivery Order'),
2003
          call      => [
2004
            'kivi.Reclamation.save', 'save_and_delivery_order',
2005
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2006
            $::instance_conf->get_reclamation_warn_no_reqdate,
2007
          ],
2020
          call      => [ 'kivi.Reclamation.save', {
2021
              action             => 'save_and_new_record',
2022
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2023
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2024
              form_params        => [
2025
                { name => 'to_type', value => RMA_DELIVERY_ORDER_TYPE() },
2026
              ],
2027
            }],
2008 2028
          only_if  => $self->type_data->show_menu('save_and_rma_delivery_order'),
2009 2029
        ],
2010 2030
        action => [
2011 2031
          t8('Save and Supplier Delivery Order'),
2012
          call      => [
2013
            'kivi.Reclamation.save', 'save_and_delivery_order',
2014
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2015
            $::instance_conf->get_reclamation_warn_no_reqdate,
2016
          ],
2032
          call      => [ 'kivi.Reclamation.save', {
2033
              action             => 'save_and_new_record',
2034
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2035
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2036
              form_params        => [
2037
                { name => 'to_type', value => SUPPLIER_DELIVERY_ORDER_TYPE() },
2038
              ],
2039
            }],
2017 2040
          only_if  => $self->type_data->show_menu('save_and_supplier_delivery_order'),
2018 2041
        ],
2019 2042
        action => [
2020 2043
          t8('Save and Credit Note'),
2021
          call      => [
2022
            'kivi.Reclamation.save', 'save_and_credit_note',
2023
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2024
            $::instance_conf->get_reclamation_warn_no_reqdate,
2025
          ],
2044
          call      => [ 'kivi.Reclamation.save', {
2045
              action             => 'save_and_credit_note',
2046
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2047
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2048
              form_params        => [
2049
                { name => 'to_type', value => 'credit_note' },
2050
              ],
2051
            }],
2026 2052
          only_if  => $self->type_data->show_menu('save_and_credit_note'),
2027 2053
        ],
2028 2054
      ], # end of combobox "Workflow"
......
2033 2059
        ],
2034 2060
        action => [
2035 2061
          t8('Save and preview PDF'),
2036
           call => [
2037
             'kivi.Reclamation.save', 'preview_pdf',
2038
             $::instance_conf->get_reclamation_warn_duplicate_parts,
2039
             $::instance_conf->get_reclamation_warn_no_reqdate,
2040
           ],
2062
          call      => [ 'kivi.Reclamation.save', {
2063
              action             => 'preview_pdf',
2064
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2065
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2066
            }],
2041 2067
        ],
2042 2068
        action => [
2043 2069
          t8('Save and print'),
......
2050 2076
        action => [
2051 2077
          t8('Save and E-mail'),
2052 2078
          id   => 'save_and_email_action',
2053
          call => [
2054
            'kivi.Reclamation.save', 'save_and_show_email_dialog',
2055
            $::instance_conf->get_reclamation_warn_duplicate_parts,
2056
            $::instance_conf->get_reclamation_warn_no_reqdate,
2057
          ],
2079
          call      => [ 'kivi.Reclamation.save', {
2080
              action             => 'save_and_show_email_dialog',
2081
              warn_on_duplicates => $::instance_conf->get_reclamation_warn_duplicate_parts,
2082
              warn_on_reqdate    => $::instance_conf->get_reclamation_warn_no_reqdate,
2083
            }],
2058 2084
          disabled => !$self->reclamation->id ? t8('This object has not been saved yet.') : undef,
2059 2085
        ],
2060 2086
        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