salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.46k stars 2.08k forks source link

Quotes Filter Doesn't Filter For Line Items #8102

Open jack7anderson7 opened 4 years ago

jack7anderson7 commented 4 years ago

When using the advanced filter in the Quotes Module, it does not allow you to filter by line items as suggested

Issue

Screenshot from 2019-10-21 09-20-50 Above is the shown that the product is related to the "Test Quote" Record

Screenshot from 2019-10-21 09-21-03 Above is me searching for the line item via the advanced filter

Screenshot from 2019-10-21 09-21-09

Expected Behavior

After searching, all quotes with that line item present should be listed.

Actual Behavior

Relevant records are not listed

Steps to Reproduce

  1. Go to Studio -> Quotes -> Layouts -> Filter -> Advanced Filter
  2. Add line items from "Hidden" to "Default"
  3. Return back to Quotes
  4. Use advanced filter to search for Line Items

Context

Your Environment

LeoZandvliet commented 4 years ago

I tested this with the Contracts module, this bug is also present there. And I guess the same would go for invoices?

The field 'line_items' is literally added to the where clause of the query instead of a join with the table aos_products_quotes and a search on it's field name. From the suitecrm logfile:

Query Failed:  
SELECT
    aos_contracts.id,
    aos_contracts.assigned_user_id,
    aos_contracts.contract_account_id,
    aos_contracts.name,
    aos_contracts.status ,
    jt0.user_name assigned_user_name,
    jt0.created_by assigned_user_name_owner ,
    'Users' assigned_user_name_mod, jt1.name contract_account,
    aos_contracts.total_contract_value,
    aos_contracts.currency_id,
    aos_contracts.start_date,
    aos_contracts.end_date,
    aos_contracts.date_entered,
    aos_contracts.created_by
FROM aos_contracts
     LEFT JOIN aos_contracts_cstm ON aos_contracts.id = aos_contracts_cstm.id_c 
     LEFT JOIN users jt0 ON aos_contracts.assigned_user_id=jt0.id AND jt0.deleted=0 AND jt0.deleted=0 
     LEFT JOIN accounts jt1 ON aos_contracts.contract_account_id = jt1.id AND jt1.deleted=0 
WHERE 
    ((aos_contracts.start_date = '2019-10-25' ) 
    AND ( line_items like 'TEST%')) 
    AND aos_contracts.deleted=0 
ORDER BY 
    aos_contracts.name ASC 
LIMIT 
    0,21

MySQL error 1054: Unknown column 'line_items' in 'where clause'