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

(-)a/C4/Items.pm (-60 / +49 lines)
Lines 1167-1172 If this is set, it is set to C<One Order>. Link Here
1167
sub GetItemsInfo {
1167
sub GetItemsInfo {
1168
    my ( $biblionumber ) = @_;
1168
    my ( $biblionumber ) = @_;
1169
    my $dbh   = C4::Context->dbh;
1169
    my $dbh   = C4::Context->dbh;
1170
1171
    my $sth_auth_val = $dbh->prepare(
1172
        'SELECT authorised_value
1173
         FROM   marc_subfield_structure
1174
         WHERE  kohafield=?
1175
    '
1176
    );
1177
1178
    $sth_auth_val->execute("items.notforloan");
1179
    my ($authorised_valuecode_notforloan) = $sth_auth_val->fetchrow;
1180
    my $sthnflstatus = $dbh->prepare(
1181
        "SELECT lib FROM authorised_values
1182
            WHERE  category=?
1183
            AND authorised_value=?"
1184
    );
1185
1186
    $sth_auth_val->execute("items.restricted");
1187
    my ($authorised_valuecode_restricted) = $sth_auth_val->fetchrow;
1188
    my $restrictedstatus = $dbh->prepare(
1189
        "SELECT lib,lib_opac FROM authorised_values
1190
            WHERE  category=?
1191
            AND authorised_value=?"
1192
    );
1193
1194
    $sth_auth_val->execute("items.stack");
1195
    my ($authorised_valuecode_stack) = $sth_auth_val->fetchrow;
1196
    my $stackstatus = $dbh->prepare(
1197
        "SELECT lib
1198
            FROM   authorised_values
1199
            WHERE  category=?
1200
            AND    authorised_value=?
1201
    "
1202
    );
1203
1170
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1204
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1171
    my $query = "
1205
    my $query = "
1172
    SELECT items.*,
1206
    SELECT items.*,
Lines 1185-1191 sub GetItemsInfo { Link Here
1185
           items.notforloan as itemnotforloan,
1219
           items.notforloan as itemnotforloan,
1186
           itemtypes.description,
1220
           itemtypes.description,
1187
           itemtypes.notforloan as notforloan_per_itemtype,
1221
           itemtypes.notforloan as notforloan_per_itemtype,
1188
           branchurl
1222
           branches.branchcode,
1223
           branches.branchname,
1224
           branches.branchaddress1,
1225
           branches.branchaddress2,
1226
           branches.branchaddress3,
1227
           branches.branchphone,
1228
           branches.branchemail,
1229
           branches.branchnotes,
1230
           branches.branchurl
1189
     FROM items
1231
     FROM items
1190
     LEFT JOIN branches ON items.holdingbranch = branches.branchcode
1232
     LEFT JOIN branches ON items.holdingbranch = branches.branchcode
1191
     LEFT JOIN biblio      ON      biblio.biblionumber     = items.biblionumber
1233
     LEFT JOIN biblio      ON      biblio.biblionumber     = items.biblionumber
Lines 1235-1291 sub GetItemsInfo { Link Here
1235
# value.
1277
# value.
1236
            $count_reserves = $restype;
1278
            $count_reserves = $restype;
1237
        }
1279
        }
1238
        #get branch information.....
1239
        my $bsth = $dbh->prepare(
1240
            "SELECT * FROM branches WHERE branchcode = ?
1241
        "
1242
        );
1243
        $bsth->execute( $data->{'holdingbranch'} );
1244
        if ( my $bdata = $bsth->fetchrow_hashref ) {
1245
            $data->{'branchname'} = $bdata->{'branchname'};
1246
        }
1247
        $data->{'datedue'}        = $datedue;
1280
        $data->{'datedue'}        = $datedue;
1248
        $data->{'count_reserves'} = $count_reserves;
1281
        $data->{'count_reserves'} = $count_reserves;
1249
1282
1250
        # get notforloan complete status if applicable
1283
        # get notforloan complete status if applicable
1251
        my $sthnflstatus = $dbh->prepare(
1284
        if ($authorised_valuecode_notforloan) {
1252
            'SELECT authorised_value
1285
            $sthnflstatus->execute( $authorised_valuecode_notforloan,
1253
            FROM   marc_subfield_structure
1254
            WHERE  kohafield="items.notforloan"
1255
        '
1256
        );
1257
1258
        $sthnflstatus->execute;
1259
        my ($authorised_valuecode) = $sthnflstatus->fetchrow;
1260
        if ($authorised_valuecode) {
1261
            $sthnflstatus = $dbh->prepare(
1262
                "SELECT lib FROM authorised_values
1263
                 WHERE  category=?
1264
                 AND authorised_value=?"
1265
            );
1266
            $sthnflstatus->execute( $authorised_valuecode,
1267
                $data->{itemnotforloan} );
1286
                $data->{itemnotforloan} );
1268
            my ($lib) = $sthnflstatus->fetchrow;
1287
            my ($lib) = $sthnflstatus->fetchrow;
1269
            $data->{notforloanvalue} = $lib;
1288
            $data->{notforloanvalue} = $lib;
1270
        }
1289
        }
1271
1290
1272
        # get restricted status and description if applicable
1291
        # get restricted status and description if applicable
1273
        my $restrictedstatus = $dbh->prepare(
1292
        if ($authorised_valuecode_restricted) {
1274
            'SELECT authorised_value
1293
            $restrictedstatus->execute( $authorised_valuecode_restricted,
1275
            FROM   marc_subfield_structure
1276
            WHERE  kohafield="items.restricted"
1277
        '
1278
        );
1279
1280
        $restrictedstatus->execute;
1281
        ($authorised_valuecode) = $restrictedstatus->fetchrow;
1282
        if ($authorised_valuecode) {
1283
            $restrictedstatus = $dbh->prepare(
1284
                "SELECT lib,lib_opac FROM authorised_values
1285
                 WHERE  category=?
1286
                 AND authorised_value=?"
1287
            );
1288
            $restrictedstatus->execute( $authorised_valuecode,
1289
                $data->{restricted} );
1294
                $data->{restricted} );
1290
1295
1291
            if ( my $rstdata = $restrictedstatus->fetchrow_hashref ) {
1296
            if ( my $rstdata = $restrictedstatus->fetchrow_hashref ) {
Lines 1295-1318 sub GetItemsInfo { Link Here
1295
        }
1300
        }
1296
1301
1297
        # my stack procedures
1302
        # my stack procedures
1298
        my $stackstatus = $dbh->prepare(
1303
        if ($authorised_valuecode_stack) {
1299
            'SELECT authorised_value
1304
            $stackstatus->execute( $authorised_valuecode_stack, $data->{stack} );
1300
             FROM   marc_subfield_structure
1301
             WHERE  kohafield="items.stack"
1302
        '
1303
        );
1304
        $stackstatus->execute;
1305
1306
        ($authorised_valuecode) = $stackstatus->fetchrow;
1307
        if ($authorised_valuecode) {
1308
            $stackstatus = $dbh->prepare(
1309
                "SELECT lib
1310
                 FROM   authorised_values
1311
                 WHERE  category=?
1312
                 AND    authorised_value=?
1313
            "
1314
            );
1315
            $stackstatus->execute( $authorised_valuecode, $data->{stack} );
1316
            my ($lib) = $stackstatus->fetchrow;
1305
            my ($lib) = $stackstatus->fetchrow;
1317
            $data->{stack} = $lib;
1306
            $data->{stack} = $lib;
1318
        }
1307
        }
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (-1 / +121 lines)
Lines 188-193 function renderPagination(index, total, ul, highlIndex) Link Here
188
}//renderPagination
188
}//renderPagination
189
[% END %]
189
[% END %]
190
190
191
var branch_info = [% branch_info_json %];
192
function branch_popup(branchcode) {
193
    if (branchcode == "") return;
194
195
    var b_i = branch_info[branchcode];
196
    if (!b_i) return;
197
198
    var info = "<strong>" + b_i.branchname + "</strong><br/>"
199
             + b_i.branchaddress1;
200
    if (b_i.branchaddress2) info = info + "<br/>" + b_i.branchaddress2;
201
    if (b_i.branchaddress3) info = info + "<br/>" + b_i.branchaddress3;
202
    if (b_i.branchnotes)    info = info + "<br/><br/>" + b_i.branchnotes;
203
    if (b_i.branchphone)    info = info + "<br/><br/>Tel. " + b_i.branchphone;
204
    if (b_i.branchemail)    info = info + "<br/><br/><a href='mailto:'" + b_i.branchemail + "'>" + b_i.branchemail + "</a>";
205
    if (b_i.branchurl)      info = info + "<br/><br/><a href='" + b_i.branchurl + "' target='_new'>" + b_i.branchurl + "</a>";
206
207
    popup(info);
208
}
209
210
// create the popup box - remember to give it some width in your styling 
211
document.write('<div id="pup" style="position:abolute; display:none; z-index:200;"></div>');
212
213
var minMargin = 15; // set how much minimal space there should be to
214
                            // between the popup and everything else (borders, mouse)
215
var ready = false; // we are ready when the mouse event is set up
216
var default_width = '200px'; // will be set to width from css in document.ready
217
218
var follow_mouse = true;
219
jQuery(document).ready(function(){
220
    $('#pup').hide();
221
    default_width = $('#pup').width();
222
    // set dynamic coords when the mouse moves
223
    $(document).mousemove(function(e){ 
224
        if (!follow_mouse) return;
225
226
        var x,y;
227
      
228
        x = $(document).scrollLeft() + e.clientX;
229
        y = $(document).scrollTop() + e.clientY;
230
231
        x += 10; // important: if the popup is where the mouse is, the hoverOver/hoverOut events flicker
232
      
233
        var x_y = nudge(x,y); // avoids edge overflow
234
      
235
        // remember: the popup is still hidden
236
        $('#pup').css('top', x_y[1] + 'px');
237
        $('#pup').css('left', x_y[0] + 'px');
238
    });
239
240
    ready = true;
241
});
242
243
// avoid edge overflow
244
function nudge(x,y)
245
{
246
    var win = $(window);
247
    
248
    // When the mouse is too far on the right, put window to the left
249
    var xtreme = $(document).scrollLeft() + win.width() - $('#pup').width() - minMargin;
250
    if(x > xtreme) {
251
        x -= $('#pup').width() + 2 * minMargin;
252
    }
253
    x = max(x, 0);
254
255
    // When the mouse is too far down, move window up
256
    if((y + $('#pup').height()) > (win.height() +  $(document).scrollTop())) {
257
        y -= $('#pup').height() + minMargin;
258
    }
259
260
    return [ x, y ];
261
}
262
263
function popup(msg, width)
264
{
265
    if (typeof width === "undefined"){
266
        width = default_width;
267
    }
268
    // write content and display
269
    if (ready) {
270
        $('#pup').width(width).html(msg).show();
271
        follow_mouse = false;
272
    }
273
    // make sure popup goes away on mouse out
274
    $(this).mouseout(function(e){
275
        follow_mouse = true;
276
        $('#pup').hide().width(default_width);
277
    });
278
}
279
280
281
function max(a,b){
282
    if (a>b) return a;
283
    else return b;
284
}
285
191
286
192
YAHOO.util.Event.onContentReady("furtherm", function () {
287
YAHOO.util.Event.onContentReady("furtherm", function () {
193
    $("#furtherm").css("display","block").css("visibility","hidden");
288
    $("#furtherm").css("display","block").css("visibility","hidden");
Lines 206-211 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
206
	
301
	
207
//]]>
302
//]]>
208
</script>
303
</script>
304
<style>
305
#pup {
306
  position:absolute;
307
  z-index:200; /* aaaalways on top*/
308
  padding: 3px;
309
  margin-left: 10px;
310
  margin-top: 5px;
311
  width: 250px;
312
  border: 1px solid black;
313
  background-color: #aaa;
314
  color: white;
315
  font-size: 0.95em;
316
}
317
</style>
209
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]<style type="text/css">
318
[% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]<style type="text/css">
210
    #addtagl { display: none; }
319
    #addtagl { display: none; }
211
</style>[% END %][% END %][% END %]
320
</style>[% END %][% END %][% END %]
Lines 586-592 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
586
	    </tr></thead>
695
	    </tr></thead>
587
	    <tbody>[% FOREACH ITEM_RESULT IN ITEM_RESULTS %]
696
	    <tbody>[% FOREACH ITEM_RESULT IN ITEM_RESULTS %]
588
	    <tr>[% IF ( item_level_itypes ) %]<td>[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %]
697
	    <tr>[% IF ( item_level_itypes ) %]<td>[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %]
589
		<td>[% UNLESS ( singleBranchMode ) %][% IF ( ITEM_RESULT.branchurl ) %]<a href="[% ITEM_RESULT.branchurl %]">[% ITEM_RESULT.branchname %]</a>[% ELSE %][% ITEM_RESULT.branchname %][% END %][% END %] <span class="shelvingloc">[% ITEM_RESULT.location_description %]</span> </td>
698
		<td>
699
        <span onMouseOver="branch_popup('[% ITEM_RESULT.branchcode %]')">
700
        [% UNLESS ( singleBranchMode ) %]
701
            [% IF ( ITEM_RESULT.branchurl ) %]
702
            <a href="[% ITEM_RESULT.branchurl %]">[% ITEM_RESULT.branchname %]</a>
703
            [% ELSE %]
704
            [% ITEM_RESULT.branchname %]
705
            [% END %]
706
        [% END %]
707
        </span>
708
        <span class="shelvingloc">[% ITEM_RESULT.location_description %]</span>
709
        </td>
590
		[% IF ( itemdata_ccode ) %]<td>[% ITEM_RESULT.ccode %]</td>[% END %]
710
		[% IF ( itemdata_ccode ) %]<td>[% ITEM_RESULT.ccode %]</td>[% END %]
591
		<td>[% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber %]#shelfbrowser">Browse Shelf</a>)[% END %][% END %]</td>
711
		<td>[% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber %]&amp;shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber %]#shelfbrowser">Browse Shelf</a>)[% END %][% END %]</td>
592
		[% IF ( itemdata_enumchron ) %]<td>[% ITEM_RESULT.enumchron %]</td>[% END %]
712
		[% IF ( itemdata_enumchron ) %]<td>[% ITEM_RESULT.enumchron %]</td>[% END %]
(-)a/opac/opac-detail.pl (-2 / +11 lines)
Lines 465-470 my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4: Link Here
465
my $norequests = 1;
465
my $norequests = 1;
466
my $branches = GetBranches();
466
my $branches = GetBranches();
467
my %itemfields;
467
my %itemfields;
468
my %itembranches;
468
for my $itm (@items) {
469
for my $itm (@items) {
469
    $norequests = 0
470
    $norequests = 0
470
       if ( (not $itm->{'wthdrawn'} )
471
       if ( (not $itm->{'wthdrawn'} )
Lines 516-521 for my $itm (@items) { Link Here
516
        $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
517
        $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
517
        $itm->{transfertto}   = $branches->{$transfertto}{branchname};
518
        $itm->{transfertto}   = $branches->{$transfertto}{branchname};
518
     }
519
     }
520
521
     if (my $branchcode = $itm->{branchcode}) {
522
         $itembranches{$branchcode} ||= { map { $_ => $itm->{$_} }
523
                                              qw( branchname branchaddress1 branchaddress2 branchaddress3
524
                                                  branchphone branchemail branchnotes branchurl )
525
                                              };
526
    }
519
}
527
}
520
528
521
## get notes and subjects from MARC record
529
## get notes and subjects from MARC record
Lines 535-541 my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib Link Here
535
                     MARCAUTHORS             => $marcauthorsarray,
543
                     MARCAUTHORS             => $marcauthorsarray,
536
                     MARCSERIES              => $marcseriesarray,
544
                     MARCSERIES              => $marcseriesarray,
537
                     MARCURLS                => $marcurlsarray,
545
                     MARCURLS                => $marcurlsarray,
538
		     MARCHOSTS               => $marchostsarray,
546
                     MARCHOSTS               => $marchostsarray,
539
                     norequests              => $norequests,
547
                     norequests              => $norequests,
540
                     RequestOnOpac           => C4::Context->preference("RequestOnOpac"),
548
                     RequestOnOpac           => C4::Context->preference("RequestOnOpac"),
541
                     itemdata_ccode          => $itemfields{ccode},
549
                     itemdata_ccode          => $itemfields{ccode},
Lines 633-640 if(C4::Context->preference("ISBD")) { Link Here
633
	$template->param(ISBD => 1);
641
	$template->param(ISBD => 1);
634
}
642
}
635
643
644
use JSON;
636
$template->param(
645
$template->param(
637
    ITEM_RESULTS        => \@items,
646
    ITEM_RESULTS        => \@items,
647
    branch_info_json    => encode_json(\%itembranches),
638
    subscriptionsnumber => $subscriptionsnumber,
648
    subscriptionsnumber => $subscriptionsnumber,
639
    biblionumber        => $biblionumber,
649
    biblionumber        => $biblionumber,
640
    subscriptions       => \@subs,
650
    subscriptions       => \@subs,
641
- 

Return to bug 7264