X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FHelper%2FCustomVariables.pm;h=3869f161302f2ec3d06cc0d19ae1bb53d8f34ce4;hb=a6ce2c7f3f7ae10f7065fb86121c8d11049617ee;hp=fef521cfa19675a64adc0b73ff1b9502fdac65d4;hpb=ee7454765fe538049c15e39c1f58304a4c569ea8;p=kivitendo-erp.git diff --git a/SL/DB/Helper/CustomVariables.pm b/SL/DB/Helper/CustomVariables.pm index fef521cfa..3869f1613 100644 --- a/SL/DB/Helper/CustomVariables.pm +++ b/SL/DB/Helper/CustomVariables.pm @@ -4,6 +4,7 @@ use strict; use Carp; use Data::Dumper; use List::Util qw(first); +use List::UtilsBy qw(sort_by); use constant META_CVARS => 'cvars_config'; @@ -12,7 +13,7 @@ sub import { my $caller_package = caller; # TODO: if module is empty, module overloading needs to take effect - # certain stuff may have more than one overload, odr even more than one type + # certain stuff may have more than one overload, or even more than one type defined $caller_package or croak 'need to be included from a caller reference'; $params{module} ||= _calc_modules_from_overloads(%params) if $params{overloads}; @@ -98,6 +99,8 @@ sub make_cvar_by_configs { @$configs ); + @return = sort_by { $_->config->sortkey } @return; + return \@return; } } @@ -309,7 +312,7 @@ sub make_cvar_custom_filter { query_is_sql => 1, ); - $query{config} =~ s{ \bdefault_value\b \s*=\s* (?!'') }{default_value::${conversion} = }x if $conversion; + $query{config} =~ s{ (? $config->dbh, @@ -327,7 +330,7 @@ sub make_cvar_custom_filter { # remove rose aliases. query builder sadly is not reentrant, and will reuse the same aliases. :( $query{$key} =~ s{\bt\d+(?:\.)?\b}{}g; - # manually inline the values. again, rose doen't know how to handly bind params in subqueries :( + # manually inline the values. again, rose doesn't know how to handle bind params in subqueries :( $query{$key} =~ s{\?}{ $config->dbh->quote(shift @{ $bind_vals{$key} }) }xeg; $query{$key} =~ s{\n}{ }g; @@ -358,7 +361,7 @@ __END__ =head1 NAME -SL::DB::Helper::CustomVariables - Mixin to provide custom variables relations +SL::DB::Helper::CustomVariables - Mixin to provide custom variable relations =head1 SYNOPSIS