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

(-)a/C4/Acquisition.pm (-23 / +122 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 76-81 BEGIN { Link Here
76
        &GetItemnumbersFromOrder
76
        &GetItemnumbersFromOrder
77
77
78
        &AddClaim
78
        &AddClaim
79
        &GetBiblioCountByBasketno
79
    );
80
    );
80
}
81
}
81
82
Lines 215-221 sub NewBasket { Link Here
215
216
216
  &CloseBasket($basketno);
217
  &CloseBasket($basketno);
217
218
218
close a basket (becomes unmodifiable,except for recieves)
219
close a basket (becomes unmodifiable, except for receives)
219
220
220
=cut
221
=cut
221
222
Lines 229-234 sub CloseBasket { Link Here
229
    ";
230
    ";
230
    my $sth = $dbh->prepare($query);
231
    my $sth = $dbh->prepare($query);
231
    $sth->execute($basketno);
232
    $sth->execute($basketno);
233
234
    my @orders = GetOrders($basketno);
235
    foreach my $order (@orders) {
236
        $query = qq{
237
            UPDATE aqorders
238
            SET orderstatus = 1
239
            WHERE ordernumber = ?;
240
        };
241
        $sth = $dbh->prepare($query);
242
        $sth->execute($order->{'ordernumber'});
243
    }
244
}
245
246
=head3 ReopenBasket
247
248
  &ReopenBasket($basketno);
249
250
reopen a basket
251
252
=cut
253
254
sub ReopenBasket {
255
    my ($basketno) = @_;
256
    my $dbh        = C4::Context->dbh;
257
    my $query = "
258
        UPDATE aqbasket
259
        SET    closedate=NULL
260
        WHERE  basketno=?
261
    ";
262
    my $sth = $dbh->prepare($query);
263
    $sth->execute($basketno);
264
265
    my @orders = GetOrders($basketno);
266
    foreach my $order (@orders) {
267
        $query = qq{
268
            UPDATE aqorders
269
            SET orderstatus = 0
270
            WHERE ordernumber = ?;
271
        };
272
        $sth = $dbh->prepare($query);
273
        $sth->execute($order->{'ordernumber'});
274
    }
232
}
275
}
233
276
234
#------------------------------------------------------------#
277
#------------------------------------------------------------#
Lines 468-473 sub ModBasket { Link Here
468
    my $dbh = C4::Context->dbh;
511
    my $dbh = C4::Context->dbh;
469
    my $sth = $dbh->prepare($query);
512
    my $sth = $dbh->prepare($query);
470
    $sth->execute(@params);
513
    $sth->execute(@params);
514
471
    $sth->finish;
515
    $sth->finish;
472
}
516
}
473
517
Lines 1118-1124 The following keys are used: "biblionumber", "title", "basketno", "quantity", "n Link Here
1118
1162
1119
sub NewOrder {
1163
sub NewOrder {
1120
    my $orderinfo = shift;
1164
    my $orderinfo = shift;
1121
#### ------------------------------
1165
    my $parent_ordernumber = shift;
1166
1122
    my $dbh = C4::Context->dbh;
1167
    my $dbh = C4::Context->dbh;
1123
    my @params;
1168
    my @params;
1124
1169
Lines 1338-1344 sub ModReceiveOrder { Link Here
1338
        # (entirely received)
1383
        # (entirely received)
1339
        $sth=$dbh->prepare("
1384
        $sth=$dbh->prepare("
1340
            UPDATE aqorders
1385
            UPDATE aqorders
1341
            SET quantity = ?
1386
            SET quantity = ?,
1387
                orderstatus = 2
1342
            WHERE ordernumber = ?
1388
            WHERE ordernumber = ?
1343
        ");
1389
        ");
1344
1390
Lines 1366-1372 sub ModReceiveOrder { Link Here
1366
    } else {
1412
    } else {
1367
        $sth=$dbh->prepare("update aqorders
1413
        $sth=$dbh->prepare("update aqorders
1368
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1414
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1369
                                unitprice=?,rrp=?,ecost=?
1415
                                unitprice=?,rrp=?,ecost=?,orderstatus=3
1370
                            where biblionumber=? and ordernumber=?");
1416
                            where biblionumber=? and ordernumber=?");
1371
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1417
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1372
        $sth->finish;
1418
        $sth->finish;
Lines 1416-1422 sub CancelReceipt { Link Here
1416
            UPDATE aqorders
1462
            UPDATE aqorders
1417
            SET quantityreceived = ?,
1463
            SET quantityreceived = ?,
1418
                datereceived = ?,
1464
                datereceived = ?,
1419
                invoiceid = ?
1465
                invoiceid = ?,
1466
                orderstatus = 1
1420
            WHERE ordernumber = ?
1467
            WHERE ordernumber = ?
1421
        };
1468
        };
1422
        $sth = $dbh->prepare($query);
1469
        $sth = $dbh->prepare($query);
Lines 1443-1449 sub CancelReceipt { Link Here
1443
        }
1490
        }
1444
        $query = qq{
1491
        $query = qq{
1445
            UPDATE aqorders
1492
            UPDATE aqorders
1446
            SET quantity = ?
1493
            SET quantity = ?,
1494
                orderstatus = 1
1447
            WHERE ordernumber = ?
1495
            WHERE ordernumber = ?
1448
        };
1496
        };
1449
        $sth = $dbh->prepare($query);
1497
        $sth = $dbh->prepare($query);
Lines 1583-1589 sub DelOrder { Link Here
1583
    my $dbh = C4::Context->dbh;
1631
    my $dbh = C4::Context->dbh;
1584
    my $query = "
1632
    my $query = "
1585
        UPDATE aqorders
1633
        UPDATE aqorders
1586
        SET    datecancellationprinted=now()
1634
        SET    datecancellationprinted=now(), orderstatus=4
1587
        WHERE  biblionumber=? AND ordernumber=?
1635
        WHERE  biblionumber=? AND ordernumber=?
1588
    ";
1636
    ";
1589
    my $sth = $dbh->prepare($query);
1637
    my $sth = $dbh->prepare($query);
Lines 1944-1949 sub GetHistory { Link Here
1944
    my $basket = $params{basket};
1992
    my $basket = $params{basket};
1945
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
1993
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
1946
    my $basketgroupname = $params{basketgroupname};
1994
    my $basketgroupname = $params{basketgroupname};
1995
    my $budget = $params{budget};
1996
    my $orderstatus = $params{orderstatus};
1997
1947
    my @order_loop;
1998
    my @order_loop;
1948
    my $total_qty         = 0;
1999
    my $total_qty         = 0;
1949
    my $total_qtyreceived = 0;
2000
    my $total_qtyreceived = 0;
Lines 1952-1961 sub GetHistory { Link Here
1952
    my $dbh   = C4::Context->dbh;
2003
    my $dbh   = C4::Context->dbh;
1953
    my $query ="
2004
    my $query ="
1954
        SELECT
2005
        SELECT
1955
            biblio.title,
2006
            COALESCE(biblio.title,     deletedbiblio.title)     AS title,
1956
            biblio.author,
2007
            COALESCE(biblio.author,    deletedbiblio.author)    AS author,
1957
	    biblioitems.isbn,
2008
            COALESCE(biblioitems.isbn, deletedbiblioitems.isbn) AS isbn,
1958
        biblioitems.ean,
2009
            COALESCE(biblioitems.ean,  deletedbiblioitems.ean)  AS ean,
1959
            aqorders.basketno,
2010
            aqorders.basketno,
1960
            aqbasket.basketname,
2011
            aqbasket.basketname,
1961
            aqbasket.basketgroupid,
2012
            aqbasket.basketgroupid,
Lines 1970-1988 sub GetHistory { Link Here
1970
            aqorders.invoiceid,
2021
            aqorders.invoiceid,
1971
            aqinvoices.invoicenumber,
2022
            aqinvoices.invoicenumber,
1972
            aqbooksellers.id as id,
2023
            aqbooksellers.id as id,
1973
            aqorders.biblionumber
2024
            aqorders.biblionumber,
2025
            aqorders.orderstatus,
2026
            aqorders.parent_ordernumber,
2027
            aqbudgets.budget_name
2028
            ";
2029
    $query .= ", aqbudgets.budget_id AS budget" if defined $budget;
2030
    $query .= "
1974
        FROM aqorders
2031
        FROM aqorders
1975
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
2032
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
1976
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
2033
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
1977
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
2034
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
1978
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
2035
        LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
1979
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
2036
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
1980
    LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid";
2037
        LEFT JOIN aqbudgets ON aqorders.budget_id=aqbudgets.budget_id
2038
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
2039
        LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber
2040
        LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber
2041
        ";
1981
2042
1982
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
2043
    if ( C4::Context->preference("IndependentBranches") ) {
1983
    if ( C4::Context->preference("IndependentBranches") );
2044
        $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber";
2045
    }
1984
2046
1985
    $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
2047
    $query .= " WHERE 1 ";
2048
2049
    $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne '4';
1986
2050
1987
    my @query_params  = ();
2051
    my @query_params  = ();
1988
2052
Lines 2001-2007 sub GetHistory { Link Here
2001
        $query .= " AND biblioitems.isbn LIKE ? ";
2065
        $query .= " AND biblioitems.isbn LIKE ? ";
2002
        push @query_params, "%$isbn%";
2066
        push @query_params, "%$isbn%";
2003
    }
2067
    }
2004
    if ( defined $ean and $ean ) {
2068
    if ( $ean ) {
2005
        $query .= " AND biblioitems.ean = ? ";
2069
        $query .= " AND biblioitems.ean = ? ";
2006
        push @query_params, "$ean";
2070
        push @query_params, "$ean";
2007
    }
2071
    }
Lines 2010-2015 sub GetHistory { Link Here
2010
        push @query_params, "%$name%";
2074
        push @query_params, "%$name%";
2011
    }
2075
    }
2012
2076
2077
    if ( $budget ) {
2078
        $query .= " AND aqbudgets.budget_id = ? ";
2079
        push @query_params, "$budget";
2080
    }
2081
2013
    if ( $from_placed_on ) {
2082
    if ( $from_placed_on ) {
2014
        $query .= " AND creationdate >= ? ";
2083
        $query .= " AND creationdate >= ? ";
2015
        push @query_params, $from_placed_on;
2084
        push @query_params, $from_placed_on;
Lines 2020-2025 sub GetHistory { Link Here
2020
        push @query_params, $to_placed_on;
2089
        push @query_params, $to_placed_on;
2021
    }
2090
    }
2022
2091
2092
    if ( defined $orderstatus and $orderstatus ne '') {
2093
        $query .= " AND aqorders.orderstatus = ? ";
2094
        push @query_params, "$orderstatus";
2095
    }
2096
2023
    if ($basket) {
2097
    if ($basket) {
2024
        if ($basket =~ m/^\d+$/) {
2098
        if ($basket =~ m/^\d+$/) {
2025
            $query .= " AND aqorders.basketno = ? ";
2099
            $query .= " AND aqorders.basketno = ? ";
Lines 2055-2063 sub GetHistory { Link Here
2055
        $line->{count} = $cnt++;
2129
        $line->{count} = $cnt++;
2056
        $line->{toggle} = 1 if $cnt % 2;
2130
        $line->{toggle} = 1 if $cnt % 2;
2057
        push @order_loop, $line;
2131
        push @order_loop, $line;
2058
        $total_qty         += $line->{'quantity'};
2132
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
2059
        $total_qtyreceived += $line->{'quantityreceived'};
2133
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
2060
        $total_price       += $line->{'quantity'} * $line->{'ecost'};
2134
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
2061
    }
2135
    }
2062
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2136
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2063
}
2137
}
Lines 2554-2559 sub DelInvoice { Link Here
2554
    return;
2628
    return;
2555
}
2629
}
2556
2630
2631
=head3 GetBiblioCountByBasketno
2632
2633
$biblio_count = &GetBiblioCountByBasketno($basketno);
2634
2635
Looks up the biblio's count that has basketno value $basketno
2636
2637
Returns a quantity
2638
2639
=cut
2640
2641
sub GetBiblioCountByBasketno {
2642
    my ($basketno) = @_;
2643
    my $dbh          = C4::Context->dbh;
2644
    my $query        = "
2645
        SELECT COUNT( DISTINCT( biblionumber ) )
2646
        FROM   aqorders
2647
        WHERE  basketno = ?
2648
            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
2649
        ";
2650
2651
    my $sth = $dbh->prepare($query);
2652
    $sth->execute($basketno);
2653
    return $sth->fetchrow;
2654
}
2655
2557
1;
2656
1;
2558
__END__
2657
__END__
2559
2658
(-)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 70-75 my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' ); Link Here
70
my $do_search               = $input->param('do_search') || 0;
72
my $do_search               = $input->param('do_search') || 0;
71
my $from_placed_on          = C4::Dates->new($input->param('from'));
73
my $from_placed_on          = C4::Dates->new($input->param('from'));
72
my $to_placed_on            = C4::Dates->new($input->param('to'));
74
my $to_placed_on            = C4::Dates->new($input->param('to'));
75
my $budget                  = $input->param( 'budget' );
76
my $orderstatus             = $input->param( 'orderstatus' );
77
73
if ( not $input->param('from') ) {
78
if ( not $input->param('from') ) {
74
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
79
    # FIXME Dirty but we can't sent a Date::Calc to C4::Dates ?
75
    # We would use a function like Add_Delta_YM(-1, 0, 0);
80
    # We would use a function like Add_Delta_YM(-1, 0, 0);
Lines 110-130 if ($do_search) { Link Here
110
        basket => $basket,
115
        basket => $basket,
111
        booksellerinvoicenumber => $booksellerinvoicenumber,
116
        booksellerinvoicenumber => $booksellerinvoicenumber,
112
        basketgroupname => $basketgroupname,
117
        basketgroupname => $basketgroupname,
118
        budget => $budget,
119
        orderstatus => $orderstatus,
113
    );
120
    );
114
}
121
}
115
122
116
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
123
my $from_date = $from_placed_on ? $from_placed_on->output('syspref') : undef;
117
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
124
my $to_date = $to_placed_on ? $to_placed_on->output('syspref') : undef;
118
125
126
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
127
my $bp_loop = $budgetperiods;
128
for my $bp ( @{$budgetperiods} ) {
129
    my $hierarchy = C4::Budgets::GetBudgetHierarchy( $$bp{budget_period_id} );
130
    for my $budget ( @{$hierarchy} ) {
131
        $$budget{budget_display_name} = sprintf("%s", ">" x $$budget{depth} . $$budget{budget_name});
132
    }
133
    $$bp{hierarchy} = $hierarchy;
134
}
135
119
$template->param(
136
$template->param(
120
    suggestions_loop        => $order_loop,
137
    order_loop              => $order_loop,
121
    total_qty               => $total_qty,
138
    total_qty               => $total_qty,
122
    total_qtyreceived       => $total_qtyreceived,
139
    total_qtyreceived       => $total_qtyreceived,
123
    total_price             => sprintf( "%.2f", $total_price ),
140
    total_price             => sprintf( "%.2f", $total_price ),
124
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
141
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
125
    title                   => $title,
142
    title                   => $title,
126
    author                  => $author,
143
    author                  => $author,
127
    isbn		    => $isbn,
144
    isbn                    => $isbn,
128
    ean                     => $ean,
145
    ean                     => $ean,
129
    name                    => $name,
146
    name                    => $name,
130
    basket                  => $basket,
147
    basket                  => $basket,
Lines 132-137 $template->param( Link Here
132
    basketgroupname         => $basketgroupname,
149
    basketgroupname         => $basketgroupname,
133
    from_placed_on          => $from_date,
150
    from_placed_on          => $from_date,
134
    to_placed_on            => $to_date,
151
    to_placed_on            => $to_date,
152
    bp_loop                 => $bp_loop,
135
    debug                   => $debug || $input->param('debug') || 0,
153
    debug                   => $debug || $input->param('debug') || 0,
136
    uc(C4::Context->preference("marcflavour")) => 1
154
    uc(C4::Context->preference("marcflavour")) => 1
137
);
155
);
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2931-2936 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2931
  `claimed_date` date default NULL, -- last date a claim was generated
2931
  `claimed_date` date default NULL, -- last date a claim was generated
2932
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2932
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2933
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2933
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2934
  `orderstatus` tinyint(2) default 0, -- the current status for this line item
2934
  PRIMARY KEY  (`ordernumber`),
2935
  PRIMARY KEY  (`ordernumber`),
2935
  KEY `basketno` (`basketno`),
2936
  KEY `basketno` (`basketno`),
2936
  KEY `biblionumber` (`biblionumber`),
2937
  KEY `biblionumber` (`biblionumber`),
(-)a/installer/data/mysql/updatedatabase.pl (+18 lines)
Lines 7104-7109 if ( CheckVersion($DBversion) ) { Link Here
7104
    SetVersion($DBversion);
7104
    SetVersion($DBversion);
7105
}
7105
}
7106
7106
7107
7108
7109
7110
7111
7112
7113
$DBversion = "3.13.00.XXX";
7114
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7115
    my $return_count;
7116
    $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus tinyint(2) DEFAULT 0 AFTER parent_ordernumber");
7117
    $dbh->do("UPDATE aqorders SET orderstatus=1 WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)");
7118
    $dbh->do("UPDATE aqorders SET orderstatus=2 WHERE quantity > quantityreceived AND quantityreceived > 0");
7119
    $dbh->do("UPDATE aqorders SET orderstatus=3 WHERE quantity=quantityreceived");
7120
    $dbh->do("UPDATE aqorders SET orderstatus=4 WHERE datecancellationprinted IS NOT NULL");
7121
    print "Upgrade to $DBversion done (Add category ORDRSTATUS values in authorised_values table)\n";
7122
    SetVersion($DBversion);
7123
}
7124
7107
=head1 FUNCTIONS
7125
=head1 FUNCTIONS
7108
7126
7109
=head2 TableExists($table)
7127
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt (-28 / +74 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 22-28 Link Here
22
[% INCLUDE 'header.inc' %]
22
[% INCLUDE 'header.inc' %]
23
[% INCLUDE 'acquisitions-search.inc' %]
23
[% INCLUDE 'acquisitions-search.inc' %]
24
24
25
<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>
25
<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>
26
26
27
<div id="doc3" class="yui-t2">
27
<div id="doc3" class="yui-t2">
28
   
28
   
Lines 30-36 Link Here
30
	<div id="yui-main">
30
	<div id="yui-main">
31
	<div class="yui-b">
31
	<div class="yui-b">
32
	
32
	
33
		[% UNLESS ( suggestions_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
33
[% UNLESS ( order_loop ) %]<form action="/cgi-bin/koha/acqui/histsearch.pl" method="post">
34
<fieldset class="rows">
34
<fieldset class="rows">
35
	<legend>Search Orders</legend>
35
	<legend>Search Orders</legend>
36
		<ol>
36
		<ol>
Lines 47-52 Link Here
47
            <label for="basketgroupname">Basket group:</label>
47
            <label for="basketgroupname">Basket group:</label>
48
            <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroupname %]" />
48
            <input type="text" name="basketgroupname" id="basketgroupname" value="[% basketgroupname %]" />
49
        </li>
49
        </li>
50
51
        <li>
52
            <label for="orderstatus">Order Status: </label>
53
            <select name="orderstatus" id="orderstatus">
54
                <option value=""></option>
55
                <option value="0">New</option>
56
                <option value="1">Ordered</option>
57
                <option value="2">Partial</option>
58
                <option value="3">Complete</option>
59
                <option value="4">Deleted</option>
60
            </select>
61
        </li>
62
63
        <li>
64
            <label for="fund">Fund: </label>
65
            <select name="budget" id="fund">
66
                <option value="">All funds</option>
67
                [% FOREACH bp_loo IN bp_loop %]
68
                    <optgroup label="[% bp_loo.budget_period_description %]">
69
                    [% FOREACH h_loo IN bp_loo.hierarchy %]
70
                        <option type="text" value="[% h_loo.budget_id %]" branchcode="[% h_loo.budget_branchcode %]">
71
                            [% h_loo.budget_display_name %]
72
                        </option>
73
                    [% END %]
74
                    </optgroup>
75
                [% END %]
76
            </select>
77
        </li>
78
50
		<li><label for="from">From: </label> 
79
		<li><label for="from">From: </label> 
51
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
80
        <input type="text" size="10" id="from" name="from" value="[% from_placed_on %]" class="datepickerfrom" />
52
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
81
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
Lines 60-70 Link Here
60
    <input type="hidden" name="do_search" value="1" />
89
    <input type="hidden" name="do_search" value="1" />
61
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
90
	<fieldset class="action"><input type="submit" value="Search" /></fieldset>
62
	</form>[% END %]
91
	</form>[% END %]
63
    [% IF ( suggestions_loop ) %]<h1>Search results</h1>
92
    [% IF ( order_loop ) %]<h1>Search results</h1>
64
	<div id="acqui_histsearch">
93
	<div id="acqui_histsearch">
65
        <table id="histsearcht">
94
        <table id="histsearcht">
66
            <thead>
95
            <thead>
67
			<tr>
96
			<tr>
97
                <th>Order line</th>
68
				<th>Basket</th>
98
				<th>Basket</th>
69
				<th>Basket group</th>
99
				<th>Basket group</th>
70
                <th>Invoice number</th>
100
                <th>Invoice number</th>
Lines 73-113 Link Here
73
				<th>Vendor</th>
103
				<th>Vendor</th>
74
				<th>Placed on</th>
104
				<th>Placed on</th>
75
				<th>Received on</th>
105
				<th>Received on</th>
76
				<th>Quantity ordered</th>
106
                <th>Status</th>
107
                <th>Quantity received</th>
108
                <th>Pending order</th>
77
				<th>Unit cost</th>
109
				<th>Unit cost</th>
110
                <th>Fund</th>
78
			</tr>
111
			</tr>
79
            </thead>
112
            </thead>
80
            <tbody>
113
            <tbody>
81
			[% FOREACH suggestions_loo IN suggestions_loop %]
114
            [% FOREACH order IN order_loop %]
82
				<tr>
115
                <tr>
83
                    <td>[% suggestions_loo.basketname %] (<a href="basket.pl?basketno=[% suggestions_loo.basketno %]">[% suggestions_loo.basketno %]</a>)</td>
116
                    <td>[% order.parent_ordernumber %]</td>
117
                    <td>[% order.basketname %] (<a href="basket.pl?basketno=[% order.basketno %]">[% order.basketno %]</a>)</td>
84
                    <td>
118
                    <td>
85
                        [% IF ( suggestions_loo.basketgroupid ) %]
119
                        [% IF ( order.basketgroupid ) %]
86
                            [% suggestions_loo.groupname %] (<a href="basketgroup.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.basketgroupid %]</a>)
120
                            [% order.groupname %] (<a href="basketgroup.pl?booksellerid=[% order.id %]">[% order.basketgroupid %]</a>)
87
                        [% ELSE %]
121
                        [% ELSE %]
88
                            &nbsp;
122
                            &nbsp;
89
                        [% END %]
123
                        [% END %]
90
                    </td>
124
                    </td>
91
                    <td>[% IF  suggestions_loo.invoicenumber  %]
125
                    <td>[% IF ( order.invoicenumber ) %]
92
                        <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% suggestions_loo.invoiceid %]">[% suggestions_loo.invoicenumber %]</a>
126
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid %]">[% order.invoicenumber %]</a>
93
					    [% ELSE %]
127
                        [% ELSE %]
94
					        &nbsp;
128
                            &nbsp;
95
					    [% END %]
129
                        [% END %]
96
					</td>
130
                    </td>
97
                    <td>[% suggestions_loo.ordernumber %]</td>
131
                    <td>[% order.ordernumber %]</td>
98
					<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestions_loo.biblionumber %]">[% suggestions_loo.title |html %]</a>
132
                    <td>
99
                        <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td>
133
                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a>
100
					<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td>
134
                        <br />[% order.author %] <br /> [% order.isbn %]
101
					<td>[% suggestions_loo.creationdate | $KohaDates %]</td>
135
                    </td>
136
                    <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id %]">[% order.name %]</a></td>
137
                    <td>[% order.creationdate | $KohaDates %]</td>
138
                    <td>
139
                        [% IF order.datereceived %]
140
                            [% order.datereceived | $KohaDates %]
141
                        [% END %]
142
                    </td>
102
                    <td>
143
                    <td>
103
                        [% IF suggestions_loo.datereceived %]
144
                        [% SWITCH order.orderstatus %]
104
                            [% suggestions_loo.datereceived | $KohaDates %]
145
                            [% CASE '0' %]New
146
                            [% CASE '1' %]Ordered
147
                            [% CASE '2' %]Partial
148
                            [% CASE '3' %]Complete
149
                            [% CASE '4' %]Deleted
105
                        [% END %]
150
                        [% END %]
106
                    </td>
151
                    </td>
107
					<td>[% suggestions_loo.quantity %]</td>
152
                    <td>[% order.quantityreceived %]</td>
108
					<td>[% suggestions_loo.ecost %]</td>
153
                    <td>[% order.quantity %]</td>
109
				</tr>
154
                    <td>[% order.ecost %]</td>
110
			[% END %]
155
                    <td>[% order.budget_name %]</td>
156
                </tr>
157
            [% END %]
111
            </tbody>
158
            </tbody>
112
		</table>
159
		</table>
113
	</div>[% ELSE %][% END %]
160
	</div>[% ELSE %][% END %]
114
- 

Return to bug 5336