Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ad_insertion[:rundate_insert] == nil or ad_insertion[:rundate_insert] then
- # if ad_insertion[:rundate_insert] != false && !ad_insertion[:kill_all]
- if ad_insertion[:location].nil?
- existing_rundate = AutomatorAdRundate.find(:first, :conditions=>["UPPER(ad_num)=? and rundate=? and UPPER(pub_code)=?", ad_insertion[:ad_num].upcase, Date.strptime(ad_insertion[:rundate], '%m/%d/%Y'), ad_insertion[:pubcode].upcase])
- else
- existing_rundate = AutomatorAdRundate.find(:first, :conditions=>["UPPER(ad_num)=? and rundate=? and UPPER(pub_code)=? and UPPER(location)=?", ad_insertion[:ad_num].upcase, Date.strptime(ad_insertion[:rundate], '%m/%d/%Y'), ad_insertion[:pubcode].upcase, ad_insertion[:location].upcase])
- end
- if existing_rundate == nil then
- new_rundate = AutomatorAdRundate.new
- new_rundate.ad_num = ad_insertion[:ad_num].upcase
- new_rundate.pub_code = ad_insertion[:pubcode].upcase
- new_rundate.rundate = Date.strptime(ad_insertion[:rundate], '%m/%d/%Y')
- new_rundate.created_at = Time.now
- new_rundate.status = ad_status
- new_rundate.location = ad_insertion[:location].nil? ? "" : ad_insertion[:location].upcase
- new_rundate.desired_section = ad_insertion[:section]
- if export_to_suite?
- new_rundate.other = ad_insertion[:other]
- end
- new_rundate.save
- else
- existing_rundate.updated_at = Time.now if ad_insertion[:killed]
- if ad_insertion[:killed] then
- existing_rundate.status = ad_status
- end
- existing_rundate.save
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement