Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a03e4841

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

  • ID a03e4841e8d7faaca994f8f5549c6448c203399e
  • Vorgänger 4b184957
  • Nachfolger 5cada5ab

Gültigkeitstoken Lieferscheine (alter Controller)

Unterschiede anzeigen:

SL/DB/ValidityToken.pm
11 11

  
12 12
__PACKAGE__->meta->initialize;
13 13

  
14
use constant SCOPE_SALES_INVOICE_POST => 'SalesInvoice::Post';
14
use constant SCOPE_SALES_INVOICE_POST  => 'SalesInvoice::Post';
15
use constant SCOPE_DELIVERY_ORDER_SAVE => 'DeliveryOrder::Save';
15 16

  
16 17
sub create {
17 18
  my ($class, %params) = @_;
bin/mozilla/do.pl
114 114
  $form->{show_details} = $::myconfig{show_form_details};
115 115
  $form->{callback} = build_std_url('action=add', 'type', 'vc') unless ($form->{callback});
116 116

  
117
  if (!$form->{form_validity_token}) {
118
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_DELIVERY_ORDER_SAVE())->token;
119
  }
120

  
117 121
  order_links(is_new => 1);
118 122
  prepare_order();
119 123
  display_form();
......
987 991

  
988 992
  $form->mtime_ischanged('delivery_orders');
989 993

  
994
  my $validity_token;
995
  if (!$form->{id}) {
996
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
997
      scope => SL::DB::ValidityToken::SCOPE_DELIVERY_ORDER_SAVE(),
998
      token => $form->{form_validity_token},
999
    );
1000

  
1001
    $form->error($::locale->text('The form is not valid anymore.')) if !$validity_token;
1002
  }
1003

  
990 1004
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
991 1005

  
992 1006
  $form->isblank("transdate", $locale->text('Delivery Order Date missing!'));
......
1041 1055
    }
1042 1056
  }
1043 1057
  DO->save();
1058

  
1059
  $validity_token->delete if $validity_token;
1060
  delete $form->{form_validity_token};
1061

  
1044 1062
  # saving the history
1045 1063
  if(!exists $form->{addition}) {
1046 1064
    $form->{snumbers} = qq|donumber_| . $form->{donumber};
bin/mozilla/oe.pl
2077 2077
    $form->{type}  = 'purchase_delivery_order';
2078 2078
  }
2079 2079

  
2080
  $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_DELIVERY_ORDER_SAVE())->token;
2081

  
2080 2082
  $form->get_employee();
2081 2083

  
2082 2084
  require "bin/mozilla/do.pl";
templates/design40_webpages/do/form_header.html
119 119
<input type="hidden" name="lastmtime" id="lastmtime" value="[% HTML.escape(lastmtime) %]">
120 120
<input type="hidden" name="tax_point" id="tax_point" value="[% HTML.escape(tax_point) %]">
121 121

  
122

  
122
[% IF !id %]
123
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
124
[% END %]
123 125

  
124 126
<table class="tbl-horizontal col">
125 127
  <caption>[% 'Customer & Order Information' | $T8 %]</caption>
templates/webpages/do/form_header.html
122 122
  <input type="hidden" name="lastmtime" id="lastmtime" value="[% HTML.escape(lastmtime) %]">
123 123
  <input type="hidden" name="tax_point" id="tax_point" value="[% HTML.escape(tax_point) %]">
124 124

  
125
  [% IF !id %]
126
  [%   L.hidden_tag('form_validity_token', form_validity_token) %]
127
  [% END %]
128

  
125 129
  <p>
126 130
   <table width="100%">
127 131
    <tr valign="top">

Auch abrufbar als: Unified diff