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 (-2 / +58 lines)
Lines 170-176 function verify_images() { Link Here
170
170
171
    [% IF ( XSLTDetailsDisplay ) %]
171
    [% IF ( XSLTDetailsDisplay ) %]
172
        [% XSLTBloc %]
172
        [% XSLTBloc %]
173
173
        [% IF ( countorders || countdeletedorders ) %]
174
            <span class="biblio_in_orders">
175
	        <span class="label">Number of order(s) using this title: </span>
176
		<span>  	            
177
		    [% IF ( countorders ) %]
178
                        [% countorders %] active order(s) in basket(s)
179
			[% FOREACH basketo IN basketsorders %]
180
			   [% IF ( CAN_user_acquisition_order_manage ) %]
181
			    <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketo %]">#[% basketo %]</a>,
182
			   [% ELSE %]
183
			    [% basketo %],
184
			   [% END %]			   
185
			[% END %]
186
		    [% END %]		
187
		    [% IF ( countorders && countdeletedorders ) %]
188
		        and
189
		    [% END %]		    
190
		    [% IF ( countdeletedorders ) %]
191
                        [% countdeletedorders %] deleted order(s) in basket(s)
192
			[% FOREACH basketdo IN basketsdeletedorders %]
193
			   [% IF ( CAN_user_acquisition_order_manage ) %]
194
			    <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketdo %]">#[% basketdo %]</a>,
195
			   [% ELSE %]
196
			    [% basketdo %],
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
			   [% ELSE %]
345
			    [% basketo %],
346
			   [% END %]			   
347
			[% END %]    
348
		    [% END %]
349
		    [% IF ( countorders && countdeletedorders ) %]
350
		        and
351
		    [% END %]
352
		    [% IF ( countdeletedorders ) %]
353
                        [% countdeletedorders %] deleted order(s) in basket(s)
354
			[% FOREACH basketdo IN basketsdeletedorders %]
355
			   [% IF ( CAN_user_acquisition_order_manage ) %]
356
			    <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketdo %]">#[% basketdo %]</a>,
357
			   [% ELSE %]
358
			    [% basketdo %],
359
			   [% END %]			   
360
			[% END %]
361
		    [% END %]		    
362
	    </li>
363
        [% END %]
307
        <!--This grabs all of the lists a bib record appears in -->
364
        <!--This grabs all of the lists a bib record appears in -->
308
        [% IF ( GetShelves ) %]
365
        [% IF ( GetShelves ) %]
309
	        <li><strong>Lists that include this title: </strong>
366
	        <li><strong>Lists that include this title: </strong>
310
- 

Return to bug 9780