Hello.
Since my custom filter was triggering an error ("$in requires an array"), i created a new PHP file containing a "CustomFilterApi" class that extends FilterApi class, so then i was able to change some FilterApi's functions and bypass my filter's error. But when i extend the FilterApi class, it triggers some forbidden functions.
There's my CustomFilterApi code:
<?php
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
* Copyright (C) SugarCRM Inc. All rights reserved.
*/
require_once ("clients/base/api/FilterApi.php");
class CustomFilterApi extends FilterApi
{
protected static function addFilters(array $filterDefs, SugarQuery_Builder_Where $where, SugarQuery $q)
{
foreach ($filterDefs as $filterDef) {
if (!is_array($filterDef)) {
$filterDef = array($filterDef);
/*throw new SugarApiExceptionInvalidParameter(
sprintf(
'Did not recognize the definition: %s',
print_r($filterDef, true)
)
);*/
}
foreach ($filterDef as $field => $filter) {
parent::addFilter($field, $filter, $where, $q);
}
}
}
}
Error screenshot:
/resized-image/__size/319x137/__key/communityserver-discussions-components-files/42/EVIDENCE1.png
