change tax profile structure
This commit is contained in:
@@ -76,9 +76,15 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
# DELETE /settings/tax_profiles/1
|
||||
# DELETE /settings/tax_profiles/1.json
|
||||
def destroy
|
||||
@settings_tax_profile.destroy
|
||||
flash[:notice] = 'Tax profile was successfully destroyed.'
|
||||
render :json => {:status=> "Success", :url => settings_tax_profiles_url }.to_json
|
||||
customers = Customer.where("tax_profiles LIKE '%#{@settings_tax_profile.id}%'")
|
||||
if customers.nil? || customers.empty?
|
||||
@settings_tax_profile.destroy
|
||||
flash[:notice] = 'Tax profile was successfully destroyed.'
|
||||
render :json => {:status=> "Success", :url => settings_tax_profiles_url }.to_json
|
||||
else
|
||||
flash[:error] = 'Tax profile could not destroy! This record is using in somewhere.'
|
||||
render :json => {:status=> "Error", :url => settings_tax_profiles_url }.to_json
|
||||
end
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to settings_tax_profiles_url, notice: 'Tax profile was successfully destroyed.' }
|
||||
# format.json { head :no_content }
|
||||
|
||||
Reference in New Issue
Block a user