I had problems with printing my views with URL parameters (exposed filters).
D7 needs different passing of URL parameters. Please update this function.

function print_query_string_encode($query, $exclude = array(), $parent = '') {
  $params = array();

  foreach ($query as $key => $value) {
    if ($parent) {
      $key = $parent . '[' . $key . ']';
    }

    if (in_array($key, $exclude)) {
      continue;
    }

    if (is_array($value)) {
      $params[] = print_query_string_encode($value, $exclude, $key);
    }
    else {
      $params[$key] = rawurlencode($value);
    }
  }

  return $params;
}

Just modify 1 line to

      $params[$key] = rawurlencode($value);
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcnventura’s picture

Status: Active » Needs review
Simon Georges’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
FileSize
410 bytes

The according patch is attached (all credits go to jacerny).

nathanjo’s picture

Priority: Normal » Major

This patch should be made in the next dev release.
Same case and using this patch solve the query issue in views.

jcnventura’s picture

Status: Needs review » Fixed

Thanks everyone.. I've committed this to git.

Pentacor’s picture

Status: Active » Fixed

Have updated to latest dev module, the problem is still happening though. When having applied exposed filters to a view if I click 'email this page', the page emailed is not correctly filtered.

The filters I'm using are date form and to inputs to capture nodes between 2 dates. The first date is being captured in the querystring but the second date is not (see below for the url captured and what the url captured should be):

?field_date_value%5Bmin%5D%5Bdate%5D=2012-03-15&1[field_date_value%5Bmax%5D%5Bdate%5D]=2012-03-23

?field_date_value%5Bmin%5D%5Bdate%5D=2012-03-15&field_date_value%5Bmax%5D%5Bdate%5D=2012-03-23

As you can see only part of the querystring is being captured by the function, any ideas?

Thanks for help

Pentacor’s picture

Status: Fixed » Active
jcnventura’s picture

Do not cross-post.. I've little enough time to fix bugs as it is...

jcnventura’s picture

Status: Fixed » Active
oadaeh’s picture

Priority: Major » Normal
Status: Active » Needs review
FileSize
667 bytes

I'm not sure if this it the correct issue to post it, but it seems the closest to me.

I, too, had the problem as @Pentacor in #5, but the recommended fixes in this issue did not correct it. The attached patch fixes the problem for me. Hopefully, it doesn't cause other problems.

BTW, none of the recommended solutions were ever committed, as indicated in #4.

jcnventura’s picture

Status: Needs review » Fixed

#4 was indeed committed, I can see the commit result in your patch.. But it was indeed incomplete.

I've committed your patch to dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

JCL324’s picture

Apologies if there is already an issue for the 2.x-dev branch, but I am using 7.x-2.0-beta1+11-dev (2012-Jun-24) and it appears that these patches here have not been added. I will revert to the 1.x-dev version.

Update: I have reverted to (7.x-1.1+7-dev (2012-Jun-28)) and still have an issue with incorrect URLs. I completely deleted the 2.x-dev version, installed 1.x-dev, flushed caches and did a DB update (wasn't required). I verified that the above patch #9 was indeed in the print.module code.

My view page has 2 exposed filters:

View URL = /oos-records?field_municipality_tid%5B%5D=44&field_type_tid%5B%5D=1&field_type_tid%5B%5D=2
Print URL = /oos-records?field_municipality_tid&field_type_tid[1]=2

It seems to drop the value for the first filter and ignores the middle one. Can't the code just take the existing URL and inserting "print/" in front of it? When I do that manually, it works just fine.

jcnventura’s picture

Status: Closed (fixed) » Active

It works for you, but unfortunately not for PHP code..

jcnventura’s picture

Status: Active » Fixed
JCL324’s picture

Basically what I reported in #12 :-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.