From 49ba04d27242e500ab905821f20fe23445d3396d Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Wed, 9 Jan 2008 14:02:15 -0600 Subject: [PATCH] Calendar (js) tweaks: histsearch fixed, viewlog template updated Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- acqui/histsearch.pl | 29 +++-- .../prog/en/includes/calendar.inc | 19 ++++ .../prog/en/modules/acqui/histsearch.tmpl | 100 ++++++------------ .../prog/en/modules/tools/viewlog.tmpl | 40 ++----- 4 files changed, 85 insertions(+), 103 deletions(-) diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index 08e3f842ad..4fd12b69c2 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -53,14 +53,21 @@ use CGI; use C4::Auth; # get_template_and_user use C4::Output; use C4::Acquisition; -use C4::Dates qw(format_date_in_iso); +use C4::Dates; + +use vars qw($debug); + +BEGIN { + $debug = $ENV{DEBUG} || 0; +} my $input = new CGI; -my $title = $input->param('title'); +$debug or $debug = $input->param('debug') || 0; +my $title = $input->param( 'title'); my $author = $input->param('author'); -my $name = $input->param('name'); -my $from_placed_on = $input->param('fromplacedon'); -my $to_placed_on = format_date_in_iso($input->param('toplacedon')); +my $name = $input->param( 'name' ); +my $from_placed_on = C4::Dates->new($input->param('from')); +my $to_placed_on = C4::Dates->new($input->param( 'to')); my $dbh = C4::Context->dbh; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -74,8 +81,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); +my $from_iso = ($from_placed_on->output('iso') || 0); +my $to_iso = ( $to_placed_on->output('iso') || 0); my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = - &GetHistory( $title, $author, $name, $from_placed_on, $to_placed_on ); + &GetHistory( $title, $author, $name, $from_iso, $to_iso ); $template->param( suggestions_loop => $order_loop, @@ -86,9 +95,11 @@ $template->param( title => $title, author => $author, name => $name, - from_placed_on => $from_placed_on, - to_placed_on => $to_placed_on, - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + from_placed_on => $from_placed_on->output('syspref'), + to_placed_on => $to_placed_on->output('syspref'), + DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(), + dateformat => C4::Dates->new()->format(), + debug => $debug, ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index 18fe1e41ea..3515027bf9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -23,5 +23,24 @@ function Date_from_syspref(dstring) { return 0; } } + +function get_Calendar_limit (date,did) { + // this function could be moved to a static calendar-extras.js file + var dvalue = document.getElementById(did).value; + if (dvalue == "") { return false; } + var limitDate = Date_from_syspref(dvalue); + if (debug && debug > 5) { + var month = date.getMonth() + 1; + var dateString = date.getFullYear() + '-' + month + '-' + date.getDate(); + alert("Comparing incoming (" + dateString + ") vs " + + "'" + did + "' limit\n" + + "\n thisdate: " + date + + "\nlimitdate: " + limitDate + + "\nlimit > thisdate : " + (limitDate > date) + + "\nlimit < thisdate : " + (limitDate < date) + ); + } + return limitDate; +} //]]> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl index d68cd4ae33..b6baacffd7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tmpl @@ -19,71 +19,41 @@
Search Orders -
    -
  1. " />
  2. -
  3. " />
  4. -
  5. " />
  6. -
  7. - " /> /lib/calendar/cal.gif" border="0" id="openCalendarFrom" style="cursor: pointer;" alt="Show Calendar" /> -
  8. -
  9. - " type="text" /> /lib/calendar/cal.gif" id="openCalendarTo" style="cursor: pointer;" alt="Show Calendar" /> -
  10. -
-
-
-
+
    +
  1. " />
  2. +
  3. " />
  4. +
  5. " />
  6. +
  7. + " /> + /lib/calendar/cal.gif" id="openCalendarFrom" style="cursor: pointer;" alt="Show Calendar" /> +
  8. +
  9. + " /> + /lib/calendar/cal.gif" id="openCalendarTo" style="cursor: pointer;" alt="Show Calendar" /> + +
  10. +
+ +
+

Search Results

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl index 2a1a4b979c..babc73216f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl @@ -43,42 +43,24 @@ // } // } - function get_limit (date,did) { - var dvalue = document.getElementById(did).value; - if (dvalue == "") { return false; } - var limitDate = Date_from_syspref(dvalue); - if (debug && debug > 5) { - var month = date.getMonth() + 1; - var dateString = date.getFullYear() + '-' + month + '-' + date.getDate(); - alert("comparing to " + did + " date:\n" - + (limitDate > date) + "\n date: " + date - + "\nincoming:\n" + dateString + "\nlimitdate: " + limitDate - ); - } - return limitDate; - } + // return true if the date is blocked. + function disable_from(date) {var limit = get_Calendar_limit(date,'to' ); return (limit && limit < date);} + function disable_to (date) {var limit = get_Calendar_limit(date,'from'); return (limit && limit > date);} - function validatefrom(date) {return (get_limit(date,'to' ) < date);} // true or false - function validateto (date) {return (get_limit(date,'from') > date);} // true or false - - Calendar.setup( - { + Calendar.setup({ inputField : "from", ifFormat : "", button : "openCalendarFrom", - disableFunc : validatefrom, - dateStatusFunc : validatefrom - } - ); - Calendar.setup( - { + disableFunc : disable_from, + dateStatusFunc : disable_from + }); + Calendar.setup({ inputField : "to", ifFormat : "", button : "openCalendarTo", - disableFunc : validateto, - dateStatusFunc : validateto - } - ); + disableFunc : disable_to, + dateStatusFunc : disable_to + });

-- 2.39.5