Revision 652397fc
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1190 | 1190 |
$main::lxdebug->leave_sub(); |
1191 | 1191 |
} |
1192 | 1192 |
|
1193 |
sub swap_buchungsgruppen {
|
|
1193 |
sub swap_sortkeys {
|
|
1194 | 1194 |
$main::lxdebug->enter_sub(); |
1195 | 1195 |
|
1196 |
my ($self, $myconfig, $form) = @_; |
|
1196 |
my ($self, $myconfig, $form, $table) = @_;
|
|
1197 | 1197 |
|
1198 | 1198 |
# connect to database |
1199 | 1199 |
my $dbh = $form->dbconnect_noauto($myconfig); |
1200 | 1200 |
|
1201 | 1201 |
my $query = |
1202 | 1202 |
qq|SELECT |
1203 |
(SELECT sortkey FROM buchungsgruppen WHERE id = ?) AS sortkey1,
|
|
1204 |
(SELECT sortkey FROM buchungsgruppen WHERE id = ?) AS sortkey2|;
|
|
1203 |
(SELECT sortkey FROM $table WHERE id = ?) AS sortkey1,
|
|
1204 |
(SELECT sortkey FROM $table WHERE id = ?) AS sortkey2|;
|
|
1205 | 1205 |
my @values = ($form->{"id1"}, $form->{"id2"}); |
1206 | 1206 |
my @sortkeys = selectrow_query($form, $dbh, $query, @values); |
1207 | 1207 |
|
1208 |
$query = qq|UPDATE buchungsgruppen SET sortkey = ? WHERE id = ?|;
|
|
1208 |
$query = qq|UPDATE $table SET sortkey = ? WHERE id = ?|;
|
|
1209 | 1209 |
my $sth = $dbh->prepare($query); |
1210 | 1210 |
$sth->execute($sortkeys[1], $form->{"id1"}) || |
1211 | 1211 |
$form->dberror($query . " ($sortkeys[1], $form->{id1})"); |
bin/mozilla/am.pl | ||
---|---|---|
2114 | 2114 |
sub swap_buchungsgruppen { |
2115 | 2115 |
$lxdebug->enter_sub(); |
2116 | 2116 |
|
2117 |
AM->swap_buchungsgruppen(\%myconfig, $form);
|
|
2117 |
AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
|
|
2118 | 2118 |
list_buchungsgruppe(); |
2119 | 2119 |
|
2120 | 2120 |
$lxdebug->leave_sub(); |
Auch abrufbar als: Unified diff
Funktion "swap_buchungsgruppen" in "swap_sortkeys" umbenannt.