Bug 8838: (follow-up) Rebase, fix typos, and tidy.
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
cec91b3b27
commit
358272ebbc
|
|
@ -7,16 +7,20 @@ return {
|
|||
my ($args) = @_;
|
||||
my ( $dbh, $out ) = @$args{qw(dbh out)};
|
||||
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO `letter` VALUES (NULL,'reserves','HOLDDGST','','Hold available for pickup (digest)',0,'Hold(s) available for pickup','You have one or more holds available for pickup:\r\n----\r\nTitle: [% hold.biblio.title %]\r\nAuthor: [% hold.biblio.author %]\r\nCopy: [% hold.item.copynumber %]\r\nLocation: [% hold.branch.branchname %]\r\nWaiting since: [% hold.waitingdate %]:\r\n[% hold.branch.branchaddress1 %]\r\n[% hold.branch.branchaddress2 %]\r\n[% hold.branch.branchaddress3 %]\r\n[% hold.branch.branchcity %] [% hold.branch.branchzip %]\r\n----','email','default','2023-08-29 18:42:15');
|
||||
});
|
||||
$dbh->do(
|
||||
q{
|
||||
INSERT IGNORE INTO `letter` VALUES (NULL,'reserves','HOLDDGST','','Hold available for pickup (digest)',0,'Hold(s) available for pickup','You have one or more holds available for pickup:\r\n----\r\nTitle: [% hold.biblio.title %]\r\nAuthor: [% hold.biblio.author %]\r\nCopy: [% hold.item.copynumber %]\r\nLocation: [% hold.branch.branchname %]\r\nWaiting since: [% hold.waitingdate %]\r\n[% hold.branch.branchaddress1 %]\r\n[% hold.branch.branchaddress2 %]\r\n[% hold.branch.branchaddress3 %]\r\n[% hold.branch.branchcity %] [% hold.branch.branchzip %]\r\n----','email','default','2023-08-29 18:42:15');
|
||||
}
|
||||
);
|
||||
|
||||
$dbh->do(q{
|
||||
$dbh->do(
|
||||
q{
|
||||
INSERT IGNORE INTO message_transports VALUES
|
||||
( 4, "email", 1, "reserves", "HOLDDGST", "" ),
|
||||
( 4, "sms", 1, "reserves", "HOLDDGST", "" ),
|
||||
( 4, "phone", 1, "reserves", "HOLDDGST", "");
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
# Print useful stuff here
|
||||
# tables
|
||||
|
|
|
|||
|
|
@ -1809,7 +1809,7 @@ tables:
|
|||
- "Author: [% hold.biblio.author %]"
|
||||
- "Copy: [% hold.item.copynumber %]"
|
||||
- "Waiting since: [% hold.waitingdate %]"
|
||||
- "Waitng at: [% hold.branch.branchname %]"
|
||||
- "Waiting at: [% hold.branch.branchname %]"
|
||||
- "[% hold.branch.branchaddress1 %]"
|
||||
- "[% hold.branch.branchaddress2 %]"
|
||||
- "[% hold.branch.branchaddress3 %]"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 79;
|
||||
use Test::More tests => 77;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
|
||||
|
|
@ -1824,67 +1824,79 @@ subtest 'HOLDDGST tests' => sub {
|
|||
plan tests => 2;
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $branch = $builder->build_object({
|
||||
class => 'Koha::Libraries',
|
||||
value => {
|
||||
branchemail => 'branch@e.mail',
|
||||
branchreplyto => 'branch@reply.to',
|
||||
pickup_location => 1
|
||||
my $branch = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Libraries',
|
||||
value => {
|
||||
branchemail => 'branch@e.mail',
|
||||
branchreplyto => 'branch@reply.to',
|
||||
pickup_location => 1
|
||||
}
|
||||
}
|
||||
});
|
||||
my $item = $builder->build_sample_item({
|
||||
homebranch => $branch->branchcode,
|
||||
holdingbranch => $branch->branchcode
|
||||
});
|
||||
my $item2 = $builder->build_sample_item({
|
||||
homebranch => $branch->branchcode,
|
||||
holdingbranch => $branch->branchcode
|
||||
});
|
||||
);
|
||||
my $item = $builder->build_sample_item(
|
||||
{
|
||||
homebranch => $branch->branchcode,
|
||||
holdingbranch => $branch->branchcode
|
||||
}
|
||||
);
|
||||
my $item2 = $builder->build_sample_item(
|
||||
{
|
||||
homebranch => $branch->branchcode,
|
||||
holdingbranch => $branch->branchcode
|
||||
}
|
||||
);
|
||||
|
||||
my $wants_hold_and_email = {
|
||||
wants_digest => '1',
|
||||
transports => {
|
||||
sms => 'HOLDDGST',
|
||||
transports => {
|
||||
sms => 'HOLDDGST',
|
||||
email => 'HOLDDGST',
|
||||
},
|
||||
},
|
||||
letter_code => 'HOLDDGST'
|
||||
};
|
||||
|
||||
my $mp = Test::MockModule->new( 'C4::Members::Messaging' );
|
||||
my $mp = Test::MockModule->new('C4::Members::Messaging');
|
||||
|
||||
$mp->mock("GetMessagingPreferences",$wants_hold_and_email);
|
||||
$mp->mock( "GetMessagingPreferences", $wants_hold_and_email );
|
||||
|
||||
$dbh->do('DELETE FROM letter');
|
||||
|
||||
my $email_hold_notice = $builder->build({
|
||||
my $email_hold_notice = $builder->build(
|
||||
{
|
||||
source => 'Letter',
|
||||
value => {
|
||||
value => {
|
||||
message_transport_type => 'email',
|
||||
branchcode => '',
|
||||
code => 'HOLDDGST',
|
||||
module => 'reserves',
|
||||
lang => 'default',
|
||||
branchcode => '',
|
||||
code => 'HOLDDGST',
|
||||
module => 'reserves',
|
||||
lang => 'default',
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
my $sms_hold_notice = $builder->build({
|
||||
my $sms_hold_notice = $builder->build(
|
||||
{
|
||||
source => 'Letter',
|
||||
value => {
|
||||
value => {
|
||||
message_transport_type => 'sms',
|
||||
branchcode => '',
|
||||
code => 'HOLDDGST',
|
||||
module => 'reserves',
|
||||
lang=>'default',
|
||||
branchcode => '',
|
||||
code => 'HOLDDGST',
|
||||
module => 'reserves',
|
||||
lang => 'default',
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
my $hold_borrower = $builder->build({
|
||||
my $hold_borrower = $builder->build(
|
||||
{
|
||||
source => 'Borrower',
|
||||
value => {
|
||||
smsalertnumber=>'5555555551',
|
||||
email=>'a@c.com',
|
||||
value => {
|
||||
smsalertnumber => '5555555551',
|
||||
email => 'a@c.com',
|
||||
}
|
||||
})->{borrowernumber};
|
||||
}
|
||||
)->{borrowernumber};
|
||||
|
||||
C4::Reserves::AddReserve(
|
||||
{
|
||||
|
|
@ -1902,22 +1914,26 @@ subtest 'HOLDDGST tests' => sub {
|
|||
}
|
||||
);
|
||||
|
||||
ModReserveAffect($item->itemnumber, $hold_borrower, 0);
|
||||
ModReserveAffect($item2->itemnumber, $hold_borrower, 0);
|
||||
ModReserveAffect( $item->itemnumber, $hold_borrower, 0 );
|
||||
ModReserveAffect( $item2->itemnumber, $hold_borrower, 0 );
|
||||
|
||||
my $sms_count = $schema->resultset('MessageQueue')->search({
|
||||
letter_code => 'HOLDDGST',
|
||||
my $sms_count = $schema->resultset('MessageQueue')->search(
|
||||
{
|
||||
letter_code => 'HOLDDGST',
|
||||
message_transport_type => 'sms',
|
||||
borrowernumber => $hold_borrower,
|
||||
})->count;
|
||||
is($sms_count, 1 ,"Only one sms hold digest message created for two holds");
|
||||
borrowernumber => $hold_borrower,
|
||||
}
|
||||
)->count;
|
||||
is( $sms_count, 1, "Only one sms hold digest message created for two holds" );
|
||||
|
||||
my $email_count = $schema->resultset('MessageQueue')->search({
|
||||
letter_code => 'HOLDDGST',
|
||||
my $email_count = $schema->resultset('MessageQueue')->search(
|
||||
{
|
||||
letter_code => 'HOLDDGST',
|
||||
message_transport_type => 'email',
|
||||
borrowernumber => $hold_borrower,
|
||||
})->count;
|
||||
is($email_count, 1 ,"Only one email hold digest message created for two holds");
|
||||
borrowernumber => $hold_borrower,
|
||||
}
|
||||
)->count;
|
||||
is( $email_count, 1, "Only one email hold digest message created for two holds" );
|
||||
|
||||
$schema->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue