X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FHelper%2FSorted.pm;h=00eedb97cd01452d3fd1c079c72f62d075c4287a;hb=refs%2Fheads%2Fswiss;hp=9442c842e9d820e94e7b45d5c1257b306187ea2b;hpb=762f8a97338181a9ecb01c20eed52215b470212d;p=kivitendo-erp.git diff --git a/SL/DB/Helper/Sorted.pm b/SL/DB/Helper/Sorted.pm index 9442c842e..00eedb97c 100644 --- a/SL/DB/Helper/Sorted.pm +++ b/SL/DB/Helper/Sorted.pm @@ -47,7 +47,7 @@ sub _get_sort_spec { sub _make_sort_spec { my ($class) = @_; - my %sort_spec = $class->_sort_spec if defined &{ "${class}::_sort_spec" }; + my %sort_spec = defined &{ "${class}::_sort_spec" } ? $class->_sort_spec : (); my $meta = $class->object_class->meta; @@ -122,7 +122,7 @@ sorting of database records Evaluates C<$params{sort_by}> and C<$params{sort_dir}> and returns an SQL string suitable for sorting. The package this package is mixed into has to provide a method L that returns a hash whose -structure is explained below. That hash is authoritive in which +structure is explained below. That hash is authoritative in which columns may be sorted, which column to sort by by default and how to handle C values. @@ -173,7 +173,7 @@ strings by which to sort. Example: customer_name => 'lower(customer.name)', }, -If sorting by a column is requested that is not a key in this hash +If sorting is requested for a column that is not a key in this hash then the default column name will be used. The value can be either a scalar or an array reference. If it's the @@ -196,12 +196,12 @@ Either a scalar or a hash reference determining where C values will be sorted. If undefined then the decision is left to the database. -If it is a scalar then all the same value will be used for all +If it is a scalar then the same value will be used for all classes. The value is either C or C. If it is a hash reference then its keys are column names (not SQL names). The values are either C or C. If a column name is -not found in this hash then the special keu C will be looked +not found in this hash then the special key C will be looked up and used if it is found. Example: