View | Details | Raw Unified | Return to bug 19359
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-17 / +17 lines)
Lines 328-353 canned reports and writing custom SQL reports.</p> Link Here
328
        [% IF ( CAN_user_reports_create_reports ) %]
328
        [% IF ( CAN_user_reports_create_reports ) %]
329
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
329
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
330
            <input type="hidden" name="phase" value="Build new" />
330
            <input type="hidden" name="phase" value="Build new" />
331
            <input type="submit" name="submit" value="Build new"/>
331
            <input type="submit" name="submit" value="Build new" id="buildnew"/>
332
        </form>
332
        </form>
333
        [% END %]
333
        [% END %]
334
        [% IF ( CAN_user_reports_execute_reports ) %]
334
        [% IF ( CAN_user_reports_execute_reports ) %]
335
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
335
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
336
            <input type="hidden" name="phase" value="Use saved"/>
336
            <input type="hidden" name="phase" value="Use saved"/>
337
            <input type="submit" name="submit" value="Use saved"/>
337
            <input type="submit" name="submit" value="Use saved" id="usesaved"/>
338
        </form>
338
        </form>
339
        [% END %]
339
        [% END %]
340
        [% IF ( CAN_user_reports_create_reports ) %]
340
        [% IF ( CAN_user_reports_create_reports ) %]
341
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
341
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
342
            <input type="hidden" name="phase" value="Create report from SQL"/>
342
            <input type="hidden" name="phase" value="Create report from SQL"/>
343
            <input type="submit" name="submit" value="Create report from SQL"/>
343
            <input type="submit" name="submit" value="Create report from SQL" id="createreport"/>
344
        </form>
344
        </form>
345
        [% END %]
345
        [% END %]
346
<h3>Reports Dictionary</h3>
346
<h3>Reports Dictionary</h3>
347
<p>Use the reports dictionary to define custom criteria to use in your reports</p>
347
<p>Use the reports dictionary to define custom criteria to use in your reports</p>
348
<form action="/cgi-bin/koha/reports/dictionary.pl">
348
<form action="/cgi-bin/koha/reports/dictionary.pl">
349
<input type="hidden" name="phase" value="View Dictionary"/>
349
<input type="hidden" name="phase" value="View Dictionary"/>
350
<input type="submit" name="submit" value="View dictionary"/>
350
<input type="submit" name="submit" value="View dictionary" id="viewdictionary"/>
351
</form>
351
</form>
352
[% END %]
352
[% END %]
353
353
Lines 546-552 canned reports and writing custom SQL reports.</p> Link Here
546
</fieldset>
546
</fieldset>
547
<fieldset class="action">
547
<fieldset class="action">
548
<input type="hidden" name="phase" value="Report on this Area" />
548
<input type="hidden" name="phase" value="Report on this Area" />
549
<input type="submit" name="submit" value="Next &gt;&gt;" />
549
<input type="submit" name="submit" value="Next &gt;&gt;" id="submitfirststep" />
550
550
551
</fieldset>
551
</fieldset>
552
</form>
552
</form>
Lines 571-577 canned reports and writing custom SQL reports.</p> Link Here
571
<fieldset class="action">
571
<fieldset class="action">
572
    <input type="hidden" name="phase" value="Choose this type" />
572
    <input type="hidden" name="phase" value="Choose this type" />
573
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
573
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
574
    <input type="submit" name="submit" value="Next &gt;&gt;" />
574
    <input type="submit" name="submit" value="Next &gt;&gt;" id="secondstepnext" />
575
</fieldset>
575
</fieldset>
576
</form>
576
</form>
577
</div>
577
</div>
Lines 631-637 canned reports and writing custom SQL reports.</p> Link Here
631
<fieldset class="action">
631
<fieldset class="action">
632
    <input type="hidden" name="phase" value="Choose these columns" />
632
    <input type="hidden" name="phase" value="Choose these columns" />
633
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
633
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
634
    <input type="submit" name="submit" value="Next &gt;&gt;" />
634
    <input type="submit" name="submit" value="Next &gt;&gt;" id="thirdstepnext"/>
635
</fieldset>
635
</fieldset>
636
</div>
636
</div>
637
</form>
637
</form>
Lines 704-710 canned reports and writing custom SQL reports.</p> Link Here
704
704
705
<fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
705
<fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
706
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
706
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
707
    <input type="submit" name="submit" value="Next &gt;&gt;" /> </fieldset>
707
    <input type="submit" name="submit" value="Next &gt;&gt;" id="fourthstepnext"/> </fieldset>
708
</form>
708
</form>
709
[% END %]
709
[% END %]
710
710
Lines 736-742 canned reports and writing custom SQL reports.</p> Link Here
736
736
737
<fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
737
<fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
738
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
738
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
739
    <input type="submit" name="submit" value="Next &gt;&gt;" /></fieldset>
739
    <input type="submit" name="submit" value="Next &gt;&gt;" id="fifthstepnext"/></fieldset>
740
</form>
740
</form>
741
[% END %]
741
[% END %]
742
742
Lines 768-774 canned reports and writing custom SQL reports.</p> Link Here
768
768
769
<fieldset class="action">
769
<fieldset class="action">
770
<input type="hidden" name="phase" value="Build report" />
770
<input type="hidden" name="phase" value="Build report" />
771
<input type="submit" name="submit" value="Finish" /></fieldset>
771
<input type="submit" name="submit" value="Finish" id="finish" /></fieldset>
772
</form>
772
</form>
773
[% END %]
773
[% END %]
774
774
Lines 787-793 canned reports and writing custom SQL reports.</p> Link Here
787
<input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
787
<input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
788
<p>You will need to save the report before you can execute it</p>
788
<p>You will need to save the report before you can execute it</p>
789
<fieldset class="action"><input type="hidden" name="phase" value="Save" />  
789
<fieldset class="action"><input type="hidden" name="phase" value="Save" />  
790
<input type="submit" name="submit" value="Save" />  </fieldset>
790
<input type="submit" name="submit" value="Save" id="save"/>  </fieldset>
791
</form>
791
</form>
792
[% END %]
792
[% END %]
793
793
Lines 806-812 canned reports and writing custom SQL reports.</p> Link Here
806
    <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
806
    <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
807
</ol></fieldset>
807
</ol></fieldset>
808
<fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
808
<fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
809
<input type="submit" name="submit" value="Save report" /></fieldset>
809
<input type="submit" name="submit" value="Save report" id="savereport" /></fieldset>
810
</form>
810
</form>
811
[% END %]
811
[% END %]
812
812
Lines 922-928 canned reports and writing custom SQL reports.</p> Link Here
922
922
923
<div class="pages">[% pagination_bar %]</div>
923
<div class="pages">[% pagination_bar %]</div>
924
[% UNLESS ( errors ) %]
924
[% UNLESS ( errors ) %]
925
<table>
925
<table id="reporttable">
926
<tr>[% FOREACH header_ro IN header_row %]<th>[% header_ro.cell %]</th>[% END %]</tr>
926
<tr>[% FOREACH header_ro IN header_row %]<th>[% header_ro.cell %]</th>[% END %]</tr>
927
[% FOREACH result IN results %]
927
[% FOREACH result IN results %]
928
<tr>
928
<tr>
Lines 1077-1087 Sub report:<select name="subreport"> Link Here
1077
<h4>[% reportname %]</h4>
1077
<h4>[% reportname %]</h4>
1078
<ul>
1078
<ul>
1079
    [% IF ( id ) %]
1079
    [% IF ( id ) %]
1080
    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&amp;phase=Run%20this%20report">Run this report</a></li>
1080
    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id %]&amp;phase=Run%20this%20report" id="runreport" >Run this report</a></li>
1081
    [% END %]
1081
    [% END %]
1082
    <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports page</a></li>
1082
    <li>Access this report from the: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" id="savedreportspage">Saved reports page</a></li>
1083
    <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl">Scheduler tool</a></li>
1083
    <li>Schedule this report to run using the: <a href="/cgi-bin/koha/tools/scheduler.pl" id="schedulartool">Scheduler tool</a></li>
1084
    <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Guided reports</a></li>
1084
    <li>Return to: <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" id="guidedreports"> Guided reports</a></li>
1085
</ul>
1085
</ul>
1086
[% END %]
1086
[% END %]
1087
[% END %]
1087
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt (-8 / +8 lines)
Lines 17-38 Link Here
17
    <h1>Reports</h1>
17
    <h1>Reports</h1>
18
    <div class="yui-u first"><h2>Guided reports</h2>
18
    <div class="yui-u first"><h2>Guided reports</h2>
19
        <ul>
19
        <ul>
20
            <li><a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a></li>
20
            <li><a href="/cgi-bin/koha/reports/guided_reports.pl" id="reportwizard">Guided reports wizard</a></li>
21
            [% IF ( CAN_user_reports_create_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build new</a></li>[% END %]
21
            [% IF ( CAN_user_reports_create_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new" id="buildnew">Build new</a></li>[% END %]
22
            [% IF ( CAN_user_reports_execute_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Use saved</a></li>[% END %]
22
            [% IF ( CAN_user_reports_execute_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" id="usesaved">Use saved</a></li>[% END %]
23
            [% IF ( CAN_user_reports_create_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">Create from SQL</a></li>[% END %]
23
            [% IF ( CAN_user_reports_create_reports ) %]<li><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL" id="createfromsql">Create from SQL</a></li>[% END %]
24
        </ul>
24
        </ul>
25
25
26
        <h5>Reports dictionary</h5>
26
        <h5>Reports dictionary</h5>
27
        <ul>
27
        <ul>
28
            <li><a href="/cgi-bin/koha/reports/dictionary.pl?phase=View%20Dictionary">View dictionary</a></li>
28
            <li><a href="/cgi-bin/koha/reports/dictionary.pl?phase=View%20Dictionary" id="viewdictionary">View dictionary</a></li>
29
        </ul>
29
        </ul>
30
30
31
        <h2>Statistics wizards</h2>
31
        <h2>Statistics wizards</h2>
32
        <ul>
32
        <ul>
33
            <li><a href="/cgi-bin/koha/reports/acquisitions_stats.pl">Acquisitions</a></li>
33
            <li><a href="/cgi-bin/koha/reports/acquisitions_stats.pl" id="aqcwizard">Acquisitions</a></li>
34
            <li><a href="/cgi-bin/koha/reports/borrowers_stats.pl">Patrons</a></li>
34
            <li><a href="/cgi-bin/koha/reports/borrowers_stats.pl" id="patronwizard">Patrons</a></li>
35
            <li><a href="/cgi-bin/koha/reports/catalogue_stats.pl">Catalog</a></li>
35
            <li><a href="/cgi-bin/koha/reports/catalogue_stats.pl" id="cataloguewizard">Catalog</a></li>
36
            <li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
36
            <li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
37
            <li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
37
            <li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
38
            <li><a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash register</a></li>
38
            <li><a href="/cgi-bin/koha/reports/cash_register_stats.pl">Cash register</a></li>
(-)a/t/db_dependent/selenium/reporting_workflow.t (-75 / +29 lines)
Lines 31-36 use Test::More tests => 7; Link Here
31
use MARC::Record;
31
use MARC::Record;
32
use MARC::Field;
32
use MARC::Field;
33
use Selenium::Remote::Driver::Firefox::Profile;
33
use Selenium::Remote::Driver::Firefox::Profile;
34
use t::lib::Selenium;
34
35
35
my $dbh = C4::Context->dbh;
36
my $dbh = C4::Context->dbh;
36
my $login = 'koha';
37
my $login = 'koha';
Lines 74-81 SKIP: { Link Here
74
    $prev_time = $start;
75
    $prev_time = $start;
75
    $driver->get($base_url."mainpage.pl");
76
    $driver->get($base_url."mainpage.pl");
76
    like( $driver->get_title(), qr(Log in to Koha), );
77
    like( $driver->get_title(), qr(Log in to Koha), );
77
    auth( $driver, $login, $password );
78
    t::lib::Selenium::auth( $driver, $login, $password );
78
    time_diff("main");
79
    t::lib::Selenium::time_diff($prev_time, "main");
79
80
80
    #Add biblio
81
    #Add biblio
81
    $borrowernumber = $dbh->selectcol_arrayref(q|SELECT borrowernumber FROM borrowers WHERE userid=?|, {}, $sample_data->{patron}{userid} )->[0];
82
    $borrowernumber = $dbh->selectcol_arrayref(q|SELECT borrowernumber FROM borrowers WHERE userid=?|, {}, $sample_data->{patron}{userid} )->[0];
Lines 98-104 SKIP: { Link Here
98
        my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio,     '');
99
        my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio,     '');
99
        push @biblionumbers, $biblionumber;
100
        push @biblionumbers, $biblionumber;
100
    }
101
    }
101
    time_diff("add biblio");
102
    t::lib::Selenium::time_diff($prev_time, "add biblio");
102
103
103
    #Add items to the biblio
104
    #Add items to the biblio
104
    my $itemtype = $dbh->selectcol_arrayref(q|SELECT itemtype FROM itemtypes|);
105
    my $itemtype = $dbh->selectcol_arrayref(q|SELECT itemtype FROM itemtypes|);
Lines 108-114 SKIP: { Link Here
108
        $driver->get($base_url."/cataloguing/additem.pl?biblionumber=$biblionumber");
109
        $driver->get($base_url."/cataloguing/additem.pl?biblionumber=$biblionumber");
109
        like( $driver->get_title(), qr(test biblio \d+ by test author), );
110
        like( $driver->get_title(), qr(test biblio \d+ by test author), );
110
        my $form = $driver->find_element('//form[@name="f"]');
111
        my $form = $driver->find_element('//form[@name="f"]');
111
        my $inputs = $driver->find_child_elements($form, '//input[@    type="text"]');
112
        my $inputs = $driver->find_child_elements($form, '//input[@type="text"]');
112
        for my $input ( @$inputs ) {
113
        for my $input ( @$inputs ) {
113
            next if $input->is_hidden();
114
            next if $input->is_hidden();
114
            my $id = $input->get_attribute('id');
115
            my $id = $input->get_attribute('id');
Lines 122-159 SKIP: { Link Here
122
         $dbh->do(q|UPDATE biblioitems SET itemtype=? WHERE biblionumber=?|, {}, $itemtype, $biblionumber);
123
         $dbh->do(q|UPDATE biblioitems SET itemtype=? WHERE biblionumber=?|, {}, $itemtype, $biblionumber);
123
         $dbh->do(q|UPDATE items SET itype=? WHERE biblionumber=?|,{}, $itemtype, $biblionumber);
124
         $dbh->do(q|UPDATE items SET itype=? WHERE biblionumber=?|,{}, $itemtype, $biblionumber);
124
    }
125
    }
125
    time_diff("add items");
126
    t::lib::Selenium::time_diff($prev_time, "add items");
126
127
127
    #Navigate into Reports and create a new report
128
    #Navigate into Reports and create a new report
128
    $driver->get($base_url."mainpage.pl");
129
    $driver->get($base_url."mainpage.pl");
129
    $driver->find_element_by_xpath('/html/body/div[4]/div/div[1]/div/div[1]/div[2]/div/ul/li[3]/a')->click;
130
    $driver->find_element('//a[@id="reports"]')->click;
130
    $driver->pause(20000);
131
    $driver->pause(20000);
131
    $driver->find_element_by_xpath('/html/body/div[4]/div/div[1]/div/div[1]/ul[1]/li[2]/a')->click;
132
    $driver->find_element('//a[@id="reportwizard"]')->click;
132
    $driver->pause(20000);
133
    $driver->pause(20000);
133
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[1]/ol/li[1]/select')->click;
134
    $driver->find_element('//input[@id="buildnew"]')->click;
134
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[1]/ol/li[1]/select/option[2]')->click;
135
    $driver->find_element('//select[@id="area"]')->click;
135
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[2]/input[2]')->click;
136
    $driver->find_element('//option[@value="CAT"]')->click;
136
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div[1]/form/fieldset[2]/input[3]')->click;
137
    $driver->find_element('//input[@id="submitfirststep"]')->click;
137
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset/div/div[1]/div[1]/select/optgroup[1]/option[1]')->click;
138
    $driver->find_element('//input[@id="secondstepnext"]')->click;
138
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset/div/div[1]/div[2]/input[1]')->click;
139
    $driver->find_element('//option[@value="items.itemnumber"]')->click;
139
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset/div/div[1]/div[1]/select/optgroup[1]/option[2]')->click;
140
    $driver->find_element('//input[@id="addColumn"]')->click;
140
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset/div/div[1]/div[2]/input[1]')->click;
141
    $driver->find_element('//option[@value="items.biblionumber"]')->click;
141
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/div/fieldset/input[3]')->click;
142
    $driver->find_element('//input[@id="addColumn"]')->click;
142
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[2]/input[3]')->click;
143
    $driver->find_element('//input[@id="thirdstepnext"]')->click;
143
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[2]/input[3]')->click;
144
    $driver->find_element('//input[@id="fourthstepnext"]')->click;
145
    $driver->find_element('//input[@id="fifthstepnext"]')->click;
144
    $driver->pause(20000);
146
    $driver->pause(20000);
145
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[2]/input[2]')->click;
147
    $driver->find_element('//input[@id="finish"]')->click;
146
    $driver->pause(20000);
148
    $driver->pause(20000);
147
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset/input[2]')->click;
149
    $driver->find_element('//input[@id="save"]')->click;
148
    $driver->pause(20000);
150
    $driver->pause(20000);
149
    $driver->find_element('//input[@id="reportname"]')->send_keys("Test report");
151
    $driver->find_element('//input[@id="reportname"]')->send_keys("Test report");
150
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[1]/ol/li[4]/textarea')->send_keys("This test retrieves item information from the catalog");
152
    $driver->find_element('//textarea[@id="notes"]')->send_keys("This test retrieves item information from the catalog");
151
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/form/fieldset[2]/input[2]')->click;
153
    $driver->find_element('//input[@id="savereport"]')->click;
152
    $driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/ul/li[1]/a')->click;
154
    $driver->find_element('//a[@id="runreport"]')->click;
153
    if ($driver->find_element_by_xpath('/html/body/div[5]/div/div[1]/div/table/tbody/tr[1]/th[1]')) {
155
    if ($driver->find_element('//table[@id="reporttable"]')) {
154
        time_diff("Report successfully created");
156
        t::lib::Selenium::time_diff($prev_time, "Report successfully created");
155
    } else {
157
    } else {
156
        time_diff("Report not successfully created");
158
        t::lib::Selenium::time_diff($prev_time, "Report not successfully created");
157
    }
159
    }
158
160
159
    close $fh;
161
    close $fh;
Lines 161-212 SKIP: { Link Here
161
};
163
};
162
164
163
END {
165
END {
164
    cleanup() if $cleanup_needed;
166
    t::lib::Selenium::cleanup($sample_data,$number_of_biblios_to_insert,$borrowernumber) if $cleanup_needed;
165
};
167
};
166
167
sub auth {
168
    my ( $driver, $login, $password) = @_;
169
    fill_form( $driver, { userid => 'koha', password => 'koha' } );
170
    my $login_button = $driver->find_element('//input[@id="submit"]');
171
    $login_button->submit();
172
}
173
174
sub patron_auth {
175
    my ( $driver,$patronusername, $patronpassword) = @_;
176
    fill_form( $driver, { userid => $patronusername, password => $patronpassword } );
177
    my $login_button = $driver->find_element('//input[@id="submit"]');
178
    $login_button->submit();
179
}
180
181
sub patron_opac_auth {
182
    my ( $driver,$patronusername, $patronpassword) = @_;
183
    fill_form( $driver, { userid => $patronusername, password => $patronpassword } );
184
    my $login_button = $driver->find_element('//input[@value="Log in"]');
185
    $login_button->submit();
186
}
187
188
sub fill_form {
189
    my ( $driver, $values ) = @_;
190
    while ( my ( $id, $value ) = each %$values ) {
191
        my $element = $driver->find_element('//*[@id="'.$id.'"]');
192
        my $tag = $element->get_tag_name();
193
        if ( $tag eq 'input' ) {
194
            $driver->find_element('//input[@id="'.$id.'"]')->send_keys($value);
195
        } elsif ( $tag eq 'select' ) {
196
            $driver->find_element('//select[@id="'.$id.'"]/option[@value="'.$value.'"]')->click;
197
        }
198
    }
199
}
200
201
sub cleanup {
202
    my $dbh = C4::Context->dbh;
203
    $dbh->do(q|DELETE FROM categories WHERE categorycode = ?|, {}, $sample_data->{category}{categorycode});
204
    $dbh->do(q|DELETE FROM borrowers WHERE userid = ?|, {}, $sample_data->{patron}{userid});
205
}
206
207
sub time_diff {
208
    my $lib = shift;
209
    my $now = gettimeofday;
210
    warn "CP $lib = " . sprintf("%.2f", $now - $prev_time ) . "\n";
211
    $prev_time = $now;
212
}
213
- 

Return to bug 19359