dord.closed, dord.reqdate, dord.department_id, dord.cusordnumber,
d.description AS department, dord.language_id,
dord.shipto_id,
+ dord.itime,dord.mtime,
dord.globalproject_id, dord.delivered, dord.transaction_description,
dord.taxzone_id, dord.taxincluded, dord.payment_id, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency,
dord.delivery_term_id, dord.itime::DATE AS insertdate
}
}
$sth->finish();
-
+ $form->{mtime} = $form->{itime} if !$form->{mtime};
+ $form->{lastmtime} = $form->{mtime};
$form->{donumber_array} =~ s/\s*$//g;
$form->{ordnumber_array} =~ s/ //;
$form->{ordnumber_array} =~ s/\s*$//g;
$main::lxdebug->leave_sub();
}
+sub mtime_ischanged {
+ my ($self, $relation,$option) = @_;
+ #$main::lxdebug->message(LXDebug->DEBUG2(),"mtime_ischanged from rel=".$relation." id=".$id);
+ if ( ! $self->{id} ) { return ; }
+
+ my $query = "SELECT mtime, itime FROM ".$relation." WHERE id = ?";
+ my $ref = selectfirst_hashref_query($self, $self->get_standard_dbh, $query, $self->{id});
+ $ref->{mtime} = $ref->{itime} if !$ref->{mtime};
+ #$main::lxdebug->message(LXDebug->DEBUG2(),"my mtime=".$self->{lastmtime}." new mtime=".$ref->{mtime});
+ if ($self->{lastmtime} && $self->{lastmtime} ne $ref->{mtime} ) {
+ 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");
+ $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")
+ if defined $option && $option eq 'mail';
+ $self->error($main::locale->text($etxt));
+ ::end_of_request();
+ }
+}
+
sub language_payment {
$main::lxdebug->enter_sub();
qq|SELECT
a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid,
a.duedate, a.ordnumber, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.notes,
+ a.mtime,a.itime,
a.intnotes, a.department_id, a.amount AS oldinvtotal,
a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type,
a.globalproject_id, ${extra_columns}
foreach my $key (keys %$ref) {
$self->{$key} = $ref->{$key};
}
-
+ $self->{mtime} = $self->{itime} if ! $self->{mtime};
+ $self->{lastmtime} = $self->{mtime};
my $transdate = "current_date";
if ($self->{transdate}) {
$transdate = $dbh->quote($self->{transdate});
# copy to $form variables
map { $form->{$_} = $ref->{$_} } (keys %{$ref});
+ $form->{mtime} = $form->{itime} if !$form->{mtime};
+ $form->{lastmtime} = $form->{mtime};
$form->{onhand} *= 1;
# part or service item
$query = qq|SELECT cp_id, invnumber, transdate AS invdate, duedate,
orddate, quodate, globalproject_id,
ordnumber, quonumber, paid, taxincluded, notes, taxzone_id, storno, gldate,
+ mtime, itime,
intnotes, (SELECT cu.name FROM currencies cu WHERE cu.id=ap.currency_id) AS currency, direct_debit,
delivery_term_id
FROM ap
WHERE id = ?|;
$ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id}));
map { $form->{$_} = $ref->{$_} } keys %$ref;
+ $form->{mtime} = $form->{itime} if !$form->{mtime};
+ $form->{lastmtime} = $form->{mtime};
$form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "sell");
a.shippingpoint, a.shipvia, a.notes, a.intnotes, a.taxzone_id,
a.duedate, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.shipto_id, a.cp_id,
a.employee_id, a.salesman_id, a.payment_id,
+ a.mtime, a.itime,
a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type,
a.transaction_description, a.donumber, a.invnumber_for_credit_note,
a.marge_total, a.marge_percent, a.direct_debit, a.delivery_term_id,
WHERE a.id = ?|;
$ref = selectfirst_hashref_query($form, $dbh, $query, $id);
map { $form->{$_} = $ref->{$_} } keys %{ $ref };
+ $form->{mtime} = $form->{itime} if !$form->{mtime};
+ $form->{lastmtime} = $form->{mtime};
$form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "buy");
(SELECT cu.name FROM currencies cu WHERE cu.id=o.currency_id) AS currency, e.name AS employee, o.employee_id, o.salesman_id,
o.${vc}_id, cv.name AS ${vc}, o.amount AS invtotal,
o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber,
+ o.mtime, o.itime,
d.description AS department, o.payment_id, o.language_id, o.taxzone_id,
o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id,
o.globalproject_id, o.delivered, o.transaction_description, o.delivery_term_id,
map { $form->{$_} = '' if ($ref->{$_} ne $form->{$_}) } keys %$ref;
}
}
+ $form->{mtime} = $form->{itime} if ! $form->{mtime};
+ $form->{lastmtime} = $form->{mtime};
# if not given, fill transdate with current_date
$form->{transdate} = $form->current_date($myconfig)
my $locale = $main::locale;
$main::auth->assert('general_ledger');
+ $form->mtime_ischanged('ap');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
my $locale = $main::locale;
$main::auth->assert('general_ledger');
+ $form->mtime_ischanged('ap');
my ($inline) = @_;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
+ $form->mtime_ischanged('ar');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
my $invdate = $form->datetonum($form->{transdate}, \%myconfig);
my ($inline) = @_;
+ $form->mtime_ischanged('ar');
+
my ($datepaid);
# check if there is an invoice number, invoice and due date
my %myconfig = %main::myconfig;
my $locale = $main::locale;
+ $form->mtime_ischanged('delivery_orders');
+
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("transdate", $locale->text('Delivery Order Date missing!'));
my $locale = $main::locale;
check_do_access();
+ $form->mtime_ischanged('delivery_orders');
+
$main::auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
$form->{convert_from_do_ids} = $form->{id};
check_do_access();
- my $form = $main::form;
+ $::form->mtime_ischanged('delivery_orders','mail');
- $form->{print_and_save} = 1;
+ $::form->{print_and_save} = 1;
my $saved_form = save_form();
$lxdebug->enter_sub();
$auth->assert('part_service_assembly_edit');
-
+ $::form->mtime_ischanged('parts');
my ($parts_id, %newform, $amount, $callback);
# check if there is a part number - commented out, cause there is an automatic allocation of numbers
$main::auth->assert('vendor_invoice_edit');
+ $form->mtime_ischanged('ap') ;
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"}) {
$main::auth->assert('vendor_invoice_edit');
+ $form->mtime_ischanged('ap');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$main::auth->assert('invoice_edit');
+ $form->mtime_ischanged('ar') ;
my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
my $locale = $main::locale;
$main::auth->assert('invoice_edit');
+ $form->mtime_ischanged('ar');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
my $locale = $main::locale;
check_oe_access();
+ $form->mtime_ischanged('oe');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
check_oe_access();
+ $form->mtime_ischanged('oe');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
check_oe_access();
check_oe_conversion_to_sales_invoice_allowed();
+ $form->mtime_ischanged('oe');
+
$main::auth->assert($form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation' ? 'vendor_invoice_edit' : 'invoice_edit');
$form->{old_salesman_id} = $form->{salesman_id};
my $locale = $main::locale;
check_oe_access();
+ $form->mtime_ischanged('oe');
+
$main::auth->assert('purchase_order_edit');
$form->{sales_order_to_purchase_order} = 0;
my $locale = $main::locale;
check_oe_access();
+
+ $form->mtime_ischanged('oe');
$main::auth->assert('sales_order_edit');
if ($form->{type} eq "purchase_order") {
my $form = $main::form;
my %myconfig = %main::myconfig;
+ $form->mtime_ischanged('oe');
+
if ($form->{type} =~ /^sales/) {
$main::auth->assert('sales_delivery_order_edit');
$main::lxdebug->enter_sub();
my $form = $main::form;
+ my $locale = $main::locale;
check_oe_access();
+ $form->mtime_ischanged('oe','mail');
$form->{print_and_save} = 1;
my $saved_form = save_form();
'The discount must be less than 100%.' => 'Der Rabatt muss kleiner als 100% sein.',
'The discount must not be negative.' => 'Der Rabatt darf nicht negativ sein.',
'The discounted amount will be shown in documents.' => 'Der Rabattbetrag wird in Belegen ausgewiesen.',
+ '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',
+ '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',
'The document have been sent to \'#1\'.' => 'Das Dokument wurde an \'#1\' geschickt.',
'The documents have been sent to the printer \'#1\'.' => 'Die Dokumente wurden an den Drucker \'#1\' geschickt.',
'The dunning process started' => 'Der Mahnprozess ist gestartet.',
<input type="hidden" name="creditremaining" value="[% creditremaining | html %]">
<input type="hidden" name="forex" value="[% forex | html %]">
+<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
<input type="hidden" name="id" value="[% id | html %]">
<input type="hidden" name="sort" value="[% sort | html %]">
[% L.hidden_tag('follow_up_trans_type_1', 'ar_transaction') %]
[% L.hidden_tag('follow_up_trans_info_1', follow_up_trans_info) %]
[% L.hidden_tag('follow_up_rowcount', 1) %]
+<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
<h1>[% title | html %]</h1>
<input type="hidden" name="title" value="[% HTML.escape(title) %]">
<input type="hidden" name="type" value="[% HTML.escape(type) %]">
<input type="hidden" name="vc" value="[% HTML.escape(vc) %]">
+ <input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
<p>
<table width="100%">
<input type="hidden" name="follow_up_trans_type_1" value="sales_invoice">
<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
<input type="hidden" name="follow_up_rowcount" value="1">
+<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
[%- INCLUDE 'common/flash.html' %]
[%- INCLUDE 'generic/set_longdescription.html' %]
<input type="hidden" name="follow_up_trans_type_1" value="sales_invoice">
<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
<input type="hidden" name="follow_up_rowcount" value="1">
+<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
<h1>[% title %]</h1>
<input type="hidden" name="follow_up_trans_type_1" value="[% HTML.escape(type) %]">
<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
<input type="hidden" name="follow_up_rowcount" value="1">
+ <input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
<h1>[% title %]</h1>