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

(-)a/C4/Acquisition.pm (+5 lines)
Lines 1659-1664 sub SearchOrders { Link Here
1659
    my $owner = $params->{owner};
1659
    my $owner = $params->{owner};
1660
    my $pending = $params->{pending};
1660
    my $pending = $params->{pending};
1661
    my $ordered = $params->{ordered};
1661
    my $ordered = $params->{ordered};
1662
    my $biblionumber = $params->{biblionumber};
1662
1663
1663
    my $dbh = C4::Context->dbh;
1664
    my $dbh = C4::Context->dbh;
1664
    my @args = ();
1665
    my @args = ();
Lines 1710-1715 sub SearchOrders { Link Here
1710
        $query .= ' AND (aqorders.ordernumber=?)';
1711
        $query .= ' AND (aqorders.ordernumber=?)';
1711
        push @args, $ordernumber;
1712
        push @args, $ordernumber;
1712
    }
1713
    }
1714
    if ( $biblionumber ) {
1715
        $query .= 'AND aqorders.biblionumber = ?';
1716
        push @args, $biblionumber;
1717
    }
1713
    if( $search ) {
1718
    if( $search ) {
1714
        $query .= ' AND (biblio.title LIKE ? OR biblio.author LIKE ? OR biblioitems.isbn LIKE ?)';
1719
        $query .= ' AND (biblio.title LIKE ? OR biblio.author LIKE ? OR biblioitems.isbn LIKE ?)';
1715
        push @args, ("%$search%","%$search%","%$search%");
1720
        push @args, ("%$search%","%$search%","%$search%");
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 202-207 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
202
('OAI-PMH:ConfFile','',NULL,'If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.','File'),
202
('OAI-PMH:ConfFile','',NULL,'If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.','File'),
203
('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'),
203
('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'),
204
('OCLCAffiliateID','','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','free'),
204
('OCLCAffiliateID','','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','free'),
205
('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'),
205
('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'),
206
('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'),
206
('OPACAllowHoldDateInFuture','0','','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','YesNo'),
207
('OPACAllowHoldDateInFuture','0','','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','YesNo'),
207
('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'),
208
('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 8106-8111 if(CheckVersion($DBversion)) { Link Here
8106
    SetVersion($DBversion);
8106
    SetVersion($DBversion);
8107
}
8107
}
8108
8108
8109
8110
$DBversion = "3.15.00.XXX";
8111
if ( CheckVersion($DBversion) ) {
8112
    $dbh->do(q|
8113
        INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('OPACAcquisitionDetails','0', '','Show the acquisition details at the OPAC','YesNo')
8114
    |);
8115
    print "Upgrade to $DBversion done (MT12445 - Add OPACAcquisitionDetails syspref)\n";
8116
    SetVersion($DBversion);
8117
}
8118
8119
8120
8121
8109
=head1 FUNCTIONS
8122
=head1 FUNCTIONS
8110
8123
8111
=head2 TableExists($table)
8124
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +7 lines)
Lines 436-442 OPAC: Link Here
436
                  yes: Allow
436
                  yes: Allow
437
                  no: Do not allow
437
                  no: Do not allow
438
            - users to add a note when placing a hold.
438
            - users to add a note when placing a hold.
439
439
        -
440
            - pref: OPACAcquisitionDetails
441
              default: 0
442
              choices:
443
                  yes: Display
444
                  no: Don't display
445
            - the acquisition details on OPAC detail pages.
440
    Policy:
446
    Policy:
441
        -
447
        -
442
            - pref: singleBranchMode
448
            - pref: singleBranchMode
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc (+2 lines)
Lines 46-51 not use an API to fetch items that populates item.datedue. Link Here
46
    [% ELSE %]
46
    [% ELSE %]
47
        Item damaged
47
        Item damaged
48
    [% END %]
48
    [% END %]
49
[% ELSIF item.on_order %]
50
  On order
49
[% ELSE %]
51
[% ELSE %]
50
    Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
52
    Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
51
[% END %]
53
[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (-1 / +20 lines)
Lines 985-990 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
985
        <a href="#subscriptions">Subscriptions</a>
985
        <a href="#subscriptions">Subscriptions</a>
986
    </li>
986
    </li>
987
[% END %]
987
[% END %]
988
[% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.orders.size > 0 %]
989
    <li id="tab_acquisitions"><a href="#acquisition_details">Acquisition details</a></li>
990
[% END %]
988
[% IF ( Koha.Preference( 'reviewson' ) == 1 ) %]
991
[% IF ( Koha.Preference( 'reviewson' ) == 1 ) %]
989
    <li id="tab_comments"><a href="#comments">Comments ( [% reviews.size || 0 %] )</a></li>
992
    <li id="tab_comments"><a href="#comments">Comments ( [% reviews.size || 0 %] )</a></li>
990
[% END %]
993
[% END %]
Lines 1238-1243 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1238
    </div>
1241
    </div>
1239
    [% END %]
1242
    [% END %]
1240
1243
1244
1245
[% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.orders.size > 0 %]
1246
  <div id="acquisition_details">
1247
    <h2>Acquisition details</h2>
1248
    [% IF Koha.Preference('AcqCreateItem') == 'ordering' %]
1249
      The following items are on order.
1250
      [% INCLUDE items_table items=acquisition_details.items tab="acquisition_details" noshelfbrowser=1 %]
1251
    [% ELSE %]
1252
      [% acquisition_details.total_quantity %] items are on order.
1253
    [% END %]
1254
  </div>
1255
[% END %]
1256
1257
1258
1259
1241
[% IF ( LibraryThingForLibrariesID ) %] 
1260
[% IF ( LibraryThingForLibrariesID ) %] 
1242
[% IF ( LibraryThingForLibrariesTabbedView ) %]
1261
[% IF ( LibraryThingForLibrariesTabbedView ) %]
1243
	<!-- Library Thing for Libraries Content --> 
1262
	<!-- Library Thing for Libraries Content --> 
Lines 1558-1564 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1558
        <td class="call_no" property="sku">
1577
        <td class="call_no" property="sku">
1559
            [% IF ( ITEM_RESULT.itemcallnumber ) %]
1578
            [% IF ( ITEM_RESULT.itemcallnumber ) %]
1560
                [% ITEM_RESULT.itemcallnumber %]
1579
                [% ITEM_RESULT.itemcallnumber %]
1561
                [% IF ( OPACShelfBrowser ) %]
1580
                [% IF ( OPACShelfBrowser and not noshelfbrowser ) %]
1562
                    [% IF ( ITEM_RESULT.itemnumber == starting_itemnumber ) %]
1581
                    [% IF ( ITEM_RESULT.itemnumber == starting_itemnumber ) %]
1563
                        (<a class="close_shelf" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber %]#[% tab %]">Browse shelf</a>)
1582
                        (<a class="close_shelf" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber %]#[% tab %]">Browse shelf</a>)
1564
                    [% ELSE %]
1583
                    [% ELSE %]
(-)a/opac/opac-detail.pl (-49 / +81 lines)
Lines 25-30 use warnings; Link Here
25
25
26
use CGI;
26
use CGI;
27
use C4::Auth qw(:DEFAULT get_session);
27
use C4::Auth qw(:DEFAULT get_session);
28
use C4::Acquisition qw( SearchOrders );
28
use C4::Branch;
29
use C4::Branch;
29
use C4::Koha;
30
use C4::Koha;
30
use C4::Serials;    #uses getsubscriptionfrom biblionumber
31
use C4::Serials;    #uses getsubscriptionfrom biblionumber
Lines 487-502 if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) { Link Here
487
488
488
my $dat = &GetBiblioData($biblionumber);
489
my $dat = &GetBiblioData($biblionumber);
489
490
490
my $itemtypes = GetItemTypes();
491
our $itemtypes = GetItemTypes();
491
# imageurl:
492
# imageurl:
492
my $itemtype = $dat->{'itemtype'};
493
my $itemtype = $dat->{'itemtype'};
493
if ( $itemtype ) {
494
if ( $itemtype ) {
494
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
495
    $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
495
    $dat->{'description'} = $itemtypes->{$itemtype}->{'description'};
496
    $dat->{'description'} = $itemtypes->{$itemtype}->{'description'};
496
}
497
}
497
my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
498
our $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
498
my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
499
our $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
499
my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac');
500
our $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac');
500
501
501
#coping with subscriptions
502
#coping with subscriptions
502
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
503
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
Lines 532-538 $dat->{'count'} = scalar(@items); Link Here
532
533
533
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) );
534
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) );
534
535
535
my (%item_reserves, %priority);
536
our (%item_reserves, %priority);
536
my ($show_holds_count, $show_priority);
537
my ($show_holds_count, $show_priority);
537
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
538
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
538
    m/holds/o and $show_holds_count = 1;
539
    m/holds/o and $show_holds_count = 1;
Lines 562-567 if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { Link Here
562
    $template->param(SeparateHoldings => 1);
563
    $template->param(SeparateHoldings => 1);
563
}
564
}
564
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch');
565
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch');
566
565
my $viewallitems = $query->param('viewallitems');
567
my $viewallitems = $query->param('viewallitems');
566
my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50;
568
my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50;
567
if ( not $viewallitems and @items > $max_items_to_display ) {
569
if ( not $viewallitems and @items > $max_items_to_display ) {
Lines 571-620 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
571
    );
573
    );
572
} else {
574
} else {
573
  for my $itm (@items) {
575
  for my $itm (@items) {
574
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
576
    $itm = _get_items_infos( $itm );
575
    $itm->{priority} = $priority{ $itm->{itemnumber} };
576
    $norequests = 0
577
       if ( (not $itm->{'withdrawn'} )
578
         && (not $itm->{'itemlost'} )
579
         && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} )
580
		 && (not $itemtypes->{$itm->{'itype'}}->{notforloan} )
581
         && ($itm->{'itemnumber'} ) );
582
577
583
    # get collection code description, too
584
    my $ccode = $itm->{'ccode'};
585
    $itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} );
586
    my $copynumber = $itm->{'copynumber'};
587
    $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
588
    if ( defined $itm->{'location'} ) {
589
        $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
590
    }
591
    if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
592
        $itm->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
593
        $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'};
594
    }
595
    foreach (qw(ccode enumchron copynumber itemnotes uri)) {
596
        $itemfields{$_} = 1 if ($itm->{$_});
597
    }
598
599
     # walk through the item-level authorised values and populate some images
600
     my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) );
601
     # warn( Data::Dumper->Dump( [ $item_authorised_value_images ], [ 'item_authorised_value_images' ] ) );
602
603
     if ( $itm->{'itemlost'} ) {
604
         my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images;
605
         $itm->{'lostimageurl'}   = $lostimageinfo->{ 'imageurl' };
606
         $itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' };
607
     }
608
     my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber});
609
      if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
610
      if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
611
    
612
     my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
613
     if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
614
        $itm->{transfertwhen} = $transfertwhen;
615
        $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
616
        $itm->{transfertto}   = $branches->{$transfertto}{branchname};
617
     }
618
    my $itembranch = $itm->{$separatebranch};
578
    my $itembranch = $itm->{$separatebranch};
619
    if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
579
    if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
620
        if ($itembranch and $itembranch eq $currentbranch) {
580
        if ($itembranch and $itembranch eq $currentbranch) {
Lines 1068-1071 if ( C4::Context->preference('UseCourseReserves') ) { Link Here
1068
    }
1028
    }
1069
}
1029
}
1070
1030
1031
if ( C4::Context->preference('OPACAcquisitionDetails') ) {
1032
    my $orders = C4::Acquisition::SearchOrders({
1033
        biblionumber => $biblionumber,
1034
        pending => 1,
1035
    });
1036
1037
    my @items;
1038
    my $total_quantity;
1039
    for my $order ( @$orders ) {
1040
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
1041
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
1042
                my $item = C4::Items::GetItem( $itemnumber );
1043
                $item->{on_order} = 1;
1044
                push @items, _get_items_infos( $item );
1045
            }
1046
        }
1047
        $total_quantity += $order->{quantity};
1048
    }
1049
    $template->{VARS}->{acquisition_details} = {
1050
        orders => $orders,
1051
        items => \@items,
1052
        total_quantity => $total_quantity,
1053
    };
1054
}
1055
1071
output_html_with_http_headers $query, $cookie, $template->output;
1056
output_html_with_http_headers $query, $cookie, $template->output;
1072
- 
1057
1058
sub _get_items_infos {
1059
    my ( $itm ) = @_;
1060
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
1061
    $itm->{priority} = $priority{ $itm->{itemnumber} };
1062
    $norequests = 0
1063
       if ( (not $itm->{'withdrawn'} )
1064
         && (not $itm->{'itemlost'} )
1065
         && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} )
1066
         && (not $itemtypes->{$itm->{'itype'}}->{notforloan} )
1067
         && ($itm->{'itemnumber'} ) );
1068
1069
    # get collection code description, too
1070
    my $ccode = $itm->{'ccode'};
1071
    $itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) );
1072
    my $copynumber = $itm->{'copynumber'};
1073
    $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
1074
    if ( defined $itm->{'location'} ) {
1075
        $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
1076
    }
1077
    if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
1078
        $itm->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
1079
        $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'};
1080
    }
1081
    foreach (qw(ccode enumchron copynumber itemnotes uri)) {
1082
        $itemfields{$_} = 1 if ($itm->{$_});
1083
    }
1084
1085
    # walk through the item-level authorised values and populate some images
1086
    my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) );
1087
1088
    if ( $itm->{'itemlost'} ) {
1089
        my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images;
1090
        $itm->{'lostimageurl'}   = $lostimageinfo->{ 'imageurl' };
1091
        $itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' };
1092
    }
1093
    my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber});
1094
     if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
1095
     if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
1096
1097
    my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
1098
    if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
1099
       $itm->{transfertwhen} = $transfertwhen;
1100
       $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
1101
       $itm->{transfertto}   = $branches->{$transfertto}{branchname};
1102
    }
1103
    return $itm;
1104
}

Return to bug 11169