diff --git a/apply/appjd.rb b/apply/appjd.rb index ddfba6e..3366f7c 100755 --- a/apply/appjd.rb +++ b/apply/appjd.rb @@ -71,8 +71,8 @@ exit 0 end -email = c["email"].read -name = c["pname"].read +email = c["email"].read.gsub("'", "").gsub('"', "").gsub(/\s/, "") +name = c["pname"].read.strip from = "" sj = NKF.nkf('-jM', "申請書").strip @@ -136,9 +136,17 @@ EOF # Create csv db.close - system(<<~EOF) - sqlite3 -header -csv #{dbf} "SELECT * FROM applicants" > #{csv} + email.gsub("'", "") + if false then + CSV.open(csv, "w", force_quotes: true) do |c| + c << keys + c << addition + end + else + system(<<~EOF) + sqlite3 -header -csv #{dbf} "SELECT * FROM applicants WHERE email='#{email}'" > #{csv} EOF + end end end # Send to admin