Skip to content

Commit

Permalink
searching errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ishmael committed Aug 2, 2010
1 parent a6f350a commit 0610912
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
21 changes: 4 additions & 17 deletions app/models/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ def conditions
return nil if options.empty?

if not start_date.empty?
#conditions << "#{@model.table_name}.movdate >= to_date(?,'YYYY-MM-DD')"
conditions << "#{@model.table_name}.movdate >= ?"
conditions << "#{@model.table_name}.movdate >= to_date(?,'DD-MM-YYYY')"
#conditions << "#{@model.table_name}.movdate >= ?"
parameters << start_date
end

if not end_date.empty?
#conditions << "#{@model.table_name}.movdate <= to_date(?,'YYYY-MM-DD')"
conditions << "#{@model.table_name}.movdate <= ?"
conditions << "#{@model.table_name}.movdate <= to_date(?,'DD-MM-YYYY')"
#conditions << "#{@model.table_name}.movdate <= ?"
parameters << end_date
end

Expand Down Expand Up @@ -103,17 +103,4 @@ def conditions
nil
end
end

private

# Just like the one in the Report model, but just for dates instead of times.
# Using a Proc to generate input parameter names like those for date_select.
def date_from_options(which)
part = Proc.new { |n| options["#{which}(#{n}i)"] }
y,m,d = part[1], part[2], part[3]
y = Date.today.year if y.blank?
Date.new(y.to_i, m.to_i, d.to_i)
rescue ArgumentError => e
return nil
end
end
8 changes: 4 additions & 4 deletions public/javascripts/bankaccount_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@
outTxt = YAHOO.util.Dom.get("search_end_date"),
inDate, outDate, interval,
mov_type = YAHOO.util.Dom.get("search_type_mov_hidden");
/*inTxt.value = "";
outTxt.value = "";*/
inTxt.value = "";
outTxt.value = "";

var cal = new YAHOO.example.calendar.IntervalCalendar("calSearchContainer", {pages:1,navigator:true,MDY_MONTH_POSITION:2,MDY_DAY_POSITION:1,MDY_YEAR_POSITION:3});
// cal.cfg.setProperty("DATE_FIELD_DELIMITER", ".");
Expand Down Expand Up @@ -342,8 +342,8 @@
}
}, cal, true);
//alert( Date.parseExact(outTxt.value,"d/M/yyyy"));
if( inTxt.value != '' && outTxt.value != '')
cal.setInterval( Date.parseExact(inTxt.value,"d/M/yyyy"),Date.parseExact(outTxt.value,"d/M/yyyy"));
//if( inTxt.value != '' && outTxt.value != '')
//cal.setInterval( Date.parseExact(inTxt.value,"d/M/yyyy"),Date.parseExact(outTxt.value,"d/M/yyyy"));
cal.render();

});
Expand Down

0 comments on commit 0610912

Please sign in to comment.