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

(-)a/acqui/histsearch.pl (-57 / +30 lines)
Lines 59-85 use C4::Koha; Link Here
59
use Koha::DateUtils;
59
use Koha::DateUtils;
60
60
61
my $input = new CGI;
61
my $input = new CGI;
62
my $title                   = $input->param( 'title');
63
my $author                  = $input->param('author');
64
my $isbn                    = $input->param('isbn');
65
my $name                    = $input->param( 'name' );
66
my $ean                     = $input->param('ean');
67
my $basket                  = $input->param( 'basket' );
68
my $basketgroupname             = $input->param('basketgroupname');
69
my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' );
70
my $do_search               = $input->param('do_search') || 0;
62
my $do_search               = $input->param('do_search') || 0;
71
my $budget                  = $input->param( 'budget' );
72
my $orderstatus             = $input->param( 'orderstatus' );
73
my $ordernumber             = $input->param( 'ordernumber' );
74
my $search_children_too     = $input->param( 'search_children_too' );
75
my @created_by              = $input->multi_param('created_by');
76
77
my $from_placed_on = eval { dt_from_string( scalar $input->param('from') ) } || dt_from_string;
78
my $to_placed_on   = eval { dt_from_string( scalar $input->param('to')   ) } || dt_from_string;
79
unless ( $input->param('from') ) {
80
    # Fill the form with year-1
81
    $from_placed_on->subtract( years => 1 );
82
}
83
63
84
my $dbh = C4::Context->dbh;
64
my $dbh = C4::Context->dbh;
85
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
65
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 93-118 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
93
    }
73
    }
94
);
74
);
95
75
76
my $filters = {
77
    basket                  => scalar $input->param('basket'),
78
    title                   => scalar $input->param('title'),
79
    author                  => scalar $input->param('author'),
80
    isbn                    => scalar $input->param('isbn'),
81
    name                    => scalar $input->param('name'),
82
    ean                     => scalar $input->param('ean'),
83
    basketgroupname         => scalar $input->param('basketgroupname'),
84
    budget                  => scalar $input->param('budget'),
85
    booksellerinvoicenumber => scalar $input->param('booksellerinvoicenumber'),
86
    budget                  => scalar $input->param('budget'),
87
    orderstatus             => scalar $input->param('orderstatus'),
88
    ordernumber             => scalar $input->param('ordernumber'),
89
    search_children_too     => scalar $input->param('search_children_too'),
90
    created_by              => scalar $input->multi_param('created_by'),
91
};
92
my $from_placed_on = eval { dt_from_string( scalar $input->param('from') ) } || dt_from_string;
93
my $to_placed_on   = eval { dt_from_string( scalar $input->param('to')   ) } || dt_from_string;
94
unless ( $input->param('from') ) {
95
    # Fill the form with year-1
96
    $from_placed_on->subtract( years => 1 );
97
}
98
$filters->{from_placed_on} = output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } ),
99
$filters->{to_placed_on} = output_pref( { dt => $to_placed_on, dateformat => 'iso', dateonly => 1 } ),
100
96
my $order_loop;
101
my $order_loop;
97
# If we're supplied any value then we do a search. Otherwise we don't.
102
# If we're supplied any value then we do a search. Otherwise we don't.
98
if ($do_search) {
103
if ($do_search) {
99
    $order_loop = GetHistory(
104
    $order_loop = GetHistory(%$filters);
100
        title => $title,
101
        author => $author,
102
        isbn   => $isbn,
103
        ean   => $ean,
104
        name => $name,
105
        from_placed_on => output_pref( { dt => $from_placed_on, dateformat => 'iso', dateonly => 1 } ),
106
        to_placed_on   => output_pref( { dt => $to_placed_on,   dateformat => 'iso', dateonly => 1 } ),
107
        basket => $basket,
108
        booksellerinvoicenumber => $booksellerinvoicenumber,
109
        basketgroupname => $basketgroupname,
110
        budget => $budget,
111
        orderstatus => $orderstatus,
112
        ordernumber => $ordernumber,
113
        search_children_too => $search_children_too,
114
        created_by => \@created_by,
115
    );
116
}
105
}
117
106
118
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
107
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
Lines 126-151 for my $bp ( @{$budgetperiods} ) { Link Here
126
}
115
}
127
116
128
$template->param(
117
$template->param(
129
    order_loop              => $order_loop,
118
    order_loop  => $order_loop,
130
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
119
    filters     => $filters,
131
    title                   => $title,
120
    bp_loop     => $bp_loop,
132
    author                  => $author,
121
    search_done => $do_search,
133
    isbn                    => $isbn,
134
    ean                     => $ean,
135
    name                    => $name,
136
    basket                  => $basket,
137
    booksellerinvoicenumber => $booksellerinvoicenumber,
138
    basketgroupname         => $basketgroupname,
139
    ordernumber             => $ordernumber,
140
    search_children_too     => $search_children_too,
141
    from_placed_on          => $from_placed_on,
142
    to_placed_on            => $to_placed_on,
143
    orderstatus             => $orderstatus,
144
    budget_id               => $budget,
145
    bp_loop                 => $bp_loop,
146
    search_done             => $do_search,
147
    debug                   => $debug || $input->param('debug') || 0,
148
    uc(C4::Context->preference("marcflavour")) => 1
149
);
122
);
150
123
151
output_html_with_http_headers $input, $cookie, $template->output;
124
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc (+96 lines)
Line 0 Link Here
1
[% USE Koha %]
2
<ol>
3
    <li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% filters.title | html %]" /></li>
4
    <li><label for="author">Author: </label> <input type="text" name="author" id="author" value="[% filters.author | html %]" /></li>
5
    <li><label for="isbn">ISBN: </label> <input type="text" name="isbn" id="isbn" value="[% filters.isbn | html %]" /></li>
6
            [% IF Koha.Preference('marcflavour') == 'UNIMARC' %]
7
    <li><label for="ean">EAN: </label> <input type="text" name="ean" id="ean" value="[% filters.ean | html %]" /></li>
8
            [% END %]
9
    <li><label for="name">Vendor: </label> <input type="text" name="name" id="name" value="[% filters.name | html %]" /></li>
10
    <li><label for="basket">Basket: </label> <input type="text" name="basket" id="basket" value="[% filters.basket | html %]" /></li>
11
    <li><label for="basket_creators">Basket created by: </label>
12
        <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
13
        <div>
14
            <div id="basket_creators" style="float:left;"></div>
15
        </div>
16
    </li>
17
    <li><label for="booksellerinvoicenumber ">Bookseller invoice no: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% filters.booksellerinvoicenumber | html %]" /></li>
18
    <li>
19
        <label for="basketgroupname">Basket group:</label>
20
        <input type="text" name="basketgroupname" id="basketgroupname" value="[% filters.basketgroupname | html %]" />
21
    </li>
22
    <li>
23
      <label for="ordernumber">Order line:</label>
24
      <input type="text" name="ordernumber" id="ordernumber" value="[% filters.ordernumber | html %]" />
25
      [% IF filters.search_children_too %]
26
        <input type="checkbox" name="search_children_too" id="search_children_too" value="1" checked="checked" />
27
      [% ELSE %]
28
        <input type="checkbox" name="search_children_too" id="search_children_too" value="1" />
29
      [% END %]
30
      <label class="yesno" for="search_children_too">Display children too.</label>
31
    </li>
32
33
    <li>
34
        <label for="orderstatus">Order status: </label>
35
        <select name="orderstatus" id="orderstatus">
36
            [% IF filters.orderstatus == "" %]
37
              <option value="">Any status except cancelled</option>
38
            [% ELSE %]
39
              <option value="" selected="selected"></option>
40
            [% END %]
41
            [% IF filters.orderstatus == "new" %]
42
              <option value="new" selected="selected">New</option>
43
            [% ELSE %]
44
              <option value="new">New</option>
45
            [% END %]
46
            [% IF filters.orderstatus == "ordered" %]
47
              <option value="ordered" selected="selected">Ordered</option>
48
            [% ELSE %]
49
              <option value="ordered">Ordered</option>
50
            [% END %]
51
            [% IF filters.orderstatus == "partial" %]
52
              <option value="partial" selected="selected">Partially received</option>
53
            [% ELSE %]
54
              <option value="partial">Partially received</option>
55
            [% END %]
56
            [% IF filters.orderstatus == "complete" %]
57
              <option value="complete" selected="selected">Received</option>
58
            [% ELSE %]
59
              <option value="complete">Received</option>
60
            [% END %]
61
            [% IF filters.orderstatus == "cancelled" %]
62
              <option value="cancelled" selected="selected">Cancelled</option>
63
            [% ELSE %]
64
              <option value="cancelled">Cancelled</option>
65
            [% END %]
66
        </select>
67
    </li>
68
    <li>
69
        <label for="fund">Fund: </label>
70
        <select name="budget" id="fund">
71
            <option value="">All funds</option>
72
            [% FOREACH bp_loo IN bp_loop %]
73
                <optgroup label="[% bp_loo.budget_period_description | html %]">
74
                [% FOREACH h_loo IN bp_loo.hierarchy %]
75
                  [% IF h_loo.budget_id == filters.budget %]
76
                    <option type="text" value="[% h_loo.budget_id | html %]" branchcode="[% h_loo.budget_branchcode | html %]" selected="selected">
77
                  [% ELSE %]
78
                    <option type="text" value="[% h_loo.budget_id | html %]" branchcode="[% h_loo.budget_branchcode | html %]">
79
                  [% END %]
80
                        [% h_loo.budget_display_name %]
81
                    </option>
82
                [% END %]
83
                </optgroup>
84
            [% END %]
85
        </select>
86
    </li>
87
88
    <li><label for="from">From: </label>
89
    <input type="text" size="10" id="from" name="from" value="[% filters.from_placed_on | $KohaDates %]" class="datepickerfrom" />
90
            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
91
    </li>
92
    <li><label for="to">To: </label>
93
    <input type="text" size="10" id="to" name="to" value="[% filters.to_placed_on | $KohaDates %]" class="datepickerto" />
94
            <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
95
    </li>
96
</ol>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-97 / +2 lines)
Lines 23-124 Link Here
23
[% UNLESS ( order_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
23
[% UNLESS ( order_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
24
<fieldset class="rows">
24
<fieldset class="rows">
25
    <legend>Search orders</legend>
25
    <legend>Search orders</legend>
26
		<ol>
26
    [% INCLUDE 'filter-orders.inc' %]
27
		<li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% title | html %]" /></li>
27
</fieldset>
28
		<li><label for="author">Author: </label> <input type="text" name="author" id="author" value="[% author | html %]" /></li>
29
        <li><label for="isbn">ISBN: </label> <input type="text" name="isbn" id="isbn" value="[% isbn | html %]" /></li>
30
                [% IF (UNIMARC) %]
31
        <li><label for="ean">EAN: </label> <input type="text" name="ean" id="ean" value="[% ean | html %]" /></li>
32
                [% END %]
33
		<li><label for="name">Vendor: </label> <input type="text" name="name" id="name" value="[% name | html %]" /></li>
34
		<li><label for="basket">Basket: </label> <input type="text" name="basket" id="basket" value="[% basket | html %]" /></li>
35
        <li><label for="basket_creators">Basket created by: </label>
36
            <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
37
            <div>
38
                <div id="basket_creators" style="float:left;"></div>
39
            </div>
40
        </li>
41
        <li><label for="booksellerinvoicenumber ">Bookseller invoice no: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% booksellerinvoicenumber | html %]" /></li>
42
        <li>
43
            <label for="basketgroupname">Basket group:</label>
44
            <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroupname | html %]" />
45
        </li>
46
        <li>
47
          <label for="ordernumber">Order line:</label>
48
          <input type="text" name="ordernumber" id="ordernumber" value="[% ordernumber | html %]" />
49
          [% IF search_children_too %]
50
            <input type="checkbox" name="search_children_too" id="search_children_too" value="1" checked="checked" />
51
          [% ELSE %]
52
            <input type="checkbox" name="search_children_too" id="search_children_too" value="1" />
53
          [% END %]
54
          <label class="yesno" for="search_children_too">Display children too.</label>
55
        </li>
56
57
        <li>
58
            <label for="orderstatus">Order status: </label>
59
            <select name="orderstatus" id="orderstatus">
60
                [% IF orderstatus == "" %]
61
                  <option value="">Any status except cancelled</option>
62
                [% ELSE %]
63
                  <option value="" selected="selected"></option>
64
                [% END %]
65
                [% IF orderstatus == "new" %]
66
                  <option value="new" selected="selected">New</option>
67
                [% ELSE %]
68
                  <option value="new">New</option>
69
                [% END %]
70
                [% IF orderstatus == "ordered" %]
71
                  <option value="ordered" selected="selected">Ordered</option>
72
                [% ELSE %]
73
                  <option value="ordered">Ordered</option>
74
                [% END %]
75
                [% IF orderstatus == "partial" %]
76
                  <option value="partial" selected="selected">Partially received</option>
77
                [% ELSE %]
78
                  <option value="partial">Partially received</option>
79
                [% END %]
80
                [% IF orderstatus == "complete" %]
81
                  <option value="complete" selected="selected">Received</option>
82
                [% ELSE %]
83
                  <option value="complete">Received</option>
84
                [% END %]
85
                [% IF orderstatus == "cancelled" %]
86
                  <option value="cancelled" selected="selected">Cancelled</option>
87
                [% ELSE %]
88
                  <option value="cancelled">Cancelled</option>
89
                [% END %]
90
            </select>
91
        </li>
92
        <li>
93
            <label for="fund">Fund: </label>
94
            <select name="budget" id="fund">
95
                <option value="">All funds</option>
96
                [% FOREACH bp_loo IN bp_loop %]
97
                    <optgroup label="[% bp_loo.budget_period_description | html %]">
98
                    [% FOREACH h_loo IN bp_loo.hierarchy %]
99
                      [% IF h_loo.budget_id == budget_id %]
100
                        <option type="text" value="[% h_loo.budget_id | html %]" branchcode="[% h_loo.budget_branchcode | html %]" selected="selected">
101
                      [% ELSE %]
102
                        <option type="text" value="[% h_loo.budget_id | html %]" branchcode="[% h_loo.budget_branchcode | html %]">
103
                      [% END %]
104
                            [% h_loo.budget_display_name | html %]
105
                        </option>
106
                    [% END %]
107
                    </optgroup>
108
                [% END %]
109
            </select>
110
        </li>
111
112
		<li><label for="from">From: </label> 
113
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on | $KohaDates %]" class="datepickerfrom" />
114
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
115
		</li>
116
		<li><label for="to">To: </label> 
117
        <input type="text" size="10" id="to" name="to" value="[% to_placed_on | $KohaDates %]" class="datepickerto" />
118
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
119
		</li>
120
		</ol>
121
	</fieldset>
122
    <input type="hidden" name="do_search" value="1" />
28
    <input type="hidden" name="do_search" value="1" />
123
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
29
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
124
	</form>[% END %]
30
	</form>[% END %]
125
- 

Return to bug 15184