Operator function in SELECT tab

Applied your own function on a field (restored in KReporter 4.4)

In the following example we want to apply "this month, next year" to opportunity field Close date.

Create your custom function in custom/modules/KReports/KReportCustomFunction.php

global $kreportCustomFunctions;
$kreportCustomFunctions['thismonthnextyear'] =  'this month, next year';

    function thismonthnextyear($whereConditionRecord)
        global $current_user;

        $thismonth = date('m');
        $nextyear = date('Y')+1;
        $firstDay = $nextyear."-".$thismonth."-01";
        $lastDay = date("Y-m-t", strtotime($firstDay));
        return array(
            'operator' => 'between',
            'value' => '',
            'valuekey' => $firstDay." 00:00:00",
            'valueto' => '',
            'valuetokey' => $lastDay." 23:59:59",

In array $kreportCustomFunctions write function name and function description.

Then write your function. Add a check on function name or make sure your funciton name is unique.

That's it.

If you want to check possible operators have a look at modules/KReports/config/KReportWhereOperators.php

results matching ""

    No results matching ""