Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a198dfae

Von Bernd Bleßmann vor fast 3 Jahren hinzugefügt

  • ID a198dfae6de24a4932609b2fb72c23879b7df1bf
  • Vorgänger 2fb4c76f
  • Nachfolger 19132371

Anzahlungs-Rg.: Workflow Anzahlungs-Rg. -> Anzahlungs-Rg.

Unterschiede anzeigen:

bin/mozilla/is.pl
38 38
use SL::MoreCommon qw(restore_form save_form);
39 39
use Data::Dumper;
40 40
use DateTime;
41
use List::MoreUtils qw(uniq);
41
use List::MoreUtils qw(any uniq);
42 42
use List::Util qw(max sum);
43 43
use List::UtilsBy qw(sort_by);
44 44
use English qw(-no_match_vars);
......
309 309
  if ($::instance_conf->get_warn_no_delivery_order_for_invoice && !$form->{id}) {
310 310
    $warn_unlinked_delivery_order = 1 unless $form->{convert_from_do_ids};
311 311
  }
312

  
313
  my $has_further_invoice_for_advance_payment;
314
  if ($form->{id} && $form->{type} eq "invoice_for_advance_payment") {
315
    my $invoice_obj = SL::DB::Invoice->load_cached($form->{id});
316
    my $lr          = $invoice_obj->linked_records(direction => 'to', to => ['Invoice']);
317
    $has_further_invoice_for_advance_payment = any {'SL::DB::Invoice' eq ref $_ && "invoice_for_advance_payment" eq $_->type} @$lr;
318
  }
319

  
312 320
  for my $bar ($::request->layout->get('actionbar')) {
313 321
    $bar->add(
314 322
      action => [
......
393 401
                    : !$form->{id}      ? t8('This invoice has not been posted yet.')
394 402
                    :                     undef,
395 403
        ],
404
        action => [
405
          t8('Further Invoice for Advance Payment'),
406
          submit   => [ '#form', { action => "further_invoice_for_advance_payment" } ],
407
          checks   => [ 'kivi.validate_form' ],
408
          disabled => !$may_edit_create ? t8('You must not change this invoice.')
409
                    : !$form->{id}      ? t8('This invoice has not been posted yet.')
410
                    : $has_further_invoice_for_advance_payment ? t8('This invoice has already a further invoice for advanced payment.')
411
                    :                     undef,
412
          only_if  => $form->{type} eq "invoice_for_advance_payment",
413
        ],
396 414
        action => [
397 415
          t8('Credit Note'),
398 416
          submit   => [ '#form', { action => "credit_note" } ],
......
1129 1147
  $main::lxdebug->leave_sub();
1130 1148
}
1131 1149

  
1150
sub further_invoice_for_advance_payment {
1151
  my $form     = $main::form;
1152
  my %myconfig = %main::myconfig;
1153

  
1154
  $main::auth->assert('invoice_edit');
1155

  
1156
  delete @{ $form }{qw(printed emailed queued invnumber invdate exchangerate forex deliverydate datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno locked)};
1157
  $form->{convert_from_ar_ids} = $form->{id};
1158
  $form->{id}                  = '';
1159
  $form->{rowcount}--;
1160
  $form->{paidaccounts}        = 1;
1161
  $form->{invdate}             = $form->current_date(\%myconfig);
1162
  my $terms                    = get_payment_terms_for_invoice();
1163
  $form->{duedate}             = $terms ? $terms->calc_date(reference_date => $form->{invdate})->to_kivitendo : $form->{invdate};
1164
  $form->{employee_id}         = SL::DB::Manager::Employee->current->id;
1165
  $form->{forex}               = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy');
1166
  $form->{exchangerate}        = $form->{forex} if $form->{forex};
1167

  
1168
  $form->{"converted_from_invoice_id_$_"} = delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
1169

  
1170
  &display_form;
1171
}
1172

  
1132 1173
sub storno {
1133 1174
  $main::lxdebug->enter_sub();
1134 1175

  
......
1258 1299

  
1259 1300
  &prepare_invoice;
1260 1301

  
1261

  
1262 1302
  &display_form;
1263 1303

  
1264 1304
  $main::lxdebug->leave_sub();
locale/de/all
1622 1622
  'Function block actions'      => 'Funktionsblockaktionen',
1623 1623
  'Function block number format' => 'Format der Funktionsblocknummerierung',
1624 1624
  'Function/position'           => 'Funktion/Position',
1625
  'Further Invoice for Advance Payment' => 'Weitere Anzahlungsrechnung',
1625 1626
  'GL Transaction'              => 'Dialogbuchung',
1626 1627
  'GL Transaction (abbreviation)' => 'DB',
1627 1628
  'GL Transactions'             => 'Dialogbuchungen',
......
3849 3850
  'This group is valid for the following clients' => 'Diese Gruppe ist für die folgenden Mandanten gültig',
3850 3851
  'This has been changed in this version, therefore please change the "old" bins to some real warehouse bins.' => 'Das wurde in dieser Version umgestellt, bitte ändern Sie die Freitext-Lagerplätze auf vorhandene Lagerplätze.',
3851 3852
  'This has been changed in this version.' => 'Ab dieser Version ist dies nicht mehr so.',
3853
  'This invoice has already a further invoice for advanced payment.' => 'Diese Rechnung hat schon eine weitere Anzahlungsrechnung.',
3852 3854
  'This invoice has already been posted.' => 'Die Rechnung wurde bereits gebucht.',
3853 3855
  'This invoice has been canceled already.' => 'Die Rechnung wurde bereits storniert.',
3854 3856
  'This invoice has been linked with a sepa export, undo this first.' => 'Diese Rechnung ist mit einem SEPA-Export verknüpft. Bitte diese Verknüpfung zuerst aufheben.',
locale/en/all
1622 1622
  'Function block actions'      => '',
1623 1623
  'Function block number format' => '',
1624 1624
  'Function/position'           => '',
1625
  'Further Invoice for Advance Payment' => '',
1625 1626
  'GL Transaction'              => '',
1626 1627
  'GL Transaction (abbreviation)' => '',
1627 1628
  'GL Transactions'             => '',
......
3844 3845
  'This group is valid for the following clients' => '',
3845 3846
  'This has been changed in this version, therefore please change the "old" bins to some real warehouse bins.' => '',
3846 3847
  'This has been changed in this version.' => '',
3848
  'This invoice has already a further invoice for advanced payment.' => '',
3847 3849
  'This invoice has already been posted.' => '',
3848 3850
  'This invoice has been canceled already.' => '',
3849 3851
  'This invoice has been linked with a sepa export, undo this first.' => '',

Auch abrufbar als: Unified diff