use Data::Dumper;
use List::MoreUtils qw(all any uniq);
-use YAML;
use SL::CVar;
use SL::DBUtils;
use SL::TransNumber;
use SL::Util qw(trim);
use SL::DB;
+use SL::Presenter::Part qw(type_abbreviation classification_abbreviation separate_abbreviation);
use Carp;
use strict;
);
# if the join condition in these blocks are met, the column
- # of the scecified table will gently override (coalesce actually) the original value
+ # of the specified table will gently override (coalesce actually) the original value
# use it to conditionally coalesce values from subtables
my @column_override = (
# column name, prefix, joins_needed, nick name (in case column is named like another)
# special case smart search
if ($form->{all}) {
- $form->{"l_$_"} = 1 for qw(partnumber description unit sellprice lastcost cvar_packaging linetotal);
+ $form->{"l_$_"} = 1 for qw(partnumber description unit sellprice lastcost linetotal);
+ $form->{l_service} = 1 if $form->{searchitems} eq 'service' || $form->{searchitems} eq '';
+ $form->{l_assembly} = 1 if $form->{searchitems} eq 'assembly' || $form->{searchitems} eq '';
+ $form->{l_part} = 1 if $form->{searchitems} eq 'part' || $form->{searchitems} eq '';
+ $form->{l_assortment} = 1 if $form->{searchitems} eq 'assortment' || $form->{searchitems} eq '';
push @where_tokens, "p.partnumber ILIKE ? OR p.description ILIKE ?";
push @bind_vars, (like($form->{all})) x 2;
}
}
$j++;
- $form->{"type_and_classific_$j"} = $::request->presenter->type_abbreviation($ref->{part_type}).
- $::request->presenter->classification_abbreviation($ref->{classification_id});
+ $form->{"type_and_classific_$j"} = type_abbreviation($ref->{part_type}).
+ classification_abbreviation($ref->{classification_id});
$form->{"id_$j"} = $ref->{id};
$form->{"partnumber_$j"} = $ref->{partnumber};
$form->{"description_$j"} = $ref->{description};
SQL
my $query_tax = <<SQL;
- SELECT c.accno, t.taxdescription AS description, t.rate, t.taxnumber
+ SELECT c.accno, t.taxdescription AS description, t.rate,
+ c.accno as taxnumber
FROM tax t
LEFT JOIN chart c ON c.id = t.chart_id
WHERE t.id IN
my $id = $form->{"${prefix}${i}"};
next unless $id;
my $prt = $parts_by_id{$id};
- my $type_abbr = $::request->presenter->type_abbreviation($prt->part_type);
+ my $type_abbr = type_abbreviation($prt->part_type);
push @{ $template_arrays{part_type} }, $prt->part_type;
push @{ $template_arrays{part_abbreviation} }, $type_abbr;
- push @{ $template_arrays{type_and_classific}}, $type_abbr.$::request->presenter->classification_abbreviation($prt->classification_id);
- push @{ $template_arrays{separate} }, $::request->presenter->separate_abbreviation($prt->classification_id);
+ push @{ $template_arrays{type_and_classific}}, $type_abbr . classification_abbreviation($prt->classification_id);
+ push @{ $template_arrays{separate} }, separate_abbreviation($prt->classification_id);
}
$main::lxdebug->leave_sub();
return %template_arrays;
}
-sub normalize_text_blocks {
- $main::lxdebug->enter_sub();
-
- my $self = shift;
- my %params = @_;
-
- my $form = $params{form} || $main::form;
-
- # check if feature is enabled (select normalize_part_descriptions from defaults)
- return unless ($::instance_conf->get_normalize_part_descriptions);
-
- foreach (qw(description notes)) {
- $form->{$_} =~ s/\s+$//s;
- $form->{$_} =~ s/^\s+//s;
- $form->{$_} =~ s/ {2,}/ /g;
- }
- $main::lxdebug->leave_sub();
-}
-
-
1;