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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-12 / +36 lines)
Lines 346-352 Link Here
346
    </div>
346
    </div>
347
    </div>
347
    </div>
348
348
349
    [% IF orders.count %]
349
    [% IF orders_grouped.size %]
350
        <div id="acquisition_details">
350
        <div id="acquisition_details">
351
            <h2>Acquisition details</h2>
351
            <h2>Acquisition details</h2>
352
            <table id="orders">
352
            <table id="orders">
Lines 373-384 Link Here
373
                    </tr>
373
                    </tr>
374
                </thead>
374
                </thead>
375
                <tbody>
375
                <tbody>
376
                [% FOR order IN orders %]
376
                [% FOR ordernumber IN orders_grouped.keys %]
377
                    [% IF order.parent_ordernumber != order.ordernumber %]
377
                    [% SET parent_tree_id = loop.count %]
378
                        <tr data-tt-id="[% order.ordernumber | html %]" data-tt-parent-id="[% order.parent_ordernumber | html %]">
378
                    [% SET parent_order = orders_grouped.$ordernumber %]
379
                    [% ELSE %]
379
                    <tr data-tt-id="[% parent_tree_id | html %]" class="highlighted-row">
380
                        <tr data-tt-id="[% order.parent_ordernumber | html %]">
380
                        <td></td> [%# invoice %]
381
                    [% END %]
381
                        <td>
382
                            [% IF CAN_user_acquisition_order_manage %]
383
                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basket.basketno | uri %]">[% parent_order.basket.basketname | html %] ([% parent_order.basket.basketno | html %])</a>
384
                            [% ELSE %]
385
                                [% parent_order.basket.basketname | html %] ([% parent_order.basket.basketno | html %])
386
                            [% END %]
387
                        </td>
388
                        <td></td> [%# ordernumber %]
389
                        <td>[% parent_order.basket.creationdate | $KohaDates %]</td>
390
                        <td>[% parent_order.datereceived | $KohaDates %]</td>
391
                        <td>
392
                          [% SWITCH parent_order.orderstatus %]
393
                            [% CASE 'new' %]<span title="status_1">New</span>
394
                            [% CASE 'ordered' %]<span title="status_2">Ordered</span>
395
                            [% CASE 'partial' %]<span title="status_3">Partial</span>
396
                            [% CASE 'complete' %]<span title="status_4">Complete</span>
397
                            [% CASE 'cancelled' %]<span title="status_5">Cancelled</span>
398
                          [% END %]
399
                        </td>
400
                        <td></td> [%# internalnote %]
401
                        <td></td> [%# vendornote %]
402
                        <td></td> [%# fund %]
403
                        <td>[% parent_order.quantity | html %]</td>
404
                        <td>[% parent_order.ecost_tax_excluded | $Price %] / [% parent_order.ecost_tax_included | $Price %]</td>
405
                        <td>[% parent_order.unitprice_tax_excluded | $Price %] / [% parent_order.unitprice_tax_included | $Price %]</td>
406
                    </tr>
407
                    [% FOR order IN parent_order.orders %]
408
                        <tr data-tt-id="0" data-tt-parent-id="[% parent_tree_id | html %]">
382
                        <td>
409
                        <td>
383
                        [% IF order.invoice %]
410
                        [% IF order.invoice %]
384
                            [% IF CAN_user_acquisition %]
411
                            [% IF CAN_user_acquisition %]
Lines 389-399 Link Here
389
                            [% END %]
416
                            [% END %]
390
                        [% END %]
417
                        [% END %]
391
                        </td>
418
                        </td>
392
                        <td>[% IF CAN_user_acquisition_order_manage %]
419
                        <td></td> [%# basket %]
393
                            <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]">[% order.basket.basketname | html %] ([% order.basketno | html %])</a>
394
                        [% ELSE %]
395
                            [% order.basket.basketname | html %] ([% order.basketno | html %])
396
                        [% END %]</td>
397
                        <td>[% order.ordernumber | html %]</td>
420
                        <td>[% order.ordernumber | html %]</td>
398
                        <td><span title="[% order.basket.creationdate | uri %]">[% order.basket.creationdate | $KohaDates%]</span></td>
421
                        <td><span title="[% order.basket.creationdate | uri %]">[% order.basket.creationdate | $KohaDates%]</span></td>
399
                        <td>[% IF order.datereceived %]<span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates %]</span>[% END %]</td>
422
                        <td>[% IF order.datereceived %]<span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates %]</span>[% END %]</td>
Lines 422-427 Link Here
422
                            [% END %]
445
                            [% END %]
423
                        </td>
446
                        </td>
424
                    </tr>
447
                    </tr>
448
                    [% END %]
425
                [% END %]
449
                [% END %]
426
                </tbody>
450
                </tbody>
427
            </table>
451
            </table>
(-)a/serials/subscription-detail.pl (-3 / +16 lines)
Lines 129-135 for my $field ( @$additional_fields ) { Link Here
129
$template->param( additional_fields_for_subscription => $additional_fields );
129
$template->param( additional_fields_for_subscription => $additional_fields );
130
130
131
# FIXME Do we want to hide canceled orders?
131
# FIXME Do we want to hide canceled orders?
132
my $orders = Koha::Acquisition::Orders->search( { subscriptionid => $subscriptionid }, { order_by => { -desc => 'parent_ordernumber' } } );
132
my $orders = Koha::Acquisition::Orders->search( { subscriptionid => $subscriptionid }, { order_by => [ { -desc => 'timestamp' }, \[ "field(orderstatus, 'ordered', 'partial', 'complete')" ] ] } );
133
my $orders_grouped;
134
while ( my $o = $orders->next ) {
135
    if ( $o->ordernumber == $o->parent_ordernumber ) {
136
        $orders_grouped->{$o->parent_ordernumber}->{datereceived} = $o->datereceived;
137
        $orders_grouped->{$o->parent_ordernumber}->{orderstatus} = $o->orderstatus;
138
        $orders_grouped->{$o->parent_ordernumber}->{basket} = $o->basket;
139
    }
140
    $orders_grouped->{$o->parent_ordernumber}->{quantity} += $o->quantity;
141
    $orders_grouped->{$o->parent_ordernumber}->{ecost_tax_excluded} += sprintf('%.2f', $o->ecost_tax_excluded * $o->quantity);
142
    $orders_grouped->{$o->parent_ordernumber}->{ecost_tax_included} += sprintf('%.2f', $o->ecost_tax_included * $o->quantity);
143
    $orders_grouped->{$o->parent_ordernumber}->{unitprice_tax_excluded} += sprintf('%.2f', $o->unitprice_tax_excluded * $o->quantity);
144
    $orders_grouped->{$o->parent_ordernumber}->{unitprice_tax_included} += sprintf('%.2f', $o->unitprice_tax_included * $o->quantity);
145
    push @{$orders_grouped->{$o->parent_ordernumber}->{orders}}, $o;
146
}
133
147
134
$template->param(
148
$template->param(
135
    subscriptionid => $subscriptionid,
149
    subscriptionid => $subscriptionid,
Lines 147-153 $template->param( Link Here
147
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
161
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
148
    irregular_issues => scalar @irregular_issues,
162
    irregular_issues => scalar @irregular_issues,
149
    default_bib_view => $default_bib_view,
163
    default_bib_view => $default_bib_view,
150
    orders => $orders,
164
    orders_grouped => $orders_grouped,
151
    (uc(C4::Context->preference("marcflavour"))) => 1,
165
    (uc(C4::Context->preference("marcflavour"))) => 1,
152
);
166
);
153
167
154
- 

Return to bug 21467