my $close = $input->param('close');
my $data;
my $new;
-my $dbh = C4::Context->dbh;
if ( $ordnum eq '' ) { # create order
$new = 'yes';
my $itemtypes = GetItemTypes;
my @itemtypesloop;
-foreach my $thisitemtype (sort keys %$itemtypes) {
+foreach my $thisitemtype (sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'}} keys %$itemtypes) {
push @itemtypesloop, { itemtype => $itemtypes->{$thisitemtype}->{'itemtype'} , desc => $itemtypes->{$thisitemtype}->{'description'} } ;
}
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
-foreach my $thisbranch ( sort keys %$branches ) {
+foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) {
my %row = (
value => $thisbranch,
branchname => $branches->{$thisbranch}->{'branchname'},
);
+ $row{'selected'} = 1 if( $thisbranch eq $data->{branchcode}) ;
push @branchloop, \%row;
}
$template->param( branchloop => \@branchloop , itypeloop => \@itemtypesloop );
-name => 'bookfund',
-id => 'bookfund',
-values => \@select_bookfund,
- -default => $data->{'bookfundid'},
+ -default => ($data->{'bookfundid'} ? $data->{'bookfundid'} : $select_bookfund[0]),
-labels => \%select_bookfunds,
#-size => 1,
- -tabindex =>'',
-multiple => 0
);
nocalc => $bookseller->{'nocalc'},
name => $bookseller->{'name'},
currency => $bookseller->{'listprice'},
- gstrate => C4::Context->preference("gist"),
+ gstrate => C4::Context->preference("gist") || 0,
loop_currencies => \@loop_currency,
orderexists => ( $new eq 'yes' ) ? 0 : 1,
title => $data->{'title'},