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 1121-1127 The following keys are used: "biblionumber", "title", "basketno", "quantity", "n Link Here
1121
1165
1122
sub NewOrder {
1166
sub NewOrder {
1123
    my $orderinfo = shift;
1167
    my $orderinfo = shift;
1124
#### ------------------------------
1168
    my $parent_ordernumber = shift;
1169
1125
    my $dbh = C4::Context->dbh;
1170
    my $dbh = C4::Context->dbh;
1126
    my @params;
1171
    my @params;
1127
1172
Lines 1348-1354 sub ModReceiveOrder { Link Here
1348
        # (entirely received)
1393
        # (entirely received)
1349
        $sth=$dbh->prepare("
1394
        $sth=$dbh->prepare("
1350
            UPDATE aqorders
1395
            UPDATE aqorders
1351
            SET quantity = ?
1396
            SET quantity = ?,
1397
                orderstatus = 2
1352
            WHERE ordernumber = ?
1398
            WHERE ordernumber = ?
1353
        ");
1399
        ");
1354
1400
Lines 1376-1382 sub ModReceiveOrder { Link Here
1376
    } else {
1422
    } else {
1377
        $sth=$dbh->prepare("update aqorders
1423
        $sth=$dbh->prepare("update aqorders
1378
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1424
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1379
                                unitprice=?,rrp=?,ecost=?
1425
                                unitprice=?,rrp=?,ecost=?,orderstatus=3
1380
                            where biblionumber=? and ordernumber=?");
1426
                            where biblionumber=? and ordernumber=?");
1381
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1427
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1382
        $sth->finish;
1428
        $sth->finish;
Lines 1426-1432 sub CancelReceipt { Link Here
1426
            UPDATE aqorders
1472
            UPDATE aqorders
1427
            SET quantityreceived = ?,
1473
            SET quantityreceived = ?,
1428
                datereceived = ?,
1474
                datereceived = ?,
1429
                invoiceid = ?
1475
                invoiceid = ?,
1476
                orderstatus = 1
1430
            WHERE ordernumber = ?
1477
            WHERE ordernumber = ?
1431
        };
1478
        };
1432
        $sth = $dbh->prepare($query);
1479
        $sth = $dbh->prepare($query);
Lines 1453-1459 sub CancelReceipt { Link Here
1453
        }
1500
        }
1454
        $query = qq{
1501
        $query = qq{
1455
            UPDATE aqorders
1502
            UPDATE aqorders
1456
            SET quantity = ?
1503
            SET quantity = ?,
1504
                orderstatus = 1
1457
            WHERE ordernumber = ?
1505
            WHERE ordernumber = ?
1458
        };
1506
        };
1459
        $sth = $dbh->prepare($query);
1507
        $sth = $dbh->prepare($query);
Lines 1593-1599 sub DelOrder { Link Here
1593
    my $dbh = C4::Context->dbh;
1641
    my $dbh = C4::Context->dbh;
1594
    my $query = "
1642
    my $query = "
1595
        UPDATE aqorders
1643
        UPDATE aqorders
1596
        SET    datecancellationprinted=now()
1644
        SET    datecancellationprinted=now(), orderstatus=4
1597
        WHERE  biblionumber=? AND ordernumber=?
1645
        WHERE  biblionumber=? AND ordernumber=?
1598
    ";
1646
    ";
1599
    my $sth = $dbh->prepare($query);
1647
    my $sth = $dbh->prepare($query);
Lines 2012-2017 sub GetHistory { Link Here
2012
    my $basket = $params{basket};
2060
    my $basket = $params{basket};
2013
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
2061
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
2014
    my $basketgroupname = $params{basketgroupname};
2062
    my $basketgroupname = $params{basketgroupname};
2063
    my $budget = $params{budget};
2064
    my $orderstatus = $params{orderstatus};
2065
2015
    my @order_loop;
2066
    my @order_loop;
2016
    my $total_qty         = 0;
2067
    my $total_qty         = 0;
2017
    my $total_qtyreceived = 0;
2068
    my $total_qtyreceived = 0;
Lines 2020-2029 sub GetHistory { Link Here
2020
    my $dbh   = C4::Context->dbh;
2071
    my $dbh   = C4::Context->dbh;
2021
    my $query ="
2072
    my $query ="
2022
        SELECT
2073
        SELECT
2023
            biblio.title,
2074
            COALESCE(biblio.title,     deletedbiblio.title)     AS title,
2024
            biblio.author,
2075
            COALESCE(biblio.author,    deletedbiblio.author)    AS author,
2025
	    biblioitems.isbn,
2076
            COALESCE(biblioitems.isbn, deletedbiblioitems.isbn) AS isbn,
2026
        biblioitems.ean,
2077
            COALESCE(biblioitems.ean,  deletedbiblioitems.ean)  AS ean,
2027
            aqorders.basketno,
2078
            aqorders.basketno,
2028
            aqbasket.basketname,
2079
            aqbasket.basketname,
2029
            aqbasket.basketgroupid,
2080
            aqbasket.basketgroupid,
Lines 2038-2056 sub GetHistory { Link Here
2038
            aqorders.invoiceid,
2089
            aqorders.invoiceid,
2039
            aqinvoices.invoicenumber,
2090
            aqinvoices.invoicenumber,
2040
            aqbooksellers.id as id,
2091
            aqbooksellers.id as id,
2041
            aqorders.biblionumber
2092
            aqorders.biblionumber,
2093
            aqorders.orderstatus,
2094
            aqorders.parent_ordernumber,
2095
            aqbudgets.budget_name
2096
            ";
2097
    $query .= ", aqbudgets.budget_id AS budget" if defined $budget;
2098
    $query .= "
2042
        FROM aqorders
2099
        FROM aqorders
2043
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
2100
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
2044
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
2101
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
2045
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
2102
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
2046
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
2103
        LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
2047
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
2104
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
2048
    LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid";
2105
        LEFT JOIN aqbudgets ON aqorders.budget_id=aqbudgets.budget_id
2106
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
2107
        LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber
2108
        LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber
2109
        ";
2049
2110
2050
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
2111
    if ( C4::Context->preference("IndependentBranches") ) {
2051
    if ( C4::Context->preference("IndependentBranches") );
2112
        $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber";
2113
    }
2052
2114
2053
    $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
2115
    $query .= " WHERE 1 ";
2116
2117
    $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne '4';
2054
2118
2055
    my @query_params  = ();
2119
    my @query_params  = ();
2056
2120
Lines 2069-2075 sub GetHistory { Link Here
2069
        $query .= " AND biblioitems.isbn LIKE ? ";
2133
        $query .= " AND biblioitems.isbn LIKE ? ";
2070
        push @query_params, "%$isbn%";
2134
        push @query_params, "%$isbn%";
2071
    }
2135
    }
2072
    if ( defined $ean and $ean ) {
2136
    if ( $ean ) {
2073
        $query .= " AND biblioitems.ean = ? ";
2137
        $query .= " AND biblioitems.ean = ? ";
2074
        push @query_params, "$ean";
2138
        push @query_params, "$ean";
2075
    }
2139
    }
Lines 2078-2083 sub GetHistory { Link Here
2078
        push @query_params, "%$name%";
2142
        push @query_params, "%$name%";
2079
    }
2143
    }
2080
2144
2145
    if ( $budget ) {
2146
        $query .= " AND aqbudgets.budget_id = ? ";
2147
        push @query_params, "$budget";
2148
    }
2149
2081
    if ( $from_placed_on ) {
2150
    if ( $from_placed_on ) {
2082
        $query .= " AND creationdate >= ? ";
2151
        $query .= " AND creationdate >= ? ";
2083
        push @query_params, $from_placed_on;
2152
        push @query_params, $from_placed_on;
Lines 2088-2093 sub GetHistory { Link Here
2088
        push @query_params, $to_placed_on;
2157
        push @query_params, $to_placed_on;
2089
    }
2158
    }
2090
2159
2160
    if ( defined $orderstatus and $orderstatus ne '') {
2161
        $query .= " AND aqorders.orderstatus = ? ";
2162
        push @query_params, "$orderstatus";
2163
    }
2164
2091
    if ($basket) {
2165
    if ($basket) {
2092
        if ($basket =~ m/^\d+$/) {
2166
        if ($basket =~ m/^\d+$/) {
2093
            $query .= " AND aqorders.basketno = ? ";
2167
            $query .= " AND aqorders.basketno = ? ";
Lines 2123-2131 sub GetHistory { Link Here
2123
        $line->{count} = $cnt++;
2197
        $line->{count} = $cnt++;
2124
        $line->{toggle} = 1 if $cnt % 2;
2198
        $line->{toggle} = 1 if $cnt % 2;
2125
        push @order_loop, $line;
2199
        push @order_loop, $line;
2126
        $total_qty         += $line->{'quantity'};
2200
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
2127
        $total_qtyreceived += $line->{'quantityreceived'};
2201
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
2128
        $total_price       += $line->{'quantity'} * $line->{'ecost'};
2202
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
2129
    }
2203
    }
2130
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2204
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2131
}
2205
}
Lines 2622-2627 sub DelInvoice { Link Here
2622
    return;
2696
    return;
2623
}
2697
}
2624
2698
2699
=head3 GetBiblioCountByBasketno
2700
2701
$biblio_count = &GetBiblioCountByBasketno($basketno);
2702
2703
Looks up the biblio's count that has basketno value $basketno
2704
2705
Returns a quantity
2706
2707
=cut
2708
2709
sub GetBiblioCountByBasketno {
2710
    my ($basketno) = @_;
2711
    my $dbh          = C4::Context->dbh;
2712
    my $query        = "
2713
        SELECT COUNT( DISTINCT( biblionumber ) )
2714
        FROM   aqorders
2715
        WHERE  basketno = ?
2716
            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
2717
        ";
2718
2719
    my $sth = $dbh->prepare($query);
2720
    $sth->execute($basketno);
2721
    return $sth->fetchrow;
2722
}
2723
2625
1;
2724
1;
2626
__END__
2725
__END__
2627
2726
(-)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 2933-2938 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2933
  `claimed_date` date default NULL, -- last date a claim was generated
2933
  `claimed_date` date default NULL, -- last date a claim was generated
2934
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2934
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2935
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2935
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2936
  `orderstatus` tinyint(2) default 0, -- the current status for this line item
2936
  PRIMARY KEY  (`ordernumber`),
2937
  PRIMARY KEY  (`ordernumber`),
2937
  KEY `basketno` (`basketno`),
2938
  KEY `basketno` (`basketno`),
2938
  KEY `biblionumber` (`biblionumber`),
2939
  KEY `biblionumber` (`biblionumber`),
(-)a/installer/data/mysql/updatedatabase.pl (+18 lines)
Lines 7155-7160 if ( CheckVersion($DBversion) ) { Link Here
7155
    SetVersion($DBversion);
7155
    SetVersion($DBversion);
7156
}
7156
}
7157
7157
7158
7159
7160
7161
7162
7163
7164
$DBversion = "3.13.00.XXX";
7165
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7166
    my $return_count;
7167
    $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus tinyint(2) DEFAULT 0 AFTER parent_ordernumber");
7168
    $dbh->do("UPDATE aqorders SET orderstatus=1 WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)");
7169
    $dbh->do("UPDATE aqorders SET orderstatus=2 WHERE quantity > quantityreceived AND quantityreceived > 0");
7170
    $dbh->do("UPDATE aqorders SET orderstatus=3 WHERE quantity=quantityreceived");
7171
    $dbh->do("UPDATE aqorders SET orderstatus=4 WHERE datecancellationprinted IS NOT NULL");
7172
    print "Upgrade to $DBversion done (Add category ORDRSTATUS values in authorised_values table)\n";
7173
    SetVersion($DBversion);
7174
}
7175
7158
=head1 FUNCTIONS
7176
=head1 FUNCTIONS
7159
7177
7160
=head2 TableExists($table)
7178
=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