|
Lines 33-39
subtest 'CRUD' => sub {
Link Here
|
| 33 |
|
33 |
|
| 34 |
my $shelf = Koha::Virtualshelf->new({ |
34 |
my $shelf = Koha::Virtualshelf->new({ |
| 35 |
shelfname => "my first shelf", |
35 |
shelfname => "my first shelf", |
| 36 |
owner => $patron->{borrowernumber}, |
36 |
owner_id => $patron->{borrowernumber}, |
| 37 |
public => 0, |
37 |
public => 0, |
| 38 |
} |
38 |
} |
| 39 |
)->store; |
39 |
)->store; |
|
Lines 62-68
subtest 'CRUD' => sub {
Link Here
|
| 62 |
eval { |
62 |
eval { |
| 63 |
$shelf = Koha::Virtualshelf->new({ |
63 |
$shelf = Koha::Virtualshelf->new({ |
| 64 |
shelfname => "my first shelf", |
64 |
shelfname => "my first shelf", |
| 65 |
owner => $patron->{borrowernumber}, |
65 |
owner_id => $patron->{borrowernumber}, |
| 66 |
public => 0, |
66 |
public => 0, |
| 67 |
} |
67 |
} |
| 68 |
)->store; |
68 |
)->store; |
|
Lines 78-84
subtest 'CRUD' => sub {
Link Here
|
| 78 |
|
78 |
|
| 79 |
$shelf = Koha::Virtualshelf->new({ |
79 |
$shelf = Koha::Virtualshelf->new({ |
| 80 |
shelfname => "my first shelf", |
80 |
shelfname => "my first shelf", |
| 81 |
owner => $another_patron->{borrowernumber}, |
81 |
owner_id => $another_patron->{borrowernumber}, |
| 82 |
public => 0, |
82 |
public => 0, |
| 83 |
} |
83 |
} |
| 84 |
)->store; |
84 |
)->store; |
|
Lines 110-123
subtest 'Sharing' => sub {
Link Here
|
| 110 |
|
110 |
|
| 111 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
111 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
| 112 |
shelfname => "my first shelf", |
112 |
shelfname => "my first shelf", |
| 113 |
owner => $patron_wants_to_share->{borrowernumber}, |
113 |
owner_id => $patron_wants_to_share->{borrowernumber}, |
| 114 |
public => 0, |
114 |
public => 0, |
| 115 |
} |
115 |
} |
| 116 |
)->store; |
116 |
)->store; |
| 117 |
|
117 |
|
| 118 |
my $shelf_not_to_share = Koha::Virtualshelf->new({ |
118 |
my $shelf_not_to_share = Koha::Virtualshelf->new({ |
| 119 |
shelfname => "my second shelf", |
119 |
shelfname => "my second shelf", |
| 120 |
owner => $patron_wants_to_share->{borrowernumber}, |
120 |
owner_id => $patron_wants_to_share->{borrowernumber}, |
| 121 |
public => 0, |
121 |
public => 0, |
| 122 |
} |
122 |
} |
| 123 |
)->store; |
123 |
)->store; |
|
Lines 199-205
subtest 'Shelf content' => sub {
Link Here
|
| 199 |
my $dt_yesterday = dt_from_string->subtract_duration( DateTime::Duration->new( days => 1 ) ); |
199 |
my $dt_yesterday = dt_from_string->subtract_duration( DateTime::Duration->new( days => 1 ) ); |
| 200 |
my $shelf = Koha::Virtualshelf->new( |
200 |
my $shelf = Koha::Virtualshelf->new( |
| 201 |
{ shelfname => "my first shelf", |
201 |
{ shelfname => "my first shelf", |
| 202 |
owner => $patron1->{borrowernumber}, |
202 |
owner_id => $patron1->{borrowernumber}, |
| 203 |
public => 0, |
203 |
public => 0, |
| 204 |
lastmodified => $dt_yesterday, |
204 |
lastmodified => $dt_yesterday, |
| 205 |
} |
205 |
} |
|
Lines 316-322
subtest 'Shelf permissions' => sub {
Link Here
|
| 316 |
|
316 |
|
| 317 |
my $public_shelf = Koha::Virtualshelf->new( |
317 |
my $public_shelf = Koha::Virtualshelf->new( |
| 318 |
{ shelfname => "my first shelf", |
318 |
{ shelfname => "my first shelf", |
| 319 |
owner => $patron1->{borrowernumber}, |
319 |
owner_id => $patron1->{borrowernumber}, |
| 320 |
public => 1, |
320 |
public => 1, |
| 321 |
allow_change_from_owner => 0, |
321 |
allow_change_from_owner => 0, |
| 322 |
allow_change_from_others => 0, |
322 |
allow_change_from_others => 0, |
|
Lines 456-462
subtest 'Shelf permissions' => sub {
Link Here
|
| 456 |
|
456 |
|
| 457 |
my $private_shelf = Koha::Virtualshelf->new( |
457 |
my $private_shelf = Koha::Virtualshelf->new( |
| 458 |
{ shelfname => "my first shelf", |
458 |
{ shelfname => "my first shelf", |
| 459 |
owner => $patron1->{borrowernumber}, |
459 |
owner_id => $patron1->{borrowernumber}, |
| 460 |
public => 0, |
460 |
public => 0, |
| 461 |
allow_change_from_owner => 0, |
461 |
allow_change_from_owner => 0, |
| 462 |
allow_change_from_others => 0, |
462 |
allow_change_from_others => 0, |
|
Lines 578-614
subtest 'Get shelves' => sub {
Link Here
|
| 578 |
|
578 |
|
| 579 |
my $private_shelf1_1 = Koha::Virtualshelf->new({ |
579 |
my $private_shelf1_1 = Koha::Virtualshelf->new({ |
| 580 |
shelfname => "private shelf 1 for patron 1", |
580 |
shelfname => "private shelf 1 for patron 1", |
| 581 |
owner => $patron1->{borrowernumber}, |
581 |
owner_id => $patron1->{borrowernumber}, |
| 582 |
public => 0, |
582 |
public => 0, |
| 583 |
} |
583 |
} |
| 584 |
)->store; |
584 |
)->store; |
| 585 |
my $private_shelf1_2 = Koha::Virtualshelf->new({ |
585 |
my $private_shelf1_2 = Koha::Virtualshelf->new({ |
| 586 |
shelfname => "private shelf 2 for patron 1", |
586 |
shelfname => "private shelf 2 for patron 1", |
| 587 |
owner => $patron1->{borrowernumber}, |
587 |
owner_id => $patron1->{borrowernumber}, |
| 588 |
public => 0, |
588 |
public => 0, |
| 589 |
} |
589 |
} |
| 590 |
)->store; |
590 |
)->store; |
| 591 |
my $private_shelf2_1 = Koha::Virtualshelf->new({ |
591 |
my $private_shelf2_1 = Koha::Virtualshelf->new({ |
| 592 |
shelfname => "private shelf 1 for patron 2", |
592 |
shelfname => "private shelf 1 for patron 2", |
| 593 |
owner => $patron2->{borrowernumber}, |
593 |
owner_id => $patron2->{borrowernumber}, |
| 594 |
public => 0, |
594 |
public => 0, |
| 595 |
} |
595 |
} |
| 596 |
)->store; |
596 |
)->store; |
| 597 |
my $public_shelf1_1 = Koha::Virtualshelf->new({ |
597 |
my $public_shelf1_1 = Koha::Virtualshelf->new({ |
| 598 |
shelfname => "public shelf 1 for patron 1", |
598 |
shelfname => "public shelf 1 for patron 1", |
| 599 |
owner => $patron1->{borrowernumber}, |
599 |
owner_id => $patron1->{borrowernumber}, |
| 600 |
public => 1, |
600 |
public => 1, |
| 601 |
} |
601 |
} |
| 602 |
)->store; |
602 |
)->store; |
| 603 |
my $public_shelf1_2 = Koha::Virtualshelf->new({ |
603 |
my $public_shelf1_2 = Koha::Virtualshelf->new({ |
| 604 |
shelfname => "public shelf 2 for patron 1", |
604 |
shelfname => "public shelf 2 for patron 1", |
| 605 |
owner => $patron1->{borrowernumber}, |
605 |
owner_id => $patron1->{borrowernumber}, |
| 606 |
public => 1, |
606 |
public => 1, |
| 607 |
} |
607 |
} |
| 608 |
)->store; |
608 |
)->store; |
| 609 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
609 |
my $shelf_to_share = Koha::Virtualshelf->new({ |
| 610 |
shelfname => "shared shelf", |
610 |
shelfname => "shared shelf", |
| 611 |
owner => $patron1->{borrowernumber}, |
611 |
owner_id => $patron1->{borrowernumber}, |
| 612 |
public => 0, |
612 |
public => 0, |
| 613 |
} |
613 |
} |
| 614 |
)->store; |
614 |
)->store; |
|
Lines 644-662
subtest 'Get shelves containing biblios' => sub {
Link Here
|
| 644 |
|
644 |
|
| 645 |
my $shelf1 = Koha::Virtualshelf->new( |
645 |
my $shelf1 = Koha::Virtualshelf->new( |
| 646 |
{ shelfname => "my first shelf", |
646 |
{ shelfname => "my first shelf", |
| 647 |
owner => $patron1->{borrowernumber}, |
647 |
owner_id => $patron1->{borrowernumber}, |
| 648 |
public => 0, |
648 |
public => 0, |
| 649 |
} |
649 |
} |
| 650 |
)->store; |
650 |
)->store; |
| 651 |
my $shelf2 = Koha::Virtualshelf->new( |
651 |
my $shelf2 = Koha::Virtualshelf->new( |
| 652 |
{ shelfname => "my x second shelf", # 'x' to make it sorted after 'third' |
652 |
{ shelfname => "my x second shelf", # 'x' to make it sorted after 'third' |
| 653 |
owner => $patron2->{borrowernumber}, |
653 |
owner_id => $patron2->{borrowernumber}, |
| 654 |
public => 0, |
654 |
public => 0, |
| 655 |
} |
655 |
} |
| 656 |
)->store; |
656 |
)->store; |
| 657 |
my $shelf3 = Koha::Virtualshelf->new( |
657 |
my $shelf3 = Koha::Virtualshelf->new( |
| 658 |
{ shelfname => "my third shelf", |
658 |
{ shelfname => "my third shelf", |
| 659 |
owner => $patron1->{borrowernumber}, |
659 |
owner_id => $patron1->{borrowernumber}, |
| 660 |
public => 1, |
660 |
public => 1, |
| 661 |
} |
661 |
} |
| 662 |
)->store; |
662 |
)->store; |
|
Lines 731-739
subtest 'cannot_be_transferred' => sub {
Link Here
|
| 731 |
$removed_patron->delete; |
731 |
$removed_patron->delete; |
| 732 |
|
732 |
|
| 733 |
# Create three lists |
733 |
# Create three lists |
| 734 |
my $private_list = Koha::Virtualshelf->new({ shelfname => "A", owner => $listowner->id })->store; |
734 |
my $private_list = Koha::Virtualshelf->new({ shelfname => "A", owner_id => $listowner->id })->store; |
| 735 |
my $public_list = Koha::Virtualshelf->new({ shelfname => "B", public => 1, owner => $listowner->id })->store; |
735 |
my $public_list = Koha::Virtualshelf->new({ shelfname => "B", public => 1, owner_id => $listowner->id })->store; |
| 736 |
my $shared_list = Koha::Virtualshelf->new({ shelfname => "C", owner => $listowner->id })->store; |
736 |
my $shared_list = Koha::Virtualshelf->new({ shelfname => "C", owner_id => $listowner->id })->store; |
| 737 |
$shared_list->share("key")->accept( "key", $receiver->id ); |
737 |
$shared_list->share("key")->accept( "key", $receiver->id ); |
| 738 |
|
738 |
|
| 739 |
# Test on private list |
739 |
# Test on private list |