Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

202411 feat suche seriennummer ekvk rechnungen #404

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions SL/AP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,19 @@ SQL
push @values, like($form->{parts_description});
}

if ($form->{parts_serialnumber}) {
$where .= <<SQL;
AND EXISTS (
SELECT invoice.trans_id
FROM invoice
WHERE (invoice.trans_id = a.id)
AND (invoice.serialnumber ILIKE ?)
LIMIT 1
)
SQL
push @values, like($form->{parts_serialnumber});
}

if ($where) {
$where =~ s{\s*AND\s*}{ WHERE };
$query .= $where;
Expand Down
36 changes: 36 additions & 0 deletions SL/AR.pm
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,29 @@ sub ar_transactions {
}
}

$form->{fulltext} = trim($form->{fulltext});
if ($form->{fulltext}) {
my @fulltext_fields = qw(a.notes
a.intnotes
a.shipvia
a.transaction_description
a.quonumber
a.ordnumber
a.invnumber);
$where .= ' AND (';
$where .= join ' OR ', map {"$_ ILIKE ?"} @fulltext_fields;

$where .= <<SQL;
OR EXISTS (
SELECT files.id FROM files LEFT JOIN file_full_texts ON (file_full_texts.file_id = files.id)
WHERE files.object_id = a.id AND files.object_type = 'invoice'
AND file_full_texts.full_text ILIKE ?)
SQL
$where .= ')'; # end AND

push(@values, like($form->{fulltext})) for 1 .. (scalar @fulltext_fields) + 1;
}

if ($form->{parts_partnumber}) {
$where .= <<SQL;
AND EXISTS (
Expand Down Expand Up @@ -694,6 +717,19 @@ SQL
push @values, like($form->{parts_description});
}

if ($form->{parts_serialnumber}) {
$where .= <<SQL;
AND EXISTS (
SELECT invoice.trans_id
FROM invoice
WHERE (invoice.trans_id = a.id)
AND (invoice.serialnumber ILIKE ?)
LIMIT 1
)
SQL
push @values, like($form->{parts_serialnumber});
}

if ($form->{show_not_mailed}) {
$where .= <<SQL;
AND NOT EXISTS (
Expand Down
4 changes: 3 additions & 1 deletion bin/mozilla/ap.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,8 @@ sub ap_transactions {
push @hidden_variables, "l_subtotal", qw(open closed vendor invnumber ordnumber transaction_description notes intnotes project_id
transdatefrom transdateto duedatefrom duedateto datepaidfrom datepaidto
parts_partnumber parts_description department_id taxzone_id payment_id
fulltext insertdatefrom insertdateto);
fulltext insertdatefrom insertdateto
parts_serialnumber);

my $href = build_std_url('action=ap_transactions', grep { $form->{$_} } @hidden_variables);

Expand Down Expand Up @@ -1267,6 +1268,7 @@ sub ap_transactions {
push @options, $locale->text('Part Description') . " : $form->{parts_description}" if $form->{parts_description};
push @options, $locale->text('Part Number') . " : $form->{parts_partnumber}" if $form->{parts_partnumber};
push @options, $locale->text('Full Text') . " : $form->{fulltext}" if ($form->{fulltext});
push @options, $locale->text('Serial Number') . " : $form->{parts_serialnumber}" if ($form->{parts_serialnumber});
push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1) if ($form->{transdatefrom});
push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1) if ($form->{transdateto});
push @options, $locale->text('Due Date') . " " . $locale->text('from') . " " . $locale->date(\%myconfig, $form->{duedatefrom}, 1) if ($form->{duedatefrom});
Expand Down
8 changes: 7 additions & 1 deletion bin/mozilla/ar.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ sub ar_transactions {
business_id parts_partnumber parts_description department_id
show_marked_as_closed show_not_mailed shippingpoint shipvia taxzone_id
payment_id shiptoname shiptodepartment_1 shiptodepartment_2 shiptostreet
shiptozipcode shiptocity shiptocountry
shiptozipcode shiptocity shiptocountry fulltext parts_serialnumber
);
push @hidden_variables, map { "cvar_$_->{name}" } @ct_searchable_custom_variables;

Expand Down Expand Up @@ -1331,6 +1331,12 @@ sub ar_transactions {
if ($form->{shiptocountry}) {
push @options, $locale->text('Country (Shipping)') . " : $form->{shiptocountry}";
}
if ($form->{fulltext}) {
push @options, $locale->text('Full Text') . " : $form->{fulltext}";
}
if ($form->{parts_serialnumber}) {
push @options, $locale->text('Serial Number') . " : $form->{parts_serialnumber}";
}

$form->{ALL_PRINTERS} = SL::DB::Manager::Printer->get_all_sorted;

Expand Down
4 changes: 4 additions & 0 deletions templates/design40_webpages/ap/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ <h1>[% title %]</h1>
<th>[% 'Part Number' | $T8 %]</th>
<td>[% L.input_tag("parts_partnumber", "", class="wi-normal") %]</td>
</tr>
<tr>
<th>[% 'Serial Number' | $T8 %]</th>
<td>[% L.input_tag("parts_serialnumber", "") %]</td>
</tr>
<tr>
<th>[% 'Project Number' | $T8 %]</th>
<td>[% P.project.picker("project_id", project_id, active="both", valid="both", class="wi-normal") %]</td>
Expand Down
8 changes: 8 additions & 0 deletions templates/design40_webpages/ar/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ <h1>[% title %]</h1>
<tr>
<th class="caption" colspan="2">[% 'Miscellaneous' | $T8 %]</th>
</tr>
<tr>
<th>[% 'Full Text' | $T8 %]</th>
<td>[% L.input_tag('fulltext', '') %]</td>
</tr>
<tr>
<th>[% 'Transaction description' | $T8 %]</th>
<td>[% L.input_tag("transaction_description", "") %]</td>
Expand All @@ -59,6 +63,10 @@ <h1>[% title %]</h1>
<th>[% 'Part Number' | $T8 %]</th>
<td>[% L.input_tag("parts_partnumber", "") %]</td>
</tr>
<tr>
<th>[% 'Serial Number' | $T8 %]</th>
<td>[% L.input_tag("parts_serialnumber", "") %]</td>
</tr>
</tbody>
</table>

Expand Down
2 changes: 2 additions & 0 deletions templates/webpages/ap/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ <h1>[% title %]</h1>
<tr>
<th align="right">[% 'Full Text' | $T8 %]</th>
<td>[% L.input_tag('fulltext', '', style=style) %]</td>
<th align="right">[% 'Serial Number' | $T8 %]</th>
<td>[% L.input_tag("parts_serialnumber", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Project Number' | $T8 %]</th>
Expand Down
6 changes: 6 additions & 0 deletions templates/webpages/ar/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ <h1>[% title %]</h1>
<th align="right">[% 'Part Number' | $T8 %]</th>
<td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Full Text' | $T8 %]</th>
<td>[% L.input_tag('fulltext', '', style=style) %]</td>
<th align="right">[% 'Serial Number' | $T8 %]</th>
<td>[% L.input_tag("parts_serialnumber", "", style=style) %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Shipping Point' | $T8 %]</th>
<td>[% L.input_tag("shippingpoint", "", style=style) %]</td>
Expand Down