Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 680c7f12

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

  • ID 680c7f127081e472405768fa4f8715b27c7b15c2
  • Vorgänger cdd9fe3f
  • Nachfolger 822fc676

Gültigkeitstoken: Debitorenbuchung

Unterschiede anzeigen:

bin/mozilla/ar.pl
51 51
use SL::DB::InvoiceItem;
52 52
use SL::DB::RecordTemplate;
53 53
use SL::DB::Tax;
54
use SL::DB::ValidityToken;
54 55
use SL::Helper::Flash qw(flash flash_later);
55 56
use SL::Locale::String qw(t8);
56 57
use SL::Presenter::Tag;
......
174 175

  
175 176
  flash('info', $::locale->text("The record template '#1' has been loaded.", $template->template_name));
176 177

  
178
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
179

  
177 180
  update(
178 181
    keep_rows_without_amount => 1,
179 182
    dont_add_new_row         => 1,
......
261 264
    $form->{"AR_amount_chart_id_1"} = $last_used_ar_chart->id if $last_used_ar_chart;
262 265
  }
263 266

  
267
  if (!$form->{form_validity_token}) {
268
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
269
  }
270

  
264 271
  &display_form;
265 272
  $main::lxdebug->leave_sub();
266 273
}
......
585 592
sub show_draft {
586 593
  $::form->{transdate} = DateTime->today_local->to_kivitendo if !$::form->{transdate};
587 594
  $::form->{gldate}    = $::form->{transdate} if !$::form->{gldate};
595
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
588 596
  update();
589 597
}
590 598

  
......
750 758

  
751 759
  $form->mtime_ischanged('ar');
752 760

  
761
  my $validity_token;
762
  if (!$form->{id}) {
763
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
764
      scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST(),
765
      token => $form->{form_validity_token},
766
    );
767

  
768
    $form->error($::locale->text('The form is not valid anymore.')) if !$validity_token;
769
  }
770

  
753 771
  my ($datepaid);
754 772

  
755 773
  # check if there is an invoice number, invoice and due date
......
812 830
  $form->{id} = 0 if $form->{postasnew};
813 831
  $form->error($locale->text('Cannot post transaction!')) unless AR->post_transaction(\%myconfig, \%$form);
814 832

  
833
  $validity_token->delete if $validity_token;
834
  delete $form->{form_validity_token};
835

  
815 836
  # saving the history
816 837
  if(!exists $form->{addition} && $form->{id} ne "") {
817 838
    $form->{snumbers}  = "invnumber_$form->{invnumber}";
......
880 901
    $form->{duedate}  = $payment_terms->calc_date(reference_date => $today)->to_kivitendo if $payment_terms;
881 902
  }
882 903

  
904
  $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
905

  
883 906
  &update;
884 907

  
885 908
  $main::lxdebug->leave_sub();

Auch abrufbar als: Unified diff