Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1163cee7

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

  • ID 1163cee7d5cfe9355a9d231ac544ce0943623d77
  • Vorgänger f633eda2
  • Nachfolger 684e84d8

Warensuche: überlagerte custom variables werden nun korrekt auch in der Warensuche überlagert.

Unterschiede anzeigen:

SL/IC.pm
792 792
    pfac       => 'LEFT JOIN price_factors pfac ON (pfac.id     = p.price_factor_id)',
793 793
    invoice_oi =>
794 794
      q|LEFT JOIN (
795
         SELECT parts_id, description, serialnumber, trans_id, unit, sellprice, qty,          assemblyitem,         deliverydate, 'invoice'    AS ioi FROM invoice UNION
796
         SELECT parts_id, description, serialnumber, trans_id, unit, sellprice, qty, FALSE AS assemblyitem, NULL AS deliverydate, 'orderitems' AS ioi FROM orderitems
795
         SELECT parts_id, description, serialnumber, trans_id, unit, sellprice, qty,          assemblyitem,         deliverydate, 'invoice'    AS ioi, id FROM invoice UNION
796
         SELECT parts_id, description, serialnumber, trans_id, unit, sellprice, qty, FALSE AS assemblyitem, NULL AS deliverydate, 'orderitems' AS ioi, id FROM orderitems
797 797
       ) AS ioi ON ioi.parts_id = p.id|,
798 798
    apoe       =>
799 799
      q|LEFT JOIN (
......
824 824
     serialnumber => 'ioi.',
825 825
     quotation    => 'apoe.',
826 826
     cv           => 'cv.',
827
     "ioi.id"     => ' ',
828
     "ioi.ioi"    => ' ',
827 829
  );
828 830

  
829 831
  # if the join condition in these blocks are met, the column
......
841 843
  my %renamed_columns = (
842 844
    'factor'       => 'price_factor',
843 845
    'SUM(ioi.qty)' => 'soldtotal',
846
    'ioi.id'       => 'ioi_id',
847
    'ioi.ioi'      => 'ioi',
844 848
  );
845 849

  
846 850
  if (($form->{searchitems} eq 'assembly') && $form->{l_lastcost}) {
......
937 941
  my $bsooqr        = any { $form->{$_} } @oe_flags;
938 942
  my @bsooqr_tokens = ();
939 943

  
940
  push @select_tokens, @qsooqr_flags, 'quotation', 'cv'                       if $bsooqr;
944
  push @select_tokens, @qsooqr_flags, 'quotation', 'cv', 'ioi.id', 'ioi.ioi'  if $bsooqr;
941 945
  push @select_tokens, @deliverydate_flags                                    if $bsooqr && $form->{l_deliverydate};
942 946
  push @select_tokens, $q_assembly_lastcost                                   if ($form->{searchitems} eq 'assembly') && $form->{l_lastcost};
943 947
  push @bsooqr_tokens, q|module = 'ir' AND NOT ioi.assemblyitem|              if $form->{bought};
......
1005 1009
    push @bind_vars, @cvar_values;
1006 1010
  }
1007 1011

  
1008
  my $query = qq|SELECT DISTINCT $select_clause FROM parts p $join_clause WHERE $where_clause $group_clause $order_clause $limit_clause|;
1012
  my $query = <<"  SQL";
1013
    SELECT DISTINCT $select_clause
1014
    FROM parts p
1015
    $join_clause
1016
    WHERE $where_clause
1017
    $group_clause
1018
    $order_clause
1019
    $limit_clause
1020
  SQL
1009 1021

  
1010 1022
  $form->{parts} = selectall_hashref_query($form, $dbh, $query, @bind_vars);
1011 1023

  

Auch abrufbar als: Unified diff