Filter list view records, not applied to Select All->Export

Hello

I have a question here, and it is that in the Contact List View, I have modified the custom/Contacts/views/view.list.php file so the records shown in the list view, are for some users, only the ones that matches a condition.

To do so we have added some code to the $sql variable that produces the list

// Obtenemos el id de la Delegaci�n del usuario
$delegacion_name = ToolsDelegacion::devolverDelegacion($GLOBALS['current_user']->id);
$this->where .= " (oms2_delegaciones_contacts_1_name='".$delegacion_name."') ";
$this->lv->setup($this->seed, $tplFile, $this->where, $this->params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
echo $this->lv->display();

this works fine, and the list produced only shows records matching the condition. However the problem comes when the user clicks in the list view in the option "Select All",and then exports the records to CVS file. In the CVS file there is not only the records shown in the screen but all the Contacts in the system.

How can we do so the filter applied to the List View is also appliced to the Exported records when you click in the "Select All" ?.

Thanks a lot