Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. def close
  2. today = Date.today
  3. daily_closed_tickets = Fst.retrieve_closed_tickets(today)
  4. daily_closed_tickets.each do |ticket|
  5. CSV.open("/var/www/heatfst/public/#{ticket.attributes['WfWorkUnitID']}.txt", "w+", {force_quotes: false}) do |csv|
  6. if (ticket.attributes['ClosedDate'].present?)
  7. csv << ["Closed FST Ticket|Commercial|#{ticket.attributes['ReservationNumber']}|#{ticket.attributes['Address']}|#{ticket.attributes['Customer Name']}|#{ticket.attributes['ServiceOrderNumber']}|#{ticket.attributes['TroubleTicketNumber']}|#{ticket.attributes['City']}|#{ticket.attributes['State']}|#{ticket.attributes['ReservationTime']}|#{ticket.attributes['Job Code']}|#{ticket.attributes['TechID']}|#{ticket.attributes['Technician']}|#{ticket.attributes['Created By']}|#{ticket.attributes['ReservationCreateDate']}|#{ticket.attributes['wfWORKGROUP_Id']}|#{ticket.attributes['Account_Id']}|#{ticket.attributes['ReportedTrouble']}|#{ticket.attributes['FoundCode']}|#{ticket.attributes['CauseCode']}"]
  8. Dir.glob("/var/www/heatfst/public/*.txt").each do |txt_file|
  9. newFile = txt_file.split("/").last
  10. if (File.size("/var/www/heatfst/public/#{newFile}") != 0 && (!File.exist?("/mnt/nfs/vporldfl-frapp1/#{newFile}")))
  11. FileUtils.cp_r("/var/www/heatfst/public/#{newFile}", '/mnt/nfs/vporldfl-frapp1')
  12. end
  13. end
  14. end
  15. end
  16. end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement