Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6aaed579

Von Martin Helmling martin.helmling@octosoft.eu vor fast 8 Jahren hinzugefügt

  • ID 6aaed579a01d95b634a06d6a0b4bf11ac61363b6
  • Vorgänger 6ad5169e
  • Nachfolger 6ba38ffe

Paginierung schneller machen:

SQL-Injection raus

Unterschiede anzeigen:

SL/WH.pm
552 552
    GROUP BY $group_clause
553 553
    ORDER BY r_${sort_spec}) AS lines WHERE r_qty>0|;
554 554

  
555
  $query .= " LIMIT $filter{limit}"    if $filter{limit} ;
556
  $query .= " OFFSET $filter{offset}"  if $filter{offset} ;
555
  my @all_vars = (@filter_vars,@filter_vars,@filter_vars);
557 556

  
558
  my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars, @filter_vars, @filter_vars);
557
  if ($filter{limit}) {
558
    $query .= " LIMIT ?";
559
    push @all_vars,$filter{limit};
560
  }
561
  if ($filter{offset}) {
562
    $query .= " OFFSET ?";
563
    push @all_vars, $filter{offset};
564
  }
565

  
566
  my $sth = prepare_execute_query($form, $dbh, $query, @all_vars);
559 567

  
560 568
  my ($h_oe_id, $q_oe_id);
561 569
  if ($form->{l_oe_id}) {
......
824 832
      GROUP BY $group_clause
825 833
      ORDER BY $sort_spec ) AS lines WHERE qty<>0|;
826 834

  
827
  $query .= " LIMIT $filter{limit}"    if $filter{limit} ;
828
  $query .= " OFFSET $filter{offset}"  if $filter{offset} ;
829

  
830
  my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars);
835
  if ($filter{limit}) {
836
    $query .= " LIMIT ?";
837
    push @filter_vars,$filter{limit};
838
  }
839
  if ($filter{offset}) {
840
    $query .= " OFFSET ?";
841
    push @filter_vars, $filter{offset};
842
  }
843
  my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars );
831 844

  
832 845
  my (%non_empty_bins, @all_fields, @contents);
833 846

  
bin/mozilla/wh.pl
593 593
  }
594 594
  # /filter stuff
595 595

  
596
  my $allrows = 0;
597
  $allrows = 1 if $form->{report_generator_output_format} ne 'HTML' ;
596
  my $allrows        = !!($form->{report_generator_output_format} ne 'HTML') ;
598 597

  
599 598
  # manual paginating
600
  my $pages = {};
601
  my $page = $::form->{page} || 1;
602
  $pages->{per_page}        = $::form->{per_page} || 15;
603
  my $first_nr = ($page - 1) * $pages->{per_page};
604
  my $last_nr  = $first_nr + $pages->{per_page};
599
  my $pages          = {};
600
  my $page           = $::form->{page} || 1;
601
  $pages->{per_page} = $::form->{per_page} || 15;
602
  my $first_nr       = ($page - 1) * $pages->{per_page};
603
  my $last_nr        = $first_nr + $pages->{per_page};
605 604

  
606 605
  # no optimisation if qty op
607 606
  if ( !$allrows && $form->{maxrows} && !$filter{qty_op}) {
608 607
    $filter{limit}  = $pages->{per_page};
609 608
    $filter{offset} = ($page - 1) * $pages->{per_page};
610
    $first_nr = 0;
611
    $last_nr = $pages->{per_page};
609
    $first_nr       = 0;
610
    $last_nr        = $pages->{per_page};
612 611
  }
613 612

  
614 613
  my @contents  = WH->get_warehouse_journal(%filter);
......
696 695
    $entry->{type_and_classific} = $::request->presenter->type_abbreviation($entry->{part_type}).
697 696
                                   $::request->presenter->classification_abbreviation($entry->{classification_id});
698 697
    $entry->{qty}        = $form->format_amount(\%myconfig, $entry->{qty});
699
#    $entry->{qty}        = $form->format_amount_units('amount'     => $entry->{qty},
700
#                                                      'part_unit'  => $entry->{partunit},
701
#                                                      'conv_units' => 'convertible');
702 698
    $entry->{trans_type} = $locale->text($entry->{trans_type});
703 699

  
704 700
    my $row = { };
......
828 824
  $form->{report_generator_output_format} = 'HTML' if !$form->{report_generator_output_format};
829 825

  
830 826
  # manual paginating
831
  my $allrows = 0;
832
  $allrows = 1 if $form->{report_generator_output_format} ne 'HTML' ;
833
  my $page = $::form->{page} || 1;
834
  my $pages = {};
835
  $pages->{per_page}        = $::form->{per_page} || 20;
836
  my $first_nr = ($page - 1) * $pages->{per_page};
837
  my $last_nr  = $first_nr + $pages->{per_page};
827
  my $allrows        = !!($form->{report_generator_output_format} ne 'HTML') ;
828
  my $page           = $::form->{page} || 1;
829
  my $pages          = {};
830
  $pages->{per_page} = $::form->{per_page} || 20;
831
  my $first_nr       = ($page - 1) * $pages->{per_page};
832
  my $last_nr        = $first_nr + $pages->{per_page};
838 833

  
839 834
  # no optimisation if qty op
840 835
  if ( !$allrows && $form->{maxrows} && !$filter{qty_op}) {
841 836
    $filter{limit}  = $pages->{per_page};
842 837
    $filter{offset} = ($page - 1) * $pages->{per_page};
843
    $first_nr = 0;
844
    $last_nr = $pages->{per_page};
838
    $first_nr       = 0;
839
    $last_nr        = $pages->{per_page};
845 840
  }
846 841

  
847 842
  my @contents  = WH->get_warehouse_report(%filter);

Auch abrufbar als: Unified diff