Revision 828bd683
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1204 | 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 |
$main::lxdebug->dump(0, "v", \@values); |
|
1208 |
$main::lxdebug->dump(0, "s", \@sortkeys); |
|
1207 | 1209 |
|
1208 | 1210 |
$query = qq|UPDATE $table SET sortkey = ? WHERE id = ?|; |
1209 | 1211 |
my $sth = $dbh->prepare($query); |
... | ... | |
1328 | 1330 |
# connect to database |
1329 | 1331 |
my $dbh = $form->dbconnect($myconfig); |
1330 | 1332 |
|
1331 |
my $query = qq|SELECT * |
|
1332 |
FROM payment_terms |
|
1333 |
ORDER BY id|; |
|
1333 |
my $query = qq|SELECT * FROM payment_terms ORDER BY sortkey|; |
|
1334 | 1334 |
|
1335 | 1335 |
$sth = $dbh->prepare($query); |
1336 | 1336 |
$sth->execute || $form->dberror($query); |
1337 | 1337 |
|
1338 |
$form->{ALL} = []; |
|
1338 | 1339 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
1339 |
$ref->{percent_skonto} = $form->format_amount($myconfig,($ref->{percent_skonto} * 100)); |
|
1340 | 1340 |
push @{ $form->{ALL} }, $ref; |
1341 | 1341 |
} |
1342 | 1342 |
|
... | ... | |
1354 | 1354 |
# connect to database |
1355 | 1355 |
my $dbh = $form->dbconnect($myconfig); |
1356 | 1356 |
|
1357 |
my $query = |
|
1358 |
qq|SELECT * |
|
1359 |
FROM payment_terms |
|
1360 |
WHERE id = $form->{id}|; |
|
1357 |
my $query = qq|SELECT * FROM payment_terms WHERE id = ?|; |
|
1361 | 1358 |
my $sth = $dbh->prepare($query); |
1362 |
$sth->execute || $form->dberror($query);
|
|
1359 |
$sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})");
|
|
1363 | 1360 |
|
1364 | 1361 |
my $ref = $sth->fetchrow_hashref(NAME_lc); |
1365 |
$ref->{percent_skonto} = $form->format_amount($myconfig,($ref->{percent_skonto} * 100)); |
|
1366 |
|
|
1367 | 1362 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
1368 | 1363 |
|
1369 | 1364 |
$sth->finish; |
... | ... | |
1381 | 1376 |
# connect to database |
1382 | 1377 |
my $dbh = $form->dbconnect($myconfig); |
1383 | 1378 |
|
1384 |
$form->{description} =~ s/\'/\'\'/g; |
|
1385 |
$form->{description_long} =~ s/\'/\'\'/g; |
|
1386 |
$percentskonto = $form->parse_amount($myconfig, $form->{percent_skonto}) /100; |
|
1387 |
$form->{ranking} *= 1; |
|
1388 |
$form->{terms_netto} *= 1; |
|
1389 |
$form->{terms_skonto} *= 1; |
|
1390 |
$form->{percent_skonto} *= 1; |
|
1391 |
|
|
1392 |
|
|
1379 |
my @values = ($form->{description}, $form->{description_long}, |
|
1380 |
$form->{ranking} * 1, |
|
1381 |
$form->{terms_netto} * 1, $form->{terms_skonto} * 1, |
|
1382 |
$form->{percent_skonto} * 1); |
|
1393 | 1383 |
|
1384 |
my $query; |
|
1394 | 1385 |
# id is the old record |
1395 | 1386 |
if ($form->{id}) { |
1396 | 1387 |
$query = qq|UPDATE payment_terms SET |
1397 |
description = '$form->{description}', |
|
1398 |
ranking = $form->{ranking}, |
|
1399 |
description_long = '$form->{description_long}', |
|
1400 |
terms_netto = $form->{terms_netto}, |
|
1401 |
terms_skonto = $form->{terms_skonto}, |
|
1402 |
percent_skonto = $percentskonto |
|
1403 |
WHERE id = $form->{id}|; |
|
1388 |
description = ?, description_long = ?, |
|
1389 |
ranking = ?, |
|
1390 |
terms_netto = ?, terms_skonto = ?, |
|
1391 |
percent_skonto = ? |
|
1392 |
WHERE id = ?|; |
|
1393 |
push(@values, $form->{"id"}); |
|
1404 | 1394 |
} else { |
1395 |
$query = qq|SELECT MAX(sortkey) + 1 FROM payment_terms|; |
|
1396 |
my ($sortkey) = selectrow_query($form, $dbh, $query); |
|
1405 | 1397 |
$query = qq|INSERT INTO payment_terms |
1406 |
(description, ranking, description_long, terms_netto, terms_skonto, percent_skonto) |
|
1407 |
VALUES ('$form->{description}', $form->{ranking}, '$form->{description_long}', $form->{terms_netto}, $form->{terms_skonto}, $percentskonto)|; |
|
1398 |
(description, description_long, ranking, |
|
1399 |
terms_netto, terms_skonto, percent_skonto, sortkey) |
|
1400 |
VALUES (?, ?, ?, ?, ?, ?, ?)|; |
|
1401 |
push(@values, $sortkey); |
|
1408 | 1402 |
} |
1409 |
$dbh->do($query) || $form->dberror($query);
|
|
1403 |
do_query($form, $dbh, $query, @values);
|
|
1410 | 1404 |
|
1411 | 1405 |
$dbh->disconnect; |
1412 | 1406 |
|
... | ... | |
1421 | 1415 |
# connect to database |
1422 | 1416 |
my $dbh = $form->dbconnect($myconfig); |
1423 | 1417 |
|
1424 |
$query = qq|DELETE FROM payment_terms |
|
1425 |
WHERE id = $form->{id}|; |
|
1426 |
$dbh->do($query) || $form->dberror($query); |
|
1418 |
my $query = qq|DELETE FROM payment_terms WHERE id = ?|; |
|
1419 |
do_query($form, $dbh, $query, $form->{"id"}); |
|
1427 | 1420 |
|
1428 | 1421 |
$dbh->disconnect; |
1429 | 1422 |
|
SL/CT.pm | ||
---|---|---|
185 | 185 |
# get payment terms |
186 | 186 |
$query = qq|SELECT id, description |
187 | 187 |
FROM payment_terms |
188 |
ORDER BY 1|;
|
|
188 |
ORDER BY sortkey|;
|
|
189 | 189 |
$sth = $dbh->prepare($query); |
190 | 190 |
$sth->execute || $form->dberror($query); |
191 | 191 |
|
... | ... | |
315 | 315 |
# get payment terms |
316 | 316 |
$query = qq|SELECT id, description |
317 | 317 |
FROM payment_terms |
318 |
ORDER BY 1|;
|
|
318 |
ORDER BY sortkey|;
|
|
319 | 319 |
$sth = $dbh->prepare($query); |
320 | 320 |
$sth->execute || $form->dberror($query); |
321 | 321 |
|
SL/Form.pm | ||
---|---|---|
1562 | 1562 |
# get payment terms |
1563 | 1563 |
$query = qq|SELECT id, description |
1564 | 1564 |
FROM payment_terms |
1565 |
ORDER BY 1|;
|
|
1565 |
ORDER BY sortkey|;
|
|
1566 | 1566 |
$sth = $dbh->prepare($query); |
1567 | 1567 |
$sth->execute || $self->dberror($query); |
1568 | 1568 |
|
... | ... | |
1612 | 1612 |
# get payment terms |
1613 | 1613 |
$query = qq|SELECT id, description |
1614 | 1614 |
FROM payment_terms |
1615 |
ORDER BY 1|;
|
|
1615 |
ORDER BY sortkey|;
|
|
1616 | 1616 |
$sth = $dbh->prepare($query); |
1617 | 1617 |
$sth->execute || $self->dberror($query); |
1618 | 1618 |
|
SL/IC.pm | ||
---|---|---|
1517 | 1517 |
# get payment terms |
1518 | 1518 |
$query = qq|SELECT id, description |
1519 | 1519 |
FROM payment_terms |
1520 |
ORDER BY 1|;
|
|
1520 |
ORDER BY sortkey|;
|
|
1521 | 1521 |
$sth = $dbh->prepare($query); |
1522 | 1522 |
$sth->execute || $form->dberror($query); |
1523 | 1523 |
|
bin/mozilla/am.pl | ||
---|---|---|
2348 | 2348 |
$form->{title} = "Edit"; |
2349 | 2349 |
|
2350 | 2350 |
AM->get_payment(\%myconfig, \%$form); |
2351 |
$form->{percent_skonto} = |
|
2352 |
$form->format_amount(\%myconfig, $form->{percent_skonto} * 100); |
|
2351 | 2353 |
|
2352 | 2354 |
&payment_header; |
2353 | 2355 |
|
... | ... | |
2362 | 2364 |
|
2363 | 2365 |
AM->payment(\%myconfig, \%$form); |
2364 | 2366 |
|
2365 |
$form->{callback} = |
|
2366 |
"$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"; |
|
2367 |
$form->{callback} = build_std_url("action=list_payment"); |
|
2367 | 2368 |
|
2368 | 2369 |
$callback = $form->escape($form->{callback}); |
2369 | 2370 |
|
2370 | 2371 |
$form->{title} = $locale->text('Payment Terms'); |
2371 | 2372 |
|
2372 |
@column_index = qw(description description_long terms_netto terms_skonto percent_skonto); |
|
2373 |
@column_index = qw(up down description description_long terms_netto |
|
2374 |
terms_skonto percent_skonto); |
|
2373 | 2375 |
|
2376 |
$column_header{up} = |
|
2377 |
qq|<th class="listheading" align="center" valign="center">| |
|
2378 |
. qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| |
|
2379 |
. qq|</th>|; |
|
2380 |
$column_header{down} = |
|
2381 |
qq|<th class="listheading" align="center" valign="center">| |
|
2382 |
. qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| |
|
2383 |
. qq|</th>|; |
|
2374 | 2384 |
$column_header{description} = |
2375 | 2385 |
qq|<th class=listheading>| |
2376 | 2386 |
. $locale->text('Description') |
... | ... | |
2414 | 2424 |
</tr> |
2415 | 2425 |
|; |
2416 | 2426 |
|
2427 |
my $swap_link = build_std_url("action=swap_payment_terms"); |
|
2428 |
|
|
2429 |
my $row = 0; |
|
2417 | 2430 |
foreach $ref (@{ $form->{ALL} }) { |
2418 | 2431 |
|
2419 | 2432 |
$i++; |
... | ... | |
2423 | 2436 |
<tr valign=top class=listrow$i> |
2424 | 2437 |
|; |
2425 | 2438 |
|
2439 |
if ($row) { |
|
2440 |
my $pref = $form->{ALL}->[$row - 1]; |
|
2441 |
$column_data{up} = |
|
2442 |
qq|<td align="center" valign="center">| . |
|
2443 |
qq|<a href="${swap_link}&id1=$ref->{id}&id2=$pref->{id}">| . |
|
2444 |
qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">| . |
|
2445 |
qq|</a></td>|; |
|
2446 |
} else { |
|
2447 |
$column_data{up} = qq|<td> </td>|; |
|
2448 |
} |
|
2449 |
|
|
2450 |
if ($row == (scalar(@{ $form->{ALL} }) - 1)) { |
|
2451 |
$column_data{down} = qq|<td> </td>|; |
|
2452 |
} else { |
|
2453 |
my $nref = $form->{ALL}->[$row + 1]; |
|
2454 |
$column_data{down} = |
|
2455 |
qq|<td align="center" valign="center">| . |
|
2456 |
qq|<a href="${swap_link}&id1=$ref->{id}&id2=$nref->{id}">| . |
|
2457 |
qq|<img src="image/down.png" alt="| . $locale->text("down") . qq|">| . |
|
2458 |
qq|</a></td>|; |
|
2459 |
} |
|
2426 | 2460 |
|
2427 | 2461 |
$column_data{description} = |
2428 |
qq|<td><a href=$form->{script}?action=edit_payment&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|; |
|
2429 |
$column_data{description_long} = qq|<td align=right>$ref->{description_long}</td>|; |
|
2462 |
qq|<td><a href="| . |
|
2463 |
build_std_url("action=edit_payment", "id=$ref->{id}", "callback=$callback") . |
|
2464 |
qq|">| . H($ref->{description}) . qq|</a></td>|; |
|
2465 |
$column_data{description_long} = |
|
2466 |
qq|<td align=right>| . H($ref->{description_long}) . qq|</td>|; |
|
2430 | 2467 |
$column_data{terms_netto} = |
2431 | 2468 |
qq|<td align=right>$ref->{terms_netto}</td>|; |
2432 | 2469 |
$column_data{terms_skonto} = |
2433 | 2470 |
qq|<td align=right>$ref->{terms_skonto}</td>|; |
2434 | 2471 |
$column_data{percent_skonto} = |
2435 |
qq|<td align=right>$ref->{percent_skonto} %</td>|; |
|
2472 |
qq|<td align=right>| . |
|
2473 |
$form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) . |
|
2474 |
qq|%</td>|; |
|
2436 | 2475 |
map { print "$column_data{$_}\n" } @column_index; |
2437 | 2476 |
|
2438 | 2477 |
print qq| |
2439 | 2478 |
</tr> |
2440 | 2479 |
|; |
2480 |
$row++; |
|
2441 | 2481 |
} |
2442 | 2482 |
|
2443 | 2483 |
print qq| |
... | ... | |
2530 | 2570 |
sub save_payment { |
2531 | 2571 |
$lxdebug->enter_sub(); |
2532 | 2572 |
|
2533 |
$form->isblank("description", $locale->text('Language missing!')); |
|
2573 |
$form->isblank("description", $locale->text('Description missing!')); |
|
2574 |
$form->{"percent_skonto"} = |
|
2575 |
$form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100; |
|
2534 | 2576 |
AM->save_payment(\%myconfig, \%$form); |
2535 | 2577 |
$form->redirect($locale->text('Payment Terms saved!')); |
2536 | 2578 |
|
... | ... | |
2546 | 2588 |
$lxdebug->leave_sub(); |
2547 | 2589 |
} |
2548 | 2590 |
|
2591 |
sub swap_payment_terms { |
|
2592 |
$lxdebug->enter_sub(); |
|
2593 |
|
|
2594 |
AM->swap_sortkeys(\%myconfig, $form, "payment_terms"); |
|
2595 |
list_payment(); |
|
2596 |
|
|
2597 |
$lxdebug->leave_sub(); |
|
2598 |
} |
|
2599 |
|
|
2549 | 2600 |
sub add_sic { |
2550 | 2601 |
$lxdebug->enter_sub(); |
2551 | 2602 |
|
bin/mozilla/common.pl | ||
---|---|---|
41 | 41 |
$lxdebug->leave_sub(); |
42 | 42 |
} |
43 | 43 |
|
44 |
sub build_std_url { |
|
45 |
$lxdebug->enter_sub(); |
|
46 |
|
|
47 |
my $url = "$form->{script}?"; |
|
48 |
my $first = 1; |
|
49 |
foreach my $key ((qw(login password path), @_)) { |
|
50 |
next unless ($key); |
|
51 |
$url .= "&" unless ($first); |
|
52 |
$first = 0; |
|
53 |
|
|
54 |
if ($key =~ /=/) { |
|
55 |
$url .= $key; |
|
56 |
} else { |
|
57 |
$url .= "${key}=" . E($form->{$key}); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
61 |
$lxdebug->leave_sub(); |
|
62 |
|
|
63 |
return $url; |
|
64 |
} |
|
65 |
|
|
44 | 66 |
sub select_employee { |
45 | 67 |
$lxdebug->enter_sub(); |
46 | 68 |
|
... | ... | |
424 | 446 |
return $form->quote($_[0]); |
425 | 447 |
} |
426 | 448 |
|
449 |
sub E { |
|
450 |
return $form->escape($_[0]); |
|
451 |
} |
|
452 |
|
|
427 | 453 |
sub format_dates { |
428 | 454 |
$lxdebug->enter_sub(); |
429 | 455 |
|
locale/de/am | ||
---|---|---|
298 | 298 |
}; |
299 | 299 |
|
300 | 300 |
$self->{subs} = { |
301 |
'E' => 'E', |
|
301 | 302 |
'H' => 'H', |
302 | 303 |
'Q' => 'Q', |
303 | 304 |
'account_header' => 'account_header', |
... | ... | |
317 | 318 |
'audit_control' => 'audit_control', |
318 | 319 |
'backup' => 'backup', |
319 | 320 |
'buchungsgruppe_header' => 'buchungsgruppe_header', |
321 |
'build_std_url' => 'build_std_url', |
|
320 | 322 |
'business_header' => 'business_header', |
321 | 323 |
'calculate_qty' => 'calculate_qty', |
322 | 324 |
'config' => 'config', |
... | ... | |
401 | 403 |
'set_unit_languages' => 'set_unit_languages', |
402 | 404 |
'sic_header' => 'sic_header', |
403 | 405 |
'swap_buchungsgruppen' => 'swap_buchungsgruppen', |
406 |
'swap_payment_terms' => 'swap_payment_terms', |
|
404 | 407 |
'vendor_selection' => 'vendor_selection', |
405 | 408 |
'warehouse_header' => 'warehouse_header', |
406 | 409 |
'erfassen' => 'add', |
locale/de/cn | ||
---|---|---|
205 | 205 |
}; |
206 | 206 |
|
207 | 207 |
$self->{subs} = { |
208 |
'E' => 'E', |
|
208 | 209 |
'H' => 'H', |
209 | 210 |
'Q' => 'Q', |
210 | 211 |
'add' => 'add', |
211 | 212 |
'add_transaction' => 'add_transaction', |
212 | 213 |
'ap_transaction' => 'ap_transaction', |
213 | 214 |
'ar_transaction' => 'ar_transaction', |
215 |
'build_std_url' => 'build_std_url', |
|
214 | 216 |
'calculate_qty' => 'calculate_qty', |
215 | 217 |
'check_form' => 'check_form', |
216 | 218 |
'check_name' => 'check_name', |
locale/de/common | ||
---|---|---|
23 | 23 |
}; |
24 | 24 |
|
25 | 25 |
$self->{subs} = { |
26 |
'E' => 'E', |
|
26 | 27 |
'H' => 'H', |
27 | 28 |
'Q' => 'Q', |
29 |
'build_std_url' => 'build_std_url', |
|
28 | 30 |
'calculate_qty' => 'calculate_qty', |
29 | 31 |
'delivery_customer_selection' => 'delivery_customer_selection', |
30 | 32 |
'employee_selection_internal' => 'employee_selection_internal', |
locale/de/dn | ||
---|---|---|
197 | 197 |
}; |
198 | 198 |
|
199 | 199 |
$self->{subs} = { |
200 |
'E' => 'E', |
|
200 | 201 |
'H' => 'H', |
201 | 202 |
'Q' => 'Q', |
202 | 203 |
'add' => 'add', |
203 | 204 |
'add_transaction' => 'add_transaction', |
204 | 205 |
'ap_transaction' => 'ap_transaction', |
205 | 206 |
'ar_transaction' => 'ar_transaction', |
207 |
'build_std_url' => 'build_std_url', |
|
206 | 208 |
'calculate_qty' => 'calculate_qty', |
207 | 209 |
'check_form' => 'check_form', |
208 | 210 |
'check_name' => 'check_name', |
locale/de/ic | ||
---|---|---|
246 | 246 |
}; |
247 | 247 |
|
248 | 248 |
$self->{subs} = { |
249 |
'E' => 'E', |
|
249 | 250 |
'H' => 'H', |
250 | 251 |
'Q' => 'Q', |
251 | 252 |
'add' => 'add', |
252 | 253 |
'addtop100' => 'addtop100', |
253 | 254 |
'assembly_row' => 'assembly_row', |
255 |
'build_std_url' => 'build_std_url', |
|
254 | 256 |
'calculate_qty' => 'calculate_qty', |
255 | 257 |
'check_form' => 'check_form', |
256 | 258 |
'choice' => 'choice', |
locale/de/io | ||
---|---|---|
142 | 142 |
}; |
143 | 143 |
|
144 | 144 |
$self->{subs} = { |
145 |
'E' => 'E', |
|
145 | 146 |
'H' => 'H', |
146 | 147 |
'Q' => 'Q', |
148 |
'build_std_url' => 'build_std_url', |
|
147 | 149 |
'calculate_qty' => 'calculate_qty', |
148 | 150 |
'check_form' => 'check_form', |
149 | 151 |
'customer_details' => 'customer_details', |
locale/de/ir | ||
---|---|---|
197 | 197 |
}; |
198 | 198 |
|
199 | 199 |
$self->{subs} = { |
200 |
'E' => 'E', |
|
200 | 201 |
'H' => 'H', |
201 | 202 |
'Q' => 'Q', |
202 | 203 |
'add' => 'add', |
203 | 204 |
'add_transaction' => 'add_transaction', |
204 | 205 |
'ap_transaction' => 'ap_transaction', |
205 | 206 |
'ar_transaction' => 'ar_transaction', |
207 |
'build_std_url' => 'build_std_url', |
|
206 | 208 |
'calculate_qty' => 'calculate_qty', |
207 | 209 |
'check_form' => 'check_form', |
208 | 210 |
'check_name' => 'check_name', |
locale/de/is | ||
---|---|---|
222 | 222 |
}; |
223 | 223 |
|
224 | 224 |
$self->{subs} = { |
225 |
'E' => 'E', |
|
225 | 226 |
'H' => 'H', |
226 | 227 |
'Q' => 'Q', |
227 | 228 |
'add' => 'add', |
228 | 229 |
'add_transaction' => 'add_transaction', |
229 | 230 |
'ap_transaction' => 'ap_transaction', |
230 | 231 |
'ar_transaction' => 'ar_transaction', |
232 |
'build_std_url' => 'build_std_url', |
|
231 | 233 |
'calculate_qty' => 'calculate_qty', |
232 | 234 |
'check_form' => 'check_form', |
233 | 235 |
'check_name' => 'check_name', |
locale/de/oe | ||
---|---|---|
258 | 258 |
}; |
259 | 259 |
|
260 | 260 |
$self->{subs} = { |
261 |
'E' => 'E', |
|
261 | 262 |
'H' => 'H', |
262 | 263 |
'Q' => 'Q', |
263 | 264 |
'add' => 'add', |
... | ... | |
265 | 266 |
'ap_transaction' => 'ap_transaction', |
266 | 267 |
'ar_transaction' => 'ar_transaction', |
267 | 268 |
'backorder_exchangerate' => 'backorder_exchangerate', |
269 |
'build_std_url' => 'build_std_url', |
|
268 | 270 |
'calculate_qty' => 'calculate_qty', |
269 | 271 |
'check_form' => 'check_form', |
270 | 272 |
'check_name' => 'check_name', |
sql/Pg-upgrade2/payment_terms_sortkey.sql | ||
---|---|---|
1 |
-- @tag: payment_terms_sortkey |
|
2 |
-- @description: Neue Spalte für Sortierreihenfolge der Zahlungskonditionen |
|
3 |
-- @depends: release_2_4_1 |
|
4 |
ALTER TABLE payment_terms ADD COLUMN sortkey integer; |
|
5 |
CREATE SEQUENCE tmp_counter; |
|
6 |
UPDATE payment_terms SET sortkey = nextval('tmp_counter'); |
|
7 |
DROP SEQUENCE tmp_counter; |
|
8 |
ALTER TABLE payment_terms ALTER COLUMN sortkey SET NOT NULL; |
Auch abrufbar als: Unified diff
Die Zahlungskonditionen sortierbar gemacht.