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

(-)a/C4/Acquisition.pm (-20 / +117 lines)
Lines 28-34 use MARC::Record; Link Here
28
use C4::Suggestions;
28
use C4::Suggestions;
29
use C4::Biblio;
29
use C4::Biblio;
30
use C4::Debug;
30
use C4::Debug;
31
use C4::SQLHelper qw(InsertInTable);
31
use C4::SQLHelper qw(InsertInTable UpdateInTable);
32
use C4::Bookseller qw(GetBookSellerFromId);
32
use C4::Bookseller qw(GetBookSellerFromId);
33
use C4::Templates qw(gettemplate);
33
use C4::Templates qw(gettemplate);
34
34
Lines 43-49 BEGIN { Link Here
43
    require Exporter;
43
    require Exporter;
44
    @ISA    = qw(Exporter);
44
    @ISA    = qw(Exporter);
45
    @EXPORT = qw(
45
    @EXPORT = qw(
46
        &GetBasket &NewBasket &CloseBasket &DelBasket &ModBasket
46
        &GetBasket &NewBasket &CloseBasket &ReopenBasket &DelBasket &ModBasket
47
        &GetBasketAsCSV &GetBasketGroupAsCSV
47
        &GetBasketAsCSV &GetBasketGroupAsCSV
48
        &GetBasketsByBookseller &GetBasketsByBasketgroup
48
        &GetBasketsByBookseller &GetBasketsByBasketgroup
49
        &GetBasketsInfosByBookseller
49
        &GetBasketsInfosByBookseller
Lines 75-80 BEGIN { Link Here
75
        &GetItemnumbersFromOrder
75
        &GetItemnumbersFromOrder
76
76
77
        &AddClaim
77
        &AddClaim
78
        &GetBiblioCountByBasketno
78
    );
79
    );
79
}
80
}
80
81
Lines 214-220 sub NewBasket { Link Here
214
215
215
  &CloseBasket($basketno);
216
  &CloseBasket($basketno);
216
217
217
close a basket (becomes unmodifiable,except for recieves)
218
close a basket (becomes unmodifiable, except for receives)
218
219
219
=cut
220
=cut
220
221
Lines 228-233 sub CloseBasket { Link Here
228
    ";
229
    ";
229
    my $sth = $dbh->prepare($query);
230
    my $sth = $dbh->prepare($query);
230
    $sth->execute($basketno);
231
    $sth->execute($basketno);
232
233
    my @orders = GetOrders($basketno);
234
    foreach my $order (@orders) {
235
        $query = qq{
236
            UPDATE aqorders
237
            SET orderstatus = 1
238
            WHERE ordernumber = ?;
239
        };
240
        $sth = $dbh->prepare($query);
241
        $sth->execute($order->{'ordernumber'});
242
    }
243
}
244
245
=head3 ReopenBasket
246
247
  &ReopenBasket($basketno);
248
249
reopen a basket
250
251
=cut
252
253
sub ReopenBasket {
254
    my ($basketno) = @_;
255
    my $dbh        = C4::Context->dbh;
256
    my $query = "
257
        UPDATE aqbasket
258
        SET    closedate=NULL
259
        WHERE  basketno=?
260
    ";
261
    my $sth = $dbh->prepare($query);
262
    $sth->execute($basketno);
263
264
    my @orders = GetOrders($basketno);
265
    foreach my $order (@orders) {
266
        $query = qq{
267
            UPDATE aqorders
268
            SET orderstatus = 0
269
            WHERE ordernumber = ?;
270
        };
271
        $sth = $dbh->prepare($query);
272
        $sth->execute($order->{'ordernumber'});
273
    }
231
}
274
}
232
275
233
#------------------------------------------------------------#
276
#------------------------------------------------------------#
Lines 467-472 sub ModBasket { Link Here
467
    my $dbh = C4::Context->dbh;
510
    my $dbh = C4::Context->dbh;
468
    my $sth = $dbh->prepare($query);
511
    my $sth = $dbh->prepare($query);
469
    $sth->execute(@params);
512
    $sth->execute(@params);
513
470
    $sth->finish;
514
    $sth->finish;
471
}
515
}
472
516
Lines 1108-1114 The following keys are used: "biblionumber", "title", "basketno", "quantity", "n Link Here
1108
1152
1109
sub NewOrder {
1153
sub NewOrder {
1110
    my $orderinfo = shift;
1154
    my $orderinfo = shift;
1111
#### ------------------------------
1155
    my $parent_ordernumber = shift;
1156
1112
    my $dbh = C4::Context->dbh;
1157
    my $dbh = C4::Context->dbh;
1113
    my @params;
1158
    my @params;
1114
1159
Lines 1381-1386 sub ModReceiveOrder { Link Here
1381
        $sth=$dbh->prepare("
1426
        $sth=$dbh->prepare("
1382
            UPDATE aqorders
1427
            UPDATE aqorders
1383
            SET quantity = ?
1428
            SET quantity = ?
1429
                ordernumber = 2
1384
            WHERE ordernumber = ?
1430
            WHERE ordernumber = ?
1385
        ");
1431
        ");
1386
1432
Lines 1407-1413 sub ModReceiveOrder { Link Here
1407
    } else {
1453
    } else {
1408
        $sth=$dbh->prepare("update aqorders
1454
        $sth=$dbh->prepare("update aqorders
1409
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1455
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1410
                                unitprice=?,rrp=?,ecost=?
1456
                                unitprice=?,rrp=?,ecost=?,orderstatus=3
1411
                            where biblionumber=? and ordernumber=?");
1457
                            where biblionumber=? and ordernumber=?");
1412
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1458
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1413
        $sth->finish;
1459
        $sth->finish;
Lines 1624-1630 sub DelOrder { Link Here
1624
    my $dbh = C4::Context->dbh;
1670
    my $dbh = C4::Context->dbh;
1625
    my $query = "
1671
    my $query = "
1626
        UPDATE aqorders
1672
        UPDATE aqorders
1627
        SET    datecancellationprinted=now()
1673
        SET    datecancellationprinted=now(), orderstatus=4
1628
        WHERE  biblionumber=? AND ordernumber=?
1674
        WHERE  biblionumber=? AND ordernumber=?
1629
    ";
1675
    ";
1630
    my $sth = $dbh->prepare($query);
1676
    my $sth = $dbh->prepare($query);
Lines 1985-1990 sub GetHistory { Link Here
1985
    my $basket = $params{basket};
2031
    my $basket = $params{basket};
1986
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
2032
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
1987
    my $basketgroupname = $params{basketgroupname};
2033
    my $basketgroupname = $params{basketgroupname};
2034
    my $budget = $params{budget};
2035
    my $orderstatus = $params{orderstatus};
2036
1988
    my @order_loop;
2037
    my @order_loop;
1989
    my $total_qty         = 0;
2038
    my $total_qty         = 0;
1990
    my $total_qtyreceived = 0;
2039
    my $total_qtyreceived = 0;
Lines 1993-2002 sub GetHistory { Link Here
1993
    my $dbh   = C4::Context->dbh;
2042
    my $dbh   = C4::Context->dbh;
1994
    my $query ="
2043
    my $query ="
1995
        SELECT
2044
        SELECT
1996
            biblio.title,
2045
            COALESCE(biblio.title,     deletedbiblio.title)     AS title,
1997
            biblio.author,
2046
            COALESCE(biblio.author,    deletedbiblio.author)    AS author,
1998
	    biblioitems.isbn,
2047
            COALESCE(biblioitems.isbn, deletedbiblioitems.isbn) AS isbn,
1999
        biblioitems.ean,
2048
            COALESCE(biblioitems.ean,  deletedbiblioitems.ean)  AS ean,
2000
            aqorders.basketno,
2049
            aqorders.basketno,
2001
            aqbasket.basketname,
2050
            aqbasket.basketname,
2002
            aqbasket.basketgroupid,
2051
            aqbasket.basketgroupid,
Lines 2010-2028 sub GetHistory { Link Here
2010
            aqorders.ordernumber,
2059
            aqorders.ordernumber,
2011
            aqinvoices.invoicenumber,
2060
            aqinvoices.invoicenumber,
2012
            aqbooksellers.id as id,
2061
            aqbooksellers.id as id,
2013
            aqorders.biblionumber
2062
            aqorders.biblionumber,
2063
            aqorders.orderstatus,
2064
            aqorders.parent_ordernumber,
2065
            aqbudgets.budget_name
2066
            ";
2067
    $query .= ", aqbudgets.budget_id AS budget" if defined $budget;
2068
    $query .= "
2014
        FROM aqorders
2069
        FROM aqorders
2015
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
2070
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
2016
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
2071
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
2017
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
2072
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
2018
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
2073
        LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
2019
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
2074
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
2020
    LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid";
2075
        LEFT JOIN aqbudgets ON aqorders.budget_id=aqbudgets.budget_id
2076
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
2077
        LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber
2078
        LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber
2079
        ";
2080
2081
    if ( C4::Context->preference("IndependantBranches") ) {
2082
        $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber";
2083
    }
2021
2084
2022
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
2085
    $query .= " WHERE 1 ";
2023
    if ( C4::Context->preference("IndependantBranches") );
2024
2086
2025
    $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
2087
    $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne '4';
2026
2088
2027
    my @query_params  = ();
2089
    my @query_params  = ();
2028
2090
Lines 2041-2047 sub GetHistory { Link Here
2041
        $query .= " AND biblioitems.isbn LIKE ? ";
2103
        $query .= " AND biblioitems.isbn LIKE ? ";
2042
        push @query_params, "%$isbn%";
2104
        push @query_params, "%$isbn%";
2043
    }
2105
    }
2044
    if ( defined $ean and $ean ) {
2106
    if ( $ean ) {
2045
        $query .= " AND biblioitems.ean = ? ";
2107
        $query .= " AND biblioitems.ean = ? ";
2046
        push @query_params, "$ean";
2108
        push @query_params, "$ean";
2047
    }
2109
    }
Lines 2050-2055 sub GetHistory { Link Here
2050
        push @query_params, "%$name%";
2112
        push @query_params, "%$name%";
2051
    }
2113
    }
2052
2114
2115
    if ( $budget ) {
2116
        $query .= " AND aqbudgets.budget_id = ? ";
2117
        push @query_params, "$budget";
2118
    }
2119
2053
    if ( $from_placed_on ) {
2120
    if ( $from_placed_on ) {
2054
        $query .= " AND creationdate >= ? ";
2121
        $query .= " AND creationdate >= ? ";
2055
        push @query_params, $from_placed_on;
2122
        push @query_params, $from_placed_on;
Lines 2060-2065 sub GetHistory { Link Here
2060
        push @query_params, $to_placed_on;
2127
        push @query_params, $to_placed_on;
2061
    }
2128
    }
2062
2129
2130
    if ( defined $orderstatus and $orderstatus ne '') {
2131
        $query .= " AND aqorders.orderstatus = ? ";
2132
        push @query_params, "$orderstatus";
2133
    }
2134
2063
    if ($basket) {
2135
    if ($basket) {
2064
        if ($basket =~ m/^\d+$/) {
2136
        if ($basket =~ m/^\d+$/) {
2065
            $query .= " AND aqorders.basketno = ? ";
2137
            $query .= " AND aqorders.basketno = ? ";
Lines 2095-2103 sub GetHistory { Link Here
2095
        $line->{count} = $cnt++;
2167
        $line->{count} = $cnt++;
2096
        $line->{toggle} = 1 if $cnt % 2;
2168
        $line->{toggle} = 1 if $cnt % 2;
2097
        push @order_loop, $line;
2169
        push @order_loop, $line;
2098
        $total_qty         += $line->{'quantity'};
2170
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
2099
        $total_qtyreceived += $line->{'quantityreceived'};
2171
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
2100
        $total_price       += $line->{'quantity'} * $line->{'ecost'};
2172
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
2101
    }
2173
    }
2102
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2174
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2103
}
2175
}
Lines 2561-2566 sub ReopenInvoice { Link Here
2561
    $sth->execute($invoiceid);
2633
    $sth->execute($invoiceid);
2562
}
2634
}
2563
2635
2636
=head3 GetBiblioCountByBasketno
2637
2638
$biblio_count = &GetBiblioCountByBasketno($basketno);
2639
2640
Looks up the biblio's count that has basketno value $basketno
2641
2642
Returns a quantity
2643
2644
=cut
2645
2646
sub GetBiblioCountByBasketno {
2647
    my ($basketno) = @_;
2648
    my $dbh          = C4::Context->dbh;
2649
    my $query        = "
2650
        SELECT COUNT( DISTINCT( biblionumber ) )
2651
        FROM   aqorders
2652
        WHERE  basketno = ?
2653
            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
2654
        ";
2655
2656
    my $sth = $dbh->prepare($query);
2657
    $sth->execute($basketno);
2658
    return $sth->fetchrow;
2659
}
2660
2564
1;
2661
1;
2565
__END__
2662
__END__
2566
2663
(-)a/acqui/basket.pl (-10 / +8 lines)
Lines 177-194 if ( $op eq 'delete_confirm' ) { Link Here
177
        }
177
        }
178
        exit;
178
        exit;
179
    } else {
179
    } else {
180
    $template->param(confirm_close => "1",
180
    $template->param(
181
            booksellerid    => $booksellerid,
181
        confirm_close   => "1",
182
            basketno        => $basket->{'basketno'},
182
        booksellerid    => $booksellerid,
183
                basketname      => $basket->{'basketname'},
183
        basketno        => $basket->{'basketno'},
184
            basketgroupname => $basket->{'basketname'});
184
        basketname      => $basket->{'basketname'},
185
        
185
        basketgroupname => $basket->{'basketname'},
186
    );
186
    }
187
    }
187
} elsif ($op eq 'reopen') {
188
} elsif ($op eq 'reopen') {
188
    my $basket;
189
    ReopenBasket($query->param('basketno'));
189
    $basket->{basketno} = $query->param('basketno');
190
    $basket->{closedate} = undef;
191
    ModBasket($basket);
192
    print $query->redirect('/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'})
190
    print $query->redirect('/cgi-bin/koha/acqui/basket.pl?basketno='.$basket->{'basketno'})
193
} else {
191
} else {
194
    # get librarian branch...
192
    # get librarian branch...
(-)a/acqui/histsearch.pl (-2 / +20 lines)
Lines 57-62 use C4::Output; Link Here
57
use C4::Acquisition;
57
use C4::Acquisition;
58
use C4::Dates;
58
use C4::Dates;
59
use C4::Debug;
59
use C4::Debug;
60
use C4::Branch;
61
use C4::Koha;
60
62
61
my $input = new CGI;
63
my $input = new CGI;
62
my $title                   = $input->param( 'title');
64
my $title                   = $input->param( 'title');
Lines 79-84 utf8::decode($booksellerinvoicenumber); Link Here
79
my $do_search               = $input->param('do_search') || 0;
81
my $do_search               = $input->param('do_search') || 0;
80
my $from_placed_on          = C4::Dates->new($input->param('from'));
82
my $from_placed_on          = C4::Dates->new($input->param('from'));
81
my $to_placed_on            = C4::Dates->new($input->param('to'));
83
my $to_placed_on            = C4::Dates->new($input->param('to'));
84
my $budget                  = $input->param( 'budget' );
85
my $orderstatus             = $input->param( 'orderstatus' );
86
82
if ( not $input->param('from') ) {
87
if ( not $input->param('from') ) {
83
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
88
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
84
    # We would use a function like Add_Delta_YM(-1, 0, 0);
89
    # We would use a function like Add_Delta_YM(-1, 0, 0);
Lines 119-139 if ($do_search) { Link Here
119
        basket => $basket,
124
        basket => $basket,
120
        booksellerinvoicenumber => $booksellerinvoicenumber,
125
        booksellerinvoicenumber => $booksellerinvoicenumber,
121
        basketgroupname => $basketgroupname,
126
        basketgroupname => $basketgroupname,
127
        budget => $budget,
128
        orderstatus => $orderstatus,
122
    );
129
    );
123
}
130
}
124
131
125
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
132
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
126
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
133
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
127
134
135
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
136
my $bp_loop = $budgetperiods;
137
for my $bp ( @{$budgetperiods} ) {
138
    my $hierarchy = C4::Budgets::GetBudgetHierarchy( $$bp{budget_period_id} );
139
    for my $budget ( @{$hierarchy} ) {
140
        $$budget{budget_display_name} = sprintf("%s", ">" x $$budget{depth} . $$budget{budget_name});
141
    }
142
    $$bp{hierarchy} = $hierarchy;
143
}
144
128
$template->param(
145
$template->param(
129
    suggestions_loop        => $order_loop,
146
    order_loop              => $order_loop,
130
    total_qty               => $total_qty,
147
    total_qty               => $total_qty,
131
    total_qtyreceived       => $total_qtyreceived,
148
    total_qtyreceived       => $total_qtyreceived,
132
    total_price             => sprintf( "%.2f", $total_price ),
149
    total_price             => sprintf( "%.2f", $total_price ),
133
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
150
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
134
    title                   => $title,
151
    title                   => $title,
135
    author                  => $author,
152
    author                  => $author,
136
    isbn		    => $isbn,
153
    isbn                    => $isbn,
137
    ean                     => $ean,
154
    ean                     => $ean,
138
    name                    => $name,
155
    name                    => $name,
139
    basket                  => $basket,
156
    basket                  => $basket,
Lines 141-146 $template->param( Link Here
141
    basketgroupname         => $basketgroupname,
158
    basketgroupname         => $basketgroupname,
142
    from_placed_on          => $from_date,
159
    from_placed_on          => $from_date,
143
    to_placed_on            => $to_date,
160
    to_placed_on            => $to_date,
161
    bp_loop                 => $bp_loop,
144
    debug                   => $debug || $input->param('debug') || 0,
162
    debug                   => $debug || $input->param('debug') || 0,
145
    uc(C4::Context->preference("marcflavour")) => 1
163
    uc(C4::Context->preference("marcflavour")) => 1
146
);
164
);
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2795-2800 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2795
  `claimed_date` date default NULL, -- last date a claim was generated
2795
  `claimed_date` date default NULL, -- last date a claim was generated
2796
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2796
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2797
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2797
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2798
  `orderstatus` tinyint(2) default 0, -- the current status for this line item
2798
  PRIMARY KEY  (`ordernumber`),
2799
  PRIMARY KEY  (`ordernumber`),
2799
  KEY `basketno` (`basketno`),
2800
  KEY `basketno` (`basketno`),
2800
  KEY `biblionumber` (`biblionumber`),
2801
  KEY `biblionumber` (`biblionumber`),
(-)a/installer/data/mysql/updatedatabase.pl (+16 lines)
Lines 6772-6777 if ( CheckVersion($DBversion) ) { Link Here
6772
}
6772
}
6773
6773
6774
6774
6775
6776
6777
6778
6779
$DBversion = "3.13.00.XXX";
6780
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6781
    my $return_count;
6782
    $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus tinyint(2) DEFAULT 0 AFTER parent_ordernumber");
6783
    $dbh->do("UPDATE aqorders SET orderstatus=1 WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)");
6784
    $dbh->do("UPDATE aqorders SET orderstatus=2 WHERE quantity > quantityreceived AND quantityreceived > 0");
6785
    $dbh->do("UPDATE aqorders SET orderstatus=3 WHERE quantity=quantityreceived");
6786
    $dbh->do("UPDATE aqorders SET orderstatus=4 WHERE datecancellationprinted IS NOT NULL");
6787
    print "Upgrade to $DBversion done (Add category ORDRSTATUS values in authorised_values table)\n";
6788
    SetVersion($DBversion);
6789
}
6790
6775
=head1 FUNCTIONS
6791
=head1 FUNCTIONS
6776
6792
6777
=head2 TableExists($table)
6793
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-28 / +73 lines)
Lines 1-6 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( suggestions_loop ) %]Orders search &rsaquo; Search results[% ELSE %]Order search[% END %]</title>
3
<title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( order_loop ) %]Orders search &rsaquo; Search results[% ELSE %]Order search[% END %]</title>
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'calendar.inc' %]
6
[% INCLUDE 'calendar.inc' %]
Lines 24-30 Link Here
24
[% INCLUDE 'header.inc' %]
24
[% INCLUDE 'header.inc' %]
25
[% INCLUDE 'acquisitions-search.inc' %]
25
[% INCLUDE 'acquisitions-search.inc' %]
26
26
27
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; [% IF ( suggestions_loop ) %]<a href="/cgi-bin/koha/acqui/histsearch.pl">Orders search</a> &rsaquo; Search results[% ELSE %]Order search[% END %]</div>
27
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; [% IF ( order_loop ) %]<a href="/cgi-bin/koha/acqui/histsearch.pl">Orders search</a> &rsaquo; Search results[% ELSE %]Order search[% END %]</div>
28
28
29
<div id="doc3" class="yui-t2">
29
<div id="doc3" class="yui-t2">
30
   
30
   
Lines 32-38 Link Here
32
	<div id="yui-main">
32
	<div id="yui-main">
33
	<div class="yui-b">
33
	<div class="yui-b">
34
	
34
	
35
		[% UNLESS ( suggestions_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
35
[% UNLESS ( order_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
36
<fieldset class="rows">
36
<fieldset class="rows">
37
	<legend>Search Orders</legend>
37
	<legend>Search Orders</legend>
38
		<ol>
38
		<ol>
Lines 49-54 Link Here
49
            <label for="basketgroupname">Basket group:</label>
49
            <label for="basketgroupname">Basket group:</label>
50
            <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroupname %]" />
50
            <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroupname %]" />
51
        </li>
51
        </li>
52
53
        <li>
54
            <label for="orderstatus">Order Status: </label>
55
            <select name="orderstatus" id="orderstatus">
56
                <option value=""></option>
57
                <option value="0">New</option>
58
                <option value="1">Ordered</option>
59
                <option value="2">Partial</option>
60
                <option value="3">Complete</option>
61
                <option value="4">Deleted</option>
62
            </select>
63
        </li>
64
65
        <li>
66
            <label for="fund">Fund: </label>
67
            <select name="budget" id="fund">
68
                <option value="">All funds</option>
69
                [% FOREACH bp_loo IN bp_loop %]
70
                    <optgroup label="[% bp_loo.budget_period_description %]">
71
                    [% FOREACH h_loo IN bp_loo.hierarchy %]
72
                        <option type="text" value="[% h_loo.budget_id %]" branchcode="[% h_loo.budget_branchcode %]">
73
                            [% h_loo.budget_display_name %]
74
                        </option>
75
                    [% END %]
76
                    </optgroup>
77
                [% END %]
78
            </select>
79
        </li>
80
52
		<li><label for="from">From: </label> 
81
		<li><label for="from">From: </label> 
53
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
82
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
54
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
83
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
Lines 62-72 Link Here
62
    <input type="hidden" name="do_search" value="1" />
91
    <input type="hidden" name="do_search" value="1" />
63
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
92
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
64
	</form>[% END %]
93
	</form>[% END %]
65
    [% IF ( suggestions_loop ) %]<h1>Search results</h1>
94
    [% IF ( order_loop ) %]<h1>Search results</h1>
66
	<div id="acqui_histsearch">
95
	<div id="acqui_histsearch">
67
        <table id="histsearcht">
96
        <table id="histsearcht">
68
            <thead>
97
            <thead>
69
			<tr>
98
			<tr>
99
                <th>Order line</th>
70
				<th>Basket</th>
100
				<th>Basket</th>
71
				<th>Basket group</th>
101
				<th>Basket group</th>
72
                <th>Invoice number</th>
102
                <th>Invoice number</th>
Lines 75-115 Link Here
75
				<th>Vendor</th>
105
				<th>Vendor</th>
76
				<th>Placed on</th>
106
				<th>Placed on</th>
77
				<th>Received on</th>
107
				<th>Received on</th>
78
				<th>Quantity ordered</th>
108
                <th>Status</th>
109
                <th>Quantity received</th>
110
                <th>Pending order</th>
79
				<th>Unit cost</th>
111
				<th>Unit cost</th>
112
                <th>Fund</th>
80
			</tr>
113
			</tr>
81
            </thead>
114
            </thead>
82
            <tbody>
115
            <tbody>
83
			[% FOREACH suggestions_loo IN suggestions_loop %]
116
            [% FOREACH order IN order_loop %]
84
				<tr>
117
                <tr>
85
                    <td>[% suggestions_loo.basketname %] (<a href="basket.pl?basketno=[% suggestions_loo.basketno %]">[% suggestions_loo.basketno %]</a>)</td>
118
                    <td>[% order.parent_ordernumber %]</td>
119
                    <td>[% order.basketname %] (<a href="basket.pl?basketno=[% order.basketno %]">[% order.basketno %]</a>)</td>
86
                    <td>
120
                    <td>
87
                        [% IF ( suggestions_loo.basketgroupid ) %]
121
                        [% IF ( order.basketgroupid ) %]
88
                            [% suggestions_loo.groupname %] (<a href="basketgroup.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.basketgroupid %]</a>)
122
                            [% order.groupname %] (<a href="basketgroup.pl?booksellerid=[% order.id %]">[% order.basketgroupid %]</a>)
89
                        [% ELSE %]
123
                        [% ELSE %]
90
                            &nbsp;
124
                            &nbsp;
91
                        [% END %]
125
                        [% END %]
92
                    </td>
126
                    </td>
93
					<td>[% IF ( suggestions_loo.invoicenumber ) %]
127
                    <td>[% IF ( order.invoicenumber ) %]
94
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% suggestions_loo.invoicenumber %]">[% suggestions_loo.invoicenumber %]</a>
128
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoicenumber %]">[% order.invoicenumber %]</a>
95
					    [% ELSE %]
129
                        [% ELSE %]
96
					        &nbsp;
130
                            &nbsp;
97
					    [% END %]
131
                        [% END %]
98
					</td>
132
                    </td>
99
                    <td>[% suggestions_loo.ordernumber %]</td>
133
                    <td>[% order.ordernumber %]</td>
100
					<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestions_loo.biblionumber %]">[% suggestions_loo.title |html %]</a>
134
                    <td>
101
                        <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td>
135
                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a>
102
					<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td>
136
                        <br />[% order.author %] <br /> [% IF ( order.internalnotes ) %][% order.internalnotes %]<br />[% END %][% order.isbn %]</td>
103
					<td>[% suggestions_loo.creationdate | $KohaDates %]</td>
137
                    <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id %]">[% order.name %]</a></td>
138
                    <td>[% order.creationdate | $KohaDates %]</td>
139
                    <td>
140
                        [% IF order.datereceived %]
141
                            [% order.datereceived | $KohaDates %]
142
                        [% END %]
143
                    </td>
104
                    <td>
144
                    <td>
105
                        [% IF suggestions_loo.datereceived %]
145
                        [% SWITCH order.orderstatus %]
106
                            [% suggestions_loo.datereceived | $KohaDates %]
146
                            [% CASE '0' %]New
147
                            [% CASE '1' %]Ordered
148
                            [% CASE '2' %]Partial
149
                            [% CASE '3' %]Complete
150
                            [% CASE '4' %]Deleted
107
                        [% END %]
151
                        [% END %]
108
                    </td>
152
                    </td>
109
					<td>[% suggestions_loo.quantity %]</td>
153
                    <td>[% order.quantityreceived %]</td>
110
					<td>[% suggestions_loo.ecost %]</td>
154
                    <td>[% order.quantity %]</td>
111
				</tr>
155
                    <td>[% order.ecost %]</td>
112
			[% END %]
156
                    <td>[% order.budget_name %]</td>
157
                </tr>
158
            [% END %]
113
            </tbody>
159
            </tbody>
114
		</table>
160
		</table>
115
	</div>[% ELSE %][% END %]
161
	</div>[% ELSE %][% END %]
116
- 

Return to bug 5336