42 |
42 |
use SL::MoreCommon qw(ary_diff);
|
43 |
43 |
use SL::ReportGenerator;
|
44 |
44 |
use SL::WH;
|
45 |
|
use Sort::Naturally;
|
|
45 |
use Sort::Naturally ();
|
46 |
46 |
require "bin/mozilla/arap.pl";
|
47 |
47 |
require "bin/mozilla/common.pl";
|
48 |
48 |
require "bin/mozilla/invoice_io.pl";
|
... | ... | |
1725 |
1725 |
$form->redirect;
|
1726 |
1726 |
|
1727 |
1727 |
}
|
|
1728 |
|
1728 |
1729 |
sub sort {
|
1729 |
1730 |
$main::lxdebug->enter_sub();
|
1730 |
1731 |
|
|
1732 |
check_do_access();
|
|
1733 |
|
1731 |
1734 |
my $form = $main::form;
|
1732 |
1735 |
my %temp_hash;
|
1733 |
1736 |
|
... | ... | |
1738 |
1741 |
$temp_hash{$form->{"delivery_order_items_id_$i"}} = { runningnumber => $form->{"runningnumber_$i"}, partnumber => $form->{"partnumber_$i"} };
|
1739 |
1742 |
}
|
1740 |
1743 |
# naturally sort partnumbers and get a sorted array of doi_ids
|
1741 |
|
my @sorted_doi_ids = sort { ncmp($temp_hash{$a}->{"partnumber"}, $temp_hash{$b}->{"partnumber"}) } keys %temp_hash;
|
|
1744 |
my @sorted_doi_ids = sort { Sort::Naturally::ncmp($temp_hash{$a}->{"partnumber"}, $temp_hash{$b}->{"partnumber"}) } keys %temp_hash;
|
1742 |
1745 |
|
1743 |
|
#$main::lxdebug->message(0, 'sortiert, vorher :' . Dumper(%temp_hash));
|
1744 |
|
#$main::lxdebug->message(0, 'sortiert, nachher:' . Dumper(@sorted_doi_ids));
|
1745 |
1746 |
|
1746 |
1747 |
my $new_number = 1;
|
|
1748 |
|
1747 |
1749 |
for (@sorted_doi_ids) {
|
1748 |
|
# reposition old runningnumber with the new order 1 .. n
|
1749 |
1750 |
$form->{"runningnumber_$temp_hash{$_}->{runningnumber}"} = $new_number;
|
1750 |
|
|
1751 |
|
#$main::lxdebug->message(0, 'hier jetzt:' . 'ferner' . $temp_hash{$_}->{runningnumber} .
|
1752 |
|
# 'mit' . $form->{"runningnumber_{$temp_hash{$_}->{runningnumber}}"}); #" = $new_number;
|
1753 |
|
|
1754 |
1751 |
$new_number++;
|
1755 |
1752 |
}
|
1756 |
|
# update or save directly
|
1757 |
|
# update_delivery_order;
|
1758 |
1753 |
$main::lxdebug->leave_sub();
|
1759 |
1754 |
save();
|
1760 |
1755 |
}
|
|
1756 |
|
|
1757 |
__END__
|
|
1758 |
|
|
1759 |
=pod
|
|
1760 |
|
|
1761 |
=encoding utf8
|
|
1762 |
|
|
1763 |
=head1 NAME
|
|
1764 |
|
|
1765 |
do.pl - Script for all calls to delivery order
|
|
1766 |
|
|
1767 |
|
|
1768 |
=head1 FUNCTIONS
|
|
1769 |
|
|
1770 |
=over 2
|
|
1771 |
|
|
1772 |
=item C<sort>
|
|
1773 |
|
|
1774 |
Sorts all position with Natural Sort. Can be activated in form_footer.html like this
|
|
1775 |
C<E<lt>input class="submit" type="submit" name="action_sort" id="sort_button" value="[% 'Sort and Save' | $T8 %]"E<gt>>
|
|
1776 |
|
|
1777 |
=back
|
|
1778 |
|
|
1779 |
=head1 TODO
|
|
1780 |
|
|
1781 |
Sort and Save can be implemented as an optional button if configuration ca be set by client config.
|
|
1782 |
Example coding for database scripts and templates in (git show af2f24b8), check also
|
|
1783 |
autogeneration for rose (scripts/rose_auto_create_model.pl --h)
|
Optionale Sortierfunktion in Lieferscheinen
Den Commit aus dem Kundenprojekt entsprechend für den
Standard überarbeitet und als optionale Aufruf für ein HTML-Template
zu Verfügung gestellt.Entsprechend kurz im POD beschrieben.