// error_reporting==0 when messages are set off with @
if ($errno & error_reporting()) {
- $messages[] = array($errno, $errstr, $file, $line, @$bt);
+ // suppress duplicated errors
+ if (!in_array(array($errno, $errstr, $file, $line, @$bt), $messages))
+ $messages[] = array($errno, $errstr, $file, $line, @$bt);
}
else if($errno&~E_NOTICE) { // log all not displayed messages
$user = @$_SESSION["wa_current_user"]->loginname;
if ($email == 1)
{
- if(!count($this->contactData)) {
+ $contactData = array();
+ if ($this->contactData)
+ foreach($this->contactData as $contact)
+ if (!empty($contact['email']))
+ $contactData[] = $contact['email'];
+
+ if(!count($contactData)) {
$this->SetLang(user_language());
- display_error(_("You have no email contact defined for this type of document"));
+ display_warning(sprintf(_("You have no email contact defined for this type of document for '%s'."), $this->formData['recipient_name']));
} else {
$sent = $try = 0;
$emails = "";
if(!$subject)
$subject = $this->formData['document_name'] . ' '. $this->formData['document_number'];
- foreach($this->contactData as $contact) {
+ foreach($contactData as $contact) {
if (!isset($contact['email']))
continue;
$emailtype = true;
unlink($fname);
$this->SetLang(user_language());
if (!$try) {
- display_error(_("There is no contact email set for this document type."));
+ display_warning(sprintf(_("You have no email contact defined for this type of document for '%s'."), $this->formData['recipient_name']));
} elseif (!$sent)
- display_error($this->title . " " . $this->formData['document_number'] . ". "
+ display_warning($this->title . " " . $this->formData['document_number'] . ". "
. _("Sending document by email failed") . ". " . _("Email:") . $emails);
else
display_notification($this->title . " " . $this->formData['document_number'] . " "