Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 796d0b76

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

  • ID 796d0b76d08c53f715b80ceaa4292135fb910063
  • Vorgänger 7f9bc2f0
  • Nachfolger 1927b931

Gültigkeitstoken Reklamationscontroller

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
25 25
use SL::DB::RecordLink;
26 26
use SL::DB::Shipto;
27 27
use SL::DB::Translation;
28
use SL::DB::ValidityToken;
28 29

  
29 30
use SL::Helper::CreatePDF qw(:all);
30 31
use SL::Helper::PrintOptions;
......
96 97

  
97 98
  $self->pre_render();
98 99

  
100
  if (!$::form->{form_validity_token}) {
101
    $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE())->token;
102
  }
103

  
99 104
  $self->render(
100 105
    'reclamation/form',
101 106
    title => $self->get_title_for('add'),
......
119 124

  
120 125
  $self->reinit_after_new_reclamation();
121 126

  
127
  if (!$::form->{form_validity_token}) {
128
    $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE())->token;
129
  }
130

  
122 131
  $self->render(
123 132
    'reclamation/form',
124 133
    title => $self->get_title_for('add'),
......
142 151

  
143 152
  $self->reinit_after_new_reclamation();
144 153

  
154
  if (!$::form->{form_validity_token}) {
155
    $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE())->token;
156
  }
157

  
145 158
  $self->render(
146 159
    'reclamation/form',
147 160
    title => $self->get_title_for('add'),
......
165 178

  
166 179
  $self->reinit_after_new_reclamation();
167 180

  
181
  if (!$::form->{form_validity_token}) {
182
    $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE())->token;
183
  }
184

  
168 185
  $self->render(
169 186
    'reclamation/form',
170 187
    title => $self->get_title_for('add'),
......
189 206

  
190 207
  $self->reinit_after_new_reclamation();
191 208

  
209
  if (!$::form->{form_validity_token}) {
210
    $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE())->token;
211
  }
212

  
192 213
  $self->render(
193 214
    'reclamation/form',
194 215
    title => $self->get_title_for('add'),
......
314 335
           )
315 336
         );
316 337

  
338
  if (!$::form->{form_validity_token}) {
339
    $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE())->token;
340
  }
341

  
317 342
  # save
318 343
  $self->action_save();
319 344
}
......
1721 1746
sub save {
1722 1747
  my ($self) = @_;
1723 1748

  
1749
  my $validity_token;
1750
  if (!$self->reclamation->id) {
1751
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
1752
      scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE(),
1753
      token => $::form->{form_validity_token},
1754
    );
1755

  
1756
    die t8('The form is not valid anymore.') if !$validity_token;
1757
  }
1758

  
1724 1759
  my $errors = [];
1725 1760
  my $db     = $self->reclamation->db;
1726 1761

  
......
1739 1774

  
1740 1775
    $self->save_history('SAVED');
1741 1776

  
1777
    $validity_token->delete if $validity_token;
1778
    delete $::form->{form_validity_token};
1779

  
1742 1780
    1;
1743 1781
  }) || push(@{$errors}, $db->error);
1744 1782

  
......
1784 1822

  
1785 1823
  $self->reinit_after_new_reclamation();
1786 1824

  
1825
  if (!$::form->{form_validity_token}) {
1826
    $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_RECLAMATION_SAVE())->token;
1827
  }
1828

  
1787 1829
  $self->render(
1788 1830
    'reclamation/form',
1789 1831
    title => $self->get_title_for('add'),
SL/DB/ValidityToken.pm
14 14
use constant SCOPE_SALES_INVOICE_POST  => 'SalesInvoice::Post';
15 15
use constant SCOPE_DELIVERY_ORDER_SAVE => 'DeliveryOrder::Save';
16 16
use constant SCOPE_ORDER_SAVE          => 'Order::Save';
17
use constant SCOPE_RECLAMATION_SAVE    => 'Reclamation::Save';
17 18

  
18 19
sub create {
19 20
  my ($class, %params) = @_;
templates/webpages/reclamation/form.html
24 24
  [% L.hidden_tag('converted_from_record_type_ref', SELF.reclamation.converted_from_record_type_ref) %]
25 25
  [% L.hidden_tag('converted_from_record_id',  SELF.reclamation.converted_from_record_id) %]
26 26

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

  
27 31
  [%- INCLUDE 'common/flash.html' %]
28 32

  
29 33
  <div class="tabwidget" id="reclamation_tabs">

Auch abrufbar als: Unified diff