Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b5e76ec2

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

  • ID b5e76ec293bbe21669526c1e227f93780b847d42
  • Vorgänger 44ee92cb
  • Nachfolger 6c6cf6d9

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);
......
307 307
  if ($::instance_conf->get_warn_no_delivery_order_for_invoice && !$form->{id}) {
308 308
    $warn_unlinked_delivery_order = 1 unless $form->{convert_from_do_ids};
309 309
  }
310

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

  
310 318
  for my $bar ($::request->layout->get('actionbar')) {
311 319
    $bar->add(
312 320
      action => [
......
391 399
                    : !$form->{id}      ? t8('This invoice has not been posted yet.')
392 400
                    :                     undef,
393 401
        ],
402
        action => [
403
          t8('Further Invoice for Advance Payment'),
404
          submit   => [ '#form', { action => "further_invoice_for_advance_payment" } ],
405
          checks   => [ 'kivi.validate_form' ],
406
          disabled => !$may_edit_create ? t8('You must not change this invoice.')
407
                    : !$form->{id}      ? t8('This invoice has not been posted yet.')
408
                    : $has_further_invoice_for_advance_payment ? t8('This invoice has already a further invoice for advanced payment.')
409
                    :                     undef,
410
          only_if  => $form->{type} eq "invoice_for_advance_payment",
411
        ],
394 412
        action => [
395 413
          t8('Credit Note'),
396 414
          submit   => [ '#form', { action => "credit_note" } ],
......
1119 1137
  $main::lxdebug->leave_sub();
1120 1138
}
1121 1139

  
1140
sub further_invoice_for_advance_payment {
1141
  my $form     = $main::form;
1142
  my %myconfig = %main::myconfig;
1143

  
1144
  $main::auth->assert('invoice_edit');
1145

  
1146
  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)};
1147
  $form->{convert_from_ar_ids} = $form->{id};
1148
  $form->{id}                  = '';
1149
  $form->{rowcount}--;
1150
  $form->{paidaccounts}        = 1;
1151
  $form->{invdate}             = $form->current_date(\%myconfig);
1152
  my $terms                    = get_payment_terms_for_invoice();
1153
  $form->{duedate}             = $terms ? $terms->calc_date(reference_date => $form->{invdate})->to_kivitendo : $form->{invdate};
1154
  $form->{employee_id}         = SL::DB::Manager::Employee->current->id;
1155
  $form->{forex}               = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy');
1156
  $form->{exchangerate}        = $form->{forex} if $form->{forex};
1157

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

  
1160
  &display_form;
1161
}
1162

  
1122 1163
sub storno {
1123 1164
  $main::lxdebug->enter_sub();
1124 1165

  
......
1248 1289

  
1249 1290
  &prepare_invoice;
1250 1291

  
1251

  
1252 1292
  &display_form;
1253 1293

  
1254 1294
  $main::lxdebug->leave_sub();
locale/de/all
1605 1605
  'Function block actions'      => 'Funktionsblockaktionen',
1606 1606
  'Function block number format' => 'Format der Funktionsblocknummerierung',
1607 1607
  'Function/position'           => 'Funktion/Position',
1608
  'Further Invoice for Advance Payment' => 'Weitere Anzahlungsrechnung',
1608 1609
  'GL Transaction'              => 'Dialogbuchung',
1609 1610
  'GL Transaction (abbreviation)' => 'DB',
1610 1611
  'GL Transactions'             => 'Dialogbuchungen',
......
3797 3798
  'This group is valid for the following clients' => 'Diese Gruppe ist für die folgenden Mandanten gültig',
3798 3799
  '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.',
3799 3800
  'This has been changed in this version.' => 'Ab dieser Version ist dies nicht mehr so.',
3801
  'This invoice has already a further invoice for advanced payment.' => 'Diese Rechnung hat schon eine weitere Anzahlungsrechnung.',
3800 3802
  'This invoice has already been posted.' => 'Die Rechnung wurde bereits gebucht.',
3801 3803
  'This invoice has been canceled already.' => 'Die Rechnung wurde bereits storniert.',
3802 3804
  '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
1605 1605
  'Function block actions'      => '',
1606 1606
  'Function block number format' => '',
1607 1607
  'Function/position'           => '',
1608
  'Further Invoice for Advance Payment' => '',
1608 1609
  'GL Transaction'              => '',
1609 1610
  'GL Transaction (abbreviation)' => '',
1610 1611
  'GL Transactions'             => '',
......
3796 3797
  'This group is valid for the following clients' => '',
3797 3798
  'This has been changed in this version, therefore please change the "old" bins to some real warehouse bins.' => '',
3798 3799
  'This has been changed in this version.' => '',
3800
  'This invoice has already a further invoice for advanced payment.' => '',
3799 3801
  'This invoice has already been posted.' => '',
3800 3802
  'This invoice has been canceled already.' => '',
3801 3803
  'This invoice has been linked with a sepa export, undo this first.' => '',

Auch abrufbar als: Unified diff