From 0980923cc7175fc81f05c6ae924116b5a94a7836 Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 13 Jun 2019 13:03:41 +0630 Subject: [PATCH] sync lookup type --- .../reports/receipt_no_controller.rb | 3 ++- app/models/lookup.rb | 5 +++++ config/initializers/action_controller.rb | 10 ++++----- config/puma.rb | 20 +++++++++--------- dump.rdb | Bin 1214650 -> 1214649 bytes 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index 7536599d..b016b08d 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -74,7 +74,8 @@ authorize_resource :class => false @orders, @order_items, @sales, @sale_items, @sale_taxes, @sale_payments, @sale_orders, @sale_audits, @shift_sales = Booking.get_sync_data(params[:sale_id]) # Here comes to call the sync api - url = "http://192.168.1.176:3000/en/api/sync_data" + # url = "http://192.168.1.176:3000/en/api/sync_data" + url = Lookup.sync_url begin @result = HTTParty.post(url.to_str, diff --git a/app/models/lookup.rb b/app/models/lookup.rb index 989f9d08..edc15fdc 100755 --- a/app/models/lookup.rb +++ b/app/models/lookup.rb @@ -21,6 +21,11 @@ class Lookup < ApplicationRecord # Lookup.select("value, name").where("lookup_type = ?", lookup_type ).order("name asc").map { |r| [r.name, r.value] } # end + def self.sync_url + lookup = Lookup.find_by_lookup_type('sync_data') + return lookup.value + end + def self.collection_of(type) Lookup.select("name, value").where("lookup_type" => type ).map { |l| [l.name, l.value] } diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 85f38ec5..205c330a 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -21,11 +21,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 6a545bed..fd89392f 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/dump.rdb b/dump.rdb index 7ba8a0b2740b58891f1a5078373dfb53b29619e5..55cbda5a05f7ca99e0341267da4bc7d2acce6a7d 100644 GIT binary patch delta 177 zcmdlr(QD^KuL*`iId2(be{qx+r>5xUrsf`+aoDxdxz(Am)tRZ)nYq=OrPZ0W)tRl; znZ4DSqt%(S)tRf+nY-1Qr`4Ia)tRr=nZMOppw(G$tFsVmD|2jc$8_&jp|5g+hNfl) zCI;pv21a`3CKe_ZW-Lji#gzvb{%p!Qcw_p*79r{FRc%7jjI4iL{<2P(exOZAa{A_W bp(ZH*W4n;l^pFmrIF7TAHeYmCO^g8mieNyS delta 178 zcmdlv(QDU4uL*`iLa!NPe{qx+r>5xUrsf{9cde&Y%-rhC((26G>de;a z%--tE(dx|E>de*Z%-!nD)9TFI>de>b%-`xP(CRF>)mezOmHC`l{dDhEp|A2nhNfl) zCI)8amgagUMuwIK2Bs`YrNxy882)U^Ie26G!xkaw?Uijp(u}OR9A8)`OyA!oBsqOk cyHFF9|Djz-YI<;oP#nj~wR