How to extend clients/base/filters/operators/operators.php in multiple files

There is a third party package that conflicts with a customization we have in place for custom/clients/base/filters/operators/operators.php. The documentation provided on the website appears that there may only be 1 custom extension to this file as it requires you to include the base file.  https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.3/Cookbook/Creating_Custom_Fields/

There are 2 custom files such as below:
custom/clients/base/filters/operators/othercustomoperators.php
custom/clients/base/filters/operators/operators.php

The issue is only 1 of the files is utilized and the other is overwritten.


Please advise how we can both extend this file without overriding the customizations in the other file.

Here is what othercustomoperators file looks like which creates a new operator option.

<?php



require('clients/base/filters/operators/operators.php');


$viewdefs['base']['filter']['operators']['customoperator'] = array(
'$equals' => 'LBL_OPERATOR_EQUALS',
'$not_equals' => 'LBL_OPERATOR_NOT_EQUALS',
'$in' => 'LBL_OPERATOR_CONTAINS',
'$gt' => 'LBL_OPERATOR_GREATER_THAN',
'$lt' => 'LBL_OPERATOR_LESS_THAN',
'$gte' => 'LBL_OPERATOR_GREATER_THAN_OR_EQUALS',
'$lte' => 'LBL_OPERATOR_LESS_THAN_OR_EQUALS',
'$between' => 'LBL_OPERATOR_BETWEEN',
);


/**********/

Then ours is similar but extends existing operator options:
<?php

require('clients/base/filters/operators/operators.php');


$viewdefs['base']['filter']['operators']['multienum'] = array(
'$contains' => 'LBL_OPERATOR_CONTAINS',
'$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',
);

$viewdefs['base']['filter']['operators']['enum'] = array(
'$in' => 'LBL_OPERATOR_CONTAINS',
'$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',
'$empty' => 'LBL_OPERATOR_EMPTY',
'$not_empty' => 'LBL_OPERATOR_NOT_EMPTY',
);
 
  • This can be easily accomplished by creating files inside folder custom/Extension/application/Ext/clients/base/filters/operators/

    The content may be only that:

    $viewdefs['base']['filter']['operators']['multienum'] = array(
        '$contains' => 'LBL_OPERATOR_CONTAINS',
        '$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',
    );
    
    $viewdefs['base']['filter']['operators']['enum'] = array(
        '$in' => 'LBL_OPERATOR_CONTAINS',
        '$not_in' => 'LBL_OPERATOR_NOT_CONTAINS',
        '$empty' => 'LBL_OPERATOR_EMPTY',
        '$not_empty' => 'LBL_OPERATOR_NOT_EMPTY',
    );

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada