Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix - Formularios - Eliminar mensajes de error innecesarios #448

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/stic_Web_Forms/Catcher/Donation/DonationBO.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public function checkParams()
$requiredParams = $this->requiredFormFields;

// Define those required based on the target module.
$this->formParams['stic_identification_number_c'] = trim($this->formParams['stic_identification_number_c']);
switch ($this->defParams['web_module']) {
case 'Contacts':
$moduleRequiredFields = array('last_name', 'stic_identification_number_c');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function doAction()
}
} // If it is an immediate operation the notification is automatically sent
else if (!$mailer->sendUserMail($defParams['decodedDefParams']['email_template_id'], $objWeb, $payment)) {
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": Unable to send confirmation email to user.");
$GLOBALS['log']->warn('Line ' . __LINE__ . ': ' . __METHOD__ . ": Unable to send confirmation email to user.");
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions modules/stic_Web_Forms/Catcher/Donation/DonationMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ public function sendUserMail($templateId, $objWeb, $payment, $lang = null)
return false;
}

if (empty($templateId)) {
$GLOBALS['log']->warn('Line ' . __LINE__ . ': ' . __METHOD__ . ": No template ID received.");
return false;
}

// Add the recipient
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Adding recipient [{$objWeb->email1}] ...");
$this->addMailsDest($objWeb->email1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public function checkParams()

if ($_REQUEST["validate_identification_number"] == '1') {
// If identification type is not set or it is a NIF/NIE, validate it. In other case, don't validate
$this->formParams['Contacts___stic_identification_number_c'] = trim($this->formParams['Contacts___stic_identification_number_c']);
if ($this->formParams['Contacts___stic_identification_number_c']
&& (empty($this->formParams['Contacts___stic_identification_type_c'])
|| $this->formParams['Contacts___stic_identification_type_c'] == 'nif'
Expand All @@ -283,6 +284,7 @@ public function checkParams()
}

// If organization's id is available, validate it
$this->formParams['Accounts___stic_identification_number_c'] = trim($this->formParams['Accounts___stic_identification_number_c']);
if (!empty($this->formParams['Accounts___stic_identification_number_c']) &&
!self::checkTaxIdentity($this->formParams['Accounts___stic_identification_number_c'])) {
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": The organization ID [{$this->formParams['Accounts___stic_identification_number_c']}] is not valid.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected function sendMails($status)
} else { // Otherwise, send the emails immediately
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Sending mail to the registered user...");
if (!$mailer->sendUserMail($defParams['email_template_id'])) {
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": Unable to send the email to the user.");
$GLOBALS['log']->warn('Line ' . __LINE__ . ': ' . __METHOD__ . ": Unable to send the email to the user.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ protected function __sendUserMail($templateId, $objContactWeb, $event, $inscript
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": The data received does not include user email, notification cannot be sent.");
return false;
}
if (empty($templateId)) {
$GLOBALS['log']->warn('Line ' . __LINE__ . ': ' . __METHOD__ . ": No templateId present.");
return false;
}

// Añade el destinatario
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Adding recipient [{$objContactWeb->email1}] ...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,14 @@ public function send()
$indice++;
}
} else {
LoggerManager::getLogger()->fatal('Attachements not found');
LoggerManager::getLogger()->warn('Attachements not found');
}
//// END ATTACHMENTS
///////////////////////////////////////////////////////////////////////

$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Sending mail...");
if (!$mail->Send()) {
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": There was an error sending the mail.");
$GLOBALS['log']->warn('Line ' . __LINE__ . ': ' . __METHOD__ . ": There was an error sending the mail.");
return false;
}
return true;
Expand Down
Loading