Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4836a949

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 4836a9491d0b0ec8b9dd72f487b531a20aa5e758
  • Vorgänger 77e57dde
  • Nachfolger f20c7a4a

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);
......
2163 2164
      combobox => [
2164 2165
        action => [
2165 2166
          t8('Save'),
2166
          call      => [ 'kivi.Order.save', { action             => 'save',
2167
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2168
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2169
          ],
2167
          call      => [ 'kivi.Order.save', {
2168
              action             => 'save',
2169
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2170
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2171
            }],
2170 2172
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'],
2171 2173
                         @req_trans_cost_art, @req_cusordnumber,
2172 2174
          ],
......
2175 2177
        ],
2176 2178
        action => [
2177 2179
          t8('Save and Close'),
2178
          call      => [ 'kivi.Order.save', { action             => 'save',
2179
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2180
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2181
                                              back_to_caller     => 1 },
2182
          ],
2180
          call      => [ 'kivi.Order.save', {
2181
              action             => 'save',
2182
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2183
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2184
              form_params        => [
2185
                { name => 'back_to_caller', value => 1 },
2186
              ],
2187
            }],
2183 2188
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices', ['kivi.validate_form','#order_form'],
2184 2189
                         @req_trans_cost_art, @req_cusordnumber,
2185 2190
          ],
......
2188 2193
        ],
2189 2194
        action => [
2190 2195
          t8('Create Sub-Version'),
2191
          call      => [ 'kivi.Order.save', { action => 'add_subversion' }, ],
2196
          call      => [ 'kivi.Order.save', { action => 'add_subversion' } ],
2192 2197
          only_if   => $::instance_conf->get_lock_oe_subversions,
2193 2198
          disabled => !$may_edit_create  ? t8('You do not have the permissions to access this function.')
2194 2199
                    : !$is_final_version ? t8('This sub-version is not yet finalized')
......
2196 2201
        ],
2197 2202
        action => [
2198 2203
          t8('Save as new'),
2199
          call      => [ 'kivi.Order.save', { action             => 'save_as_new',
2200
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2201
          ],
2204
          call      => [ 'kivi.Order.save', {
2205
              action             => 'save_as_new',
2206
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2207
            }],
2202 2208
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2203 2209
                         @req_trans_cost_art, @req_cusordnumber,
2204 2210
          ],
......
2241 2247
        ],
2242 2248
        action => [
2243 2249
          t8('Save and Delivery Order'),
2244
          call      => [ 'kivi.Order.save', { action             => 'save_and_delivery_order',
2245
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2246
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2247
          ],
2250
          call      => [ 'kivi.Order.save', {
2251
              action             => 'save_and_delivery_order',
2252
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2253
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2254
            }],
2248 2255
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2249 2256
                         @req_trans_cost_art, @req_cusordnumber,
2250 2257
          ],
......
2253 2260
        ],
2254 2261
        action => [
2255 2262
          t8('Save and Supplier Delivery Order'),
2256
          call      => [ 'kivi.Order.save', { action             => 'save_and_supplier_delivery_order',
2257
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2258
                                              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2259
          ],
2263
          call      => [ 'kivi.Order.save', {
2264
              action             => 'save_and_new_record',
2265
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2266
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2267
              form_params        => [
2268
                { name => 'to_type', value => SUPPLIER_DELIVERY_ORDER_TYPE() },
2269
              ],
2270
            }],
2260 2271
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2261 2272
                         @req_trans_cost_art, @req_cusordnumber,
2262 2273
          ],
......
2265 2276
        ],
2266 2277
        action => [
2267 2278
          t8('Save and Reclamation'),
2268
          call      => [ 'kivi.Order.save', { action             => 'save_and_reclamation',
2269
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2270
          ],
2279
          call      => [ 'kivi.Order.save', {
2280
              action             => 'save_and_new_record',
2281
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2282
              form_params        => [
2283
                { name => 'to_type',
2284
                  value => $self->order->is_sales ? SALES_RECLAMATION_TYPE()
2285
                                                  : PURCHASE_RECLAMATION_TYPE() },
2286
              ],
2287
            }],
2271 2288
          only_if   =>$self->type_data->show_menu('save_and_reclamation')
2272 2289
        ],
2273 2290
        action => [
2274 2291
          t8('Save and Invoice'),
2275
          call      => [ 'kivi.Order.save', { action             => 'save_and_invoice',
2276
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2277
          ],
2292
          call      => [ 'kivi.Order.save', {
2293
              action             => 'save_and_invoice',
2294
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2295
            }],
2278 2296
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2279 2297
                         @req_trans_cost_art, @req_cusordnumber,
2280 2298
          ],
......
2283 2301
        ],
2284 2302
        action => [
2285 2303
          ($has_invoice_for_advance_payment ? t8('Save and Further Invoice for Advance Payment') : t8('Save and Invoice for Advance Payment')),
2286
          call      => [ 'kivi.Order.save', { action             => 'save_and_invoice_for_advance_payment',
2287
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2288
          ],
2304
          call      => [ 'kivi.Order.save', {
2305
              action             => 'save_and_invoice_for_advance_payment',
2306
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2307
            }],
2289 2308
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2290 2309
                         @req_trans_cost_art, @req_cusordnumber,
2291 2310
          ],
......
2296 2315
        ],
2297 2316
        action => [
2298 2317
          t8('Save and Final Invoice'),
2299
          call      => [ 'kivi.Order.save', { action             => 'save_and_final_invoice',
2300
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2301
          ],
2318
          call      => [ 'kivi.Order.save', {
2319
              action             => 'save_and_final_invoice',
2320
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2321
            }],
2302 2322
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices',
2303 2323
                         @req_trans_cost_art, @req_cusordnumber,
2304 2324
          ],
......
2309 2329
        ],
2310 2330
        action => [
2311 2331
          t8('Save and AP Transaction'),
2312
          call      => [ 'kivi.Order.save', { action             => 'save_and_ap_transaction',
2313
                                              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts },
2314
          ],
2332
          call      => [ 'kivi.Order.save', {
2333
              action             => 'save_and_ap_transaction',
2334
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2335
            }],
2315 2336
          only_if   => $self->type_data->show_menu('save_and_ap_transaction'),
2316 2337
          disabled  => !$may_edit_create  ? t8('You do not have the permissions to access this function.') : undef,
2317 2338
        ],
......
2324 2345
        ],
2325 2346
        action => [
2326 2347
          t8('Save and preview PDF'),
2327
          call     => [ 'kivi.Order.save', { action             => 'preview_pdf',
2328
                                             warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2329
                                             warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2330
          ],
2348
          call     => [ 'kivi.Order.save', {
2349
              action             => 'preview_pdf',
2350
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2351
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2352
            }],
2331 2353
          checks   => [ @req_trans_cost_art, @req_cusordnumber ],
2332 2354
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
2333 2355
                    : $is_final_version ? t8('This record is the final version. Please create a new sub-version') : undef,
......
2344 2366
        action => [
2345 2367
          ($is_final_version ? t8('E-mail') : t8('Save and E-mail')),
2346 2368
          id       => 'save_and_email_action',
2347
          call     => [ 'kivi.Order.save', { action             => 'save_and_show_email_dialog',
2348
                                             warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2349
                                             warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2350
          ],
2369
          call     => [ 'kivi.Order.save', {
2370
              action             => 'save_and_show_email_dialog',
2371
              warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2372
              warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate,
2373
            }],
2351 2374
          disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
2352 2375
                    : !$self->order->id ? t8('This object has not been saved yet.')
2353 2376
                    : 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' });
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
    }
63 71

  
64 72
    $.post("controller.pl", data, kivi.eval_json_result);
65 73
  };
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