CRM-15103 fix - Priceset for memberships on contribution-page not working
authormonishdeb <monish.deb@webaccessglobal.com>
Tue, 2 Sep 2014 07:39:09 +0000 (13:09 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Tue, 2 Sep 2014 07:39:09 +0000 (13:09 +0530)
https://issues.civicrm.org/jira/browse/CRM-15103

CRM/Contribute/Form/Contribution/Main.php
CRM/Price/Page/Field.php
templates/CRM/Price/Page/Field.tpl

index c6a13d20749c4db538338be617646ca294a1118a..3c2ee8fecd7eee36f5da4cfed225e3de79f29ab2 100644 (file)
@@ -842,7 +842,11 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
               $priceFieldIDS[] = $fields['price_' . $priceId];
             }
 
-            if (CRM_Utils_Array::value('options', $value)) {
+            if (CRM_Utils_Array::value('options', $value)  && (
+                ($fields['price_' . $priceId] == $val['id']) ||
+                (isset($fields['price_' . $priceId]) && !empty($fields['price_' . $priceId][$val['id']]))
+              )
+            ) {
               foreach ($value['options'] as $val) {
                 if (CRM_Utils_Array::value('membership_type_id', $val)) {
                   $priceFieldMemTypes[] = $val['membership_type_id'];
index 9c0f6aa4f54f34b06cc9130b971878d2ae54b59e..dae7188aae0fb50d5901b2a475ee3e3547669474 100644 (file)
@@ -170,7 +170,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page {
 
       // need to translate html types from the db
       $htmlTypes = CRM_Price_BAO_PriceField::htmlTypes();
-      $priceField[$priceFieldBAO->id]['html_type'] = $htmlTypes[$priceField[$priceFieldBAO->id]['html_type']];
+      $priceField[$priceFieldBAO->id]['html_type_display'] = $htmlTypes[$priceField[$priceFieldBAO->id]['html_type']];
       $priceField[$priceFieldBAO->id]['order'] = $priceField[$priceFieldBAO->id]['weight'];
       $priceField[$priceFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action,
         array(
index e84f34e9e12792a10a68bab8b93b7c84f45cbab5..d5ec72cefa165d03c6c86e35d269143c3dd5280d 100644 (file)
         {foreach from=$priceField key=fid item=row}
       <tr id="row_{$row.id}"class="{cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
             <td>{$row.label}</td>
-            <td>{$row.html_type}</td>
+            <td>{$row.html_type_display}</td>
             <td class="nowrap">{$row.order}</td>
             <td>{if $row.is_required eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
             <td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
             <td>{if $row.active_on}{$row.active_on|date_format:"%Y-%m-%d %T"}{/if}</td>
             <td>{if $row.expire_on}{$row.expire_on|date_format:"%Y-%m-%d %T"}{/if}</td>
-            <td>{if $row.html_type eq "Text / Numeric Quantity"}{$row.price|crmMoney}{else}<a href="{crmURL p="civicrm/admin/price/field/option" q="action=browse&reset=1&sid=$sid&fid=$fid"}">{if $isReserved}{ts}View Price Options{/ts}{else}{ts}Edit Price Options{/ts}{/if}</a>{/if}</td>
+            <td>{if $row.html_type eq "Text"}{$row.price|crmMoney}{else}<a href="{crmURL p="civicrm/admin/price/field/option" q="action=browse&reset=1&sid=$sid&fid=$fid"}">{if $isReserved}{ts}View Price Options{/ts}{else}{ts}Edit Price Options{/ts}{/if}</a>{/if}</td>
             <td class="field-action">{$row.action|replace:'xx':$row.id}</td>
             <td class="order hiddenElement">{$row.weight}</td>
         </tr>