Revision c98a426e
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1017 | 1017 |
expense_accno_id_3, |
1018 | 1018 |
(SELECT accno FROM chart WHERE id = expense_accno_id_3) AS expense_accno_3 |
1019 | 1019 |
FROM buchungsgruppen |
1020 |
ORDER BY id|;
|
|
1020 |
ORDER BY sortkey|;
|
|
1021 | 1021 |
|
1022 | 1022 |
$sth = $dbh->prepare($query); |
1023 | 1023 |
$sth->execute || $form->dberror($query); |
... | ... | |
1141 | 1141 |
$form->{income_accno_id_2}, $form->{expense_accno_id_2}, |
1142 | 1142 |
$form->{income_accno_id_3}, $form->{expense_accno_id_3}); |
1143 | 1143 |
|
1144 |
my $query; |
|
1145 |
|
|
1144 | 1146 |
# id is the old record |
1145 | 1147 |
if ($form->{id}) { |
1146 | 1148 |
$query = qq|UPDATE buchungsgruppen SET |
... | ... | |
1152 | 1154 |
WHERE id = ?|; |
1153 | 1155 |
push(@values, $form->{id}); |
1154 | 1156 |
} else { |
1157 |
$query = qq|SELECT MAX(sortkey) + 1 FROM buchungsgruppen|; |
|
1158 |
my ($sortkey) = $dbh->selectrow_array($query); |
|
1159 |
$form->dberror($query) if ($dbh->err); |
|
1160 |
push(@values, $sortkey); |
|
1155 | 1161 |
$query = qq|INSERT INTO buchungsgruppen |
1156 | 1162 |
(description, inventory_accno_id, |
1157 | 1163 |
income_accno_id_0, expense_accno_id_0, |
1158 | 1164 |
income_accno_id_1, expense_accno_id_1, |
1159 | 1165 |
income_accno_id_2, expense_accno_id_2, |
1160 |
income_accno_id_3, expense_accno_id_3) |
|
1161 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; |
|
1166 |
income_accno_id_3, expense_accno_id_3, |
|
1167 |
sortkey) |
|
1168 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|; |
|
1162 | 1169 |
} |
1163 | 1170 |
do_query($form, $dbh, $query, @values); |
1164 | 1171 |
|
... | ... | |
1183 | 1190 |
$main::lxdebug->leave_sub(); |
1184 | 1191 |
} |
1185 | 1192 |
|
1193 |
sub swap_buchungsgruppen { |
|
1194 |
$main::lxdebug->enter_sub(); |
|
1195 |
|
|
1196 |
my ($self, $myconfig, $form) = @_; |
|
1197 |
|
|
1198 |
# connect to database |
|
1199 |
my $dbh = $form->dbconnect_noauto($myconfig); |
|
1200 |
|
|
1201 |
my $query = |
|
1202 |
qq|SELECT |
|
1203 |
(SELECT sortkey FROM buchungsgruppen WHERE id = ?) AS sortkey1, |
|
1204 |
(SELECT sortkey FROM buchungsgruppen WHERE id = ?) AS sortkey2|; |
|
1205 |
my @values = ($form->{"id1"}, $form->{"id2"}); |
|
1206 |
my @sortkeys = selectrow_query($form, $dbh, $query, @values); |
|
1207 |
|
|
1208 |
$query = qq|UPDATE buchungsgruppen SET sortkey = ? WHERE id = ?|; |
|
1209 |
my $sth = $dbh->prepare($query); |
|
1210 |
$sth->execute($sortkeys[1], $form->{"id1"}) || |
|
1211 |
$form->dberror($query . " ($sortkeys[1], $form->{id1})"); |
|
1212 |
$sth->execute($sortkeys[0], $form->{"id2"}) || |
|
1213 |
$form->dberror($query . " ($sortkeys[0], $form->{id2})"); |
|
1214 |
$sth->finish(); |
|
1215 |
|
|
1216 |
$dbh->commit(); |
|
1217 |
$dbh->disconnect; |
|
1218 |
|
|
1219 |
$main::lxdebug->leave_sub(); |
|
1220 |
} |
|
1221 |
|
|
1186 | 1222 |
sub printer { |
1187 | 1223 |
$main::lxdebug->enter_sub(); |
1188 | 1224 |
|
SL/IC.pm | ||
---|---|---|
310 | 310 |
|
311 | 311 |
# get buchungsgruppen |
312 | 312 |
$query = qq|SELECT id, description |
313 |
FROM buchungsgruppen|; |
|
313 |
FROM buchungsgruppen |
|
314 |
ORDER BY sortkey|; |
|
314 | 315 |
$sth = $dbh->prepare($query); |
315 | 316 |
$sth->execute || $form->dberror($query); |
316 | 317 |
|
bin/mozilla/am.pl | ||
---|---|---|
1782 | 1782 |
|
1783 | 1783 |
$form->{title} = $locale->text('Buchungsgruppen'); |
1784 | 1784 |
|
1785 |
@column_index = qw(description inventory_accno income_accno_0 expense_accno_0 income_accno_1 expense_accno_1 income_accno_2 expense_accno_2 income_accno_3 expense_accno_3 ); |
|
1786 |
|
|
1785 |
@column_index = qw(up down description inventory_accno |
|
1786 |
income_accno_0 expense_accno_0 |
|
1787 |
income_accno_1 expense_accno_1 |
|
1788 |
income_accno_2 expense_accno_2 |
|
1789 |
income_accno_3 expense_accno_3 ); |
|
1790 |
|
|
1791 |
$column_header{up} = |
|
1792 |
qq|<th class="listheading">| |
|
1793 |
. qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| |
|
1794 |
. qq|</th>|; |
|
1795 |
$column_header{down} = |
|
1796 |
qq|<th class="listheading">| |
|
1797 |
. qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| |
|
1798 |
. qq|</th>|; |
|
1787 | 1799 |
$column_header{description} = |
1788 |
qq|<th class=listheading width=60%>|
|
|
1800 |
qq|<th class="listheading" width="40%">|
|
|
1789 | 1801 |
. $locale->text('Description') |
1790 | 1802 |
. qq|</th>|; |
1791 | 1803 |
$column_header{inventory_accno} = |
1792 |
qq|<th class=listheading width=10%>|
|
|
1804 |
qq|<th class=listheading>| |
|
1793 | 1805 |
. $locale->text('Bestandskonto') |
1794 | 1806 |
. qq|</th>|; |
1795 | 1807 |
$column_header{income_accno_0} = |
... | ... | |
1846 | 1858 |
</tr> |
1847 | 1859 |
|; |
1848 | 1860 |
|
1861 |
my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|; |
|
1862 |
map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" } |
|
1863 |
qw(login password path)); |
|
1864 |
|
|
1865 |
my $row = 0; |
|
1849 | 1866 |
foreach $ref (@{ $form->{ALL} }) { |
1850 | 1867 |
|
1851 | 1868 |
$i++; |
... | ... | |
1855 | 1872 |
<tr valign=top class=listrow$i> |
1856 | 1873 |
|; |
1857 | 1874 |
|
1875 |
if ($row) { |
|
1876 |
my $pref = $form->{ALL}->[$row - 1]; |
|
1877 |
$column_data{up} = |
|
1878 |
qq|<td align="center" valign="center">| . |
|
1879 |
qq|<a href="${swap_link}id1=$ref->{id}&id2=$pref->{id}">| . |
|
1880 |
qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| . |
|
1881 |
qq|</a></td>|; |
|
1882 |
} else { |
|
1883 |
$column_data{up} = qq|<td> </td>|; |
|
1884 |
} |
|
1885 |
|
|
1886 |
if ($row == (scalar(@{ $form->{ALL} }) - 1)) { |
|
1887 |
$column_data{down} = qq|<td> </td>|; |
|
1888 |
} else { |
|
1889 |
my $nref = $form->{ALL}->[$row + 1]; |
|
1890 |
$column_data{down} = |
|
1891 |
qq|<td align="center" valign="center">| . |
|
1892 |
qq|<a href="${swap_link}id1=$ref->{id}&id2=$nref->{id}">| . |
|
1893 |
qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| . |
|
1894 |
qq|</a></td>|; |
|
1895 |
} |
|
1858 | 1896 |
|
1859 | 1897 |
$column_data{description} = |
1860 | 1898 |
qq|<td><a href=$form->{script}?action=edit_buchungsgruppe&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|; |
... | ... | |
1877 | 1915 |
print qq| |
1878 | 1916 |
</tr> |
1879 | 1917 |
|; |
1918 |
|
|
1919 |
$row++; |
|
1880 | 1920 |
} |
1881 | 1921 |
|
1882 | 1922 |
print qq| |
... | ... | |
2071 | 2111 |
$lxdebug->leave_sub(); |
2072 | 2112 |
} |
2073 | 2113 |
|
2114 |
sub swap_buchungsgruppen { |
|
2115 |
$lxdebug->enter_sub(); |
|
2116 |
|
|
2117 |
AM->swap_buchungsgruppen(\%myconfig, $form); |
|
2118 |
list_buchungsgruppe(); |
|
2119 |
|
|
2120 |
$lxdebug->leave_sub(); |
|
2121 |
} |
|
2122 |
|
|
2074 | 2123 |
|
2075 | 2124 |
sub add_printer { |
2076 | 2125 |
$lxdebug->enter_sub(); |
locale/de/all | ||
---|---|---|
1158 | 1158 |
'dimension units' => 'Maßeinheiten', |
1159 | 1159 |
'does not exist' => 'existiert nicht', |
1160 | 1160 |
'done' => 'erledigt', |
1161 |
'down' => 'hoch', |
|
1161 | 1162 |
'eMail Send?' => 'eMail-Versand?', |
1162 | 1163 |
'eMail?' => 'eMail?', |
1163 | 1164 |
'ea' => 'St.', |
... | ... | |
1187 | 1188 |
'successfully created!' => 'wurde erfolgreich erstellt', |
1188 | 1189 |
'successfully deleted!' => 'wurde erfolgreich gel?scht', |
1189 | 1190 |
'to (date)' => 'bis', |
1191 |
'up' => 'runter', |
|
1190 | 1192 |
'use program settings' => 'benutze Programmeinstellungen', |
1191 | 1193 |
'ustva' => 'UStVA', |
1192 | 1194 |
'website' => 'Webseite', |
locale/de/am | ||
---|---|---|
288 | 288 |
'Year End' => 'Jahresende', |
289 | 289 |
'Yes' => 'Ja', |
290 | 290 |
'dimension units' => 'Maßeinheiten', |
291 |
'down' => 'hoch', |
|
291 | 292 |
'equal Outputformat' => 'wie Ausgabeformat', |
292 | 293 |
'lead deleted!' => 'Kundenquelle gel?scht', |
293 | 294 |
'lead saved!' => 'Kundenquelle geichert', |
294 | 295 |
'service units' => 'Dienstleistungseinheiten', |
296 |
'up' => 'runter', |
|
295 | 297 |
'use program settings' => 'benutze Programmeinstellungen', |
296 | 298 |
}; |
297 | 299 |
|
... | ... | |
398 | 400 |
'set_longdescription' => 'set_longdescription', |
399 | 401 |
'set_unit_languages' => 'set_unit_languages', |
400 | 402 |
'sic_header' => 'sic_header', |
403 |
'swap_buchungsgruppen' => 'swap_buchungsgruppen', |
|
401 | 404 |
'vendor_selection' => 'vendor_selection', |
402 | 405 |
'warehouse_header' => 'warehouse_header', |
403 | 406 |
'erfassen' => 'add', |
sql/Pg-upgrade2/buchungsgruppen_sortkey.sql | ||
---|---|---|
1 |
-- @tag: buchungsgruppen_sortkey |
|
2 |
-- @description: Neue Spalte für Sortierreihenfolge der Buchungsgruppen |
|
3 |
-- @depends: release_2_4_1 |
|
4 |
ALTER TABLE buchungsgruppen ADD COLUMN sortkey integer; |
|
5 |
CREATE SEQUENCE tmp_counter; |
|
6 |
UPDATE buchungsgruppen SET sortkey = nextval('tmp_counter'); |
|
7 |
DROP SEQUENCE tmp_counter; |
|
8 |
ALTER TABLE buchungsgruppen ALTER COLUMN sortkey SET NOT NULL; |
Auch abrufbar als: Unified diff
Die Buchungsgruppen sortierbar gemacht.