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

(-)a/C4/Acquisition.pm (-1 / +34 lines)
Lines 53-59 BEGIN { Link Here
53
        &ModBasketgroup &NewBasketgroup &DelBasketgroup &GetBasketgroup &CloseBasketgroup
53
        &ModBasketgroup &NewBasketgroup &DelBasketgroup &GetBasketgroup &CloseBasketgroup
54
        &GetBasketgroups &ReOpenBasketgroup
54
        &GetBasketgroups &ReOpenBasketgroup
55
55
56
        &NewOrder &DelOrder &ModOrder &GetPendingOrders &GetOrder &GetOrders
56
        &NewOrder &DelOrder &ModOrder &GetPendingOrders &GetOrder &GetOrders &GetOrdersByBiblionumber
57
        &GetOrderNumber &GetLateOrders &GetOrderFromItemnumber
57
        &GetOrderNumber &GetLateOrders &GetOrderFromItemnumber
58
        &SearchOrder &GetHistory &GetRecentAcqui
58
        &SearchOrder &GetHistory &GetRecentAcqui
59
        &ModReceiveOrder &CancelReceipt &ModOrderBiblioitemNumber
59
        &ModReceiveOrder &CancelReceipt &ModOrderBiblioitemNumber
Lines 903-908 sub GetPendingOrders { Link Here
903
903
904
#------------------------------------------------------------#
904
#------------------------------------------------------------#
905
905
906
=head3 GetOrdersByBiblionumber
907
908
  @orders = &GetOrdersByBiblionumber($biblionumber);
909
910
Looks up the orders with linked to a specific $biblionumber, including
911
cancelled orders and received orders.
912
913
return :
914
C<@orders> is an array of references-to-hash, whose keys are the
915
fields from the aqorders, biblio, and biblioitems tables in the Koha database.
916
917
=cut
918
919
sub GetOrdersByBiblionumber {
920
    my $biblionumber = shift;
921
    my $dbh   = C4::Context->dbh;
922
    my $query  ="
923
        SELECT biblio.*,biblioitems.*,
924
                aqorders.*,
925
                aqbudgets.*
926
        FROM    aqorders
927
            LEFT JOIN aqbudgets        ON aqbudgets.budget_id = aqorders.budget_id
928
            LEFT JOIN biblio           ON biblio.biblionumber = aqorders.biblionumber
929
            LEFT JOIN biblioitems      ON biblioitems.biblionumber =biblio.biblionumber
930
        WHERE   aqorders.biblionumber=?
931
    ";
932
    my $sth = $dbh->prepare($query);
933
    $sth->execute($biblionumber);
934
    my $results = $sth->fetchall_arrayref({});
935
    $sth->finish;
936
    return @$results;
937
}
938
906
=head3 GetOrders
939
=head3 GetOrders
907
940
908
  @orders = &GetOrders($basketnumber, $orderby);
941
  @orders = &GetOrders($basketnumber, $orderby);
(-)a/catalogue/detail.pl (+32 lines)
Lines 41-46 use C4::XSLT; Link Here
41
use C4::Images;
41
use C4::Images;
42
use Koha::DateUtils;
42
use Koha::DateUtils;
43
use C4::HTML5Media;
43
use C4::HTML5Media;
44
use C4::Acquisition qw(GetOrdersByBiblionumber);
44
45
45
# use Smart::Comments;
46
# use Smart::Comments;
46
47
Lines 398-401 if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref Link Here
398
my ( $holdcount, $holds ) = C4::Reserves::GetReservesFromBiblionumber($biblionumber,1);
399
my ( $holdcount, $holds ) = C4::Reserves::GetReservesFromBiblionumber($biblionumber,1);
399
$template->param( holdcount => $holdcount, holds => $holds );
400
$template->param( holdcount => $holdcount, holds => $holds );
400
401
402
my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber);
403
my @deletedorders_using_biblio;
404
my @orders_using_biblio;
405
my @baskets_orders;
406
my @baskets_deletedorders;
407
408
foreach my $myorder (@allorders_using_biblio) {
409
    my $basket = $myorder->{'basketno'};
410
    if ((defined $myorder->{'datecancellationprinted'}) and  ($myorder->{'datecancellationprinted'} ne '0000-00-00') ){
411
	push @deletedorders_using_biblio, $myorder;
412
	unless (grep(/^$basket$/, @baskets_deletedorders)){
413
	    push @baskets_deletedorders,$myorder->{'basketno'};
414
	}
415
    }
416
    else {
417
	push @orders_using_biblio, $myorder;
418
	unless (grep(/^$basket$/, @baskets_orders)){
419
	    push @baskets_orders,$myorder->{'basketno'};
420
	    }
421
    }
422
}
423
424
my $count_orders_using_biblio = scalar @orders_using_biblio ;
425
$template->param (countorders => $count_orders_using_biblio);
426
427
my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ;
428
$template->param (countdeletedorders => $count_deletedorders_using_biblio);
429
430
$template->param (basketsorders => \@baskets_orders);
431
$template->param (basketsdeletedorders => \@baskets_deletedorders);
432
401
output_html_with_http_headers $query, $cookie, $template->output;
433
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (-3 / +16 lines)
Lines 31-42 Link Here
31
    function confirm_deletion() {
31
    function confirm_deletion() {
32
        var count = [% count %];
32
        var count = [% count %];
33
        var holdcount = [% holdcount %];
33
        var holdcount = [% holdcount %];
34
34
	var countorders = [% countorders %];
35
	var countdeletedorders = [% countdeletedorders %];
35
        var is_confirmed;
36
        var is_confirmed;
37
36
	if (count > 0){
38
	if (count > 0){
37
            is_confirmed = alert( count + " " +_("item(s) are attached to this record.\nYou must delete all items before deleting this record.") );
39
            is_confirmed = alert( count + " " +_("item(s) are attached to this record.\nYou must delete all items before deleting this record.") );
38
        } else if ( holdcount > 0 ) {
40
        }
39
            is_confirmed = confirm( holdcount + " " + _("holds(s) for this record \n Are you sure you want to delete this record?."));
41
	else if (countorders > 0){
42
            is_confirmed = alert( _("You cannot delete this record : it is used in")+" "+ countorders + " " +_("order(s).") );
43
        }
44
	else if (countdeletedorders > 0){
45
             [% IF ( CAN_user_acquisition_order_manage ) %]
46
	         is_confirmed = confirm( countdeletedorders + " " +_("deleted order(s) are using this record.\nAre you sure you want to delete this record?") );
47
	     [% ELSE %]
48
	         is_confirmed = alert( countdeletedorders + " " +_("deleted order(s) are using this record.\nYou need order managing permissions to delete this record.") );
49
	     [% END %]
50
	}
51
	else if ( holdcount > 0 ) {
52
            is_confirmed = confirm( holdcount + " " + _("holds(s) for this record.\nAre you sure you want to delete this record?"));
40
        } else {
53
        } else {
41
            is_confirmed = confirm(_("Are you sure you want to delete this record?"));
54
            is_confirmed = confirm(_("Are you sure you want to delete this record?"));
42
        }
55
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-35 / +95 lines)
Lines 136-176 function verify_images() { Link Here
136
</div>
136
</div>
137
137
138
<div id="doc3" class="yui-t2">
138
<div id="doc3" class="yui-t2">
139
139
    [% IF ( unknownbiblionumber ) %]
140
[% IF ( unknownbiblionumber ) %]
140
        <div class="dialog message">The record you requested does not exist ([% biblionumber %]).</div>
141
  <div class="dialog message">The record you requested does not exist ([% biblionumber %]).</div>
142
[% ELSE %]
143
   <div id="bd">
144
    <div id="yui-main">
145
    <div class="yui-b">
146
147
[% INCLUDE 'cat-toolbar.inc' %]
148
    [% IF ( ocoins ) %]
149
        <!-- COinS / OpenURL -->
150
        <span class="Z3988" title="[% ocoins %]"></span>
151
    [% END %]
152
153
    [% IF ( AmazonCoverImages ) %]
154
        [% IF ( XSLTDetailsDisplay ) %]
155
            <div class="yui-gc">
156
            <div id="catalogue_detail_biblio" class="yui-u first">
157
        [% ELSE %]
158
            <div class="yui-gb">
159
            <div id="catalogue_detail_biblio" class="yui-u first">
160
        [% END %]
161
    [% ELSE %]
141
    [% ELSE %]
162
        [% IF ( XSLTDetailsDisplay ) %]
142
        <div id="bd">
163
            <div class="yui-g">
143
            <div id="yui-main">
164
            <div id="catalogue_detail_biblio">
144
                <div class="yui-b">
165
        [% ELSE %]
145
                    [% INCLUDE 'cat-toolbar.inc' %]
166
            <div class="yui-g">
146
                    [% IF ( ocoins ) %]
167
            <div id="catalogue_detail_biblio" class="yui-u first">
147
                        <!-- COinS / OpenURL -->
168
        [% END %]
148
                        <span class="Z3988" title="[% ocoins %]"></span>
169
    [% END %]
149
                    [% END %]
170
150
                    [% IF ( AmazonCoverImages ) %]
171
    [% IF ( XSLTDetailsDisplay ) %]
151
                        [% IF ( XSLTDetailsDisplay ) %]
172
        [% XSLTBloc %]
152
                            <div class="yui-gc">
173
153
                            <div id="catalogue_detail_biblio" class="yui-u first">
154
                        [% ELSE %]
155
                            <div class="yui-gb">
156
                            <div id="catalogue_detail_biblio" class="yui-u first">
157
                        [% END %]
158
                    [% ELSE %]
159
                        [% IF ( XSLTDetailsDisplay ) %]
160
                            <div class="yui-g">
161
                            <div id="catalogue_detail_biblio">
162
                        [% ELSE %]
163
                            <div class="yui-g">
164
                            <div id="catalogue_detail_biblio" class="yui-u first">
165
                        [% END %]
166
                    [% END %]
167
                  [% IF ( XSLTDetailsDisplay ) %]
168
                        [% XSLTBloc %]
169
                        [% IF ( countorders || countdeletedorders ) %]
170
                            <span class="biblio_in_orders">
171
                                <span class="label">Number of order(s) using this title: </span>
172
                                <span>
173
                                    [% IF ( countorders ) %]
174
                                        [% countorders %] active order(s) in basket(s)
175
                                        [% FOREACH basketo IN basketsorders %]
176
                                            [% IF ( CAN_user_acquisition_order_manage ) %]
177
                                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketo %]">#[% basketo %]</a>
178
                                                [%- UNLESS loop.last %],[% END %]
179
                                            [% ELSE %]
180
                                                [% basketo %]
181
                                                [%- UNLESS loop.last %],[% END %]
182
                                            [% END %]
183
                                        [% END %]
184
                                    [% END %]
185
                                    [% IF ( countorders && countdeletedorders ) %]
186
                                        and
187
                                    [% END %]
188
                                    [% IF ( countdeletedorders ) %]
189
                                        [% countdeletedorders %] deleted order(s) in basket(s)
190
                                        [% FOREACH basketdo IN basketsdeletedorders %]
191
                                            [% IF ( CAN_user_acquisition_order_manage ) %]
192
                                                <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketdo %]">#[% basketdo %]</a>
193
                                                [%- UNLESS loop.last %],[% END %]
194
                                            [% ELSE %]
195
                                                [% basketdo %]
196
                                                [%- UNLESS loop.last %],[% END %]
197
                                            [% END %]
198
                                        [% END %]
199
                                    [% END %]
200
                                </span>
201
                            </span>
202
                        [% END %]
174
        [% IF ( GetShelves ) %]
203
        [% IF ( GetShelves ) %]
175
            <span class="results_summary"><span class="label">Lists that include this title: </span>
204
            <span class="results_summary"><span class="label">Lists that include this title: </span>
176
            [% FOREACH GetShelve IN GetShelves %]
205
            [% FOREACH GetShelve IN GetShelves %]
Lines 304-309 function verify_images() { Link Here
304
                [% END %]
333
                [% END %]
305
            </li>
334
            </li>
306
        [% END %]
335
        [% END %]
336
        <span>&nbsp;</span>
337
        [% IF ( countorders || countdeletedorders ) %]
338
            <li><strong>Number of order(s) using this title: </strong>
339
                [% IF ( countorders ) %]
340
                    [% countorders %] active order(s) in basket(s)
341
                    [% FOREACH basketo IN basketsorders %]
342
                        [% IF ( CAN_user_acquisition_order_manage ) %]
343
                            <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketo %]">#[% basketo %]</a>
344
                            [%- UNLESS loop.last %],[% END %]
345
                        [% ELSE %]
346
                            [% basketo %]
347
                            [%- UNLESS loop.last %],[% END %]
348
                        [% END %]
349
                    [% END %]
350
                [% END %]
351
                [% IF ( countorders && countdeletedorders ) %]
352
                    and
353
                [% END %]
354
                [% IF ( countdeletedorders ) %]
355
                    [% countdeletedorders %] deleted order(s) in basket(s)
356
                    [% FOREACH basketdo IN basketsdeletedorders %]
357
                        [% IF ( CAN_user_acquisition_order_manage ) %]
358
                            <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketdo %]">#[% basketdo %]</a>
359
                            [%- UNLESS loop.last %],[% END %]
360
                        [% ELSE %]
361
                            [% basketdo %]
362
                            [%- UNLESS loop.last %],[% END %]
363
                        [% END %]
364
                    [% END %]
365
                [% END %]
366
            </li>
367
        [% END %]
307
        <!--This grabs all of the lists a bib record appears in -->
368
        <!--This grabs all of the lists a bib record appears in -->
308
        [% IF ( GetShelves ) %]
369
        [% IF ( GetShelves ) %]
309
	        <li><strong>Lists that include this title: </strong>
370
	        <li><strong>Lists that include this title: </strong>
310
- 

Return to bug 9780