qq|AND ((globalproject_id = ?) OR EXISTS | .
qq| (SELECT * FROM orderitems oi | .
qq| WHERE oi.project_id = ? AND oi.trans_id = o.id))|;
- push(@values, $form->{"project_id"}, $form->{"project_id"});
+ push(@values, conv_i($form->{"project_id"}), conv_i($form->{"project_id"}));
+ }
+
+ if ($form->{"projectnumber"}) {
+ $query .= <<SQL;
+ AND (pr.projectnumber ILIKE ?) OR EXISTS (
+ SELECT * FROM orderitems oi
+ LEFT JOIN project proi ON proi.id = oi.project_id
+ WHERE proi.projectnumber ILIKE ? AND oi.trans_id = o.id
+ )
+SQL
+ push @values, "%" . $form->{"projectnumber"} . "%", "%" . $form->{"projectnumber"} . "%" ;
}
if ($form->{"${vc}_id"}) {
<th align="right">Projektnummer</th>
<td colspan="3">
[%- INCLUDE 'generic/multibox.html'
- name = 'project_id',
+ name = vclimit < ALL_PROJECTS.size ? 'projectnumber' : 'project_id',
style = "width: 250px",
DATA = ALL_PROJECTS,
id_key = 'id',
<th align="right"><translate>Project Number</translate></th>
<td colspan="3">
[%- INCLUDE 'generic/multibox.html'
- name = 'project_id',
+ name = vclimit < ALL_PROJECTS.size ? 'projectnumber' : 'project_id',
style = "width: 250px",
DATA = ALL_PROJECTS,
id_key = 'id',