Revision 5074cc50
Von Moritz Bunkus vor etwa 13 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
702 | 702 |
push(@values, '%' . $form->{"${column}_$i"} . '%'); |
703 | 703 |
} |
704 | 704 |
|
705 |
if ($form->{"id_${i}"}) { |
|
706 |
$where .= qq| AND p.id = ?|; |
|
707 |
push @values, $form->{"id_${i}"}; |
|
708 |
} |
|
709 |
|
|
710 | 705 |
if ($form->{id}) { |
711 | 706 |
$where .= qq| AND NOT (p.id = ?)|; |
712 | 707 |
push(@values, conv_i($form->{id})); |
713 | 708 |
} |
714 | 709 |
|
710 |
# Search for part ID overrides all other criteria. |
|
711 |
if ($form->{"id_${i}"}) { |
|
712 |
$where = qq|p.id = ?|; |
|
713 |
@values = ($form->{"id_${i}"}); |
|
714 |
} |
|
715 |
|
|
715 | 716 |
if ($form->{partnumber}) { |
716 | 717 |
$where .= qq| ORDER BY p.partnumber|; |
717 | 718 |
} else { |
SL/IR.pm | ||
---|---|---|
106 | 106 |
if ( $::instance_conf->get_inventory_system eq 'periodic') { |
107 | 107 |
# inventory account number is overwritten with expense account number, so |
108 | 108 |
# never book incoming to inventory account but always to expense account |
109 |
$form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"}
|
|
109 |
$form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"} |
|
110 | 110 |
}; |
111 | 111 |
|
112 | 112 |
# get item baseunit |
... | ... | |
226 | 226 |
# ORDER BY transdate guarantees FIFO |
227 | 227 |
|
228 | 228 |
# sold two items without having bought them yet, example result of query: |
229 |
# id | qty | allocated | trans_id | inventory_accno_id | expense_accno_id | transdate
|
|
229 |
# id | qty | allocated | trans_id | inventory_accno_id | expense_accno_id | transdate |
|
230 | 230 |
# ---+-----+-----------+----------+--------------------+------------------+------------ |
231 | 231 |
# 9 | 2 | 0 | 9 | 15 | 151 | 2011-01-05 |
232 | 232 |
|
233 | 233 |
# base_qty + allocated > 0 if article has already been sold but not bought yet |
234 | 234 |
|
235 | 235 |
# select qty,allocated,base_qty,sellprice from invoice where trans_id = 9; |
236 |
# qty | allocated | base_qty | sellprice
|
|
236 |
# qty | allocated | base_qty | sellprice |
|
237 | 237 |
# -----+-----------+----------+------------ |
238 | 238 |
# 2 | 0 | 2 | 1000.00000 |
239 | 239 |
|
... | ... | |
1093 | 1093 |
push @values, $form->{"partnumber_$i"}; |
1094 | 1094 |
} |
1095 | 1095 |
|
1096 |
# Search for part ID overrides all other criteria. |
|
1096 | 1097 |
if ($form->{"id_${i}"}) { |
1097 |
$where .= qq| AND p.id = ?|;
|
|
1098 |
push @values, $form->{"id_${i}"};
|
|
1098 |
$where = qq|p.id = ?|;
|
|
1099 |
@values = ($form->{"id_${i}"});
|
|
1099 | 1100 |
} |
1100 | 1101 |
|
1101 | 1102 |
if ($form->{"description_$i"}) { |
SL/IS.pm | ||
---|---|---|
1261 | 1261 |
|
1262 | 1262 |
# all invoice entries of an example part: |
1263 | 1263 |
|
1264 |
# id | trans_id | base_qty | allocated | sellprice | inventory_accno | income_accno | expense_accno
|
|
1264 |
# id | trans_id | base_qty | allocated | sellprice | inventory_accno | income_accno | expense_accno |
|
1265 | 1265 |
# ---+----------+----------+-----------+-----------+-----------------+--------------+--------------- |
1266 | 1266 |
# 4 | 4 | -5 | 5 | 20.00000 | 1140 | 4400 | 5400 bought 5 for 20 |
1267 | 1267 |
# 5 | 5 | 4 | -4 | 50.00000 | 1140 | 4400 | 5400 sold 4 for 50 |
... | ... | |
1771 | 1771 |
push @values, $form->{"partnumber_$i"}; |
1772 | 1772 |
} |
1773 | 1773 |
|
1774 |
# Search for part ID overrides all other criteria. |
|
1774 | 1775 |
if ($form->{"id_${i}"}) { |
1775 |
$where .= qq| AND p.id = ?|;
|
|
1776 |
push @values, $form->{"id_${i}"};
|
|
1776 |
$where = qq|p.id = ?|;
|
|
1777 |
@values = ($form->{"id_${i}"});
|
|
1777 | 1778 |
} |
1778 | 1779 |
|
1779 | 1780 |
if ($form->{"description_$i"}) { |
Auch abrufbar als: Unified diff
Artikelauswahl gefixt: das Ausgewählte nehmen, nicht den ersten Treffer
Hintergrund: Suche in SL/IS.pm hat (sehr außergewöhnlich) ein
Suchkriterium nach EAN mit "OR" verknüpft. Dadurch, dass die Suche
nach ID schlicht ans Ende mit "AND" gestellt wurde, ergab sich grob
"(NOT OBSOLETE) OR (ean = ? AND id = ?)", wodurch wieder mehr als ein
Treffer gefunden wurde.
Bug wurde in Revision cb253140 eingebaut.