Lines 286-292
$prepared_letter = GetPreparedLetter(
Link Here
|
286 |
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); |
286 |
is( $prepared_letter->{content}, $modification->id(), 'Patron modification object used correctly' ); |
287 |
|
287 |
|
288 |
subtest 'regression tests' => sub { |
288 |
subtest 'regression tests' => sub { |
289 |
plan tests => 7; |
289 |
plan tests => 8; |
290 |
|
290 |
|
291 |
my $library = $builder->build( { source => 'Branch' } ); |
291 |
my $library = $builder->build( { source => 'Branch' } ); |
292 |
my $patron = $builder->build( { source => 'Borrower' } ); |
292 |
my $patron = $builder->build( { source => 'Borrower' } ); |
Lines 860-865
EOF
Link Here
|
860 |
is( $tt_letter->{content}, $letter->{content}, ); |
860 |
is( $tt_letter->{content}, $letter->{content}, ); |
861 |
}; |
861 |
}; |
862 |
|
862 |
|
|
|
863 |
subtest 'Bug 19743 - Header and Footer should be updated on each item for checkin / checkout / renewal notices' => sub { |
864 |
plan tests => 8; |
865 |
|
866 |
my $checkout_code = 'CHECKOUT'; |
867 |
my $checkin_code = 'CHECKIN'; |
868 |
|
869 |
my $dbh = C4::Context->dbh; |
870 |
$dbh->do("DELETE FROM letter"); |
871 |
$dbh->do("DELETE FROM issues"); |
872 |
$dbh->do("DELETE FROM message_queue"); |
873 |
|
874 |
# Enable notification for CHECKOUT - Things are hardcoded here but should work with default data |
875 |
$dbh->do(q|INSERT INTO borrower_message_preferences( borrowernumber, message_attribute_id ) VALUES ( ?, ? )|, undef, $patron->{borrowernumber}, 6 ); |
876 |
my $borrower_message_preference_id = $dbh->last_insert_id(undef, undef, "borrower_message_preferences", undef); |
877 |
$dbh->do(q|INSERT INTO borrower_message_transport_preferences( borrower_message_preference_id, message_transport_type) VALUES ( ?, ? )|, undef, $borrower_message_preference_id, 'email' ); |
878 |
# Enable notification for CHECKIN - Things are hardcoded here but should work with default data |
879 |
$dbh->do(q|INSERT INTO borrower_message_preferences( borrowernumber, message_attribute_id ) VALUES ( ?, ? )|, undef, $patron->{borrowernumber}, 5 ); |
880 |
$borrower_message_preference_id = $dbh->last_insert_id(undef, undef, "borrower_message_preferences", undef); |
881 |
$dbh->do(q|INSERT INTO borrower_message_transport_preferences( borrower_message_preference_id, message_transport_type) VALUES ( ?, ? )|, undef, $borrower_message_preference_id, 'email' ); |
882 |
|
883 |
my $checkout_template = q| |
884 |
<<branches.branchname>> |
885 |
---- |
886 |
---- |
887 |
|; |
888 |
reset_template( { template => $checkout_template, code => $checkout_code, module => 'circulation' } ); |
889 |
my $checkin_template = q[ |
890 |
<<branches.branchname>> |
891 |
---- |
892 |
---- |
893 |
]; |
894 |
reset_template( { template => $checkin_template, code => $checkin_code, module => 'circulation' } ); |
895 |
|
896 |
my $issue = C4::Circulation::AddIssue( $patron, $item1->{barcode} ); |
897 |
my $first_checkout_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
898 |
|
899 |
my $library_object = Koha::Libraries->find( $issue->branchcode ); |
900 |
my $old_branchname = $library_object->branchname; |
901 |
my $new_branchname = "Kyle M Hall Memorial Library"; |
902 |
|
903 |
# Change branch name for second checkout notice |
904 |
$library_object->branchname($new_branchname); |
905 |
$library_object->store(); |
906 |
|
907 |
C4::Circulation::AddIssue( $patron, $item2->{barcode} ); |
908 |
my $second_checkout_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
909 |
|
910 |
# Restore old name for first checkin notice |
911 |
$library_object->branchname( $old_branchname ); |
912 |
$library_object->store(); |
913 |
|
914 |
AddReturn( $item1->{barcode} ); |
915 |
my $first_checkin_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
916 |
|
917 |
# Change branch name for second checkin notice |
918 |
$library_object->branchname($new_branchname); |
919 |
$library_object->store(); |
920 |
|
921 |
AddReturn( $item2->{barcode} ); |
922 |
my $second_checkin_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
923 |
|
924 |
# Restore old name for first TT checkout notice |
925 |
$library_object->branchname( $old_branchname ); |
926 |
$library_object->store(); |
927 |
|
928 |
Koha::Notice::Messages->delete; |
929 |
|
930 |
# TT syntax |
931 |
$checkout_template = q| |
932 |
[% branch.branchname %] |
933 |
---- |
934 |
---- |
935 |
|; |
936 |
reset_template( { template => $checkout_template, code => $checkout_code, module => 'circulation' } ); |
937 |
$checkin_template = q[ |
938 |
[% branch.branchname %] |
939 |
---- |
940 |
---- |
941 |
]; |
942 |
reset_template( { template => $checkin_template, code => $checkin_code, module => 'circulation' } ); |
943 |
|
944 |
C4::Circulation::AddIssue( $patron, $item1->{barcode} ); |
945 |
my $first_checkout_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
946 |
|
947 |
# Change branch name for second checkout notice |
948 |
$library_object->branchname($new_branchname); |
949 |
$library_object->store(); |
950 |
|
951 |
C4::Circulation::AddIssue( $patron, $item2->{barcode} ); |
952 |
my $second_checkout_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
953 |
|
954 |
# Restore old name for first checkin notice |
955 |
$library_object->branchname( $old_branchname ); |
956 |
$library_object->store(); |
957 |
|
958 |
AddReturn( $item1->{barcode} ); |
959 |
my $first_checkin_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
960 |
# |
961 |
# Change branch name for second checkin notice |
962 |
$library_object->branchname($new_branchname); |
963 |
$library_object->store(); |
964 |
|
965 |
AddReturn( $item2->{barcode} ); |
966 |
my $second_checkin_tt_letter = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->next; |
967 |
|
968 |
my $first_letter = qq[ |
969 |
$old_branchname |
970 |
]; |
971 |
my $second_letter = qq[ |
972 |
$new_branchname |
973 |
]; |
974 |
|
975 |
|
976 |
is( $first_checkout_letter->content, $first_letter, 'Verify first checkout letter' ); |
977 |
is( $second_checkout_letter->content, $second_letter, 'Verify second checkout letter' ); |
978 |
is( $first_checkin_letter->content, $first_letter, 'Verify first checkin letter' ); |
979 |
is( $second_checkin_letter->content, $second_letter, 'Verify second checkin letter' ); |
980 |
|
981 |
is( $first_checkout_tt_letter->content, $first_letter, 'Verify TT first checkout letter' ); |
982 |
is( $second_checkout_tt_letter->content, $second_letter, 'Verify TT second checkout letter' ); |
983 |
is( $first_checkin_tt_letter->content, $first_letter, 'Verify TT first checkin letter' ); |
984 |
is( $second_checkin_tt_letter->content, $second_letter, 'Verify TT second checkin letter' ); |
985 |
}; |
986 |
|
863 |
}; |
987 |
}; |
864 |
|
988 |
|
865 |
subtest 'loops' => sub { |
989 |
subtest 'loops' => sub { |
866 |
- |
|
|