Lines 458-464
subtest 'Test max_holds per library/patron category' => sub {
Link Here
|
458 |
plan tests => 6; |
458 |
plan tests => 6; |
459 |
|
459 |
|
460 |
$dbh->do('DELETE FROM reserves'); |
460 |
$dbh->do('DELETE FROM reserves'); |
461 |
$dbh->do('DELETE FROM circulation_rules'); |
|
|
462 |
|
461 |
|
463 |
$biblio = $builder->build_sample_biblio; |
462 |
$biblio = $builder->build_sample_biblio; |
464 |
( $item_bibnum, $item_bibitemnum, $itemnumber ) = |
463 |
( $item_bibnum, $item_bibitemnum, $itemnumber ) = |
Lines 586-593
subtest 'CanItemBeReserved / holds_per_day tests' => sub {
Link Here
|
586 |
|
585 |
|
587 |
Koha::Holds->search->delete; |
586 |
Koha::Holds->search->delete; |
588 |
$dbh->do('DELETE FROM issues'); |
587 |
$dbh->do('DELETE FROM issues'); |
589 |
$dbh->do('DELETE FROM issuingrules'); |
|
|
590 |
$dbh->do('DELETE FROM circulation_rules'); |
591 |
Koha::Items->search->delete; |
588 |
Koha::Items->search->delete; |
592 |
Koha::Biblios->search->delete; |
589 |
Koha::Biblios->search->delete; |
593 |
|
590 |
|
Lines 753-766
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
753 |
# Cleanup database |
750 |
# Cleanup database |
754 |
Koha::Holds->search->delete; |
751 |
Koha::Holds->search->delete; |
755 |
$dbh->do('DELETE FROM issues'); |
752 |
$dbh->do('DELETE FROM issues'); |
756 |
$dbh->do('DELETE FROM issuingrules'); |
753 |
Koha::CirculationRules->set_rule( |
757 |
$dbh->do( |
754 |
{ |
758 |
q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) |
755 |
branchcode => undef, |
759 |
VALUES (?, ?, ?, ?)}, |
756 |
categorycode => undef, |
760 |
{}, |
757 |
itemtype => undef, |
761 |
'*', '*', '*', 25 |
758 |
rule_name => 'reservesallowed', |
|
|
759 |
rule_value => 25, |
760 |
} |
762 |
); |
761 |
); |
763 |
$dbh->do('DELETE FROM circulation_rules'); |
|
|
764 |
|
762 |
|
765 |
Koha::Items->search->delete; |
763 |
Koha::Items->search->delete; |
766 |
Koha::Biblios->search->delete; |
764 |
Koha::Biblios->search->delete; |
Lines 818-824
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
818 |
{ |
816 |
{ |
819 |
branchcode => undef, |
817 |
branchcode => undef, |
820 |
itemtype => undef, |
818 |
itemtype => undef, |
821 |
categorycode => undef, |
|
|
822 |
rules => { |
819 |
rules => { |
823 |
holdallowed => 3, |
820 |
holdallowed => 3, |
824 |
hold_fulfillment_policy => 'any', |
821 |
hold_fulfillment_policy => 'any', |
Lines 841-855
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
841 |
'Patron cannot place hold because patron\'s home library is not part of hold group' |
838 |
'Patron cannot place hold because patron\'s home library is not part of hold group' |
842 |
); |
839 |
); |
843 |
|
840 |
|
844 |
# Cleanup default_cirt_rules |
|
|
845 |
$dbh->do('DELETE FROM circulation_rules'); |
846 |
|
847 |
# Insert default circ rule to "any" for library 2 |
841 |
# Insert default circ rule to "any" for library 2 |
848 |
Koha::CirculationRules->set_rules( |
842 |
Koha::CirculationRules->set_rules( |
849 |
{ |
843 |
{ |
850 |
branchcode => $library2->branchcode, |
844 |
branchcode => $library2->branchcode, |
851 |
itemtype => undef, |
845 |
itemtype => undef, |
852 |
categorycode => undef, |
|
|
853 |
rules => { |
846 |
rules => { |
854 |
holdallowed => 2, |
847 |
holdallowed => 2, |
855 |
hold_fulfillment_policy => 'any', |
848 |
hold_fulfillment_policy => 'any', |
Lines 870-876
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
870 |
{ |
863 |
{ |
871 |
branchcode => $library2->branchcode, |
864 |
branchcode => $library2->branchcode, |
872 |
itemtype => undef, |
865 |
itemtype => undef, |
873 |
categorycode => undef, |
|
|
874 |
rules => { |
866 |
rules => { |
875 |
holdallowed => 3, |
867 |
holdallowed => 3, |
876 |
hold_fulfillment_policy => 'any', |
868 |
hold_fulfillment_policy => 'any', |
Lines 886-900
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
886 |
'Patron cannot place hold if holdallowed is set to "hold group" for library 2' |
878 |
'Patron cannot place hold if holdallowed is set to "hold group" for library 2' |
887 |
); |
879 |
); |
888 |
|
880 |
|
889 |
# Cleanup default_branch_cirt_rules |
|
|
890 |
$dbh->do('DELETE FROM circulation_rules'); |
891 |
|
892 |
# Insert default item rule to "any" for itemtype 2 |
881 |
# Insert default item rule to "any" for itemtype 2 |
893 |
Koha::CirculationRules->set_rules( |
882 |
Koha::CirculationRules->set_rules( |
894 |
{ |
883 |
{ |
895 |
branchcode => undef, |
884 |
branchcode => $library2->branchcode, |
896 |
itemtype => $itemtype2->itemtype, |
885 |
itemtype => $itemtype2->itemtype, |
897 |
categorycode => undef, |
|
|
898 |
rules => { |
886 |
rules => { |
899 |
holdallowed => 2, |
887 |
holdallowed => 2, |
900 |
hold_fulfillment_policy => 'any', |
888 |
hold_fulfillment_policy => 'any', |
Lines 913-921
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
913 |
# Update default item rule to "hold group" for itemtype 2 |
901 |
# Update default item rule to "hold group" for itemtype 2 |
914 |
Koha::CirculationRules->set_rules( |
902 |
Koha::CirculationRules->set_rules( |
915 |
{ |
903 |
{ |
916 |
branchcode => undef, |
904 |
branchcode => $library2->branchcode, |
917 |
itemtype => $itemtype2->itemtype, |
905 |
itemtype => $itemtype2->itemtype, |
918 |
categorycode => undef, |
|
|
919 |
rules => { |
906 |
rules => { |
920 |
holdallowed => 3, |
907 |
holdallowed => 3, |
921 |
hold_fulfillment_policy => 'any', |
908 |
hold_fulfillment_policy => 'any', |
Lines 931-945
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
931 |
'Patron cannot place hold if holdallowed is set to "hold group" for itemtype 2' |
918 |
'Patron cannot place hold if holdallowed is set to "hold group" for itemtype 2' |
932 |
); |
919 |
); |
933 |
|
920 |
|
934 |
# Cleanup default_branch_item_rules |
|
|
935 |
$dbh->do('DELETE FROM circulation_rules'); |
936 |
|
937 |
# Insert branch item rule to "any" for itemtype 2 and library 2 |
921 |
# Insert branch item rule to "any" for itemtype 2 and library 2 |
938 |
Koha::CirculationRules->set_rules( |
922 |
Koha::CirculationRules->set_rules( |
939 |
{ |
923 |
{ |
940 |
branchcode => $library2->branchcode, |
924 |
branchcode => $library2->branchcode, |
941 |
itemtype => $itemtype2->itemtype, |
925 |
itemtype => $itemtype2->itemtype, |
942 |
categorycode => undef, |
|
|
943 |
rules => { |
926 |
rules => { |
944 |
holdallowed => 2, |
927 |
holdallowed => 2, |
945 |
hold_fulfillment_policy => 'any', |
928 |
hold_fulfillment_policy => 'any', |
Lines 960-966
subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
Link Here
|
960 |
{ |
943 |
{ |
961 |
branchcode => $library2->branchcode, |
944 |
branchcode => $library2->branchcode, |
962 |
itemtype => $itemtype2->itemtype, |
945 |
itemtype => $itemtype2->itemtype, |
963 |
categorycode => undef, |
|
|
964 |
rules => { |
946 |
rules => { |
965 |
holdallowed => 3, |
947 |
holdallowed => 3, |
966 |
hold_fulfillment_policy => 'any', |
948 |
hold_fulfillment_policy => 'any', |
Lines 988-1001
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
988 |
# Cleanup database |
970 |
# Cleanup database |
989 |
Koha::Holds->search->delete; |
971 |
Koha::Holds->search->delete; |
990 |
$dbh->do('DELETE FROM issues'); |
972 |
$dbh->do('DELETE FROM issues'); |
991 |
$dbh->do('DELETE FROM issuingrules'); |
973 |
Koha::CirculationRules->set_rule( |
992 |
$dbh->do( |
974 |
{ |
993 |
q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) |
975 |
branchcode => undef, |
994 |
VALUES (?, ?, ?, ?)}, |
976 |
categorycode => undef, |
995 |
{}, |
977 |
itemtype => undef, |
996 |
'*', '*', '*', 25 |
978 |
rule_name => 'reservesallowed', |
|
|
979 |
rule_value => 25, |
980 |
} |
997 |
); |
981 |
); |
998 |
$dbh->do('DELETE FROM circulation_rules'); |
|
|
999 |
|
982 |
|
1000 |
Koha::Items->search->delete; |
983 |
Koha::Items->search->delete; |
1001 |
Koha::Biblios->search->delete; |
984 |
Koha::Biblios->search->delete; |
Lines 1053-1059
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
1053 |
{ |
1036 |
{ |
1054 |
branchcode => undef, |
1037 |
branchcode => undef, |
1055 |
itemtype => undef, |
1038 |
itemtype => undef, |
1056 |
categorycode => undef, |
|
|
1057 |
rules => { |
1039 |
rules => { |
1058 |
holdallowed => 2, |
1040 |
holdallowed => 2, |
1059 |
hold_fulfillment_policy => 'holdgroup', |
1041 |
hold_fulfillment_policy => 'holdgroup', |
Lines 1076-1090
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
1076 |
'Patron cannot place hold because pickup location is not part of hold group' |
1058 |
'Patron cannot place hold because pickup location is not part of hold group' |
1077 |
); |
1059 |
); |
1078 |
|
1060 |
|
1079 |
# Cleanup default_cirt_rules |
|
|
1080 |
$dbh->do('DELETE FROM circulation_rules'); |
1081 |
|
1082 |
# Insert default circ rule to "any" for library 2 |
1061 |
# Insert default circ rule to "any" for library 2 |
1083 |
Koha::CirculationRules->set_rules( |
1062 |
Koha::CirculationRules->set_rules( |
1084 |
{ |
1063 |
{ |
1085 |
branchcode => $library2->branchcode, |
1064 |
branchcode => $library2->branchcode, |
1086 |
itemtype => undef, |
1065 |
itemtype => undef, |
1087 |
categorycode => undef, |
|
|
1088 |
rules => { |
1066 |
rules => { |
1089 |
holdallowed => 2, |
1067 |
holdallowed => 2, |
1090 |
hold_fulfillment_policy => 'any', |
1068 |
hold_fulfillment_policy => 'any', |
Lines 1105-1111
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
1105 |
{ |
1083 |
{ |
1106 |
branchcode => $library2->branchcode, |
1084 |
branchcode => $library2->branchcode, |
1107 |
itemtype => undef, |
1085 |
itemtype => undef, |
1108 |
categorycode => undef, |
|
|
1109 |
rules => { |
1086 |
rules => { |
1110 |
holdallowed => 2, |
1087 |
holdallowed => 2, |
1111 |
hold_fulfillment_policy => 'holdgroup', |
1088 |
hold_fulfillment_policy => 'holdgroup', |
Lines 1121-1135
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
1121 |
'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for library 2' |
1098 |
'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for library 2' |
1122 |
); |
1099 |
); |
1123 |
|
1100 |
|
1124 |
# Cleanup default_branch_cirt_rules |
|
|
1125 |
$dbh->do('DELETE FROM circulation_rules'); |
1126 |
|
1127 |
# Insert default item rule to "any" for itemtype 2 |
1101 |
# Insert default item rule to "any" for itemtype 2 |
1128 |
Koha::CirculationRules->set_rules( |
1102 |
Koha::CirculationRules->set_rules( |
1129 |
{ |
1103 |
{ |
1130 |
branchcode => undef, |
1104 |
branchcode => $library2->branchcode, |
1131 |
itemtype => $itemtype2->itemtype, |
1105 |
itemtype => $itemtype2->itemtype, |
1132 |
categorycode => undef, |
|
|
1133 |
rules => { |
1106 |
rules => { |
1134 |
holdallowed => 2, |
1107 |
holdallowed => 2, |
1135 |
hold_fulfillment_policy => 'any', |
1108 |
hold_fulfillment_policy => 'any', |
Lines 1148-1156
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
1148 |
# Update default item rule to "hold group" for itemtype 2 |
1121 |
# Update default item rule to "hold group" for itemtype 2 |
1149 |
Koha::CirculationRules->set_rules( |
1122 |
Koha::CirculationRules->set_rules( |
1150 |
{ |
1123 |
{ |
1151 |
branchcode => undef, |
1124 |
branchcode => $library2->branchcode, |
1152 |
itemtype => $itemtype2->itemtype, |
1125 |
itemtype => $itemtype2->itemtype, |
1153 |
categorycode => undef, |
|
|
1154 |
rules => { |
1126 |
rules => { |
1155 |
holdallowed => 2, |
1127 |
holdallowed => 2, |
1156 |
hold_fulfillment_policy => 'holdgroup', |
1128 |
hold_fulfillment_policy => 'holdgroup', |
Lines 1166-1180
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
1166 |
'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for itemtype 2' |
1138 |
'Patron cannot place hold if hold_fulfillment_policy is set to "hold group" for itemtype 2' |
1167 |
); |
1139 |
); |
1168 |
|
1140 |
|
1169 |
# Cleanup default_branch_item_rules |
|
|
1170 |
$dbh->do('DELETE FROM circulation_rules'); |
1171 |
|
1172 |
# Insert branch item rule to "any" for itemtype 2 and library 2 |
1141 |
# Insert branch item rule to "any" for itemtype 2 and library 2 |
1173 |
Koha::CirculationRules->set_rules( |
1142 |
Koha::CirculationRules->set_rules( |
1174 |
{ |
1143 |
{ |
1175 |
branchcode => $library2->branchcode, |
1144 |
branchcode => $library2->branchcode, |
1176 |
itemtype => $itemtype2->itemtype, |
1145 |
itemtype => $itemtype2->itemtype, |
1177 |
categorycode => undef, |
|
|
1178 |
rules => { |
1146 |
rules => { |
1179 |
holdallowed => 2, |
1147 |
holdallowed => 2, |
1180 |
hold_fulfillment_policy => 'any', |
1148 |
hold_fulfillment_policy => 'any', |
Lines 1195-1201
subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
Link Here
|
1195 |
{ |
1163 |
{ |
1196 |
branchcode => $library2->branchcode, |
1164 |
branchcode => $library2->branchcode, |
1197 |
itemtype => $itemtype2->itemtype, |
1165 |
itemtype => $itemtype2->itemtype, |
1198 |
categorycode => undef, |
|
|
1199 |
rules => { |
1166 |
rules => { |
1200 |
holdallowed => 2, |
1167 |
holdallowed => 2, |
1201 |
hold_fulfillment_policy => 'holdgroup', |
1168 |
hold_fulfillment_policy => 'holdgroup', |