DaDaBIK logo

Blog

DaDaBIK 9.1 is out with a brand new row-level custom filter feature

Dear all,

DaDaBIK 9.0 Monterosso has been very well received, thanks for all the words of appreciation!

It's already time for a new version: v. 9.1 Monterosso is out today, you can buy your license here.

As usual, if you are in your free upgrade timeframe, you can request your free copy from the upgrade page. If you have a DaDaBIK ENTERPRISE/PLATINUM license and you are out of your free upgrade timeframe, you can also get DaDaBIK 9.1 by purchasing a maintenance license (€65 / €85).

Version 9.1 is mainly a maintenance release but there are also a few new features, in particular I want to introduce you one of them: row-level custom filters / permissions (available for DaDaBIK Enterprise/Platinum).

You are probably familiar with record ownership: in DaDaBIK you can, for example, set that a record can be read/deleted/modified only by the user (or group) who created it (the owner). This is very useful in many situations: for example in a sales management application, you want that each agent can only see the quotes they inserted. Sometimes, however, this is not enough.

Sometimes in fact you want the records to be filtered by some criteria which is not related to the ownership; take a helpdesk application, for example: let's say the help requests are inserted by some managers and each help request is then assigned by a manger to a member of the IT staff. You might need to filter the requests so that each member of the IT staff can only see the requests assigned to them.

With the new row-level custom filter, you can do that very easily by adding these few lines of code to your custom_functions.php file:
 


$custom_filters['requests'] = 'dadabik_custom_filter_requests';

function dadabik_custom_filter_requests()
{
global $current_user, $current_id_group, $quote;

if ($current_id_group == 3){ // apply the filter only for the IT staff group
    $filter = $quote."assigned_to_request".$quote." = '".$current_user."'";
}
else{
    $filter = "1=1";
}

return $filter;
}

With these few lines, we are saying that we define a custom filter for the table request and that the filter is generated by the custom function dadabik_custom_filter_requests(). Then we write such function, simply saying to add, if the current user is part of the IT staff group, an ADDITIONAL where clause, showing only the requests assigned to him/her (being assigned_to_request the field set by the IT manager).

Here are a few more use cases:



  • In a sales management application, agents can only see orders related to their geographic area

  • In the application for a Physiotherapy practice, each therapist can only view data records belonging to their patients

  • in a multi-schools application, each principal or manager can only view data for students belonging to their school



As you may guess, since you can create your own additional filter, this new feature is very flexible; you can create very simple filters such as :



$filter = $quote.'paid_invoice'.$quote.' = 0';


to show, for everybody, only the invoices where the field paid_invoice is 0 (in this case, the filter is basically an alternatie to a VIEW) or complex filters based on custom criteria / parameters, not necessarily related to the characteristics of the user logged.

I have uploaded a new video tutorial, belonging to the series "How to Create a Web Application with DaDaBIK", where I show more in details the use of the new row-level custom filter features

As usual, you can find the complete list of the fixed bugs and new features in the change log page. About the fixed bugs, in particular, please check the changelog entries related to custom functions and, if you have used the Dada sales app and you have changed something (even just added a new user/group), pay attention to the related change log entry for the security implications.

Enjoy! :)

Best,

Eugenio Tacchini
DaDaBIK founder