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 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 1146-1152 The following keys are used: "biblionumber", "title", "basketno", "quantity", "n Link Here
1146
1190
1147
sub NewOrder {
1191
sub NewOrder {
1148
    my $orderinfo = shift;
1192
    my $orderinfo = shift;
1149
#### ------------------------------
1193
    my $parent_ordernumber = shift;
1194
1150
    my $dbh = C4::Context->dbh;
1195
    my $dbh = C4::Context->dbh;
1151
    my @params;
1196
    my @params;
1152
1197
Lines 1421-1427 sub ModReceiveOrder { Link Here
1421
        # (entirely received)
1466
        # (entirely received)
1422
        $sth=$dbh->prepare("
1467
        $sth=$dbh->prepare("
1423
            UPDATE aqorders
1468
            UPDATE aqorders
1424
            SET quantity = ?
1469
            SET quantity = ?,
1470
                orderstatus = 2
1425
            WHERE ordernumber = ?
1471
            WHERE ordernumber = ?
1426
        ");
1472
        ");
1427
1473
Lines 1448-1454 sub ModReceiveOrder { Link Here
1448
    } else {
1494
    } else {
1449
        $sth=$dbh->prepare("update aqorders
1495
        $sth=$dbh->prepare("update aqorders
1450
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1496
                            set quantityreceived=?,datereceived=?,invoiceid=?,
1451
                                unitprice=?,rrp=?,ecost=?
1497
                                unitprice=?,rrp=?,ecost=?,orderstatus=3
1452
                            where biblionumber=? and ordernumber=?");
1498
                            where biblionumber=? and ordernumber=?");
1453
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1499
        $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$biblionumber,$ordernumber);
1454
        $sth->finish;
1500
        $sth->finish;
Lines 1498-1504 sub CancelReceipt { Link Here
1498
            UPDATE aqorders
1544
            UPDATE aqorders
1499
            SET quantityreceived = ?,
1545
            SET quantityreceived = ?,
1500
                datereceived = ?,
1546
                datereceived = ?,
1501
                invoiceid = ?
1547
                invoiceid = ?,
1548
                orderstatus = 1
1502
            WHERE ordernumber = ?
1549
            WHERE ordernumber = ?
1503
        };
1550
        };
1504
        $sth = $dbh->prepare($query);
1551
        $sth = $dbh->prepare($query);
Lines 1525-1531 sub CancelReceipt { Link Here
1525
        }
1572
        }
1526
        $query = qq{
1573
        $query = qq{
1527
            UPDATE aqorders
1574
            UPDATE aqorders
1528
            SET quantity = ?
1575
            SET quantity = ?,
1576
                orderstatus = 1
1529
            WHERE ordernumber = ?
1577
            WHERE ordernumber = ?
1530
        };
1578
        };
1531
        $sth = $dbh->prepare($query);
1579
        $sth = $dbh->prepare($query);
Lines 1665-1671 sub DelOrder { Link Here
1665
    my $dbh = C4::Context->dbh;
1713
    my $dbh = C4::Context->dbh;
1666
    my $query = "
1714
    my $query = "
1667
        UPDATE aqorders
1715
        UPDATE aqorders
1668
        SET    datecancellationprinted=now()
1716
        SET    datecancellationprinted=now(), orderstatus=4
1669
        WHERE  biblionumber=? AND ordernumber=?
1717
        WHERE  biblionumber=? AND ordernumber=?
1670
    ";
1718
    ";
1671
    my $sth = $dbh->prepare($query);
1719
    my $sth = $dbh->prepare($query);
Lines 2026-2031 sub GetHistory { Link Here
2026
    my $basket = $params{basket};
2074
    my $basket = $params{basket};
2027
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
2075
    my $booksellerinvoicenumber = $params{booksellerinvoicenumber};
2028
    my $basketgroupname = $params{basketgroupname};
2076
    my $basketgroupname = $params{basketgroupname};
2077
    my $budget = $params{budget};
2078
    my $orderstatus = $params{orderstatus};
2079
2029
    my @order_loop;
2080
    my @order_loop;
2030
    my $total_qty         = 0;
2081
    my $total_qty         = 0;
2031
    my $total_qtyreceived = 0;
2082
    my $total_qtyreceived = 0;
Lines 2034-2043 sub GetHistory { Link Here
2034
    my $dbh   = C4::Context->dbh;
2085
    my $dbh   = C4::Context->dbh;
2035
    my $query ="
2086
    my $query ="
2036
        SELECT
2087
        SELECT
2037
            biblio.title,
2088
            COALESCE(biblio.title,     deletedbiblio.title)     AS title,
2038
            biblio.author,
2089
            COALESCE(biblio.author,    deletedbiblio.author)    AS author,
2039
	    biblioitems.isbn,
2090
            COALESCE(biblioitems.isbn, deletedbiblioitems.isbn) AS isbn,
2040
        biblioitems.ean,
2091
            COALESCE(biblioitems.ean,  deletedbiblioitems.ean)  AS ean,
2041
            aqorders.basketno,
2092
            aqorders.basketno,
2042
            aqbasket.basketname,
2093
            aqbasket.basketname,
2043
            aqbasket.basketgroupid,
2094
            aqbasket.basketgroupid,
Lines 2052-2070 sub GetHistory { Link Here
2052
            aqorders.invoiceid,
2103
            aqorders.invoiceid,
2053
            aqinvoices.invoicenumber,
2104
            aqinvoices.invoicenumber,
2054
            aqbooksellers.id as id,
2105
            aqbooksellers.id as id,
2055
            aqorders.biblionumber
2106
            aqorders.biblionumber,
2107
            aqorders.orderstatus,
2108
            aqorders.parent_ordernumber,
2109
            aqbudgets.budget_name
2110
            ";
2111
    $query .= ", aqbudgets.budget_id AS budget" if defined $budget;
2112
    $query .= "
2056
        FROM aqorders
2113
        FROM aqorders
2057
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
2114
        LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
2058
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
2115
        LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
2059
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
2116
        LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
2060
	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
2117
        LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
2061
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
2118
        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
2062
    LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid";
2119
        LEFT JOIN aqbudgets ON aqorders.budget_id=aqbudgets.budget_id
2120
        LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid
2121
        LEFT JOIN deletedbiblio ON deletedbiblio.biblionumber=aqorders.biblionumber
2122
        LEFT JOIN deletedbiblioitems ON deletedbiblioitems.biblionumber=aqorders.biblionumber
2123
        ";
2124
2125
    if ( C4::Context->preference("IndependentBranches") ) {
2126
        $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber";
2127
    }
2063
2128
2064
    $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
2129
    $query .= " WHERE 1 ";
2065
    if ( C4::Context->preference("IndependentBranches") );
2066
2130
2067
    $query .= " WHERE (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') ";
2131
    $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne '4';
2068
2132
2069
    my @query_params  = ();
2133
    my @query_params  = ();
2070
2134
Lines 2083-2089 sub GetHistory { Link Here
2083
        $query .= " AND biblioitems.isbn LIKE ? ";
2147
        $query .= " AND biblioitems.isbn LIKE ? ";
2084
        push @query_params, "%$isbn%";
2148
        push @query_params, "%$isbn%";
2085
    }
2149
    }
2086
    if ( defined $ean and $ean ) {
2150
    if ( $ean ) {
2087
        $query .= " AND biblioitems.ean = ? ";
2151
        $query .= " AND biblioitems.ean = ? ";
2088
        push @query_params, "$ean";
2152
        push @query_params, "$ean";
2089
    }
2153
    }
Lines 2092-2097 sub GetHistory { Link Here
2092
        push @query_params, "%$name%";
2156
        push @query_params, "%$name%";
2093
    }
2157
    }
2094
2158
2159
    if ( $budget ) {
2160
        $query .= " AND aqbudgets.budget_id = ? ";
2161
        push @query_params, "$budget";
2162
    }
2163
2095
    if ( $from_placed_on ) {
2164
    if ( $from_placed_on ) {
2096
        $query .= " AND creationdate >= ? ";
2165
        $query .= " AND creationdate >= ? ";
2097
        push @query_params, $from_placed_on;
2166
        push @query_params, $from_placed_on;
Lines 2102-2107 sub GetHistory { Link Here
2102
        push @query_params, $to_placed_on;
2171
        push @query_params, $to_placed_on;
2103
    }
2172
    }
2104
2173
2174
    if ( defined $orderstatus and $orderstatus ne '') {
2175
        $query .= " AND aqorders.orderstatus = ? ";
2176
        push @query_params, "$orderstatus";
2177
    }
2178
2105
    if ($basket) {
2179
    if ($basket) {
2106
        if ($basket =~ m/^\d+$/) {
2180
        if ($basket =~ m/^\d+$/) {
2107
            $query .= " AND aqorders.basketno = ? ";
2181
            $query .= " AND aqorders.basketno = ? ";
Lines 2137-2145 sub GetHistory { Link Here
2137
        $line->{count} = $cnt++;
2211
        $line->{count} = $cnt++;
2138
        $line->{toggle} = 1 if $cnt % 2;
2212
        $line->{toggle} = 1 if $cnt % 2;
2139
        push @order_loop, $line;
2213
        push @order_loop, $line;
2140
        $total_qty         += $line->{'quantity'};
2214
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
2141
        $total_qtyreceived += $line->{'quantityreceived'};
2215
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
2142
        $total_price       += $line->{'quantity'} * $line->{'ecost'};
2216
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
2143
    }
2217
    }
2144
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2218
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2145
}
2219
}
Lines 2603-2608 sub ReopenInvoice { Link Here
2603
    $sth->execute($invoiceid);
2677
    $sth->execute($invoiceid);
2604
}
2678
}
2605
2679
2680
=head3 GetBiblioCountByBasketno
2681
2682
$biblio_count = &GetBiblioCountByBasketno($basketno);
2683
2684
Looks up the biblio's count that has basketno value $basketno
2685
2686
Returns a quantity
2687
2688
=cut
2689
2690
sub GetBiblioCountByBasketno {
2691
    my ($basketno) = @_;
2692
    my $dbh          = C4::Context->dbh;
2693
    my $query        = "
2694
        SELECT COUNT( DISTINCT( biblionumber ) )
2695
        FROM   aqorders
2696
        WHERE  basketno = ?
2697
            AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
2698
        ";
2699
2700
    my $sth = $dbh->prepare($query);
2701
    $sth->execute($basketno);
2702
    return $sth->fetchrow;
2703
}
2704
2606
1;
2705
1;
2607
__END__
2706
__END__
2608
2707
(-)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 2914-2919 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2914
  `claimed_date` date default NULL, -- last date a claim was generated
2914
  `claimed_date` date default NULL, -- last date a claim was generated
2915
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2915
  `subscriptionid` int(11) default NULL, -- links this order line to a subscription (subscription.subscriptionid)
2916
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2916
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2917
  `orderstatus` tinyint(2) default 0, -- the current status for this line item
2917
  PRIMARY KEY  (`ordernumber`),
2918
  PRIMARY KEY  (`ordernumber`),
2918
  KEY `basketno` (`basketno`),
2919
  KEY `basketno` (`basketno`),
2919
  KEY `biblionumber` (`biblionumber`),
2920
  KEY `biblionumber` (`biblionumber`),
(-)a/installer/data/mysql/updatedatabase.pl (+16 lines)
Lines 6984-6989 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
6984
}
6984
}
6985
6985
6986
6986
6987
6988
6989
6990
6991
$DBversion = "3.13.00.XXX";
6992
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6993
    my $return_count;
6994
    $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus tinyint(2) DEFAULT 0 AFTER parent_ordernumber");
6995
    $dbh->do("UPDATE aqorders SET orderstatus=1 WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)");
6996
    $dbh->do("UPDATE aqorders SET orderstatus=2 WHERE quantity > quantityreceived AND quantityreceived > 0");
6997
    $dbh->do("UPDATE aqorders SET orderstatus=3 WHERE quantity=quantityreceived");
6998
    $dbh->do("UPDATE aqorders SET orderstatus=4 WHERE datecancellationprinted IS NOT NULL");
6999
    print "Upgrade to $DBversion done (Add category ORDRSTATUS values in authorised_values table)\n";
7000
    SetVersion($DBversion);
7001
}
7002
6987
=head1 FUNCTIONS
7003
=head1 FUNCTIONS
6988
7004
6989
=head2 TableExists($table)
7005
=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.invoiceid %]">[% suggestions_loo.invoicenumber %]</a>
128
                            <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid %]">[% 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