projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bugfix bei Artikelstammdaten: Beim erneuten Aufrufen des Sprachenfensters wurden...
[kivitendo-erp.git]
/
SL
/
Drafts.pm
diff --git
a/SL/Drafts.pm
b/SL/Drafts.pm
index
2ff3df8
..
4408899
100644
(file)
--- a/
SL/Drafts.pm
+++ b/
SL/Drafts.pm
@@
-34,12
+34,14
@@
sub get_module {
return ($module, $submodule);
}
return ($module, $submodule);
}
+@dont_save = qw(login password stylesheet action);
+
sub save {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form, $draft_id, $draft_description) = @_;
sub save {
$main::lxdebug->enter_sub();
my ($self, $myconfig, $form, $draft_id, $draft_description) = @_;
- my ($dbh, $sth, $query, %saved,
@dont_save,
$dumped);
+ my ($dbh, $sth, $query, %saved, $dumped);
$dbh = $form->dbconnect_noauto($myconfig);
$dbh = $form->dbconnect_noauto($myconfig);
@@
-47,15
+49,16
@@
sub save {
$query = "SELECT COUNT(*) FROM drafts WHERE id = ?";
my ($res) = selectrow_query($form, $dbh, $query, $draft_id);
$query = "SELECT COUNT(*) FROM drafts WHERE id = ?";
my ($res) = selectrow_query($form, $dbh, $query, $draft_id);
+
if (!$res) {
$draft_id = $module . "-" . $submodule . "-" . Common::unique_id();
if (!$res) {
$draft_id = $module . "-" . $submodule . "-" . Common::unique_id();
- $query = "INSERT INTO drafts (id, module, submodule) VALUES (?, ?, ?)";
+ $query
= "INSERT INTO drafts (id, module, submodule) VALUES (?, ?, ?)";
do_query($form, $dbh, $query, $draft_id, $module, $submodule);
}
do_query($form, $dbh, $query, $draft_id, $module, $submodule);
}
- @dont_save = qw(login password path action);
map({ $saved{$_} = $form->{$_};
delete($form->{$_}); } @dont_save);
map({ $saved{$_} = $form->{$_};
delete($form->{$_}); } @dont_save);
+
$dumped = YAML::Dump($form);
map({ $form->{$_} = $saved{$_}; } @dont_save);
$dumped = YAML::Dump($form);
map({ $form->{$_} = $saved{$_}; } @dont_save);
@@
-64,13
+67,12
@@
sub save {
qq| (SELECT id FROM employee WHERE login = ?) | .
qq|WHERE id = ?|;
qq| (SELECT id FROM employee WHERE login = ?) | .
qq|WHERE id = ?|;
- do_query($form, $dbh, $query, $draft_description, $dumped,
- $form->{login}, $draft_id);
+ do_query($form, $dbh, $query, $draft_description, $dumped, $form->{login}, $draft_id);
$dbh->commit();
$dbh->disconnect();
$dbh->commit();
$dbh->disconnect();
- $form->{draft_id} = $draft_id;
+ $form->{draft_id}
= $draft_id;
$form->{draft_description} = $draft_description;
$main::lxdebug->leave_sub();
$form->{draft_description} = $draft_description;
$main::lxdebug->leave_sub();
@@
-87,8
+89,7
@@
sub load {
$query = qq|SELECT id, description, form FROM drafts WHERE id = ?|;
$query = qq|SELECT id, description, form FROM drafts WHERE id = ?|;
- $sth = $dbh->prepare($query);
- $sth->execute($draft_id) || $form->dberror("$query ($draft_id)");
+ $sth = prepare_execute_query($form, $dbh, $query, $draft_id);
my @values;
if (my $ref = $sth->fetchrow_hashref()) {
my @values;
if (my $ref = $sth->fetchrow_hashref()) {
@@
-96,8
+97,6
@@
sub load {
}
$sth->finish();
}
$sth->finish();
- do_query($form, $dbh, "DELETE FROM drafts WHERE id = ?", $draft_id);
-
$dbh->disconnect();
$main::lxdebug->leave_sub();
$dbh->disconnect();
$main::lxdebug->leave_sub();
@@
-108,16
+107,16
@@
sub load {
sub remove {
$main::lxdebug->enter_sub();
sub remove {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form,
$draft_id
) = @_;
+ my ($self, $myconfig, $form,
@draft_ids
) = @_;
- return $main::lxdebug->leave_sub() unless (
$draft_id
);
+ return $main::lxdebug->leave_sub() unless (
@draft_ids
);
- my ($dbh, $sth, $query
, @values
);
+ my ($dbh, $sth, $query);
$dbh = $form->dbconnect($myconfig);
$dbh = $form->dbconnect($myconfig);
- $query = qq|DELETE FROM drafts WHERE id
= ?
|;
- do_query($form, $dbh, $query,
$draft_id
);
+ $query = qq|DELETE FROM drafts WHERE id
IN (| . join(", ", map { "?" } @draft_ids) . qq|)
|;
+ do_query($form, $dbh, $query,
@draft_ids
);
$dbh->disconnect();
$dbh->disconnect();
@@
-145,9
+144,7
@@
sub list {
qq|ORDER BY d.itime|;
my @values = ($module, $submodule);
qq|ORDER BY d.itime|;
my @values = ($module, $submodule);
- $sth = $dbh->prepare($query);
- $sth->execute(@values) ||
- $form->dberror($query . " (" . join(", ", @values) . ")");
+ $sth = prepare_execute_query($form, $dbh, $query, @values);
while (my $ref = $sth->fetchrow_hashref()) {
push(@list, $ref);
while (my $ref = $sth->fetchrow_hashref()) {
push(@list, $ref);