OSDN Git Service

[管理画面]: バグ #17 メルマガの配信内容設定で、本文未入力で確認ボタンを押すとエラーになる
authortmatsuzawa <tmatsuzawa@06daa6dd-5c14-464e-8a85-0d68c524be32>
Tue, 15 Dec 2009 12:44:54 +0000 (12:44 +0000)
committertmatsuzawa <tmatsuzawa@06daa6dd-5c14-464e-8a85-0d68c524be32>
Tue, 15 Dec 2009 12:44:54 +0000 (12:44 +0000)
[管理画面]: バグ #8 検索文字に特殊な文字を入れるとエラーになってしまう件に対応
[管理画面]: ロゴが旧ロゴだったので修正
[マスタ]: shopsマスタのymlを修正及びmigrateを追加

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/elecoma/trunk@3 06daa6dd-5c14-464e-8a85-0d68c524be32

README
app/controllers/admin/customers_controller.rb
app/controllers/admin/mail_magazines_controller.rb
app/models/customer.rb
app/models/customer_search_form.rb
app/models/mail_magazine.rb
app/views/admin/customers/search.html.erb
db/migrate/fixed_data/shops.yml
public/images/login_logo.png
public/images/logo.gif
public/stylesheets/admin.css

diff --git a/README b/README
index 84b1339..70fe9f3 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 ================================================================================
-   エレコマ(Elephant Commerce) version 1.0.0            http://ec.kbmj.com/     
+   エレコマ(Elephant Commerce) version 1.0.2            http://ec.kbmj.com/     
 ================================================================================
 
 エレコマのダウンロードありがとうございます。
@@ -130,8 +130,8 @@ $ sudo gem install postgres
 
 8. アプリケーションの展開
 # cd /usr/local
-# tar zxf (DOWNLOAD_PATH)/elecoma-1.0.0.tar.gz
-# mv elecoma-1.0.0 ec
+# tar zxf (DOWNLOAD_PATH)/elecoma-<version>.tar.gz
+# mv elecoma-<version> ec
 # chown -R ec:ec /usr/local/ec
 
 9. postgresqlのセットアップ
@@ -332,7 +332,7 @@ $ rake spec
 * エレコマ ライセンス
 ================================================================================
 本ソフトウェアはMIT Licenceを採用しています。
-ライセンスの詳細についてはCopyrightファイルを参照してください。
+ライセンスの詳細についてはCOPYRIGHTファイルを参照してください。
 
 配布物に含まれる「エレコマ」のロゴはクリエイティブ・コモンズノ表示-継承 2.1 
 日本ライセンスに従った範囲内でご利用いただけます。
index 8e22d0d..59b49ae 100644 (file)
@@ -17,8 +17,15 @@ class Admin::CustomersController < Admin::BaseController
       render :action => "index"
       return
     end
-    condition_sql = CustomerSearchForm.get_sql_select + CustomerSearchForm.get_sql_condition(@condition)
-    @customers = Customer.paginate_by_sql(condition_sql,
+    sql_condition, conditions = CustomerSearchForm.get_sql_condition(@condition)
+    sql = CustomerSearchForm.get_sql_select(true) + sql_condition
+    sqls = [sql]
+    conditions.each do |c|
+      sqls << c
+    end
+    #condition_sql = CustomerSearchForm.get_sql_select + CustomerSearchForm.get_sql_condition(@condition)
+    #@customers = Customer.paginate_by_sql(condition_sql,
+    @customers = Customer.paginate_by_sql(sqls,
                                           :page => params[:page],
                                           :per_page => @condition.search_par_page,
                                           :order => "id")
index ae1e30c..105f264 100644 (file)
@@ -27,12 +27,20 @@ class Admin::MailMagazinesController < Admin::BaseController
       return
     end
     session[:condition_save] = @condition
-    @customers = Customer.paginate_by_sql(MailMagazine.get_sql_select + MailMagazine.get_sql_condition(@condition),
+    sql_condition, conditions = MailMagazine.get_sql_condition(@condition)
+    sql = MailMagazine.get_sql_select + sql_condition
+    sqls = [sql]
+    conditions.each do |c|
+      sqls << c
+    end
+    #@customers = Customer.paginate_by_sql(MailMagazine.get_sql_select + MailMagazine.get_sql_condition(@condition),
+    @customers = Customer.paginate_by_sql(sqls,
       :page => params[:page],
       :per_page => @condition.search_par_page,
       :order => "id")
 
-    all_customers = Customer.find_by_sql(MailMagazine.get_sql_select + MailMagazine.get_sql_condition(@condition))
+    #all_customers = Customer.find_by_sql(MailMagazine.get_sql_select + MailMagazine.get_sql_condition(@condition))
+    all_customers = Customer.find_by_sql(sqls)
 
     @check_all = true
     customer_ids = []
@@ -142,7 +150,14 @@ class Admin::MailMagazinesController < Admin::BaseController
       redirect_to :ation => "index"
     end
     condition_data = MailMagazineCondition.new(@condition).to_yaml
-    @customers = Customer.find_by_sql(MailMagazine.get_sql_select + MailMagazine.get_sql_condition(@condition, except_list))
+    sql_condition, conditions = MailMagazine.get_sql_condition(@condition, except_list)
+    sql = MailMagazine.get_sql_select + sql_condition
+    sqls = [sql]
+    conditions.each do |c|
+      sqls << c
+    end
+    #@customers = Customer.find_by_sql(MailMagazine.get_sql_select + MailMagazine.get_sql_condition(@condition, except_list))
+    @customers = Customer.find_by_sql(sqls)
 
     @contents = MailMagazineContentsForm.new(params[:contents])
     mm = MailMagazine.new
index 00f4e5e..0237c5e 100644 (file)
@@ -301,6 +301,14 @@ class Customer < ActiveRecord::Base
   def full_name
     "#{family_name} #{first_name}"
   end
+  
+  def full_name_kana
+    "#{family_name_kana} #{first_name_kana}"
+  end
+
+  def tel_no
+    "#{tel01}-#{tel02}-#{tel03}"
+  end
 
   def self.get_symbols
     [
index f55ef43..d76d8d0 100644 (file)
@@ -29,7 +29,14 @@ class CustomerSearchForm < SearchForm
 \r
   def self.csv(params)\r
     @condition = self.new(params[:condition] ||= [])\r
-    customers = Customer.find_by_sql(get_sql_select(true) + get_sql_condition(@condition))\r
+    sql_condition, conditions = get_sql_condition(@condition)\r
+    sql = get_sql_select(true) + sql_condition\r
+    sqls = [sql]\r
+    conditions.each do |c|\r
+      sqls << c\r
+    end\r
+    #customers = Customer.find_by_sql(get_sql_select(true) + get_sql_condition(@condition))\r
+    customers = Customer.find_by_sql(sqls)\r
     unless customers.size > 0\r
       return false\r
     end\r
@@ -161,7 +168,8 @@ EOS
   end\r
 \r
   def self.get_sql_condition(condition)\r
-    <<-EOS\r
+    conditions = []\r
+    sql_condition = <<-EOS\r
 from\r
 customers c\r
 \r
@@ -204,10 +212,12 @@ order_details t
 where o.id=d.order_id\r
 and d.id=t.order_delivery_id\r
 #{if !condition.product_name.blank?\r
-    "and t.product_name like '%#{condition.product_name}%'"\r
+    conditions << "%#{condition.product_name}%"\r
+    "and t.product_name like ? "\r
   end}\r
 #{if !condition.product_code.blank?\r
-    "and t.product_code like '%#{condition.product_code}%'"\r
+    conditions << "%#{connection.product_code}%"\r
+    "and t.product_code like ? "\r
   end}\r
 #{if !condition.category_id.blank?\r
     "and t.product_category_id =#{condition.category_id}"\r
@@ -228,10 +238,12 @@ where
     "and c.prefecture_id = '#{condition.prefecture_id}'"\r
   end}\r
 #{unless condition.customer_name_kanji.blank?\r
-    "and (c.family_name || c.first_name) like '%#{condition.customer_name_kanji}%'"\r
+    conditions << "%#{condition.customer_name_kanji}%"\r
+    "and (c.family_name || c.first_name) like ? "\r
   end}\r
 #{unless condition.customer_name_kana.blank?\r
-    "and (c.family_name_kana || c.first_name_kana) like '%#{condition.customer_name_kana}%'"\r
+    conditions << "%#{condition.customer_name_kana}%"\r
+    "and (c.family_name_kana || c.first_name_kana) like ?"\r
   end}\r
 #{if condition.sex_male == "1" && condition.sex_female == "0"\r
     "and c.sex=1"\r
@@ -256,13 +268,15 @@ where
   end\r
 }\r
 #{unless condition.email.blank?\r
-    "and c.email like '%#{condition.email}%'"\r
+    conditions << "%#{condition.email}%"\r
+    "and c.email like ? "\r
   end}\r
 #{if condition.reachable == '1'\r
     "and c.reachable = '1'"\r
   end}  \r
 #{unless condition.tel_no.blank?\r
-    "and (c.tel01 || c.tel02 || c.tel03) like '%#{condition.tel_no}%'"\r
+    conditions << "%#{condition.tel_no}%"\r
+    "and (c.tel01 || c.tel02 || c.tel03) like ? "\r
   end}\r
 #{unless condition.occupation_id.blank?\r
     "and c.occupation_id in ('" << condition.occupation_id.join("','") << "')"\r
@@ -323,6 +337,7 @@ where
 }\r
 order by c.id\r
 EOS\r
+  return [sql_condition, conditions] \r
   end\r
 \r
 end\r
index 50d913b..7e16707 100644 (file)
@@ -25,7 +25,8 @@ EOS
   end
 
   def self.get_sql_condition(condition, except_list = [])
-    <<-EOS
+    conditions = []
+    sql_condition = <<-EOS
 from
 customers c
 
@@ -76,10 +77,12 @@ order_details t
 where o.id=d.order_id
 and d.id=t.order_delivery_id
 #{if !condition.product_name.blank?
-    "and t.product_name like '%#{condition.product_name}%'"
+    conditions << "%#{condition.product_name}%"
+    "and t.product_name like ? "
   end}
 #{if !condition.product_code.blank?
-    "and t.product_code like '%#{condition.product_code}%'"
+    conditions << "%#{condition.product_code}%"
+    "and t.product_code like ? "
   end}
 #{if !condition.category_id.blank?
     "and t.product_category_id =#{condition.category_id}"
@@ -114,10 +117,12 @@ and c.activate = 2
     "and c.prefecture_id = '#{condition.prefecture_id}'"
   end}
 #{unless condition.customer_name_kanji.blank?
-    "and (c.family_name || c.first_name) like '%#{condition.customer_name_kanji}%'"
+    conditions << "%#{condition.customer_name_kanji}%"
+    "and (c.family_name || c.first_name) like ? "
   end}
 #{unless condition.customer_name_kana.blank?
-    "and (c.family_name_kana || c.first_name_kana) like '%#{condition.customer_name_kana}%'"
+    condition << "%#{condition.customer_name_kana}%"
+    "and (c.family_name_kana || c.first_name_kana) like ? "
   end}
 #{if condition.sex_male == "1" && condition.sex_female == "0"
     "and c.sex=1"
@@ -142,10 +147,12 @@ and c.activate = 2
   end
 }
 #{unless condition.email.blank?
-    "and c.email like '%#{condition.email}%'"
+    conditions << "%#{condition.email}%"
+    "and c.email like ? "
   end}
 #{unless condition.tel_no.blank?
-    "and (c.tel01 || c.tel02 || c.tel03) like '%#{condition.tel_no}%'"
+    conditions << "%#{condition.tel_no}%"
+    "and (c.tel01 || c.tel02 || c.tel03) like ? "
   end}
 #{unless condition.occupation_id.blank?
     "and c.occupation_id in ('" << condition.occupation_id.join("','") << "')"
@@ -209,6 +216,7 @@ and c.activate = 2
 end}
 order by c.id
 EOS
+    return sql_condition, conditions
   end
 
 end
index f2ff794..6fc1586 100644 (file)
@@ -46,8 +46,8 @@
       <td rowspan="2"><%= Customer::ACTIVATE_NAMES[c.activate.to_i] %></td>\r
       <td><%= c.id %></td>\r
       <td rowspan="2">\r
-        <%= c.name_kanji %>/\r
-        <%= c.name_kana %>\r
+        <%= c.full_name %>/\r
+        <%= c.full_name_kana %>\r
       </td>\r
       <td rowspan="2"><%= System::SEX_NAMES[c.sex] %></td>\r
       <td><%= c.tel_no %></td>\r
index c4b5b02..2da0631 100644 (file)
@@ -22,3 +22,4 @@ load_by_shop_id_1:
     trade_item: 取扱商品
     introduction: 店舗案内
     prefecture_id: '13'
+    deleted_at: 
index d150e1b..4af2d2e 100644 (file)
Binary files a/public/images/login_logo.png and b/public/images/login_logo.png differ
index d0c41da..2c1baa0 100644 (file)
Binary files a/public/images/logo.gif and b/public/images/logo.gif differ
index 1640390..5af561d 100644 (file)
@@ -149,7 +149,7 @@ html>/**/body {
 }\r
 \r
 #header h1 {\r
-  width: 158px;\r
+  width: 169px;\r
   margin: 22px auto 0;\r
 }\r
 \r