Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 64297226

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 64297226ccb4c4ef3e1468e0404b9a0446143fdd
  • Vorgänger dc227972
  • Nachfolger 965a8ee1

ActionBar: do.pl: API-Umstellung & Tooltips für deaktivierte

Unterschiede anzeigen:

bin/mozilla/do.pl
236 236
  $main::lxdebug->leave_sub();
237 237
}
238 238

  
239
sub setup_do_action_bar {
240
  my @transfer_qty   = qw(kivi.SalesPurchase.delivery_order_check_transfer_qty);
241
  my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps;
242

  
243
  for my $bar ($::request->layout->get('actionbar')) {
244
    $bar->add(
245
      action =>
246
        [ t8('Update'),
247
          submit    => [ '#form', { action_update => 1 } ],
248
          accesskey => 'enter',
249
        ],
250

  
251
      combobox => [
252
        action => [
253
          t8('Save'),
254
          submit   => [ '#form', { action_save => 1 } ],
255
          checks   => [ @req_trans_desc ],
256
          disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef,
257
        ],
258
        action => [
259
          t8('Save as new'),
260
          submit   => [ '#form', { action_save_as_new => 1 } ],
261
          checks   => [ @req_trans_desc ],
262
          disabled => !$::form->{id},
263
        ],
264
        action => [
265
          t8('Mark as closed'),
266
          submit   => [ '#form', { action_mark_closed => 1 } ],
267
          checks   => [ @req_trans_desc ],
268
          confirm  => t8('This will remove the delivery order from showing as open even if contents are not delivered. Proceed?'),
269
          disabled => !$::form->{id}    ? t8('This record has not been saved yet.')
270
                    : $::form->{closed} ? t8('This record has already been closed.')
271
                    :                     undef,
272
        ],
273
      ], # end of combobox "Save"
274

  
275
      action => [
276
        t8('Delete'),
277
        submit   => [ '#form', { action_delete => 1 } ],
278
        confirm  => t8('Do you really want to delete this object?'),
279
        disabled => !$::form->{id}                                                                              ? t8('This record has not been saved yet.')
280
                  : $::form->{delivered}                                                                        ? t8('This record has already been delivered.')
281
                  : ($::form->{vc} eq 'customer' && !$::instance_conf->get_sales_delivery_order_show_delete)    ? t8('Deleting this type of record has been disabled in the configuration.')
282
                  : ($::form->{vc} eq 'vendor'   && !$::instance_conf->get_purchase_delivery_order_show_delete) ? t8('Deleting this type of record has been disabled in the configuration.')
283
                  :                                                                                               undef,
284
      ],
285

  
286
      combobox => [
287
        (action => [
288
          t8('Transfer out'),
289
          submit   => [ '#form', { action_transfer_out => 1 } ],
290
          checks   => [ @req_trans_desc, @transfer_qty ],
291
          disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef,
292
        ]) x ($::form->{vc} eq 'customer'),
293
        (action => [
294
          t8('Transfer out via default'),
295
          submit   => [ '#form', { action_transfer_out_default => 1 } ],
296
          checks   => [ @req_trans_desc, @transfer_qty ],
297
          disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef,
298
        ]) x ($::form->{vc} eq 'customer' && $::instance_conf->get_transfer_default),
299
        (action => [
300
          t8('Transfer in'),
301
          submit   => [ '#form', { action_transfer_in    => 1 } ],
302
          checks   => [ @req_trans_desc, @transfer_qty ],
303
          disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef,
304
        ]) x ($::form->{vc} eq 'vendor'),
305
        (action => [
306
          t8('Transfer in via default'),
307
          submit   => [ '#form', { action_transfer_in_default => 1 } ],
308
          checks   => [ @req_trans_desc, @transfer_qty ],
309
          disabled => $::form->{delivered} ? t8('This record has already been delivered.') : undef,
310
        ]) x ($::form->{vc} eq 'vendor' && $::instance_conf->get_transfer_default),
311
      ], # end of combobox "Transfer out"
312

  
313

  
314
      'separator',
315

  
316
      action => [
317
        t8('Invoice'),
318
        submit => [ '#form', { action_invoice => 1 } ],
319
        disabled => !$::form->{id} ? t8('This record has not been saved yet.') : undef,
320
      ],
321

  
322
      combobox => [
323
        action => [ t8('Export') ],
324
        action => [
325
          t8('Print'),
326
          submit => [ '#form', { action_print => 1 } ],
327
          checks => [ @req_trans_desc ],
328
        ],
329
        action => [
330
          t8('E Mail'),
331
          submit => [ '#form', { action_print => 1 } ],
332
          checks => [ @req_trans_desc ],
333
        ],
334
      ], # end of combobox "Export"
335

  
336
      combobox =>  [
337
        action => [ t8('more') ],
338
        action => [
339
          t8('History'),
340
          call     => [ 'set_history_window', $::form->{id} * 1, 'id' ],
341
          disabled => !$::form->{id} ? t8('This record has not been saved yet.') : undef,
342
        ],
343
        action => [
344
          t8('Follow-Up'),
345
          call     => [ 'follow_up_window' ],
346
          disabled => !$::form->{id} ? t8('This record has not been saved yet.') : undef,
347
        ],
348
      ], # end if combobox "more"
349
    );
350
  }
351
}
352

  
239 353
sub form_header {
240 354
  $main::lxdebug->enter_sub();
241 355

  
......
309 423

  
310 424
  $::form->{HIDDENS} = [ map { +{ name => $_, value => $::form->{$_} } } (@custom_hidden) ];
311 425

  
312
  my @transfer_qty   = qw(kivi.SalesPurchase.delivery_order_check_transfer_qty);
313
  my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps;
314

  
315
  for my $bar ($::request->layout->get('actionbar')) {
316
    $bar->add_actions([ t8('Update'),
317
      submit => [ '#form', { action_update         => 1 } ],
318
    ]);
319
    $bar->add_actions("combobox");
320
    $bar->actions->[-1]->add_actions([ t8('Save'),
321
      submit => [ '#form', { action_save           => 1 } ],
322
      checks => [ @req_trans_desc ],
323
      disabled => $::form->{delivered},
324
    ]);
325
    $bar->actions->[-1]->add_actions([ t8('Save as new'),
326
      submit => [ '#form', { action_save_as_new    => 1 } ],
327
      checks => [ @req_trans_desc ],
328
      disabled => !$::form->{id},
329
    ]);
330
    $bar->actions->[-1]->add_actions([ t8('mark as paid'),
331
      submit => [ '#form', { action_mark_closed    => 1 } ],
332
      checks => [ @req_trans_desc ],
333
      confirm => t8('This will remove the delivery order from showing as open even if contents are not delivered. Proceed?'),
334
      disabled => !$::form->{id} || $::form->{closed},
335
    ]);
336
    $bar->add_actions([ t8('Delete'),
337
      submit => [ '#form', { action_delete         => 1 } ],
338
      confirm => t8('Do you really want to delete this object?'),
339
      disabled => !$::form->{id} || $::form->{delivered}
340
               || ($::form->{vc} eq 'customer' && !$::instance_conf->get_sales_delivery_order_show_delete)
341
               || ($::form->{vc} eq 'vendor'   && !$::instance_conf->get_purchase_delivery_order_show_delete),
342
    ]);
343
    $bar->add_actions("combobox");
344
    $bar->actions->[-1]->add_actions([ t8('Transfer out'),
345
      submit => [ '#form', { action_transfer_out    => 1 } ],
346
      checks => [ @req_trans_desc, @transfer_qty ],
347
      disabled => $::form->{delivered},
348
    ]) if $::form->{vc} eq 'customer';
349
    $bar->actions->[-1]->add_actions([ t8('Transfer out via default'),
350
      submit => [ '#form', { action_transfer_out_default    => 1 } ],
351
      checks => [ @req_trans_desc, @transfer_qty ],
352
      disabled => $::form->{delivered},
353
    ]) if $::form->{vc} eq 'customer' && $::instance_conf->get_transfer_default;
354
    $bar->actions->[-1]->add_actions([ t8('Transfer in'),
355
      submit => [ '#form', { action_transfer_in    => 1 } ],
356
      checks => [ @req_trans_desc, @transfer_qty ],
357
      disabled => $::form->{delivered},
358
    ]) if $::form->{vc} eq 'vendor';
359
    $bar->actions->[-1]->add_actions([ t8('Transfer in via default'),
360
      submit => [ '#form', { action_transfer_in_default    => 1 } ],
361
      checks => [ @req_trans_desc, @transfer_qty ],
362
      disabled => $::form->{delivered},
363
    ]) if $::form->{vc} eq 'vendor' && $::instance_conf->get_transfer_default;
364

  
365
    $bar->add_actions("separator");
366
    $bar->add_actions([ t8('Invoice'),
367
      submit => [ '#form', { action_invoice         => 1 } ],
368
      disabled => !$::form->{id},
369
    ]);
370
    $bar->add_actions('combobox');
371
    $bar->actions->[-1]->add_actions([ t8('Export'),
372
      disabled => 1,
373
    ]);
374
    $bar->actions->[-1]->add_actions([ t8('Print'),
375
      submit => [ '#form', { action_print          => 1 } ],
376
      checks => [ @req_trans_desc ],
377
    ]);
378
    $bar->actions->[-1]->add_actions([ t8('E Mail'),
379
      submit => [ '#form', { action_print          => 1 } ],
380
      checks => [ @req_trans_desc ],
381
    ]);
382
    $bar->add_actions('combobox');
383
    $bar->actions->[-1]->add_actions([ t8('more'),
384
      disabled => 1,
385
    ]);
386
    $bar->actions->[-1]->add_actions([ t8('History'),
387
      call     => [ 'set_history_window', $::form->{id} * 1, 'id' ],
388
      disabled => !$::form->{id},
389
    ]);
390
    $bar->actions->[-1]->add_actions([ t8('Follow-Up'),
391
      call     => [ 'follow_up_window' ],
392
      disabled => !$::form->{id},
393
    ]);
394
  }
426
  setup_do_action_bar();
395 427

  
396 428
  $form->header();
397 429
  # Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID'
......
1669 1701
  my $form     = $main::form;
1670 1702
  my $locale   = $main::locale;
1671 1703

  
1672
  foreach my $action (qw(update ship_to print e_mail save transfer_out transfer_out_default sort
1704
  foreach my $action (qw(update print e_mail save transfer_out transfer_out_default sort
1673 1705
                         transfer_in transfer_in_default mark_closed save_as_new invoice delete)) {
1674 1706
    if ($form->{"action_${action}"}) {
1675 1707
      call_sub($action);

Auch abrufbar als: Unified diff