From 672eaafc4201839ca8ee3566d9b34c40c89dc36a Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Thu, 9 May 2019 18:08:25 +0630 Subject: [PATCH] when delete item options to update in menu items --- 10 | 0 Can't open membership server } | 0 .../settings/menu_item_options_controller.rb | 20 ++++++++++++++++++- .../settings/simple_menu_items_controller.rb | 1 - config/initializers/action_controller.rb | 10 +++++----- config/puma.rb | 20 +++++++++---------- db/seeds.rb | 8 ++++---- false, | 0 member_params, | 0 { | 0 10 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 10 create mode 100644 Can't open membership server } create mode 100644 false, create mode 100644 member_params, create mode 100644 { diff --git a/10 b/10 new file mode 100644 index 00000000..e69de29b diff --git a/Can't open membership server } b/Can't open membership server } new file mode 100644 index 00000000..e69de29b diff --git a/app/controllers/settings/menu_item_options_controller.rb b/app/controllers/settings/menu_item_options_controller.rb index 00791e5d..339039bf 100755 --- a/app/controllers/settings/menu_item_options_controller.rb +++ b/app/controllers/settings/menu_item_options_controller.rb @@ -55,7 +55,25 @@ class Settings::MenuItemOptionsController < ApplicationController # DELETE /settings/menu_item_options/1 # DELETE /settings/menu_item_options/1.json def destroy - @settings_menu_item_option.destroy + item_option_id =@settings_menu_item_option.id + item_option_id_string=""+item_option_id.to_s+"" + if @settings_menu_item_option.destroy + menu_items =MenuItem.all + menu_items.each do |item| + if item.item_options.include?(item_option_id) + item_update =item.item_options.reject { |i| i == item_option_id } + item.item_code =item.item_code + item.item_options =item_update + item.save + end + if item.item_options.include?(item_option_id_string) + item_update =item.item_options.reject { |i| i == item_option_id_string } + item.item_code =item.item_code + item.item_options =item_update + item.save + end + end + end flash[:notice] = 'Menu item option was successfully destroyed.' render :json => {:status=> "Success", :url => settings_menu_item_options_path }.to_json # respond_to do |format| diff --git a/app/controllers/settings/simple_menu_items_controller.rb b/app/controllers/settings/simple_menu_items_controller.rb index df70f61e..cd1c4507 100755 --- a/app/controllers/settings/simple_menu_items_controller.rb +++ b/app/controllers/settings/simple_menu_items_controller.rb @@ -109,7 +109,6 @@ class Settings::SimpleMenuItemsController < ApplicationController @settings_menu_item.item_sets = sets end end - @settings_menu_item.menu_category_id = params[:menu_category_id] respond_to do |format| diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 5abb412e..7a123a02 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -20,11 +20,11 @@ class ActionController::Base end else # check for license file - if check_license - current_license(ENV["SX_PROVISION_URL"]) - else - redirect_to activate_path - end + # if check_license + # current_license(ENV["SX_PROVISION_URL"]) + # else + # redirect_to activate_path + # end end end diff --git a/config/puma.rb b/config/puma.rb index fd89392f..6a545bed 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,10 +1,10 @@ -application_path="#{File.expand_path("../..", __FILE__)}" -directory application_path -#environment ENV.fetch("RAILS_ENV") { "production" } -environment "production" -pidfile "#{application_path}/tmp/puma/pid" -state_path "#{application_path}/tmp/puma/state" -stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" -port ENV.fetch("PORT") { 62158 } -workers 2 -preload_app! +# application_path="#{File.expand_path("../..", __FILE__)}" +# directory application_path +# #environment ENV.fetch("RAILS_ENV") { "production" } +# environment "production" +# pidfile "#{application_path}/tmp/puma/pid" +# state_path "#{application_path}/tmp/puma/state" +# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" +# port ENV.fetch("PORT") { 62158 } +# workers 2 +# preload_app! diff --git a/db/seeds.rb b/db/seeds.rb index a2307479..9d498c2e 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -209,19 +209,19 @@ queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf zone = Zone.create({id:1, name: "H1", is_active:true, created_by: "SYSTEM DEFAULT"}) -member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://192.168.1.82:3001",merchant_account_id:"NskNY4j3YxEg6h1Fm9AE"}) +member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "https://staging.membership.paymal.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}) member_actions= MembershipAction.create([{membership_type:"get_account_balance",is_active:1,gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, {membership_type:"redeem",is_active:1,gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, - {membership_type:"create_membership_customer",is_active:1,gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"NskNY4j3YxEg6h1Fm9AE",auth_token:"rj0MJ0XI5GsKZehE"}, - {membership_type:"update_membership_customer",is_active:1,gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"NskNY4j3YxEg6h1Fm9AE",auth_token:"rj0MJ0XI5GsKZehE"}, + {membership_type:"create_membership_customer",is_active:1,gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, + {membership_type:"update_membership_customer",is_active:1,gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, {membership_type:"get_all_member_group",is_active:1,gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, {membership_type:"rebate",is_active:1,gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, {membership_type:"get_all_member_account",is_active:1,gateway_url:"/api/generic_customer/get_member_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, {membership_type:"get_member_transactions",is_active:1,gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, {membership_type:"member_discount",is_active:1,gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, {membership_type:"get_member_campaign",is_active:1,gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"}, - {membership_type:"search_paypar_account_no",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"NskNY4j3YxEg6h1Fm9AE",auth_token:"rj0MJ0XI5GsKZehE"} + {membership_type:"search_paypar_account_no",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G"} ]) payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://membership.paypar.ws"}) diff --git a/false, b/false, new file mode 100644 index 00000000..e69de29b diff --git a/member_params, b/member_params, new file mode 100644 index 00000000..e69de29b diff --git a/{ b/{ new file mode 100644 index 00000000..e69de29b