Mass action filters not displaying correct.

  • Posts: 50
  • Thank you received: 1
10 years 7 months ago #123726

Hi.

I am performing tests on the mass action and get some strange results. I want to do mass actions on registred users from Sweden. So I start to make a filter, then have the action trigger just display the results.

I have 10 registred user on my test site.

This is how I set it up:




Actions are set to display results. Like this:



Result displays:




With filter settings set to contain "Sweden" only 1 results get shown.



Results in this display:




With filter settings set to LIKE "foo" I get 10 results again.




And the display shows again all registred users. Like this:




Strange. Am I doing something wrong? Bug?

The mass action is a great feature and I have lots of use for it when getting it to work.


Regards

/MAthias

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #123815

Hi,

Thanks for the report, there were a problem.

The code to replace is the function onProcessUserMassFilteraddressColumn() in the plugin "massaction_user".

Replace it by:

	function onProcessUserMassFilteraddressColumn(&$elements,&$query,$filter,$num){
		if(empty($filter['type']) || $filter['type']=='all') return;
		if(!isset($this->massaction))$this->massaction = hikashop_get('class.massaction');
		$db = JFactory::getDBO();

		if(in_array($filter['type'],array('address_state','address_country'))){
			$db->setQuery('SELECT zone_namekey FROM '.hikashop_table('zone').' WHERE zone_name LIKE '.$db->quote($filter['value']).' OR zone_name_english LIKE '.$db->quote($filter['value']));
			$filter['value'] = $db->loadResult();
		}
		if(count($elements)){
			foreach($elements as $k => $element){
				$db->setQuery('SELECT * FROM '.hikashop_table('address').' WHERE address_user_id = '.(int)$element->user_id.' GROUP BY address_id');
				$results = $db->loadObjectList();
				$del = true;
				foreach($results as $result){
					$in = $this->massaction->checkInElement($result, $filter);
					if($in) $del = false;
				}
				if($del) unset($elements[$k]);
			}
		}else{
			if(!is_null($filter['value']) || (is_null($filter['value']) && in_array($filter['operator'],array('IS NULL','IS NOT NULL')))){
				$query->select = ' DISTINCT '.$query->select;
				$query->leftjoin[] = hikashop_table('address').' as hk_address ON hk_address.address_user_id = hk_user.user_id';
				$query->where[] = $this->massaction->getRequest($filter,'hk_address');
			}else{
				$query->leftjoin = '';
				$query->where = array('false');
			}
		 }
	}

The following user(s) said Thank You: matback

Please Log in or Create an account to join the conversation.

Time to create page: 0.107 seconds
Powered by Kunena Forum