Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 822fc676

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

  • ID 822fc6762cb3277c0e3cac8e3755001528528f1b
  • Vorgänger 680c7f12
  • Nachfolger 0c0e2ee2

Gültigkeitstoken: Kreditorenbuchung

Unterschiede anzeigen:

bin/mozilla/ap.pl
53 53
use SL::DB::PurchaseInvoice;
54 54
use SL::DB::RecordTemplate;
55 55
use SL::DB::Tax;
56
use SL::DB::ValidityToken;
56 57
use SL::Presenter::ItemsList;
57 58
use SL::Webdav;
58 59
use SL::Locale::String qw(t8);
......
182 183
                                  $form_defaults->{AP_paid_1_suggestion},
183 184
                                )) if $::form->{no_payment_bookings};
184 185

  
186
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
187

  
185 188
  update(
186 189
    keep_rows_without_amount => 1,
187 190
    dont_add_new_row         => 1,
......
267 270
    $form->{"AP_amount_chart_id_1"} = $last_used_ap_chart->id if $last_used_ap_chart;
268 271
  }
269 272

  
273
  if (!$form->{form_validity_token}) {
274
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
275
  }
276

  
270 277
  &display_form;
271 278

  
272 279
  $main::lxdebug->leave_sub();
......
639 646
sub show_draft {
640 647
  $::form->{transdate} = DateTime->today_local->to_kivitendo if !$::form->{transdate};
641 648
  $::form->{gldate}    = $::form->{transdate} if !$::form->{gldate};
649
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
642 650
  update();
643 651
}
644 652

  
......
798 806
  $main::auth->assert('ap_transactions');
799 807
  $form->mtime_ischanged('ap');
800 808

  
809
  my $validity_token;
810
  if (!$form->{id}) {
811
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
812
      scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST(),
813
      token => $form->{form_validity_token},
814
    );
815

  
816
    $form->error($::locale->text('The form is not valid anymore.')) if !$validity_token;
817
  }
818

  
801 819
  my ($inline) = @_;
802 820

  
803 821
  # check if there is a vendor, invoice, due date and invnumber
......
875 893
  $form->{id} = 0 if $form->{postasnew};
876 894

  
877 895
  if (AP->post_transaction(\%myconfig, \%$form)) {
896
    $validity_token->delete if $validity_token;
897
    delete $form->{form_validity_token};
898

  
878 899
    # create webdav folder
879 900
    if ($::instance_conf->get_webdav) {
880 901
      SL::Webdav->new(type     => 'accounts_payable',
......
966 987
    $form->{duedate}  = $payment_terms->calc_date(reference_date => $today)->to_kivitendo if $payment_terms;
967 988
  }
968 989

  
990
  $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
991

  
969 992
  &update;
970 993

  
971 994
  $main::lxdebug->leave_sub();
......
1324 1347
  $::form->{"AP_amount_chart_id_$row"} = $last_used_ap_chart->id if $last_used_ap_chart;
1325 1348
  $::form->{rowcount}                  = $row;
1326 1349

  
1350
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
1351

  
1327 1352
  update(
1328 1353
    keep_rows_without_amount => 1,
1329 1354
    dont_add_new_row         => 1,
templates/design40_webpages/ap/form_header.html
35 35

  
36 36
[% P.hidden_tag('convert_from_oe_id', convert_from_oe_id) %]
37 37

  
38
[% IF !id %]
39
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
40
[% END %]
41

  
38 42
[% FOREACH i IN [1..paidaccounts] %]
39 43
  [% temp = "acc_trans_id_"_ i %]
40 44
  <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
templates/webpages/ap/form_header.html
44 44

  
45 45
[%- P.hidden_tag('convert_from_oe_id', convert_from_oe_id) -%]
46 46

  
47
[% IF !id %]
48
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
49
[% END %]
50

  
47 51
[% FOREACH i IN [1..paidaccounts] %]
48 52
  [% temp = "acc_trans_id_"_ i %]
49 53
  <input type="hidden" name="[% temp %]" value="[% $temp | html %]">

Auch abrufbar als: Unified diff