Eileen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/246395

Change subject: CRM-17225 update report reset to cope with extra params on the 
url
......................................................................

CRM-17225 update report reset to cope with extra params on the url

BUG: T99837
Change-Id: Iae892d7f48d422d7f5bc3acad89d2298a7c1d7b7
---
M CRM/Core/BAO/Navigation.php
1 file changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/95/246395/1

diff --git a/CRM/Core/BAO/Navigation.php b/CRM/Core/BAO/Navigation.php
index de897ea..2ab0671 100644
--- a/CRM/Core/BAO/Navigation.php
+++ b/CRM/Core/BAO/Navigation.php
@@ -882,7 +882,7 @@
         "compid={$component_id}&reset=1", $reports_nav->id, $permission, 
$domain_id, TRUE);
       foreach ($component['reports'] as $report_id => $report) {
         // Create or update the report instance links.
-        $report_nav = self::createOrUpdateReportNavItem($report['title'], 
$report['url'], 'reset=1', $component_nav->id, $report['permission'], 
$domain_id);
+        $report_nav = self::createOrUpdateReportNavItem($report['title'], 
$report['url'], 'reset=1', $component_nav->id, $report['permission'], 
$domain_id, FALSE, TRUE);
         // Update the report instance to include the navigation id.
         $query = "UPDATE civicrm_report_instance SET navigation_id = %1 WHERE 
id = %2";
         $params = array(
@@ -924,6 +924,9 @@
   /**
    * Retrieve a navigation item using it's url.
    *
+   * Note that we use LIKE to permit a wildcard as the calling code likely 
doesn't
+   * care about output params appended.
+   *
    * @param string $url
    * @param array $url_params
    *
@@ -934,8 +937,9 @@
    */
   public static function getNavItemByUrl($url, $url_params, $parent_id = NULL) 
{
     $nav = new CRM_Core_BAO_Navigation();
-    $nav->url = "{$url}?{$url_params}";
     $nav->parent_id = $parent_id;
+    $nav->whereAdd("url LIKE '{$url}?{$url_params}'");
+
     if ($nav->find(TRUE)) {
       return $nav;
     }
@@ -1004,9 +1008,10 @@
    * @return \CRM_Core_DAO_Navigation
    */
   protected static function createOrUpdateReportNavItem($name, $url, 
$url_params, $parent_id, $permission,
-                                                        $domain_id, 
$onlyMatchParentID = FALSE) {
+                                                        $domain_id, 
$onlyMatchParentID = FALSE, $useWildcard = TRUE) {
     $id = NULL;
-    $existing_nav = CRM_Core_BAO_Navigation::getNavItemByUrl($url, 
$url_params, ($onlyMatchParentID ? $parent_id : NULL));
+    $existing_url_params = $useWildcard ? $url_params . '%' : $url_params;
+    $existing_nav = CRM_Core_BAO_Navigation::getNavItemByUrl($url, 
$existing_url_params, ($onlyMatchParentID ? $parent_id : NULL));
     if ($existing_nav) {
       $id = $existing_nav->id;
     }

-- 
To view, visit https://gerrit.wikimedia.org/r/246395
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae892d7f48d422d7f5bc3acad89d2298a7c1d7b7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: civi-4.6.9
Gerrit-Owner: Eileen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to