From bd8bd95b1a2dc9c22365311be323d41e0f0cada3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 28 May 2009 15:08:54 +0000 Subject: [PATCH] Bugfix fuer 1018 - Die Idee von Sven war nett, hat aber Probleme bei Artikelnummern groesser 32bit - Bei Sortierung von Waren nahc Artikelnummer erscheint ein SQL-Fehler --- SL/IC.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/SL/IC.pm b/SL/IC.pm index ba3edfabb..5548d19df 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -866,14 +866,18 @@ sub all_parts { my $sort_order = ($form->{revers} ? ' DESC' : ' ASC'); + my $order_clause = " ORDER BY $form->{sort} " . ($form->{revers} ? 'DESC' : 'ASC'); + # special case: sorting by partnumber # since partnumbers are expected to be prefixed integers, a special sorting is implemented sorting first lexically by prefix and then by suffix. # and yes, that expression is designed to hold that array of regexes only once, so the map is kinda messy, sorry about that. # ToDO: implement proper functional sorting - $form->{sort} = join ', ', map { push @select_tokens, $_; ($table_prefix{$_} = "substring(partnumber,'[") . $_ } qw|^[:digit:]]+') [:digit:]]+')::INTEGER| - if $form->{sort} eq 'partnumber'; + # Nette Idee von Sven, gibt aber Probleme wenn die Artikelnummern groesser als 32bit sind. Korrekt waere es, dass Sort-Natural-Modul zu nehmen + # Ich lass das mal hier drin, damit die Idee erhalten bleibt jb 28.5.2009 bug 1018 + #$form->{sort} = join ', ', map { push @select_tokens, $_; ($table_prefix{$_} = "substring(partnumber,'[") . $_ } qw|^[:digit:]]+') [:digit:]]+')::INTEGER| + # if $form->{sort} eq 'partnumber'; - my $order_clause = " ORDER BY $form->{sort} $sort_order"; + #my $order_clause = " ORDER BY $form->{sort} $sort_order"; my $limit_clause = " LIMIT 100" if $form->{top100}; -- 2.20.1