use SL::Webdav;
use SL::File;
use SL::Util qw(trim);
+use SL::YAML;
use SL::DB::Order;
use SL::DB::Default;
use SL::DB::Unit;
email_body => $::form->{email_body},
};
- my $periodic_invoices_config = YAML::Dump($config);
+ my $periodic_invoices_config = SL::YAML::Dump($config);
my $status = $self->get_periodic_invoices_status($config);
my $method = $sort_keys{$::form->{order_by}};
my @to_sort = map { { old_pos => $_->position, order_by => $method->($_) } } @{ $self->order->items_sorted };
if ($::form->{sort_dir}) {
- @to_sort = sort { Sort::Naturally::ncmp($a->{order_by}, $b->{order_by} ) } @to_sort;
+ if ( $::form->{order_by} =~ m/qty|sellprice|discount/ ){
+ @to_sort = sort { $a->{order_by} <=> $b->{order_by} } @to_sort;
+ } else {
+ @to_sort = sort { $a->{order_by} cmp $b->{order_by} } @to_sort;
+ }
} else {
- @to_sort = sort { Sort::Naturally::ncmp($b->{order_by}, $a->{order_by} ) } @to_sort;
+ if ( $::form->{order_by} =~ m/qty|sellprice|discount/ ){
+ @to_sort = sort { $b->{order_by} <=> $a->{order_by} } @to_sort;
+ } else {
+ @to_sort = sort { $b->{order_by} cmp $a->{order_by} } @to_sort;
+ }
}
$self->js
->run('kivi.Order.redisplay_items', \@to_sort)
$order->assign_attributes(%{$::form->{order}});
- if (my $periodic_invoices_config_attrs = $form_periodic_invoices_config ? YAML::Load($form_periodic_invoices_config) : undef) {
+ if (my $periodic_invoices_config_attrs = $form_periodic_invoices_config ? SL::YAML::Load($form_periodic_invoices_config) : undef) {
my $periodic_invoices_config = $order->periodic_invoices_config || $order->periodic_invoices_config(SL::DB::PeriodicInvoicesConfig->new);
$periodic_invoices_config->assign_attributes(%$periodic_invoices_config_attrs);
}
sub workflow_sales_or_purchase_order {
my ($self) = @_;
+
# always save
my $errors = $self->save();
return $self->js->render();
}
-
my $destination_type = $::form->{type} eq sales_quotation_type() ? sales_order_type()
: $::form->{type} eq request_quotation_type() ? purchase_order_type()
: $::form->{type} eq purchase_order_type() ? sales_order_type()
},
);
1;
- } || push @errors, ref($EVAL_ERROR) eq 'SL::X::FormError' ? $EVAL_ERROR->getMessage : $EVAL_ERROR;
+ } || push @errors, ref($EVAL_ERROR) eq 'SL::X::FormError' ? $EVAL_ERROR->error : $EVAL_ERROR;
});
return @errors;
my ($yaml_config) = @_;
return if !$yaml_config;
- my $attr = YAML::Load($yaml_config);
+ my $attr = SL::YAML::Load($yaml_config);
return if 'HASH' ne ref $attr;
return SL::DB::PeriodicInvoicesConfig->new(%$attr);
}