# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
use warnings;
parameters :
- alertid : the alert id
deletes the alert
-
+
=cut
sub delalert ($) {
=head2 EnqueueLetter
-=over 4
-
-my $success = EnqueueLetter( { letter => $letter, borrowernumber => '12', message_transport_type => 'email' } )
+ my $success = EnqueueLetter( { letter => $letter,
+ borrowernumber => '12', message_transport_type => 'email' } )
places a letter in the message_queue database table, which will
eventually get processed (sent) by the process_message_queue.pl
return true on success
-=back
-
=cut
sub EnqueueLetter ($) {
=head2 SendQueuedMessages ([$hashref])
-=over 4
+ my $sent = SendQueuedMessages( { verbose => 1 } );
sends all of the 'pending' items in the message queue.
-my $sent = SendQueuedMessages( { verbose => 1 } );
-
returns number of messages sent.
-=back
-
=cut
sub SendQueuedMessages (;$) {
=head2 GetRSSMessages
-=over 4
-
-my $message_list = GetRSSMessages( { limit => 10, borrowernumber => '14' } )
+ my $message_list = GetRSSMessages( { limit => 10, borrowernumber => '14' } )
returns a listref of all queued RSS messages for a particular person.
-=back
-
=cut
sub GetRSSMessages {
=head2 GetPrintMessages
-=over 4
-
-my $message_list = GetPrintMessages( { borrowernumber => $borrowernumber } )
+ my $message_list = GetPrintMessages( { borrowernumber => $borrowernumber } )
Returns a arrayref of all queued print messages (optionally, for a particular
person).
-=back
-
=cut
sub GetPrintMessages {
=head2 GetQueuedMessages ([$hashref])
-=over 4
-
-my $messages = GetQueuedMessage( { borrowernumber => '123', limit => 20 } );
+ my $messages = GetQueuedMessage( { borrowernumber => '123', limit => 20 } );
fetches messages out of the message queue.
returns:
list of hashes, each has represents a message in the message queue.
-=back
-
=cut
sub GetQueuedMessages {
status => 'failed' } );
return;
}
- unless ($to_address = $member->{email}) { # assigment, not comparison
+ my $which_address = C4::Context->preference('AutoEmailPrimaryAddress');
+ # If the system preference is set to 'first valid' (value == OFF), look up email address
+ if ($which_address eq 'OFF') {
+ $to_address = GetFirstValidEmailAddress( $message->{'borrowernumber'} );
+ } else {
+ $to_address = $member->{$which_address};
+ }
+ unless ($to_address) {
# warn "FAIL: No 'to_address' and no email for " . ($member->{surname} ||'') . ", borrowernumber ($message->{borrowernumber})";
# warning too verbose for this more common case?
_set_message_status( { message_id => $message->{'message_id'},