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

(-)a/catalogue/ISBDdetail.pl (+33 lines)
Lines 49-54 use C4::Search; # enabled_staff_search_views Link Here
49
use Koha::Biblios;
49
use Koha::Biblios;
50
use Koha::Patrons;
50
use Koha::Patrons;
51
use Koha::RecordProcessor;
51
use Koha::RecordProcessor;
52
use Koha::Virtualshelves;
52
53
53
54
54
my $query = CGI->new;
55
my $query = CGI->new;
Lines 138-143 if ($subscriptionsnumber) { Link Here
138
    );
139
    );
139
}
140
}
140
141
142
# get biblionumbers stored in the cart
143
my @cart_list;
144
145
if($query->cookie("intranet_bib_list")){
146
    my $cart_list = $query->cookie("intranet_bib_list");
147
    @cart_list = split(/\//, $cart_list);
148
    if ( grep {$_ eq $biblionumber} @cart_list) {
149
        $template->param( incart => 1 );
150
    }
151
}
152
153
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
154
    {
155
        borrowernumber => $loggedinuser,
156
        add_allowed    => 1,
157
        category       => 1,
158
    }
159
);
160
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
161
    {
162
        borrowernumber => $loggedinuser,
163
        add_allowed    => 1,
164
        category       => 2,
165
    }
166
);
167
168
169
$template->param(
170
    add_to_some_private_shelves => $some_private_shelves,
171
    add_to_some_public_shelves  => $some_public_shelves,
172
);
173
141
$template->param (
174
$template->param (
142
    ISBD                => $res,
175
    ISBD                => $res,
143
    biblionumber        => $biblionumber,
176
    biblionumber        => $biblionumber,
(-)a/catalogue/MARCdetail.pl (+34 lines)
Lines 62-67 use Koha::Biblios; Link Here
62
use Koha::BiblioFrameworks;
62
use Koha::BiblioFrameworks;
63
use Koha::Patrons;
63
use Koha::Patrons;
64
use Koha::DateUtils;
64
use Koha::DateUtils;
65
use Koha::Virtualshelves;
65
66
66
use List::MoreUtils qw( uniq );
67
use List::MoreUtils qw( uniq );
67
68
Lines 325-330 if ($subscriptionscount) { Link Here
325
    );
326
    );
326
}
327
}
327
328
329
# get biblionumbers stored in the cart
330
my @cart_list;
331
332
if($query->cookie("intranet_bib_list")){
333
    my $cart_list = $query->cookie("intranet_bib_list");
334
    @cart_list = split(/\//, $cart_list);
335
    if ( grep {$_ eq $biblionumber} @cart_list) {
336
        $template->param( incart => 1 );
337
    }
338
}
339
340
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
341
    {
342
        borrowernumber => $loggedinuser,
343
        add_allowed    => 1,
344
        category       => 1,
345
    }
346
);
347
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
348
    {
349
        borrowernumber => $loggedinuser,
350
        add_allowed    => 1,
351
        category       => 2,
352
    }
353
);
354
355
356
$template->param(
357
    add_to_some_private_shelves => $some_private_shelves,
358
    add_to_some_public_shelves  => $some_public_shelves,
359
);
360
328
$template->param (
361
$template->param (
329
    item_loop               => \@item_loop,
362
    item_loop               => \@item_loop,
330
    item_header_loop        => \@item_header_loop,
363
    item_header_loop        => \@item_header_loop,
Lines 337-342 $template->param ( Link Here
337
	C4::Search::enabled_staff_search_views,
370
	C4::Search::enabled_staff_search_views,
338
    searchid                => scalar $query->param('searchid'),
371
    searchid                => scalar $query->param('searchid'),
339
    biblio                  => $biblio_object,
372
    biblio                  => $biblio_object,
373
    loggedinuser => $loggedinuser,
340
);
374
);
341
375
342
$template->param( holdcount => $biblio_object->holds->count );
376
$template->param( holdcount => $biblio_object->holds->count );
(-)a/catalogue/detail.pl (+32 lines)
Lines 438-443 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { Link Here
438
    }
438
    }
439
}
439
}
440
440
441
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
442
    {
443
        borrowernumber => $borrowernumber,
444
        add_allowed    => 1,
445
        category       => 1,
446
    }
447
);
448
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
449
    {
450
        borrowernumber => $borrowernumber,
451
        add_allowed    => 1,
452
        category       => 2,
453
    }
454
);
455
456
457
$template->param(
458
    add_to_some_private_shelves => $some_private_shelves,
459
    add_to_some_public_shelves  => $some_public_shelves,
460
);
461
441
$template->param(
462
$template->param(
442
    MARCNOTES   => $marcnotesarray,
463
    MARCNOTES   => $marcnotesarray,
443
    itemdata_ccode      => $itemfields{ccode},
464
    itemdata_ccode      => $itemfields{ccode},
Lines 580-585 if ($StaffDetailItemSelection) { Link Here
580
    }
601
    }
581
}
602
}
582
603
604
# get biblionumbers stored in the cart
605
my @cart_list;
606
607
if($query->cookie("intranet_bib_list")){
608
    my $cart_list = $query->cookie("intranet_bib_list");
609
    @cart_list = split(/\//, $cart_list);
610
    if ( grep {$_ eq $biblionumber} @cart_list) {
611
        $template->param( incart => 1 );
612
    }
613
}
614
583
$template->param(biblio => $biblio);
615
$template->param(biblio => $biblio);
584
616
585
output_html_with_http_headers $query, $cookie, $template->output;
617
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/catalogue/labeledMARCdetail.pl (+33 lines)
Lines 32-37 use C4::Serials; Link Here
32
use Koha::Biblios;
32
use Koha::Biblios;
33
use Koha::BiblioFrameworks;
33
use Koha::BiblioFrameworks;
34
use Koha::Patrons;
34
use Koha::Patrons;
35
use Koha::Virtualshelves;
35
36
36
my $query        = CGI->new;
37
my $query        = CGI->new;
37
my $dbh          = C4::Context->dbh;
38
my $dbh          = C4::Context->dbh;
Lines 120-125 for my $field ($record->fields) Link Here
120
	};
121
	};
121
}
122
}
122
123
124
# get biblionumbers stored in the cart
125
my @cart_list;
126
127
if($query->cookie("intranet_bib_list")){
128
    my $cart_list = $query->cookie("intranet_bib_list");
129
    @cart_list = split(/\//, $cart_list);
130
    if ( grep {$_ eq $biblionumber} @cart_list) {
131
        $template->param( incart => 1 );
132
    }
133
}
134
135
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
136
    {
137
        borrowernumber => $loggedinuser,
138
        add_allowed    => 1,
139
        category       => 1,
140
    }
141
);
142
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
143
    {
144
        borrowernumber => $loggedinuser,
145
        add_allowed    => 1,
146
        category       => 2,
147
    }
148
);
149
150
151
$template->param(
152
    add_to_some_private_shelves => $some_private_shelves,
153
    add_to_some_public_shelves  => $some_public_shelves,
154
);
155
123
$template->param (
156
$template->param (
124
	marc_data				=> \@marc_data,
157
	marc_data				=> \@marc_data,
125
    biblionumber            => $biblionumber,
158
    biblionumber            => $biblionumber,
(-)a/catalogue/moredetail.pl (+32 lines)
Lines 265-270 $template->param(count => $data->{'count'}, Link Here
265
	C4::Search::enabled_staff_search_views,
265
	C4::Search::enabled_staff_search_views,
266
);
266
);
267
267
268
# get biblionumbers stored in the cart
269
my @cart_list;
270
271
if($query->cookie("intranet_bib_list")){
272
    my $cart_list = $query->cookie("intranet_bib_list");
273
    @cart_list = split(/\//, $cart_list);
274
    if ( grep {$_ eq $biblionumber} @cart_list) {
275
        $template->param( incart => 1 );
276
    }
277
}
278
279
my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
280
    {
281
        borrowernumber => $loggedinuser,
282
        add_allowed    => 1,
283
        category       => 1,
284
    }
285
);
286
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
287
    {
288
        borrowernumber => $loggedinuser,
289
        add_allowed    => 1,
290
        category       => 2,
291
    }
292
);
293
294
295
$template->param(
296
    add_to_some_private_shelves => $some_private_shelves,
297
    add_to_some_public_shelves  => $some_public_shelves,
298
);
299
268
$template->param(
300
$template->param(
269
    ITEM_DATA           => \@items,
301
    ITEM_DATA           => \@items,
270
    moredetailview      => 1,
302
    moredetailview      => 1,
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (+18 lines)
Lines 1357-1362 dd { Link Here
1357
        margin-top: 0;
1357
        margin-top: 0;
1358
        z-index: 300;
1358
        z-index: 300;
1359
    }
1359
    }
1360
1361
    a.addtocart {
1362
        display: block;
1363
    }
1364
1365
    a.cartRemove {
1366
        padding: 6px 12px;
1367
        font-size: 12px;
1368
        display: none;
1369
    }
1370
1371
    a.addtocart.incart {
1372
        display: none;
1373
    }
1374
1375
    a.cartRemove.incart {
1376
        display: block;
1377
    }
1360
}
1378
}
1361
1379
1362
#disabled {
1380
#disabled {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (-13 / +62 lines)
Lines 100-118 CAN_user_serials_create_subscription ) %] Link Here
100
    </ul>
100
    </ul>
101
    </div>
101
    </div>
102
102
103
[% IF ( virtualshelves && intranetbookbag ) %]
103
    [% IF ( intranetbookbag ) %]
104
    <div class="btn-group">
104
        [% IF ( incart ) %]
105
    <button class="btn btn-default dropdown-toggle" data-toggle="dropdown">Add to <span class="caret"></span></button>
105
            <div class="btn-group">
106
    <ul class="dropdown-menu">
106
                <a id="cart[% biblionumber | html %]" class="btn btn-default addtocart incart" href="#"><i class="fa fa-shopping-cart"></i> Add to cart</a>
107
        <li><a href="#" id="addtocart">Cart</a></li>
107
            </div>
108
        <li><a href="#" id="addtoshelf">List</a></li>
108
            <div class="btn-group">
109
    </ul>
109
                <a id="cartR[% biblionumber | html %]" class="btn btn-default cartRemove incart" href="#"><i class="fa fa-shopping-cart"></i> Remove from cart</a>
110
    </div>
110
            </div>
111
[% ELSIF ( virtualshelves ) %]
111
        [% ELSE %]
112
    <div class="btn-group"><a id="addtoshelf" class="btn btn-default"><i class="fa fa-list"></i> Add to list</a> </div>
112
            <div class="btn-group">
113
[% ELSIF ( intranetbookbag ) %]
113
                <a id="cart[% biblionumber | html %]" class="btn btn-default addtocart" href="#"><i class="fa fa-shopping-cart"></i> Add to cart</a>
114
    <div class="btn-group"><a id="addtocart" class="btn btn-default"><i class="fa fa-shopping-cart"></i> Add to cart</a> </div>
114
            </div>
115
[% END %]
115
            <div class="btn-group">
116
                <a id="cartR[% biblionumber | html %]" class="btn btn-default cartRemove" href="#"><i class="fa fa-shopping-cart"></i> Remove from cart</a>
117
            </div>
118
        [% END %]
119
    [% END %]
120
121
    [% IF Koha.Preference('virtualshelves') %]
122
        <div class="btn-group">
123
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
124
                <i class="fa fa-list"></i> Add to list <span class="caret"></span>
125
            </button>
126
            <ul class="dropdown-menu">
127
                [% IF add_to_some_private_shelves.count %]
128
                    <li class="dropdown-header">Your lists</li>
129
                    [% SET number_of_private_shelves = 0 %]
130
                    [% FOREACH s IN add_to_some_private_shelves %]
131
                        [% IF shelfnumber != s.shelfnumber %]
132
                            <li>
133
                                <a href="#" class="addtolist" data-shelfnumber="[% s.shelfnumber | html %]">[% s.shelfname | html %]</a>
134
                            </li>
135
                            [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
136
                            [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
137
                        [% END %]
138
                    [% END %]
139
                [% END %]
140
                [% IF add_to_some_public_shelves.count %]
141
                    <li class="dropdown-header">Public lists</li>
142
                    [% SET number_of_public_shelves = 0 %]
143
                    [% FOREACH s IN add_to_some_public_shelves %]
144
                        [% IF shelfnumber != s.shelfnumber %]
145
                            <li>
146
                                <a href="#" data-shelfnumber="[% s.shelfnumber | html %]" class="addtolist">[% s.shelfname | html %]</a>
147
                            </li>
148
                            [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
149
                            [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
150
                        [% END %]
151
                    [% END %]
152
                [% END %]
153
                <li role="separator" class="divider"></li>
154
                [% IF add_to_some_private_shelves.count > 10 or add_to_some_public_shelves.count > 10 %]
155
                    <li>
156
                        <a href="#" class="addtolist morelists">More lists</a>
157
                    </li>
158
                [% END %]
159
                <li>
160
                    <a href="#" class="addtolist newlist">New list</a>
161
                </li>
162
            </ul>
163
        </div>
164
    [% END # /IF virtualshelves %]
116
165
117
    <div class="btn-group"><a id="printbiblio" class="btn btn-default"><i class="fa fa-print"></i> Print</a></div>
166
    <div class="btn-group"><a id="printbiblio" class="btn btn-default"><i class="fa fa-print"></i> Print</a></div>
118
167
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt (+1 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Asset %]
3
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt (+1 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Asset %]
3
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt (+1 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Asset %]
3
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/basket.js (-7 / +21 lines)
Lines 484-505 function updateLink(val, op, target){ Link Here
484
    var cartR = target ? target.$("#cartR" + val) : $("#cartR" + val);
484
    var cartR = target ? target.$("#cartR" + val) : $("#cartR" + val);
485
485
486
    if(op == "add"){
486
    if(op == "add"){
487
        cart.html(__("In your cart")).addClass("incart");
487
        if( cart.hasClass("btn") ){
488
            /* Cart link is a button with an icon */
489
            cart.html("<i class=\"fa fa-shopping-cart\"></i> " + __("Add to cart")).addClass("incart");
490
            cart.hide();
491
        } else {
492
            cart.html( __("In your cart") ).addClass("incart");
493
        }
488
        cartR.show();
494
        cartR.show();
489
    } else {
495
    } else {
490
        cart.html(__("Add to cart")).removeClass("incart").addClass("addtocart");
496
        if (cart.hasClass("btn")) {
497
            cart.html("<i class=\"fa fa-shopping-cart\"></i> " + __("Add to cart")).addClass("addtocart");
498
            cart.show();
499
        } else {
500
            cart.html(__("Add to cart")).addClass("addtocart");
501
        }
491
        cartR.hide();
502
        cartR.hide();
492
    }
503
    }
493
}
504
}
494
505
495
function updateAllLinks(target){
506
function updateAllLinks(target){
496
    if(target){
507
    var cart = target ? target.$("a.incart") : $("a.incart");
497
        target.$("a.incart").html(__("Add to cart")).removeClass("incart").addClass("addtocart");
508
    var cartR = target ? target.$(".cartRemove") : $(".cartRemove");
498
        target.$(".cartRemove").hide();
509
    if( cart.hasClass("btn") ){
510
        /* Cart link is a button with an icon */
511
        cart.html("<i class=\"fa fa-shopping-cart\"></i> " + __("Add to cart")).addClass("incart");
512
        cartR.hide();
499
    } else {
513
    } else {
500
        $("a.incart").html(__("Add to cart")).removeClass("incart").addClass("addtocart");
514
        cart.html( __("In your cart") ).addClass("incart");
501
        $(".cartRemove").hide();
502
    }
515
    }
516
    cart.show();
503
}
517
}
504
518
505
$(document).ready(function(){
519
$(document).ready(function(){
(-)a/koha-tmpl/intranet-tmpl/prog/js/catalog.js (-7 / +33 lines)
Lines 1-4 Link Here
1
/* global __ biblionumber count holdcount countorders countdeletedorders searchid addRecord */
1
/* global __ biblionumber count holdcount countorders countdeletedorders searchid addRecord delSingleRecord */
2
/* exported GetZ3950Terms PopupZ3950Confirmed */
2
/* exported GetZ3950Terms PopupZ3950Confirmed */
3
/* IF ( CAN_user_editcatalogue_edit_catalogue ) */
3
/* IF ( CAN_user_editcatalogue_edit_catalogue ) */
4
    /* this function open a popup to search on z3950 server.  */
4
    /* this function open a popup to search on z3950 server.  */
Lines 15-21 Link Here
15
    }
15
    }
16
/* END IF( CAN_user_editcatalogue_edit_catalogue ) */
16
/* END IF( CAN_user_editcatalogue_edit_catalogue ) */
17
17
18
function addToCart() { addRecord( biblionumber ); }
18
function addToCart(){
19
    addRecord( biblionumber );
20
}
21
19
function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber,'Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
22
function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber,'Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
20
}
23
}
21
function printBiblio() {window.print(); }
24
function printBiblio() {window.print(); }
Lines 94-104 $(document).ready(function() { Link Here
94
        printBiblio();
97
        printBiblio();
95
        return false;
98
        return false;
96
    });
99
    });
97
    $("#addtocart").click(function(){
100
98
        addToCart();
101
    $(".addtocart").on("click", function (e) {
99
        $(".btn-group").removeClass("open");
102
        e.preventDefault();
100
        return false;
103
        var selection_id = this.id;
104
        var biblionumber = selection_id.replace("cart", "");
105
        addRecord(biblionumber);
106
    });
107
108
    $(".cartRemove").on("click", function (e) {
109
        e.preventDefault();
110
        var selection_id = this.id;
111
        var biblionumber = selection_id.replace("cartR", "");
112
        delSingleRecord(biblionumber);
113
        $(".addtocart").html("<i class=\"fa fa-shopping-cart\"></i> " + __("Add to cart"));
101
    });
114
    });
115
102
    $("#addtoshelf").click(function(){
116
    $("#addtoshelf").click(function(){
103
        addToShelf();
117
        addToShelf();
104
        $(".btn-group").removeClass("open");
118
        $(".btn-group").removeClass("open");
Lines 112-115 $(document).ready(function() { Link Here
112
            alertNoItems();
126
            alertNoItems();
113
        })
127
        })
114
        .tooltip();
128
        .tooltip();
129
130
    $(".addtolist").on("click", function (e) {
131
        e.preventDefault();
132
        var shelfnumber = $(this).data("shelfnumber");
133
        if ($(this).hasClass("morelists")) {
134
            openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber);
135
        } else if ($(this).hasClass("newlist")) {
136
            openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&biblionumber=' + biblionumber);
137
        } else {
138
            openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber=' + shelfnumber + '&confirm=1&biblionumber=' + biblionumber);
139
        }
140
    });
141
115
});
142
});
116
- 

Return to bug 26707