Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d735aab3

Von Martin Helmling mh@waldpark.octosoft.eu vor mehr als 9 Jahren hinzugefügt

  • ID d735aab3fc2987d555c63ce0dc8e24626ca30654
  • Vorgänger 13a71e41
  • Nachfolger d2af074a

Prüfen beim Speichern, ob Dokument geändert wurde.

Allgemeine Funktion in Forms zum Lesen und Vergleichen der mtime

überall Form variable lastmtime da mtime mehrfach auftaucht

Conflicts:
templates/webpages/ar/form_header.html
templates/webpages/do/form_header.html

Unterschiede anzeigen:

SL/DO.pm
685 685
         dord.closed, dord.reqdate, dord.department_id, dord.cusordnumber,
686 686
         d.description AS department, dord.language_id,
687 687
         dord.shipto_id,
688
         dord.itime,dord.mtime,
688 689
         dord.globalproject_id, dord.delivered, dord.transaction_description,
689 690
         dord.taxzone_id, dord.taxincluded, dord.payment_id, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency,
690 691
         dord.delivery_term_id, dord.itime::DATE AS insertdate
......
719 720
    }
720 721
  }
721 722
  $sth->finish();
722

  
723
  $form->{mtime} = $form->{itime} if !$form->{mtime};
724
  $form->{lastmtime} = $form->{mtime};
723 725
  $form->{donumber_array} =~ s/\s*$//g;
724 726
  $form->{ordnumber_array} =~ s/ //;
725 727
  $form->{ordnumber_array} =~ s/\s*$//g;
SL/Form.pm
2603 2603
  $main::lxdebug->leave_sub();
2604 2604
}
2605 2605

  
2606
sub mtime_ischanged {
2607
  my ($self, $relation,$option) = @_;
2608
  #$main::lxdebug->message(LXDebug->DEBUG2(),"mtime_ischanged from rel=".$relation." id=".$id);
2609
  if ( ! $self->{id} ) { return ; }
2610

  
2611
  my $query = "SELECT mtime, itime FROM ".$relation." WHERE id = ?";
2612
  my $ref = selectfirst_hashref_query($self, $self->get_standard_dbh, $query, $self->{id});
2613
  $ref->{mtime} = $ref->{itime} if !$ref->{mtime};
2614
  #$main::lxdebug->message(LXDebug->DEBUG2(),"my  mtime=".$self->{lastmtime}." new mtime=".$ref->{mtime});
2615
  if ($self->{lastmtime} && $self->{lastmtime} ne $ref->{mtime} ) {
2616
      my $etxt = $main::locale->text("The document has been changed from other user. Please reopen it in another window and copy the changes to the new window");
2617
      $etxt = $main::locale->text("The document has been changed from other user. No mail was sent. Please reopen it in another window and copy the changes to the new window")
2618
				  if  defined $option && $option eq 'mail';
2619
      $self->error($main::locale->text($etxt));
2620
    ::end_of_request();
2621
  }
2622
}
2623

  
2606 2624
sub language_payment {
2607 2625
  $main::lxdebug->enter_sub();
2608 2626

  
......
2754 2772
      qq|SELECT
2755 2773
           a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid,
2756 2774
           a.duedate, a.ordnumber, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.notes,
2775
           a.mtime,a.itime,
2757 2776
           a.intnotes, a.department_id, a.amount AS oldinvtotal,
2758 2777
           a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type,
2759 2778
           a.globalproject_id, ${extra_columns}
......
2770 2789
    foreach my $key (keys %$ref) {
2771 2790
      $self->{$key} = $ref->{$key};
2772 2791
    }
2773

  
2792
    $self->{mtime} = $self->{itime} if ! $self->{mtime};
2793
    $self->{lastmtime} = $self->{mtime};
2774 2794
    my $transdate = "current_date";
2775 2795
    if ($self->{transdate}) {
2776 2796
      $transdate = $dbh->quote($self->{transdate});
SL/IC.pm
72 72
  # copy to $form variables
73 73
  map { $form->{$_} = $ref->{$_} } (keys %{$ref});
74 74

  
75
  $form->{mtime} = $form->{itime} if !$form->{mtime};
76
  $form->{lastmtime} = $form->{mtime};
75 77
  $form->{onhand} *= 1;
76 78

  
77 79
  # part or service item
SL/IR.pm
984 984
  $query = qq|SELECT cp_id, invnumber, transdate AS invdate, duedate,
985 985
                orddate, quodate, globalproject_id,
986 986
                ordnumber, quonumber, paid, taxincluded, notes, taxzone_id, storno, gldate,
987
                mtime, itime,
987 988
                intnotes, (SELECT cu.name FROM currencies cu WHERE cu.id=ap.currency_id) AS currency, direct_debit,
988 989
                delivery_term_id
989 990
              FROM ap
990 991
              WHERE id = ?|;
991 992
  $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
992 993
  map { $form->{$_} = $ref->{$_} } keys %$ref;
994
  $form->{mtime} = $form->{itime} if !$form->{mtime};
995
  $form->{lastmtime} = $form->{mtime};
993 996

  
994 997
  $form->{exchangerate}  = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "sell");
995 998

  
SL/IS.pm
1892 1892
           a.shippingpoint, a.shipvia, a.notes, a.intnotes, a.taxzone_id,
1893 1893
           a.duedate, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.shipto_id, a.cp_id,
1894 1894
           a.employee_id, a.salesman_id, a.payment_id,
1895
           a.mtime, a.itime,
1895 1896
           a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
1896 1897
           a.transaction_description, a.donumber, a.invnumber_for_credit_note,
1897 1898
           a.marge_total, a.marge_percent, a.direct_debit, a.delivery_term_id,
......
1903 1904
         WHERE a.id = ?|;
1904 1905
    $ref = selectfirst_hashref_query($form, $dbh, $query, $id);
1905 1906
    map { $form->{$_} = $ref->{$_} } keys %{ $ref };
1907
    $form->{mtime} = $form->{itime} if !$form->{mtime};
1908
    $form->{lastmtime} = $form->{mtime};
1906 1909

  
1907 1910
    $form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "buy");
1908 1911

  
SL/OE.pm
919 919
           (SELECT cu.name FROM currencies cu WHERE cu.id=o.currency_id) AS currency, e.name AS employee, o.employee_id, o.salesman_id,
920 920
           o.${vc}_id, cv.name AS ${vc}, o.amount AS invtotal,
921 921
           o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber,
922
           o.mtime, o.itime,
922 923
           d.description AS department, o.payment_id, o.language_id, o.taxzone_id,
923 924
           o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id,
924 925
           o.globalproject_id, o.delivered, o.transaction_description, o.delivery_term_id,
......
946 947
        map { $form->{$_} = '' if ($ref->{$_} ne $form->{$_}) } keys %$ref;
947 948
      }
948 949
    }
950
    $form->{mtime} = $form->{itime} if ! $form->{mtime};
951
    $form->{lastmtime} = $form->{mtime};
949 952

  
950 953
    # if not given, fill transdate with current_date
951 954
    $form->{transdate} = $form->current_date($myconfig)
bin/mozilla/ap.pl
584 584
  my $locale   = $main::locale;
585 585

  
586 586
  $main::auth->assert('general_ledger');
587
  $form->mtime_ischanged('ap');
587 588

  
588 589
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
589 590

  
......
632 633
  my $locale   = $main::locale;
633 634

  
634 635
  $main::auth->assert('general_ledger');
636
  $form->mtime_ischanged('ap');
635 637

  
636 638
  my ($inline) = @_;
637 639

  
bin/mozilla/ar.pl
616 616
  my %myconfig = %main::myconfig;
617 617
  my $locale   = $main::locale;
618 618

  
619
  $form->mtime_ischanged('ar');
619 620
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
620 621

  
621 622
  my $invdate = $form->datetonum($form->{transdate}, \%myconfig);
......
672 673

  
673 674
  my ($inline) = @_;
674 675

  
676
  $form->mtime_ischanged('ar');
677

  
675 678
  my ($datepaid);
676 679

  
677 680
  # check if there is an invoice number, invoice and due date
bin/mozilla/do.pl
708 708
  my %myconfig = %main::myconfig;
709 709
  my $locale   = $main::locale;
710 710

  
711
  $form->mtime_ischanged('delivery_orders');
712

  
711 713
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
712 714

  
713 715
  $form->isblank("transdate", $locale->text('Delivery Order Date missing!'));
......
785 787
  my $locale   = $main::locale;
786 788

  
787 789
  check_do_access();
790
  $form->mtime_ischanged('delivery_orders');
791

  
788 792
  $main::auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
789 793

  
790 794
  $form->{convert_from_do_ids} = $form->{id};
......
1010 1014

  
1011 1015
  check_do_access();
1012 1016

  
1013
  my $form     = $main::form;
1017
  $::form->mtime_ischanged('delivery_orders','mail');
1014 1018

  
1015
  $form->{print_and_save} = 1;
1019
  $::form->{print_and_save} = 1;
1016 1020

  
1017 1021
  my $saved_form = save_form();
1018 1022

  
bin/mozilla/ic.pl
1883 1883
  $lxdebug->enter_sub();
1884 1884

  
1885 1885
  $auth->assert('part_service_assembly_edit');
1886

  
1886
  $::form->mtime_ischanged('parts');
1887 1887
  my ($parts_id, %newform, $amount, $callback);
1888 1888

  
1889 1889
  # check if there is a part number - commented out, cause there is an automatic allocation of numbers
bin/mozilla/ir.pl
672 672

  
673 673
  $main::auth->assert('vendor_invoice_edit');
674 674

  
675
  $form->mtime_ischanged('ap') ;
675 676
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
676 677
  for my $i (1 .. $form->{paidaccounts}) {
677 678
    if ($form->{"paid_$i"}) {
......
731 732

  
732 733
  $main::auth->assert('vendor_invoice_edit');
733 734

  
735
  $form->mtime_ischanged('ap');
734 736
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
735 737

  
736 738
  $form->isblank("invdate",   $locale->text('Invoice Date missing!'));
bin/mozilla/is.pl
682 682

  
683 683
  $main::auth->assert('invoice_edit');
684 684

  
685
  $form->mtime_ischanged('ar') ;
685 686
  my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
686 687

  
687 688
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
......
737 738
  my $locale   = $main::locale;
738 739

  
739 740
  $main::auth->assert('invoice_edit');
741
  $form->mtime_ischanged('ar');
740 742

  
741 743
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
742 744
  $form->isblank("invdate",  $locale->text('Invoice Date missing!'));
bin/mozilla/oe.pl
1147 1147
  my $locale   = $main::locale;
1148 1148

  
1149 1149
  check_oe_access();
1150
  $form->mtime_ischanged('oe');
1150 1151

  
1151 1152
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
1152 1153

  
......
1253 1254

  
1254 1255
  check_oe_access();
1255 1256

  
1257
  $form->mtime_ischanged('oe');
1256 1258
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
1257 1259

  
1258 1260

  
......
1404 1406

  
1405 1407
  check_oe_access();
1406 1408
  check_oe_conversion_to_sales_invoice_allowed();
1409
  $form->mtime_ischanged('oe');
1410

  
1407 1411
  $main::auth->assert($form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation' ? 'vendor_invoice_edit' : 'invoice_edit');
1408 1412

  
1409 1413
  $form->{old_salesman_id} = $form->{salesman_id};
......
1751 1755
  my $locale   = $main::locale;
1752 1756

  
1753 1757
  check_oe_access();
1758
  $form->mtime_ischanged('oe');
1759

  
1754 1760
  $main::auth->assert('purchase_order_edit');
1755 1761

  
1756 1762
  $form->{sales_order_to_purchase_order} = 0;
......
1788 1794
  my $locale   = $main::locale;
1789 1795

  
1790 1796
  check_oe_access();
1797

  
1798
  $form->mtime_ischanged('oe');
1791 1799
  $main::auth->assert('sales_order_edit');
1792 1800

  
1793 1801
  if ($form->{type} eq "purchase_order") {
......
1878 1886
  my $form     = $main::form;
1879 1887
  my %myconfig = %main::myconfig;
1880 1888

  
1889
  $form->mtime_ischanged('oe');
1890

  
1881 1891
  if ($form->{type} =~ /^sales/) {
1882 1892
    $main::auth->assert('sales_delivery_order_edit');
1883 1893

  
......
1934 1944
  $main::lxdebug->enter_sub();
1935 1945

  
1936 1946
  my $form     = $main::form;
1947
  my $locale   = $main::locale;
1937 1948

  
1938 1949
  check_oe_access();
1939 1950

  
1951
  $form->mtime_ischanged('oe','mail');
1940 1952
  $form->{print_and_save} = 1;
1941 1953

  
1942 1954
  my $saved_form = save_form();
locale/de/all
2726 2726
  'The discount must be less than 100%.' => 'Der Rabatt muss kleiner als 100% sein.',
2727 2727
  'The discount must not be negative.' => 'Der Rabatt darf nicht negativ sein.',
2728 2728
  'The discounted amount will be shown in documents.' => 'Der Rabattbetrag wird in Belegen ausgewiesen.',
2729
  'The document has been changed from other user. No mail was sent. Please reopen it in another window and copy the changes to the new window' => 'Die Daten wurden bereits von einem anderen Benutzer verändert. Deshalb ist das Dokument ungültig und es wurde keine E-Mail verschickt. Bitte öffnen Sie das Dokument erneut in einem extra Fenster und übertragen Sie die Daten', 
2730
  'The document has been changed from other user. Please reopen it in another window and copy the changes to the new window' => 'Die Daten wurden bereits von einem anderen Benutzer verändert. Deshalb ist das Dokument ungültig. Bitte öffnen Sie das Dokument erneut in einem extra Fenster und übertragen Sie die Daten',
2729 2731
  'The document have been sent to \'#1\'.' => 'Das Dokument wurde an \'#1\' geschickt.',
2730 2732
  'The documents have been sent to the printer \'#1\'.' => 'Die Dokumente wurden an den Drucker \'#1\' geschickt.',
2731 2733
  'The dunning process started' => 'Der Mahnprozess ist gestartet.',
templates/webpages/ap/form_header.html
39 39
<input type="hidden" name="creditremaining" value="[% creditremaining | html %]">
40 40

  
41 41
<input type="hidden" name="forex" value="[% forex | html %]">
42
<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
42 43

  
43 44
<input type="hidden" name="id" value="[% id | html %]">
44 45
<input type="hidden" name="sort" value="[% sort | html %]">
templates/webpages/ar/form_header.html
14 14
[% L.hidden_tag('follow_up_trans_type_1', 'ar_transaction') %]
15 15
[% L.hidden_tag('follow_up_trans_info_1', follow_up_trans_info) %]
16 16
[% L.hidden_tag('follow_up_rowcount', 1) %]
17
<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
17 18

  
18 19
<h1>[% title | html %]</h1>
19 20

  
templates/webpages/do/form_header.html
109 109
  <input type="hidden" name="title" value="[% HTML.escape(title) %]">
110 110
  <input type="hidden" name="type" value="[% HTML.escape(type) %]">
111 111
  <input type="hidden" name="vc" value="[% HTML.escape(vc) %]">
112
  <input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
112 113

  
113 114
  <p>
114 115
   <table width="100%">
templates/webpages/ir/form_header.html
22 22
<input type="hidden" name="follow_up_trans_type_1" value="sales_invoice">
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
<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
25 26

  
26 27
[%- INCLUDE 'common/flash.html' %]
27 28
[%- INCLUDE 'generic/set_longdescription.html' %]
templates/webpages/is/form_header.html
19 19
<input type="hidden" name="follow_up_trans_type_1" value="sales_invoice">
20 20
<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
21 21
<input type="hidden" name="follow_up_rowcount" value="1">
22
<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
22 23

  
23 24
<h1>[% title %]</h1>
24 25

  
templates/webpages/oe/form_header.html
25 25
    <input type="hidden" name="follow_up_trans_type_1" value="[% HTML.escape(type) %]">
26 26
    <input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
27 27
    <input type="hidden" name="follow_up_rowcount" value="1">
28
    <input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
28 29

  
29 30
    <h1>[% title %]</h1>
30 31

  

Auch abrufbar als: Unified diff