Revision fa515ecf
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
2007 | 2007 |
$main::lxdebug->leave_sub(); |
2008 | 2008 |
} |
2009 | 2009 |
|
2010 |
sub swap_units { |
|
2011 |
$main::lxdebug->enter_sub(); |
|
2012 |
|
|
2013 |
my ($self, $myconfig, $form, $dir, $name_1) = @_; |
|
2014 |
|
|
2015 |
my $dbh = $form->dbconnect_noauto($myconfig); |
|
2016 |
|
|
2017 |
my $query; |
|
2018 |
|
|
2019 |
$query = qq|SELECT sortkey FROM units WHERE name = ?|; |
|
2020 |
my ($sortkey_1) = selectrow_query($form, $dbh, $query, $name_1); |
|
2021 |
|
|
2022 |
$query = |
|
2023 |
qq|SELECT sortkey FROM units | . |
|
2024 |
qq|WHERE sortkey | . ($dir eq "down" ? ">" : "<") . qq| ? | . |
|
2025 |
qq|ORDER BY sortkey | . ($dir eq "down" ? "ASC" : "DESC") . qq| LIMIT 1|; |
|
2026 |
my ($sortkey_2) = selectrow_query($form, $dbh, $query, $sortkey_1); |
|
2027 |
|
|
2028 |
if (defined($sortkey_1)) { |
|
2029 |
$query = qq|SELECT name FROM units WHERE sortkey = ${sortkey_2}|; |
|
2030 |
my ($name_2) = selectrow_query($form, $dbh, $query); |
|
2031 |
|
|
2032 |
if (defined($name_2)) { |
|
2033 |
$query = qq|UPDATE units SET sortkey = ? WHERE name = ?|; |
|
2034 |
my $sth = $dbh->prepare($query); |
|
2035 |
|
|
2036 |
do_statement($form, $sth, $query, $sortkey_1, $name_2); |
|
2037 |
do_statement($form, $sth, $query, $sortkey_2, $name_1); |
|
2038 |
} |
|
2039 |
} |
|
2040 |
|
|
2041 |
$dbh->commit(); |
|
2042 |
$dbh->disconnect(); |
|
2043 |
|
|
2044 |
$main::lxdebug->leave_sub(); |
|
2045 |
} |
|
2046 |
|
|
2047 | 2010 |
sub taxes { |
2048 | 2011 |
$main::lxdebug->enter_sub(); |
2049 | 2012 |
|
Auch abrufbar als: Unified diff
Sortieren von Einheiten auf Drag-n-Drop & AJAX mittels jQuery UI Sortable umgestellt