Angebote/Aufträge: Suche nach Artikelnummer/-beschreibung in Positionen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 25 Apr 2016 12:50:44 +0000 (14:50 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 25 Apr 2016 13:06:24 +0000 (15:06 +0200)
SL/OE.pm
bin/mozilla/oe.pl
templates/webpages/oe/search.html

index 7a045bf..61af621 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -287,6 +287,33 @@ SQL
     push @values, conv_date($form->{expected_billing_date_to});
   }
 
+  if ($form->{parts_partnumber}) {
+    $query .= <<SQL;
+      AND EXISTS (
+        SELECT orderitems.trans_id
+        FROM orderitems
+        LEFT JOIN parts ON (orderitems.parts_id = parts.id)
+        WHERE (orderitems.trans_id = o.id)
+          AND (parts.partnumber ILIKE ?)
+        LIMIT 1
+      )
+SQL
+    push @values, like($form->{parts_partnumber});
+  }
+
+  if ($form->{parts_description}) {
+    $query .= <<SQL;
+      AND EXISTS (
+        SELECT orderitems.trans_id
+        FROM orderitems
+        WHERE (orderitems.trans_id = o.id)
+          AND (orderitems.description ILIKE ?)
+        LIMIT 1
+      )
+SQL
+    push @values, like($form->{parts_description});
+  }
+
   if ($form->{all}) {
     my @tokens = parse_line('\s+', 0, $form->{all});
     # ordnumber quonumber customer.name vendor.name transaction_description
index 7c2dbf7..4870287 100644 (file)
@@ -906,7 +906,8 @@ sub orders {
                                                         transaction_description transdatefrom transdateto type vc employee_id salesman_id
                                                         reqdatefrom reqdateto projectnumber project_id periodic_invoices_active periodic_invoices_inactive
                                                         business_id shippingpoint taxzone_id reqdate_unset_or_old insertdatefrom insertdateto
-                                                        order_probability_op order_probability_value expected_billing_date_from expected_billing_date_to);
+                                                        order_probability_op order_probability_value expected_billing_date_from expected_billing_date_to
+                                                        parts_partnumber parts_description);
   push @hidden_variables, map { "cvar_$_->{name}" } @ct_searchable_custom_variables;
 
   my   @keys_for_url = grep { $form->{$_} } @hidden_variables;
@@ -989,6 +990,8 @@ sub orders {
   push @options, $locale->text('Transaction description') . " : $form->{transaction_description}"         if $form->{transaction_description};
   push @options, $locale->text('Quick Search')            . " : $form->{all}"                             if $form->{all};
   push @options, $locale->text('Shipping Point')          . " : $form->{shippingpoint}"                   if $form->{shippingpoint};
+  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};
   if ( $form->{transdatefrom} or $form->{transdateto} ) {
     push @options, $locale->text('Order Date');
     push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1)     if $form->{transdatefrom};
index e63f6cd..b7161ee 100644 (file)
     </tr>
     <tr>
      <th align="right">[% 'Transaction description' | $T8 %]</th>
-     <td colspan="3"><input name="transaction_description" style="width: 250px"></td>
+     <td><input name="transaction_description" style="width: 250px"></td>
+
+     <th align="right">[% 'Part Description' | $T8 %]</th>
+     <td><input name="parts_description" style="width: 250px"></td>
     </tr>
     <tr>
      <th align="right">[% 'Project Number' | $T8 %]</th>
-     <td colspan="3">
+     <td>
             [%- INCLUDE 'generic/multibox.html'
                  name          =  MYCONFIG.vclimit < ALL_PROJECTS.size ? 'projectnumber' : 'project_id',
                  style         = "width: 250px",
                  allow_textbox = 1,
             -%]
      </td>
+
+     <th align="right">[% 'Part Number' | $T8 %]</th>
+     <td><input name="parts_partnumber" style="width: 250px"></td>
     </tr>
     [%- UNLESS ALL_BUSINESS_TYPES.size == 0 %]
     <tr>