From: Steve Sutton Date: Tue, 14 Jun 2016 19:47:35 +0000 (-0400) Subject: Updates for grouped Amenities X-Git-Tag: v2.1^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a542d397086c07aa50564032eb661db295e89dec;p=WP-Plugins%2Fglm-member-db.git Updates for grouped Amenities Fix for the delete of groups. fix the edit amenity and add amenity pages when there are no groups --- diff --git a/models/admin/settings/amenities.php b/models/admin/settings/amenities.php index fd2532f5..48a306d5 100644 --- a/models/admin/settings/amenities.php +++ b/models/admin/settings/amenities.php @@ -147,8 +147,6 @@ class GlmMembersAdmin_settings_amenities extends GlmDataAmenities if ( $id > 0 ) { $this->updateEntry( $id ); } - //echo '
$id: ' . print_r($id, true) . '
'; - //echo '
$_REQUEST: ' . print_r($_REQUEST, true) . '
'; // Delete the current entries for the grouped amenities $this->wpdb->delete( GLM_MEMBERS_PLUGIN_DB_PREFIX . 'grouped_amenities', @@ -194,7 +192,14 @@ class GlmMembersAdmin_settings_amenities extends GlmDataAmenities case 'deleteGroup': if ( $id > 0 ) { - $groupData->deleteEntry( $id ); + $groupData->deleteEntry( $id, true ); + + // Delete the current entries for the grouped amenities + $this->wpdb->delete( + GLM_MEMBERS_PLUGIN_DB_PREFIX . 'grouped_amenities', + array( 'group_id' => $id ), + array( '%d' ) + ); } break; diff --git a/views/admin/settings/amenities.html b/views/admin/settings/amenities.html index 0ab54a1d..397e09c6 100644 --- a/views/admin/settings/amenities.html +++ b/views/admin/settings/amenities.html @@ -44,24 +44,26 @@ Groups - {foreach $groups as $group} - - - - - - - - - {/foreach} + {if $haveGroups} + {foreach $groups as $group} + + + + + + + + + {/foreach} + {/if} @@ -119,24 +121,26 @@ Groups - {foreach $groups as $group} - - - - - - - - - {/foreach} + {if $haveGroups} + {foreach $groups as $group} + + + + + + + + + {/foreach} + {/if} @@ -422,14 +426,14 @@ $("#newGroupDialog").dialog("close"); }); - var id = false; + var group_id = false; $('.deleteGroupButton').click( function() { - id = $(this).attr('data-groupID'); + group_id = $(this).attr('data-groupID'); $("#deleteGroupDialog").dialog("open"); }); $('#deleteGroupConfirm').click( function() { $("#deleteGroupDialog").dialog("close"); - window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=amenities&option=deleteGroup&id=" + id + "&option2=group"; + window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=amenities&option=deleteGroup&id=" + group_id + "&option2=group"; }); $('#deleteGroupCancel').click( function() { $("#deleteGroupDialog").dialog("close");