Fixed handling of undefined mailboxes when reports are sent via email; supressed...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 8 Feb 2013 10:24:16 +0000 (11:24 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 8 Feb 2013 13:35:20 +0000 (14:35 +0100)
includes/errors.inc
reporting/includes/doctext.inc
reporting/includes/pdf_report.inc

index 6f9a243299c391f0f2330145773872d6bfc22cda..08a5e5781f6b6e421e087181b0709df02723b08e 100644 (file)
@@ -76,7 +76,9 @@ function error_handler($errno, $errstr, $file, $line) {
 
        // 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;
index 73bdaa10ed9353971145b0b0459f252d249c8810..bf45b1ce355fbd67ce487cf61f366d5d72217bba 100644 (file)
                        $Footer[] = $line;
        }
 
+       $this->formData['recipient_name'] = $Addr1['name'];
 ?>
index 0a412ce87aadcc5d5d718a2433f60710108c144d..caf01d966c4dc4a7d13277a013a44485fa520161 100644 (file)
@@ -976,15 +976,21 @@ class FrontReport extends Cpdf
 
                        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;
@@ -1026,9 +1032,9 @@ class FrontReport extends Cpdf
                                        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'] . " "