Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1927b931

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

  • ID 1927b9314ffe8160b819ea9b314153766387d473
  • Vorgänger 796d0b76
  • Nachfolger cdd9fe3f

Gültigkeitstoken Einkaufsrechnung

Unterschiede anzeigen:

SL/DB/ValidityToken.pm
11 11

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

  
14
use constant SCOPE_SALES_INVOICE_POST  => 'SalesInvoice::Post';
15
use constant SCOPE_DELIVERY_ORDER_SAVE => 'DeliveryOrder::Save';
16
use constant SCOPE_ORDER_SAVE          => 'Order::Save';
17
use constant SCOPE_RECLAMATION_SAVE    => 'Reclamation::Save';
14
use constant SCOPE_SALES_INVOICE_POST    => 'SalesInvoice::Post';
15
use constant SCOPE_PURCHASE_INVOICE_POST => 'PurchaseInvoice::Post';
16
use constant SCOPE_DELIVERY_ORDER_SAVE   => 'DeliveryOrder::Save';
17
use constant SCOPE_ORDER_SAVE            => 'Order::Save';
18
use constant SCOPE_RECLAMATION_SAVE      => 'Reclamation::Save';
18 19

  
19 20
sub create {
20 21
  my ($class, %params) = @_;
bin/mozilla/do.pl
1148 1148

  
1149 1149
  $form->get_employee();
1150 1150

  
1151
  $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
1152 1151
  $form->{convert_from_do_ids} = $form->{id};
1153 1152
  # if we have a reqdate (Liefertermin), this is definetely the preferred
1154 1153
  # deliverydate for invoices
......
1167 1166
    $form->{script} = 'ir.pl';
1168 1167
    $script         = "ir";
1169 1168
    $buysell        = 'sell';
1169
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
1170 1170

  
1171 1171
  } else {
1172 1172
    $form->{title}  = $locale->text('Add Sales Invoice');
1173 1173
    $form->{script} = 'is.pl';
1174 1174
    $script         = "is";
1175 1175
    $buysell        = 'buy';
1176
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
1176 1177
  }
1177 1178

  
1178 1179
  for my $i (1 .. $form->{rowcount}) {
bin/mozilla/ir.pl
42 42
use SL::DB::Department;
43 43
use SL::DB::Project;
44 44
use SL::DB::PurchaseInvoice;
45
use SL::DB::ValidityToken;
45 46
use SL::DB::Vendor;
46 47
use List::MoreUtils qw(uniq);
47 48
use List::Util qw(max sum);
......
87 88

  
88 89
  $form->{title} = $locale->text('Record Vendor Invoice');
89 90

  
91
  if (!$form->{form_validity_token}) {
92
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
93
  }
94

  
90 95
  &invoice_links;
91 96
  &prepare_invoice;
92 97
  &display_form;
......
632 637
}
633 638

  
634 639
sub show_draft {
640
  $::form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
635 641
  update();
636 642
}
637 643

  
......
803 809
  $form->{invnumber} = "Storno zu " . $form->{invnumber};
804 810
  $form->{rowcount}++;
805 811
  $form->{employee_id} = $employee_id;
812

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

  
806 815
  post();
807 816
  $main::lxdebug->leave_sub();
808 817

  
......
821 830
  $form->{rowcount}--;
822 831
  $form->{invdate} = $form->current_date(\%myconfig);
823 832

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

  
824 835
  $form->{"converted_from_invoice_id_$_"} = delete $form->{"invoice_id_$_"} for 1 .. $form->{"rowcount"};
825 836

  
826 837
  $form->{useasnew} = 1;
......
904 915
  $main::auth->assert('vendor_invoice_edit');
905 916

  
906 917
  $form->mtime_ischanged('ap');
918

  
919
  my $validity_token;
920
  if (!$form->{id}) {
921
    $validity_token = SL::DB::Manager::ValidityToken->fetch_valid_token(
922
      scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST(),
923
      token => $form->{form_validity_token},
924
    );
925

  
926
    $form->error($::locale->text('The form is not valid anymore.')) if !$validity_token;
927
  }
928

  
907 929
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
908 930

  
909 931
  $form->isblank("invdate",   $locale->text('Invoice Date missing!'));
......
973 995

  
974 996
  relink_accounts();
975 997
  if (IR->post_invoice(\%myconfig, \%$form)){
998

  
999
    $validity_token->delete if $validity_token;
1000
    delete $form->{form_validity_token};
1001

  
976 1002
    # saving the history
977 1003
    if(!exists $form->{addition} && $form->{id} ne "") {
978 1004
      $form->{snumbers}  = qq|invnumber_| . $form->{invnumber};
bin/mozilla/oe.pl
1656 1656

  
1657 1657
  $main::auth->assert($form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation' ? 'vendor_invoice_edit' : 'invoice_edit');
1658 1658

  
1659
  $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
1660 1659
  $form->{old_salesman_id} = $form->{salesman_id};
1661 1660
  $form->get_employee();
1662 1661

  
......
1732 1731
    $form->{script} = 'ir.pl';
1733 1732
    $script         = "ir";
1734 1733
    $buysell        = 'sell';
1734
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_PURCHASE_INVOICE_POST())->token;
1735 1735
  }
1736 1736

  
1737 1737
  if (   $form->{type} eq 'sales_order'
......
1742 1742
    $form->{script} = 'is.pl';
1743 1743
    $script         = "is";
1744 1744
    $buysell        = 'buy';
1745
    $form->{form_validity_token} = SL::DB::ValidityToken->create(scope => SL::DB::ValidityToken::SCOPE_SALES_INVOICE_POST())->token;
1745 1746
  }
1746 1747

  
1747 1748
  # bo creates the id, reset it
templates/design40_webpages/ir/form_header.html
23 23
<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
24 24
<input type="hidden" name="follow_up_rowcount" value="1">
25 25
<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
26
[% IF !id %]
27
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
28
[% END %]
26 29

  
27 30
[% INCLUDE 'common/flash.html' %]
28 31
[% INCLUDE 'generic/set_longdescription.html' %]
templates/webpages/ir/form_header.html
21 21
<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
22 22
<input type="hidden" name="follow_up_rowcount" value="1">
23 23
<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
24
[% IF !id %]
25
[%   L.hidden_tag('form_validity_token', form_validity_token) %]
26
[% END %]
24 27

  
25 28
[%- INCLUDE 'common/flash.html' %]
26 29
[%- INCLUDE 'generic/set_longdescription.html' %]

Auch abrufbar als: Unified diff