$form->{id});
do_query($form, $dbh, $query, @values);
+ $form->new_lastmtime('ap');
+
# add individual transactions
for my $i (1 .. $form->{rowcount}) {
if ($form->{"amount_$i"} != 0) {
if ($payments_only) {
$query = qq|UPDATE ap SET paid = ?, datepaid = ? WHERE id = ?|;
do_query($form, $dbh, $query, $form->{invpaid}, $form->{invpaid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
+ $form->new_lastmtime('ap');
}
IO->set_datepaid(table => 'ap', id => $form->{id}, dbh => $dbh);
$query = qq|UPDATE ap SET paid = amount + paid, storno = 't' WHERE id = ?|;
do_query($form, $dbh, $query, $id);
+ $form->new_lastmtime('ap') if $id == $form->{id};
+
# now copy acc_trans entries
$query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.acc_trans_id|;
my $rowref = selectall_hashref_query($form, $dbh, $query, $id);
map { IO->set_datepaid(table => 'ap', id => $_, dbh => $dbh) } ($id, $new_id);
+ $form->new_lastmtime('ap') if $storno_id == $form->{id};
+
$dbh->commit;
$main::lxdebug->leave_sub();
do_query($form, $dbh, $query, $form->{paid}, $form->{paid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id}));
}
+ $form->new_lastmtime('ar');
+
# add paid transactions
for my $i (1 .. $form->{paidaccounts}) {
$query = qq|UPDATE ar SET paid = amount + paid, storno = 't' WHERE id = ?|;
do_query($form, $dbh, $query, $id);
+ $form->new_lastmtime('ar') if $id == $form->{id};
+
# now copy acc_trans entries
$query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.acc_trans_id|;
my $rowref = selectall_hashref_query($form, $dbh, $query, $id);
map { IO->set_datepaid(table => 'ar', id => $_, dbh => $dbh) } ($id, $new_id);
+ $form->new_lastmtime('ar') if $storno_id == $form->{id};
+
$dbh->commit;
$main::lxdebug->leave_sub();
conv_i($form->{id}));
do_query($form, $dbh, $query, @values);
+ $form->new_lastmtime('delivery_orders');
+
$form->{name} = $form->{ $form->{vc} };
$form->{name} =~ s/--$form->{"$form->{vc}_id"}//;
do_query($form, $dbh, $query, map { conv_i($_) } @{ $params{ids} });
$dbh->commit() unless ($params{dbh});
+ $form->new_lastmtime('delivery_orders');
$main::lxdebug->leave_sub();
}
$main::lxdebug->leave_sub();
}
+sub new_lastmtime {
+ my ($self, $table, $option) = @_;
+
+ return unless $self->{id};
+ croak ("wrong call, no valid table defined") unless $table =~ /^(oe|ar|ap|delivery_orders|parts)$/;
+
+ my $query = "SELECT mtime, itime FROM " . $table . " WHERE id = ?";
+ my $ref = selectfirst_hashref_query($self, $self->get_standard_dbh, $query, $self->{id});
+ $ref->{mtime} ||= $ref->{itime};
+ $self->{lastmtime} = $ref->{mtime};
+ $main::lxdebug->message(LXDebug->DEBUG2(),"new lastmtime=".$self->{lastmtime});
+}
+
sub mtime_ischanged {
my ($self, $table, $option) = @_;
);
do_query($form, $dbh, $query, @values);
+ $form->new_lastmtime('parts');
+
# delete translation records
do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id}));
$qty * ($form->{weight} - $weight), conv_i($id));
do_query($form, $dbh, $query, @values);
+ $form->new_lastmtime('parts') if $id == $form->{id};
+
$main::lxdebug->leave_sub();
}
if ($payments_only) {
$query = qq|UPDATE ap SET paid = ? WHERE id = ?|;
do_query($form, $dbh, $query, $form->{paid}, conv_i($form->{id}));
-
+ $form->new_lastmtime('ap');
if (!$provided_dbh) {
$dbh->commit();
$dbh->disconnect();
do_query($form, $dbh, $query, conv_i($form->{id}));
}
+ $form->new_lastmtime('ap');
$form->{name} = $form->{vendor};
$form->{name} =~ s/--\Q$form->{vendor_id}\E//;
$query = qq|UPDATE ar SET paid = ? WHERE id = ?|;
do_query($form, $dbh, $query, $form->{paid}, conv_i($form->{id}));
+ $form->new_lastmtime('ar');
+
$dbh->commit if !$provided_dbh;
$main::lxdebug->leave_sub();
do_query($form, $dbh, qq|UPDATE ar SET paid = amount WHERE id = ?|, conv_i($form->{"id"}));
}
+ $form->new_lastmtime('ar');
+
$form->{name} = $form->{customer};
$form->{name} =~ s/--\Q$form->{customer_id}\E//;
conv_i($form->{id}));
do_query($form, $dbh, $query, @values);
+ $form->new_lastmtime('oe');
+
$form->{ordtotal} = $amount;
$form->{name} = $form->{ $form->{vc} };