Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def close
- today = Date.today
- daily_closed_tickets = Fst.retrieve_closed_tickets(today)
- daily_closed_tickets.each do |ticket|
- CSV.open("/var/www/heatfst/public/#{ticket.attributes['WfWorkUnitID']}.txt", "w+", {force_quotes: false}) do |csv|
- if (ticket.attributes['ClosedDate'].present?)
- 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']}"]
- Dir.glob("/var/www/heatfst/public/*.txt").each do |txt_file|
- newFile = txt_file.split("/").last
- if (File.size("/var/www/heatfst/public/#{newFile}") != 0 && (!File.exist?("/mnt/nfs/vporldfl-frapp1/#{newFile}")))
- FileUtils.cp_r("/var/www/heatfst/public/#{newFile}", '/mnt/nfs/vporldfl-frapp1')
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement