Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
digibib
deichman
Commits
b85ac412
Commit
b85ac412
authored
Jan 24, 2019
by
Benjamin Rokseth
Browse files
koha: add WIP AddToqueue to MessageQueue
parent
bb2a7eac
Changes
1
Hide whitespace changes
Inline
Side-by-side
koha/Deichman/Patron/MessageQueue.pm
View file @
b85ac412
...
...
@@ -20,4 +20,44 @@ sub GetByPatron {
return
$self
;
}
=head
params
letter
title
content
metadata
code
content_type
message_transport_type
borrowernumber
to_address
=cut
sub
AddToQueue
{
my
(
$self
,
$msg
)
=
@_
;
$self
->
{
patron
}
or
return
;
my
$q
=
"
INSERT INTO message_queue
( borrowernumber, subject, content, metadata, letter_code, message_transport_type, status, time_queued, to_address, from_address, content_type )
VALUES (?,?,?,?,?,?,?,?,?,?,?)
";
my
$dbh
=
$self
->
dbh
;
my
$sth
=
$dbh
->
prepare
(
$q
);
my
$content
=
$msg
->
{
letter
}
->
{
content
};
$content
=~
s/\s+//g
if
(
defined
$content
);
(
!
$content
or
$content
eq
'')
and
return
;
my
$result
=
$sth
->
execute
(
$self
->
{
patron
}
->
{
borrowernumber
},
$msg
->
{
letter
}
->
{
title
},
# subject
$msg
->
{
letter
}
->
{
content
},
$msg
->
{
letter
}
->
{
metadata
}
||
"",
$msg
->
{
letter
}
->
{
code
}
||
"",
$msg
->
{
message_transport_type
},
"
pending
",
$msg
->
{
to_address
},
$msg
->
{
from_address
},
$msg
->
{
letter
}
->
{"
content-type
"}
)
or
Deichman::Exception::
Patron
->
throw
(
$dbh
->
errstr
);
}
1
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment