bug hunting and a (small) new set of widget code
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Dec 2005 23:26:52 +0000 (23:26 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Dec 2005 23:26:52 +0000 (23:26 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2388 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/reporter/clark-kent.pl
Open-ILS/src/reporter/report_base.example.xml
Open-ILS/src/reporter/tables.example.xml
Open-ILS/src/reporter/templates/logic_header.ttk
Open-ILS/src/reporter/templates/stage2.ttk
Open-ILS/src/reporter/templates/widget_manip
Open-ILS/src/reporter/widgets.example.xml

index 466d0fd..ac063f9 100755 (executable)
@@ -39,11 +39,12 @@ my $doc = $parser->parse_file($base_xml);
 
 my $db_driver = $doc->findvalue('/reporter/setup/database/driver');
 my $db_host = $doc->findvalue('/reporter/setup/database/host');
+my $db_port = $doc->findvalue('/reporter/setup/database/port') || '5432';
 my $db_name = $doc->findvalue('/reporter/setup/database/name');
 my $db_user = $doc->findvalue('/reporter/setup/database/user');
 my $db_pw = $doc->findvalue('/reporter/setup/database/password');
 
-my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host;
+my $dsn = "dbi:" . $db_driver . ":dbname=" . $db_name .';host=' . $db_host . ';port=' . $db_port;
 
 my ($dbh,$running,$sth,@reports,$run, $current_time);
 
@@ -194,9 +195,14 @@ for my $r ( @reports ) {
 
 
                $dbh->begin_work;
-               $dbh->do(<<'            SQL',{}, $r->{run_time}, $r->{stage3}->{id});
+               #$dbh->do(<<'           SQL',{}, $r->{run_time}, $r->{stage3}->{id});
+               #       UPDATE  reporter.stage3
+               #         SET   runtime = CAST(? AS TIMESTAMP WITH TIME ZONE) + recurrence
+               #         WHERE id = ? AND recurrence > '0 seconds'::INTERVAL;
+               #SQL
+               $dbh->do(<<'            SQL',{}, $r->{stage3}->{id});
                        UPDATE  reporter.stage3
-                         SET   runtime = CAST(? AS TIMESTAMP WITH TIME ZONE) + recurrence
+                         SET   runtime = runtime + recurrence
                          WHERE id = ? AND recurrence > '0 seconds'::INTERVAL;
                SQL
                $dbh->do(<<'            SQL',{}, $r->{stage3}->{id});
@@ -593,6 +599,8 @@ sub draw_bars {
                
        }
 
+       return [] unless ($new_data[0] && @{$new_data[0]});
+
        for my $col (@use_me) {
                push @leg, $settings->{columns}->[$col + @groups - 1] if (map { 1 } grep { $col == $_ } @values);
        }
index 77b4f38..41b8f2a 100644 (file)
@@ -9,6 +9,7 @@
                <database>
                        <driver>Pg</driver>
                        <host>127.0.0.1</host>
+                       <port>5433</port>
                        <name>develooper</name>
                        <user>postgres</user>
                        <password/>
index c72eff7..1877895 100644 (file)
                        <field
                          name="create_date_day"
                          datatype="date">
-                               <label>Create Date Joiner</label>
+                               <label>Create Date</label>
                                <description>Date of the copy's cataloging</description>
                        </field>
                        <field
                          name="create_date_hour"
                          datatype="timestamptz">
-                               <label>Create Date and Hour Joiner</label>
+                               <label>Create Date and Hour</label>
                                <description>Date and Hour of the copy's cataloging</description>
                        </field>
-<!--
                        <field
                          name="create_date"
                          datatype="timestamptz"
                                <label>Edit Date</label>
                                <description>Timestamp of the copy's last edit</description>
                        </field>
--->
                        <field
                          name="edit_date_day"
                          datatype="date">
-                               <label>Edit Date Joiner</label>
+                               <label>Edit Date</label>
                                <description>Date of the copy's last edit</description>
                        </field>
                        <field
                          name="edit_date_hour"
                          datatype="timestamptz">
-                               <label>Edit Date and Hour Joiner</label>
+                               <label>Edit Date and Hour</label>
                                <description>Date and Hour of the copy's last edit</description>
                        </field>
                        <field
                        <link
                          field="create_date_day"
                          table="generic_day_series"
-                         hidden="false"
                          id="copy_create_day"
                          key="date"
                          type="has_a"/>
                        <link
                          field="create_date_hour"
                          table="generic_hour_series"
-                         hidden="false"
                          id="copy_create_hour"
                          key="date_hour"
                          type="has_a"/>
                        <link
                          field="edit_date_day"
                          table="generic_day_series"
-                         hidden="false"
                          id="copy_edit_day"
                          key="date"
                          type="has_a"/>
                        <link
                          field="edit_date_hour"
                          table="generic_hour_series"
-                         hidden="false"
                          id="copy_edit_hour"
                          key="date_hour"
                          type="has_a"/>
                        <link
                          field="owning_lib"
                          table="org_unit"
-                         hidden="false"
                          id="copy_owning_lib"
                          key="id"
                          type="has_a"/>
                          name="date"
                          primary='true'
                          filterable='true'
+                         hidden='false'
                          datatype="timestamptz">
                                <label>Date</label>
                                <description>Date</description>
                          name="date_hour"
                          primary='true'
                          filterable='true'
+                         hidden='false'
                          datatype="timestamptz">
                                <label>Date and Hour</label>
                                <description>Date and Hour</description>
index b7cf103..dcb361d 100644 (file)
@@ -26,10 +26,11 @@ dir = config.findvalue(dir);
 dbdriver = config.findvalue('/reporter/setup/database/driver');
 dbname = config.findvalue('/reporter/setup/database/name');
 dbhost = config.findvalue('/reporter/setup/database/host');
+dbport = config.findvalue('/reporter/setup/database/port') || '5432';
 d_u = config.findvalue('/reporter/setup/database/user');
 d_p = config.findvalue('/reporter/setup/database/password');
 
-dsn = "dbi:" _ dbdriver _ ":dbname=" _ dbname _';host=' _ dbhost;
+dsn = "dbi:" _ dbdriver _ ":dbname=" _ dbname _';host=' _ dbhost _ ';port=' _ dbport;
 
 logme([dsn,d_u,d_p]);
 
index 3ce0a48..39b80a8 100644 (file)
@@ -211,9 +211,9 @@ BLOCK view_stage2;
 
 
                        FOR field = table.findnodes('fields/field[not(@primary) or @primary != "true"]');
-                               link_test = '../../links/link[@field="' _ field.findvalue('@name') _ '"]';
-                               logme(['link_test',link_test]);
-                               NEXT IF field.findnodes( link_test );
+                               link_test = 'links/link[@field="' _ field.findvalue('@name') _ '" and (not(@hidden) or @hidden!="false")]';
+                               logme(['view_stage2 -> link_test',link_test]);
+                               NEXT IF table.findnodes( link_test );
 
                                fname = field.findvalue( "label" );
                                fdesc = field.findvalue( "desription" );
@@ -510,15 +510,16 @@ BLOCK show_filter_atts;
                END;
        END;
 
-       fields_xpath = 'fields/field[(not(@primary) or @primary != "true") or @filterable="true"]';
+       fields_xpath = 'fields/field[(not(@primary) or @primary != "true") or @hidden="false"]';
 
 
        count = 1;
 
        FOR field = table.findnodes(fields_xpath);
-               link_test = '../../links/link[@field="' _ field.findvalue('@name') _ '" and @hidden!="false"]';
-               logme(['link_test',link_test]);
-               NEXT IF field.findnodes( link_test );
+               link_test = '../../links/link[@field="' _ field.findvalue('@name') _ '" and (not(@hidden) or @hidden!="false")]';
+               link_test = 'links/link[@field="' _ field.findvalue('@name') _ '" and (not(@hidden) or @hidden!="false")]';
+               logme(['show_filter_atts -> link_test', t, link_test]);
+               NEXT IF table.findnodes( link_test );
 
                fname = field.findvalue( "label" );
                fid = field.findvalue( "@name" );
index fc82b56..62af297 100644 (file)
@@ -20,7 +20,7 @@ BLOCK widget_selector;
                        '/reporter/tables/table[@id="' _ tableid _
                        '"]/fields/field[(not(@primary) or @primary!="true") or @filterable="true"]';
                FOR c = config.findnodes(columns_xpath);
-                       link_text_xpath = "../../links/link[@field='" _ c.findvalue('@name') _ "']";
+                       link_text_xpath = '../../links/link[@field="' _ c.findvalue('@name') _ '" and (not(@hidden) or @hidden!="false")]';
                        NEXT IF c.findnodes(link_text_xpath);
                        columns.push(c);
                END;
index 5d9c556..fccc717 100644 (file)
                                This widget allows the user to pick a month relative to the
                                report runtime on which to report.
                        </description>
+                       <filter-code type="perl">
+                               $where_clause = 
+                                       "DATE_TRUNC($full_col, 'month') = ".
+                                               "DATE_TRUNC(now(), 'month') - CAST(? || ' months' AS INTERVAL);
+                               push @$bind_list, $val;
+                       </filter-code>
                </widget>
                
                <widget name="quarter">