Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0c0e2ee2

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

  • ID 0c0e2ee2fe0e7893532a1346bbc979eea0dfa03d
  • Vorgänger 822fc676
  • Nachfolger 5427e094

Gültigkeitstoken: Dialogbuchung

Unterschiede anzeigen:

SL/DB/ValidityToken.pm
16 16
use constant SCOPE_DELIVERY_ORDER_SAVE   => 'DeliveryOrder::Save';
17 17
use constant SCOPE_ORDER_SAVE            => 'Order::Save';
18 18
use constant SCOPE_RECLAMATION_SAVE      => 'Reclamation::Save';
19
use constant SCOPE_GL_TRANSACTION_POST   => 'GLTransaction::Post';
19 20

  
20 21
sub create {
21 22
  my ($class, %params) = @_;
bin/mozilla/gl.pl
43 43
use SL::DB::ReconciliationLink;
44 44
use SL::DB::BankTransactionAccTrans;
45 45
use SL::DB::Tax;
46
use SL::DB::ValidityToken;
46 47
use SL::FU;
47 48
use SL::GL;
48 49
use SL::Helper::Flash qw(flash flash_later);
......
148 149

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

  
152
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_GL_TRANSACTION_POST())->token;
153

  
151 154
  update(
152 155
    keep_rows_without_amount => 1,
153 156
    dont_add_new_row         => 1,
......
240 243

  
241 244
  $form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details};
242 245

  
246
  if (!$form->{form_validity_token}) {
247
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_GL_TRANSACTION_POST())->token;
248
  }
249

  
243 250
  &display_form(1);
244 251
  $main::lxdebug->leave_sub();
245 252

  
......
659 666
sub show_draft {
660 667
  $::form->{transdate} = DateTime->today_local->to_kivitendo if !$::form->{transdate};
661 668
  $::form->{gldate}    = $::form->{transdate} if !$::form->{gldate};
669
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_GL_TRANSACTION_POST())->token;
662 670
  update();
663 671
}
664 672

  
......
1448 1456
  my $form     = $main::form;
1449 1457
  my $locale   = $main::locale;
1450 1458

  
1459
  my $validity_token;
1460
  if (!$form->{id}) {
1461
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
1462
      scope => SL::DB::ValidityToken::SCOPE_GL_TRANSACTION_POST(),
1463
      token => $form->{form_validity_token},
1464
    );
1465

  
1466
    $form->error($::locale->text('The form is not valid anymore.')) if !$validity_token;
1467
  }
1468

  
1451 1469
  if ($::myconfig{mandatory_departments} && !$form->{department_id}) {
1452 1470
    $form->error($locale->text('You have to specify a department.'));
1453 1471
  }
......
1456 1474
  $form->{storno} = 0;
1457 1475

  
1458 1476
  post_transaction();
1477

  
1478
  # If we get here, the transaction is posted.
1479
  $validity_token->delete if $validity_token;
1480
  delete $form->{form_validity_token};
1481

  
1459 1482
  if ($::instance_conf->get_webdav) {
1460 1483
    SL::Webdav->new(type     => 'general_ledger',
1461 1484
                    number   => $form->{id},
templates/design40_webpages/gl/form_header.html
24 24
  [% L.hidden_tag(name, $name) %]
25 25
[% END %]
26 26

  
27
[% IF !id %]
28
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
29
[% END %]
30

  
27 31
<input type=hidden name=title value="[% hide_title | html %]">
28 32

  
29 33
<input type="hidden" name="follow_up_trans_id_1" value="[% id | html %]">
templates/webpages/gl/form_header.html
24 24
[% L.hidden_tag(name, $name) %]
25 25
[%- END %]
26 26

  
27
[% IF !id %]
28
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
29
[% END %]
30

  
27 31
<input type=hidden name=title value="[% hide_title | html %]">
28 32

  
29 33
<input type="hidden" name="follow_up_trans_id_1" value="[% id | html %]">

Auch abrufbar als: Unified diff