CRM-13685 - "Manage Extensions" - Fix upgrade check
authorTim Otten <totten@civicrm.org>
Thu, 31 Oct 2013 00:11:10 +0000 (17:11 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 31 Oct 2013 00:11:10 +0000 (17:11 -0700)
----------------------------------------
* CRM-13685: "Manage Extension" screen should use "<" to determine upgradeability
  http://issues.civicrm.org/jira/browse/CRM-13685

CRM/Admin/Page/Extensions.php
templates/CRM/Admin/Page/Extensions/Main.tpl

index a6bc3528c0728851db5d3511f4c1be14c393eb43..d92c504e37579b7e54557a8a7c13bb5a67482155 100644 (file)
@@ -217,6 +217,11 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
           'key' => $row['key'],
         )
       );
+      if (isset($localExtensionRows[$info->key])) {
+        if (version_compare($localExtensionRows[$info->key]['version'], $info->version, '<')) {
+          $row['is_upgradeable'] = TRUE;
+        }
+      }
       $remoteExtensionRows[$row['id']] = $row;
     }
     $this->assign('remoteExtensionRows', $remoteExtensionRows);
index dea6ea4dfee7c854b53a554cc303318e3fd58780..d9c8a8331fb7d7f85cc7f6a692def6d44098adce 100644 (file)
@@ -22,7 +22,7 @@ Depends: CRM/common/enableDisable.tpl and CRM/common/jsortable.tpl
         <tr id="row_{$row.id}" class="crm-extensions crm-extensions_{$row.id}{if $row.status eq 'disabled'} disabled{/if}{if $row.status eq 'installed-missing' or $row.status eq 'disabled-missing'} extension-missing{/if}{if $row.upgradable} extension-upgradable{elseif $row.status eq 'installed'} extension-installed{/if}">
           <td class="crm-extensions-label">
               <a class="collapsed" href="#"></a>&nbsp;<strong>{$row.label}</strong><br/>({$row.key})
-              {if $extAddNewEnabled && $remoteExtensionRows[$extKey] && $row.version != $remoteExtensionRows[$extKey].version}
+              {if $extAddNewEnabled && $remoteExtensionRows[$extKey] && $remoteExtensionRows[$extKey].is_upgradeable}
                 {capture assign='upgradeURL'}{crmURL p='civicrm/admin/extensions' q="action=update&id=$extKey&key=$extKey"}{/capture}
                 <div class="crm-extensions-upgrade">{ts 1=$upgradeURL}Version {$remoteExtensionRows[$extKey].version} is available. <a href="%1">Upgrade</a>{/ts}</div>
               {/if}