Commit a537a60b authored by Jared Camins-Esakov's avatar Jared Camins-Esakov Committed by Tomas Cohen Arazi

Bug 10402 follow-up: choose contacts for claims

This patch makes it possible to choose a particular contact for
acquisitions and serials claims. To test:

1) Select a contact to use for claiming late orders and a contact
   to use for claiming late issues.
2) Send a claim for a late order and a claim for a late issue.
3) Note that the claims went out to the proper people.
4) Run the unit test with:
    > prove t/db_dependent/Letters.t
5) Sign off.

Note: the claim messages are recorded in the logs in the *Acquisitions*
module, not the Letters module as you might expect

This patch also fixes several perlcritic violations and centralizes
contact-related unit testing in Bookseller.t.
Signed-off-by: default avatarPaola Rossi <paola.rossi@cineca.it>
Signed-off-by: joubu's avatarJonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi's avatarTomas Cohen Arazi <tomascohen@gmail.com>
parent 3b3656aa
......@@ -248,7 +248,7 @@ sub ModBookseller {
discount=?,notes=?,gstrate=?,deliverytime=?
WHERE id=?';
my $sth = $dbh->prepare($query);
return $sth->execute(
my $cnt = $sth->execute(
$data->{'name'}, $data->{'address1'},
$data->{'address2'}, $data->{'address3'},
$data->{'address4'}, $data->{'postal'},
......@@ -278,7 +278,7 @@ sub ModBookseller {
}
$sth = $dbh->prepare($contactquery);
$sth->execute(@contactparams);
return;
return $cnt;
}
=head2 DelBookseller
......
......@@ -63,10 +63,21 @@ Contact's e-mail address.
Notes about contact.
=item rank
=item claimacquisition
Ranking of the contact so that the contact can be given the correct
priority in display.
Whether the contact should receive acquisitions claims.
=item claimissues
Whether the contact should receive serials claims.
=item acqprimary
Whether the contact is the primary contact for acquisitions.
=item serialsprimary
Whether the contact is the primary contact for serials.
=item bookseller
......@@ -81,7 +92,7 @@ use C4::Context;
use base qw(Class::Accessor);
__PACKAGE__->mk_accessors(qw(id name position phone altphone fax email notes rank bookseller));
__PACKAGE__->mk_accessors(qw(id name position phone altphone fax email notes claimacquisition claimissues acqprimary serialsprimary bookseller));
=head1 METHODS
......@@ -152,12 +163,19 @@ sub save {
my ($self) = @_;
my $query;
my @params = ($self->name, $self->position, $self->phone, $self->altphone, $self->fax, $self->email, $self->notes, $self->rank, $self->bookseller);
my @params = (
$self->name, $self->position,
$self->phone, $self->altphone,
$self->fax, $self->email,
$self->notes, $self->acqprimary ? 1 : 0,
$self->serialsprimary ? 1 : 0, $self->claimacquisition ? 1 : 0,
$self->claimissues ? 1 : 0, $self->bookseller
);
if ($self->id) {
$query = 'UPDATE aqcontacts SET name = ?, position = ?, phone = ?, altphone = ?, fax = ?, email = ?, notes = ?, rank = ?, booksellerid = ? WHERE id = ?;';
$query = 'UPDATE aqcontacts SET name = ?, position = ?, phone = ?, altphone = ?, fax = ?, email = ?, notes = ?, acqprimary = ?, serialsprimary = ?, claimacquisition = ?, claimissues = ?, booksellerid = ? WHERE id = ?;';
push @params, $self->id;
} else {
$query = 'INSERT INTO aqcontacts (name, position, phone, altphone, fax, email, notes, rank, booksellerid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);';
$query = 'INSERT INTO aqcontacts (name, position, phone, altphone, fax, email, notes, acqprimary, serialsprimary, claimacquisition, claimissues, booksellerid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);';
}
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare($query);
......
......@@ -326,14 +326,24 @@ sub SendAlerts {
$dbh->prepare("select * from aqbooksellers where id=?");
$sthbookseller->execute( $dataorders->[0]->{booksellerid} );
my $databookseller = $sthbookseller->fetchrow_hashref;
my $addressee = $type eq 'claimacquisition' ? 'acqprimary' : 'serialsprimary';
my $sthcontact =
$dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC");
$sthcontact->execute( $dataorders->[0]->{booksellerid} );
my $datacontact = $sthcontact->fetchrow_hashref;
my @email;
my @cc;
push @email, $databookseller->{bookselleremail} if $databookseller->{bookselleremail};
push @email, $databookseller->{contemail} if $databookseller->{contemail};
push @email, $datacontact->{email} if ( $datacontact && $datacontact->{email} );
unless (@email) {
warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
return { error => "no_email" };
}
my $addlcontact;
while ($addlcontact = $sthcontact->fetchrow_hashref) {
push @cc, $addlcontact->{email} if ( $addlcontact && $addlcontact->{email} );
}
my $userenv = C4::Context->userenv;
my $letter = GetPreparedLetter (
......@@ -343,6 +353,7 @@ sub SendAlerts {
tables => {
'branches' => $userenv->{branch},
'aqbooksellers' => $databookseller,
'aqcontacts' => $datacontact,
},
repeat => $dataorders,
want_librarian => 1,
......@@ -351,6 +362,7 @@ sub SendAlerts {
# ... then send mail
my %mail = (
To => join( ',', @email),
Cc => join( ',', @cc),
From => $userenv->{emailaddress},
Subject => Encode::encode( "utf8", "" . $letter->{title} ),
Message => Encode::encode( "utf8", "" . $letter->{content} ),
......@@ -363,7 +375,7 @@ sub SendAlerts {
$type eq 'claimissues' ? "CLAIM ISSUE" : "ACQUISITION CLAIM",
undef,
"To="
. $databookseller->{contemail}
. join( ',', @email )
. " Title="
. $letter->{title}
. " Content="
......
......@@ -67,11 +67,12 @@ my $booksellerid = $query->param('booksellerid');
my $supplier = {};
if ($booksellerid) {
$supplier = GetBookSellerFromId($booksellerid);
foreach ( keys $supplier ) {
foreach ( keys %{$supplier} ) {
$template->{'VARS'}->{$_} = $supplier->{$_};
}
$template->{'VARS'}->{'booksellerid'} = $booksellerid;
}
$template->{'VARS'}->{'contacts'} = C4::Bookseller::Contact->new() unless $template->{'VARS'}->{'contacts'};
#build array for currencies
if ( $op eq 'display' ) {
......
......@@ -37,10 +37,12 @@ All informations regarding this supplier are listed on input parameter.
Here is the list :
supplier, id, company, company_postal, physical, company_phone,
physical, company_phone, company_fax, website, company_contact_name,
company_contact_position, contact_phone, contact_phone_2, contact_fax,
company_email, contact_notes, notes, status, publishers_imprints,
list_currency, gst, list_gst, invoice_gst, discount, gstrate.
physical, company_phone, company_fax, website, company_email, notes,
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
discount, gstrate, contact_name, contact_position, contact_phone,
contact_altphone, contact_fax, contact_email, contact_notes,
contact_claimacquisition, contact_claimissues, contact_acqprimary,
contact_serialsprimary.
=cut
......@@ -102,14 +104,14 @@ $data{'active'}=$input->param('status');
my @contacts;
my %contact_info;
foreach (qw(id name position phone altphone fax email notes)) {
foreach (qw(id name position phone altphone fax email notes claimacquisition claimissues acqprimary serialsprimary)) {
$contact_info{$_} = [ $input->param('contact_' . $_) ];
}
for my $cnt (0..scalar(@{$contact_info{'id'}})) {
my %contact;
my $real_contact;
foreach (qw(id name position phone altphone fax email notes)) {
foreach (qw(id name position phone altphone fax email notes claimacquisition claimissues acqprimary serialsprimary)) {
$contact{$_} = $contact_info{$_}->[$cnt];
$real_contact = 1 if $contact{$_};
}
......
......@@ -2974,10 +2974,13 @@ CREATE TABLE aqcontacts (
fax varchar(100) default NULL, -- contact's fax number
email varchar(100) default NULL, -- contact's email address
notes mediumtext, -- notes related to the contact
rank SMALLINT default 0, -- display rank for the contact
claimacquisition BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive acquisitions claims
claimissues BOOLEAN NOT NULL DEFAULT 0, -- should this contact receive serial claims
acqprimary BOOLEAN NOT NULL DEFAULT 0, -- is this the primary contact for acquisitions messages
serialsprimary BOOLEAN NOT NULL DEFAULT 0, -- is this the primary contact for serials messages
booksellerid int(11) not NULL,
PRIMARY KEY (id),
CONSTRAINT booksellerid_fk2 FOREIGN KEY (booksellerid)
CONSTRAINT booksellerid_aqcontacts_fk FOREIGN KEY (booksellerid)
REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
......
......@@ -8641,20 +8641,30 @@ if ( CheckVersion($DBversion) ) {
fax varchar(100) default NULL,
email varchar(100) default NULL,
notes mediumtext,
rank SMALLINT default 0,
claimacquisition BOOLEAN NOT NULL DEFAULT 0,
claimissues BOOLEAN NOT NULL DEFAULT 0,
acqprimary BOOLEAN NOT NULL DEFAULT 0,
serialsprimary BOOLEAN NOT NULL DEFAULT 0,
booksellerid int(11) not NULL,
PRIMARY KEY (id),
CONSTRAINT booksellerid_fk2 FOREIGN KEY (booksellerid)
CONSTRAINT booksellerid_aqcontacts_fk FOREIGN KEY (booksellerid)
REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
$dbh->do("INSERT INTO aqcontacts (name, position, phone, altphone, fax,
email, notes, booksellerid)
email, notes, booksellerid, claimacquisition, claimissues, acqprimary, serialsprimary)
SELECT contact, contpos, contphone, contaltphone, contfax, contemail,
contnotes, id FROM aqbooksellers;");
contnotes, id, 1, 1, 1, 1 FROM aqbooksellers;");
$dbh->do("ALTER TABLE aqbooksellers DROP COLUMN contact,
DROP COLUMN contpos, DROP COLUMN contphone,
DROP COLUMN contaltphone, DROP COLUMN contfax,
DROP COLUMN contemail, DROP COLUMN contnotes;");
$dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contact>>', '<<aqcontacts.name>>')");
$dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contpos>>', '<<aqcontacts.position>>')");
$dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contphone>>', '<<aqcontacts.phone>>')");
$dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contaltphone>>', '<<aqcontacts.altphone>>')");
$dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contfax>>', '<<aqcontacts.contfax>>')");
$dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contemail>>', '<<aqcontacts.contemail>>')");
$dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contnotes>>', '<<aqcontacts.contnotes>>')");
print "Upgrade to $DBversion done (Bug 10402: Move bookseller contacts to separate table)\n";
SetVersion($DBversion);
}
......
......@@ -15,8 +15,37 @@
<li><label for="contact_email[% contact.id %]">Email: </label>
<input type="text" size="40" id="contact_email[% contact.id %]" name="contact_email" value="[% contact.email %]" /></li>
<li><label for="contact_notes[% contact.id %]">Notes: </label>
<textarea id="contact_notes[% contact.id %]" name="contact_notes" cols="40" rows="4">[% contnotes %]</textarea></li>
[% IF contact.id %]<li><button class="btn" class="delete-contact"><i class="icon-remove"></i> Delete contact</li>[% END %]
<textarea id="contact_notes[% contact.id %]" name="contact_notes" cols="40" rows="4">[% contact.notes %]</textarea></li>
<li><label for="contact_acqprimary[% contact.id %]">Primary acquisitions contact</label>
[% IF contact.acqprimary %]
<input type="checkbox" id="contact_acqprimary[% contact.id %]" class="contact_acqprimary" checked="checked"></input>
[% ELSE %]
<input type="checkbox" id="contact_acqprimary[% contact.id %]" class="contact_acqprimary"></input>
[% END %]
<input type="hidden" class="contact_acqprimary_hidden" name="contact_acqprimary" value="[% contact.acqprimary %]"></input>
<li><label for="contact_serialsprimary[% contact.id %]">Primary serials contact</label>
[% IF contact.serialsprimary %]
<input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary" checked="checked"></input>
[% ELSE %]
<input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary"></input>
[% END %]
<input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary %]"></input>
<li><label for="contact_claimacquisition[% contact.id %]">Contact about late orders?</label>
[% IF contact.claimacquisition %]
<input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition" checked="checked"></input>
[% ELSE %]
<input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition"></input>
[% END %]
<input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition %]"></input>
<li><label for="contact_claimissues[% contact.id %]">Contact about late issues?</label>
[% IF contact.claimissues %]
<input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues" checked="checked"></input>
[% ELSE %]
<input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues"></input>
[% END %]
<input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues %]"></input>
</li>
[% IF contact.id %]<li><button class="btn delete-contact"><i class="icon-remove"></i> Delete contact</li>[% END %]
</ol>
[% END %]
......@@ -32,6 +61,18 @@
[% IF ( contact.notes ) %]
<p><span class="label">Notes: </span>[% contact.notes %]</p>
[% END %]
[% IF ( contact.acqprimary ) %]
<p><span class="label">Primary acquisitions contact</span></p>
[% END %]
[% IF ( contact.serialsprimary ) %]
<p><span class="label">Primary serials contact</span></p>
[% END %]
[% IF ( contact.claimacquisition ) %]
<p><span class="label">Receives claims for late orders</span></p>
[% END %]
[% IF ( contact.claimissues ) %]
<p><span class="label">Receives claims for late issues</span></p>
[% END %]
[% END %]
[% INCLUDE 'doc-head-open.inc' %]
......@@ -59,13 +100,18 @@ function add_contact() {
$(this).attr('for', $(this).attr('for') + '_' + timestamp);
});
$(new_contact).insertBefore(this);
if ($('.supplier-contact').length === 2) { // First contact
$.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) {
$(checkbox, new_contact).click();
});
}
$('input[name="contact_name"]', new_contact).focus();
return false;
}
function delete_contact() {
$(this).parents('fieldset').delete();
return false;
function delete_contact(ev) {
$(this).parents('.supplier-contact').remove();
ev.preventDefault();
}
$(document).ready(function() {
......@@ -76,8 +122,32 @@ function delete_contact() {
],
'sDom': 't'
} ) );
$('.delete-contact').click(delete_contact);
$('body').on('click', '.delete-contact', null, delete_contact);
$('#add-contact').click(add_contact);
$('body').on('click', '.contact_acqprimary', null, function () {
if ($(this).attr('checked') === 'checked') {
$('.contact_acqprimary').filter(':checked').not(this).removeAttr('checked');
$('.contact_acqprimary_hidden').each(function () {
$(this).val('0');
});
}
$(this).next('.contact_acqprimary_hidden').val('1');
});
$('body').on('click', '.contact_serialsprimary', null, function () {
if ($(this).attr('checked') === 'checked') {
$('.contact_serialsprimary').filter(':checked').not(this).removeAttr('checked');
$('.contact_serialsprimary_hidden').each(function () {
$(this).val('0');
});
}
$(this).next('.contact_serialsprimary_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
});
$('body').on('click', '.contact_claimacquisition', null, function () {
$(this).next('.contact_claimacquisition_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
});
$('body').on('click', '.contact_claimissues', null, function () {
$(this).next('.contact_claimissues_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
});
});
//]]>
</script>
......
......@@ -2,7 +2,7 @@
use Modern::Perl;
use Test::More tests => 72;
use Test::More tests => 85;
use Test::MockModule;
use C4::Context;
use Koha::DateUtils;
......@@ -51,13 +51,6 @@ my $sample_supplier1 = {
accountnumber => 'accountnumber1',
fax => 'fax1',
url => 'url1',
contact => 'contact1',
contpos => 'contpos1',
contphone => 'contphone1',
contfax => 'contefax1',
contaltphone => 'contaltphone1',
contemail => 'contemail1',
contnotes => 'contnotes1',
active => 1,
gstreg => 1,
listincgst => 1,
......@@ -78,13 +71,6 @@ my $sample_supplier2 = {
accountnumber => 'accountnumber2',
fax => 'fax2',
url => 'url2',
contact => 'contact2',
contpos => 'contpos2',
contphone => 'contphone2',
contfax => 'contefax2',
contaltphone => 'contaltphone2',
contemail => 'contemail2',
contnotes => 'contnotes2',
active => 1,
gstreg => 1,
listincgst => 1,
......@@ -92,7 +78,7 @@ my $sample_supplier2 = {
gstrate => '2.0000',
discount => '2.0000',
notes => 'notes2',
deliverytime => 2,
deliverytime => 2
};
my $id_supplier1 = C4::Bookseller::AddBookseller($sample_supplier1);
......@@ -230,13 +216,6 @@ $sample_supplier2 = {
accountnumber => 'accountnumber2 modified',
fax => 'fax2 modified',
url => 'url2 modified',
contact => 'contact2 modified',
contpos => 'contpos2 modified',
contphone => 'contphone2 modified',
contfax => 'contefax2 modified',
contaltphone => 'contaltphone2 modified',
contemail => 'contemail2 modified',
contnotes => 'contnotes2 modified',
active => 1,
gstreg => 1,
listincgst => 1,
......@@ -277,13 +256,6 @@ my $sample_supplier3 = {
accountnumber => 'accountnumber3',
fax => 'fax3',
url => 'url3',
contact => 'contact3',
contpos => 'contpos3',
contphone => 'contphone3',
contfax => 'contefax3',
contaltphone => 'contaltphone3',
contemail => 'contemail3',
contnotes => 'contnotes3',
active => 1,
gstreg => 1,
listincgst => 1,
......@@ -304,13 +276,6 @@ my $sample_supplier4 = {
accountnumber => 'accountnumber4',
fax => 'fax4',
url => 'url4',
contact => 'contact4',
contpos => 'contpos4',
contphone => 'contphone4',
contfax => 'contefax4',
contaltphone => 'contaltphone4',
contemail => 'contemail4',
contnotes => 'contnotes4',
active => 1,
gstreg => 1,
listincgst => 1,
......@@ -716,7 +681,7 @@ my $booksellerid = C4::Bookseller::AddBookseller(
]
);
my @booksellers = C4::Bookseller::GetBookSeller('my vendor');
@booksellers = C4::Bookseller::GetBookSeller('my vendor');
ok(
( grep { $_->{'id'} == $booksellerid } @booksellers ),
'GetBookSeller returns correct record when passed a name'
......@@ -777,7 +742,7 @@ sub field_filter {
'bookselleremail', 'booksellerfax',
'booksellerurl', 'othersupplier',
'currency', 'invoiceprice',
'listprice'
'listprice', 'contacts'
)
{
......
......@@ -18,17 +18,30 @@
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Test::More tests => 45;
use Test::More tests => 56;
use Test::MockModule;
use MARC::Record;
use C4::Biblio qw( AddBiblio );
use C4::Context;
use C4::Letters;
use C4::Members;
use C4::Branch;
use Koha::DateUtils qw( dt_from_string output_pref );
my %mail;
my $module = new Test::MockModule('Mail::Sendmail');
$module->mock(
'sendmail',
sub {
warn "Fake sendmail";
%mail = @_;
}
);
use_ok('C4::Context');
use_ok('C4::Members');
use_ok('C4::Branch');
use_ok('C4::Acquisition');
use_ok('C4::Biblio');
use_ok('C4::Bookseller');
use_ok('C4::Letters');
use t::lib::Mocks;
use Koha::DateUtils qw( dt_from_string output_pref );
my $dbh = C4::Context->dbh;
......@@ -116,7 +129,6 @@ is(
'message marked failed if tried to send SMS message for borrower with no smsalertnumber set (bug 11208)'
);
# GetLetters
my $letters = C4::Letters::GetLetters();
is( @$letters, 0, 'GetLetters returns the correct number of letters' );
......@@ -260,4 +272,68 @@ $prepared_letter = GetPreparedLetter((
$my_content_letter = qq|This is a SMS for an $substitute->{status}|;
is( $prepared_letter->{content}, $my_content_letter, 'GetPreparedLetter returns the content correctly' );
$dbh->do(q{INSERT INTO letter (module, code, name, title, content) VALUES ('claimacquisition','TESTACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>|<<aqcontacts.name>>|<order>Ordernumber <<aqorders.ordernumber>> (<<biblio.title>>) (<<aqorders.quantity>> ordered)</order>');});
my $booksellerid = C4::Bookseller::AddBookseller(
{
name => "my vendor",
address1 => "bookseller's address",
phone => "0123456",
active => 1,
deliverytime => 5,
},
[
{ name => 'John Smith', phone => '0123456x1', claimacquisition => 1 },
{ name => 'Leo Tolstoy', phone => '0123456x2', claimissues => 1 },
]
);
my $basketno = NewBasket($booksellerid, 1);
my $budgetid = C4::Budgets::AddBudget({
budget_code => "budget_code_test_letters",
budget_name => "budget_name_test_letters",
});
my $ordernumber;
my $bib = MARC::Record->new();
if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
$bib->append_fields(
MARC::Field->new('200', ' ', ' ', a => 'Silence in the library'),
);
} else {
$bib->append_fields(
MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'),
);
}
my ($biblionumber, $biblioitemnumber) = AddBiblio($bib, '');
( undef, $ordernumber ) = C4::Acquisition::NewOrder(
{
basketno => $basketno,
quantity => 1,
biblionumber => $biblionumber,
budget_id => $budgetid,
}
);
C4::Acquisition::CloseBasket( $basketno );
my $err;
eval {
warn "This test may issue a warning. Please ignore it.\n";
$err = SendAlerts( 'claimacquisition', [ $ordernumber ], 'TESTACQCLAIM' );
};
is($err->{'error'}, 'no_email', "Trying to send an alert when there's no e-mail results in an error");
my $bookseller = C4::Bookseller::GetBookSellerFromId($booksellerid);
$bookseller->{'contacts'}->[0]->email('testemail@mydomain.com');
C4::Bookseller::ModBookseller($bookseller);
$bookseller = C4::Bookseller::GetBookSellerFromId($booksellerid);
eval {
$err = SendAlerts( 'claimacquisition', [ $ordernumber ], 'TESTACQCLAIM' );
};
is($err, 1, "Successfully sent claim");
is($mail{'To'}, 'testemail@mydomain.com');
is($mail{'Message'}, 'my vendor|John Smith|<order>Ordernumber ' . $ordernumber . ' (Silence in the library) (1 ordered)</order>', 'Claim notice text constructed successfully');
$dbh->rollback;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment