Revision 5efcb494
Von Moritz Bunkus vor etwa 7 Jahren hinzugefügt
bin/mozilla/am.pl | ||
---|---|---|
34 | 34 |
|
35 | 35 |
use utf8; |
36 | 36 |
|
37 |
use List::MoreUtils qw(any); |
|
38 |
|
|
37 | 39 |
use SL::Auth; |
38 | 40 |
use SL::Auth::PasswordPolicy; |
39 | 41 |
use SL::AM; |
... | ... | |
1290 | 1292 |
$form->{title} = $locale->text('Add Warehouse'); |
1291 | 1293 |
$form->{callback} ||= build_std_url('action=add_warehouse'); |
1292 | 1294 |
|
1295 |
setup_am_edit_warehouse_action_bar(); |
|
1296 |
|
|
1293 | 1297 |
$form->header(); |
1294 | 1298 |
print $form->parse_html_template('am/edit_warehouse'); |
1295 | 1299 |
|
... | ... | |
1312 | 1316 |
$form->{title} = $locale->text('Edit Warehouse'); |
1313 | 1317 |
$form->{callback} ||= build_std_url('action=list_warehouses'); |
1314 | 1318 |
|
1319 |
setup_am_edit_warehouse_action_bar(id => $::form->{id}, in_use => any { $_->{in_use} } @{ $::form->{BINS} }); |
|
1320 |
|
|
1315 | 1321 |
$form->header(); |
1316 | 1322 |
print $form->parse_html_template('am/edit_warehouse'); |
1317 | 1323 |
|
1318 | 1324 |
$main::lxdebug->leave_sub(); |
1319 | 1325 |
} |
1320 | 1326 |
|
1327 |
sub edit_bins { |
|
1328 |
$::auth->assert('config'); |
|
1329 |
|
|
1330 |
AM->get_warehouse(\%::myconfig, $::form); |
|
1331 |
|
|
1332 |
$::form->{title} = $::locale->text('Edit Bins for Warehouse \'#1\'', $::form->{description}); |
|
1333 |
$::form->{callback} ||= build_std_url('action=list_warehouses'); |
|
1334 |
|
|
1335 |
setup_am_edit_bins_action_bar(id => $::form->{id}); |
|
1336 |
|
|
1337 |
$::form->header; |
|
1338 |
print $::form->parse_html_template('am/edit_bins'); |
|
1339 |
} |
|
1340 |
|
|
1321 | 1341 |
sub list_warehouses { |
1322 | 1342 |
$main::lxdebug->enter_sub(); |
1323 | 1343 |
|
... | ... | |
1333 | 1353 |
$form->{title} = $locale->text('Warehouses'); |
1334 | 1354 |
$form->{url_base} = build_std_url('callback'); |
1335 | 1355 |
|
1356 |
setup_am_list_warehouses_action_bar(); |
|
1357 |
|
|
1336 | 1358 |
$form->header(); |
1337 | 1359 |
print $form->parse_html_template('am/list_warehouses'); |
1338 | 1360 |
|
... | ... | |
1370 | 1392 |
|
1371 | 1393 |
$main::auth->assert('config'); |
1372 | 1394 |
|
1373 |
if (!$form->{confirmed}) { |
|
1374 |
$form->{title} = $locale->text('Confirmation'); |
|
1375 |
|
|
1376 |
$form->header(); |
|
1377 |
print $form->parse_html_template('am/confirm_delete_warehouse'); |
|
1378 |
$::dispatcher->end_request; |
|
1379 |
} |
|
1380 |
|
|
1381 | 1395 |
if (AM->delete_warehouse(\%myconfig, $form)) { |
1382 | 1396 |
$form->{callback} .= '&saved_message=' . E($locale->text('Warehouse deleted.')) if ($form->{callback}); |
1383 | 1397 |
$form->redirect($locale->text('Warehouse deleted.')); |
... | ... | |
1531 | 1545 |
); |
1532 | 1546 |
} |
1533 | 1547 |
} |
1548 |
|
|
1549 |
sub setup_am_list_warehouses_action_bar { |
|
1550 |
my %params = @_; |
|
1551 |
|
|
1552 |
for my $bar ($::request->layout->get('actionbar')) { |
|
1553 |
$bar->add( |
|
1554 |
link => [ |
|
1555 |
t8('Add'), |
|
1556 |
link => 'am.pl?action=add&type=warehouse&callback=' . E($::form->{callback}), |
|
1557 |
accesskey => 'enter', |
|
1558 |
], |
|
1559 |
); |
|
1560 |
} |
|
1561 |
} |
|
1562 |
|
|
1563 |
sub setup_am_edit_warehouse_action_bar { |
|
1564 |
my %params = @_; |
|
1565 |
|
|
1566 |
for my $bar ($::request->layout->get('actionbar')) { |
|
1567 |
$bar->add( |
|
1568 |
action => [ |
|
1569 |
t8('Save'), |
|
1570 |
submit => [ '#form', { action => 'save_warehouse' } ], |
|
1571 |
accesskey => 'enter', |
|
1572 |
], |
|
1573 |
|
|
1574 |
action => [ |
|
1575 |
t8('Delete'), |
|
1576 |
submit => [ '#form', { action => 'delete_warehouse' } ], |
|
1577 |
disabled => !$params{id} ? t8('The object has not been saved yet.') |
|
1578 |
: $params{in_use} ? t8('The object is in use and cannot be deleted.') |
|
1579 |
: undef, |
|
1580 |
confirm => t8('Do you really want to delete this object?'), |
|
1581 |
], |
|
1582 |
|
|
1583 |
'separator', |
|
1584 |
|
|
1585 |
link => [ |
|
1586 |
t8('Bins'), |
|
1587 |
link => 'am.pl?action=edit_bins&id=' . E($params{id}), |
|
1588 |
only_if => $params{id}, |
|
1589 |
], |
|
1590 |
|
|
1591 |
link => [ |
|
1592 |
t8('Abort'), |
|
1593 |
link => $::form->{callback} || 'am.pl?action=list_warehouses', |
|
1594 |
], |
|
1595 |
); |
|
1596 |
} |
|
1597 |
} |
|
1598 |
|
|
1599 |
sub setup_am_edit_bins_action_bar { |
|
1600 |
my %params = @_; |
|
1601 |
|
|
1602 |
for my $bar ($::request->layout->get('actionbar')) { |
|
1603 |
$bar->add( |
|
1604 |
action => [ |
|
1605 |
t8('Save'), |
|
1606 |
submit => [ '#form', { action => 'save_bin' } ], |
|
1607 |
accesskey => 'enter', |
|
1608 |
], |
|
1609 |
|
|
1610 |
'separator', |
|
1611 |
|
|
1612 |
link => [ |
|
1613 |
t8('Abort'), |
|
1614 |
link => 'am.pl?action=edit_warehouse&id=' . E($params{id}), |
|
1615 |
], |
|
1616 |
); |
|
1617 |
} |
|
1618 |
} |
Auch abrufbar als: Unified diff
ActionBar: Verwendung bei »System« → »Lager«