From f9c3cde499335c8ae311e33f409efc7f2cec8f19 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 18 Feb 2021 14:47:03 +0100 Subject: [PATCH] Bug 27715: Remove unused build_dt_query MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Renvoize Signed-off-by: Joonas Kylmälä Signed-off-by: Marcel de Rooy Signed-off-by: Fridolin Somers --- C4/Utils/DataTables.pm | 73 +----------------------------------------- 1 file changed, 1 insertion(+), 72 deletions(-) diff --git a/C4/Utils/DataTables.pm b/C4/Utils/DataTables.pm index e6fc1ccbcf..4a7dafed4f 100644 --- a/C4/Utils/DataTables.pm +++ b/C4/Utils/DataTables.pm @@ -25,7 +25,7 @@ use vars qw(@ISA @EXPORT); BEGIN { @ISA = qw(Exporter); - @EXPORT = qw(dt_build_orderby dt_build_having dt_get_params dt_build_query); + @EXPORT = qw(dt_build_orderby dt_build_having dt_get_params); } =head1 NAME @@ -209,75 +209,4 @@ sub dt_get_params { return %dtparam; } -=head2 dt_build_query_simple - - my ( $query, $params )= dt_build_query_simple( $value, $field ) - - This function takes a value and a field (table.field). - - It returns (undef, []) if not $value. - Else, returns a SQL where string and an arrayref containing parameters - for the execute method of the statement. - -=cut -sub dt_build_query_simple { - my ( $value, $field ) = @_; - my $query; - my @params; - if( $value ) { - $query .= " AND $field = ? "; - push @params, $value; - } - return ( $query, \@params ); -} - -=head2 dt_build_query_dates - - my ( $query, $params )= dt_build_query_dates( $datefrom, $dateto, $field) - - This function takes a datefrom, dateto and a field (table.field). - - It returns (undef, []) if not $value. - Else, returns a SQL where string and an arrayref containing parameters - for the execute method of the statement. - -=cut -sub dt_build_query_dates { - my ( $datefrom, $dateto, $field ) = @_; - my $query; - my @params; - if ( $datefrom ) { - $query .= " AND $field >= ? "; - push @params, eval { output_pref( { dt => dt_from_string( $datefrom ), dateonly => 1, dateformat => 'iso' } ); }; - } - if ( $dateto ) { - $query .= " AND $field <= ? "; - push @params, eval { output_pref( { dt => dt_from_string( $dateto ), dateonly => 1, dateformat => 'iso' } ); }; - } - return ( $query, \@params ); -} - -=head2 dt_build_query - - my ( $query, $filter ) = dt_build_query( $type, @params ) - - This function takes a value and a list of parameters. - - It calls dt_build_query_dates or dt_build_query_simple function of $type. - - $type can contain 'simple' or 'range_dates'. - if $type is not matched it returns undef - -=cut -sub dt_build_query { - my ( $type, @params ) = @_; - if ( $type =~ m/simple/ ) { - return dt_build_query_simple(@params); - } - elsif ( $type =~ m/range_dates/ ) { - return dt_build_query_dates(@params); - } - return; -} - 1; -- 2.39.5