Skip to content

Commit

Permalink
comments deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
ainaraRT committed Jan 17, 2024
1 parent eba65d8 commit 79d9180
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 102 deletions.
31 changes: 1 addition & 30 deletions modules/stic_Web_Forms/Catcher/Donation/DonationMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,13 @@ public function sendAdminMail($objWeb, $payment, $formParams, $donator, $candida
case DonationBO::DONATOR_NEW:
case DonationBO::DONATOR_UNIQUE:

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
// $html = $this->newDonationMail($objWeb, $payment, $formParams, $donator, $donatorResult == DonationBO::DONATOR_NEW);

// Function that verify if the form have the 'custom_assigned_email_template' input
if(!empty($_REQUEST['custom_assigned_email_template'])) {
return $this->sendAssignedUserMail($_REQUEST['custom_assigned_email_template'], $objWeb, $payment);
// If the form doesn't have the input send the generic email
} else {
$html = $this->newDonationMail($objWeb, $payment, $formParams, $donator, $donatorResult == DonationBO::DONATOR_NEW);
}
// End STIC 20240109

break;
}
Expand Down Expand Up @@ -243,8 +238,6 @@ private function webObjectToHtml($objWeb, $formParams)
return $html;
}

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
/**
* Function to parse the email
*
Expand Down Expand Up @@ -273,7 +266,6 @@ public function parsingEmail($templateId, $payment, $replacementObjects, $lang){
return false;
}
}
// End STIC 20231205 - ART

/**
* Send the notification email to the registered user
Expand All @@ -297,23 +289,6 @@ public function sendUserMail($templateId, $objWeb, $payment, $lang = null)
$replacementObjects[0] = $objWeb;
$replacementObjects[1] = $payment;

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
// if ($payment->load_relationship('stic_payments_stic_payment_commitments')) {
// $relatedBeans = $payment->stic_payments_stic_payment_commitments->getBeans();
// foreach ($relatedBeans as $fpBean) {
// $replacementObjects[] = $fpBean;
// }
// }

// Parse the template
// $GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Parsing template [{$templateId}]...");

// if (false === parent::parseEmailTemplateById($templateId, $replacementObjects, $lang)) {
// $GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": Error parsing the template.");
// return false;
// }

// Function to parse the email
$this->parsingEmail($templateId, $replacementObjects[1], $replacementObjects, $lang);

Expand All @@ -323,12 +298,9 @@ public function sendUserMail($templateId, $objWeb, $payment, $lang = null)
// If there's a template for the user send the mail
if(!empty($templateId)) {
return $this->send();
}
// End STIC 20240116 - ART
}
}

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
/**
* Send the notification email to the assigned user
*
Expand Down Expand Up @@ -377,5 +349,4 @@ public function sendAssignedUserMail($templateId, $objWeb, $payment, $lang = nul
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Sending mail...");
return $this->send();
}
// End STIC 20231205 - ART
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ public function sendAdminMail()
case EventInscriptionBO::CONTACT_NEW:
case EventInscriptionBO::CONTACT_UNIQUE:

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
// $GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Generating information for CONTACT_NEW or CONTACT_UNIQUE");
// $html .= $this->newObjectBodyHTML($objWeb, $formParams, $contactObject, $contactResult == EventInscriptionBO::CONTACT_NEW);

// Function that verify if the form have the 'custom_assigned_email_template' input
if(!empty($_REQUEST['custom_assigned_email_template'])) {
return $this->sendAssignedUserMail($_REQUEST['custom_assigned_email_template'], $objWeb, $this->eventInscriptionBO->getEvent(), $this->eventInscriptionBO->getInscriptionObject(), null, $this->payment);
Expand All @@ -104,7 +99,6 @@ public function sendAdminMail()
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Generating information for CONTACT_NEW or CONTACT_UNIQUE");
$html .= $this->newObjectBodyHTML($objWeb, $formParams, $contactObject, $contactResult == EventInscriptionBO::CONTACT_NEW);
}
// End STIC 20240109

break;
}
Expand Down Expand Up @@ -146,18 +140,13 @@ public function sendAdminMail()
case EventInscriptionBO::ACCOUNT_NEW:
case EventInscriptionBO::ACCOUNT_UNIQUE:

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
//$html .= $this->newObjectBodyHTML($objWeb, $formParams, $accountObject, $accountResult == EventInscriptionBO::ACCOUNT_NEW);

// Function that verify if the form have the 'custom_assigned_email_template' input
if(!empty($_REQUEST['custom_assigned_email_template'])) {
return $this->sendAssignedUserMail($_REQUEST['custom_assigned_email_template'], $objWeb, $this->eventInscriptionBO->getEvent(), $this->eventInscriptionBO->getInscriptionObject(), $accountObject, $this->payment);
// If the form doesn't have the input send the generic email
} else {
$html .= $this->newObjectBodyHTML($objWeb, $formParams, $accountObject, $accountResult == EventInscriptionBO::ACCOUNT_NEW);
}
// End STIC 20230920

break;
case EventInscriptionBO::ACCOUNT_NO_DATA:
Expand Down Expand Up @@ -201,8 +190,6 @@ public function sendUserMail($templateId, $lang = null)
$lang);
}

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
/**
* Function to parse the email
*
Expand Down Expand Up @@ -237,7 +224,6 @@ public function parsingEmail($templateId, $account, $payment, $replacementObject
return false;
}
}
// End STIC 20230921 - ART

/**
* Send the notification email to the registered user
Expand All @@ -262,29 +248,6 @@ protected function __sendUserMail($templateId, $objContactWeb, $event, $inscript
$replacementObjects[1] = $event;
$replacementObjects[2] = $inscription;

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
// if (!empty($account)) {
// $replacementObjects[] = $account;
// }

// if (!empty($payment)) {
// $replacementObjects[] = $payment;
// if ($payment->load_relationship('stic_payments_stic_payment_commitments')) {
// $relatedBeans = $payment->stic_payments_stic_payment_commitments->getBeans();
// foreach ($relatedBeans as $fpBean) {
// $replacementObjects[] = $fpBean;
// }
// }
// }

// Parse the template
// $GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Parsing template ...");
// if (false === parent::parseEmailTemplateById($templateId, $replacementObjects, $lang)) {
// $GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": Error parsing the template.");
// return false;
// }

// Function to parse the email
$this->parsingEmail($templateId, $account, $payment, $replacementObjects, $lang);

Expand All @@ -295,12 +258,9 @@ protected function __sendUserMail($templateId, $objContactWeb, $event, $inscript
if(!empty($templateId)) {
return $this->send();
}
// End STIC 20240116 - ART
}


// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224
/**
* Send the notification email to the assigned user
*
Expand Down Expand Up @@ -360,7 +320,6 @@ protected function sendAssignedUserMail($templateId, $objWeb, $event, $inscripti
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Sending mail ...");
return $this->send();
}
// End STIC 20230920

/**
* Prepare the necessary information for deferred mail delivery
Expand Down
32 changes: 1 addition & 31 deletions modules/stic_Web_Forms/Catcher/Include/Mailer/WebFormMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,8 @@ public function getCampaingData($id, $link = true)
*/
public function parseEmailTemplateById($templateId, $replacementObjects, $lang = null)
{
// STIC 20231205 - ART - Enable custom email template for assigned user
// STIC#1224
// Calling the object from the form to parse the entire template
$objWeb = $replacementObjects[0];
// End STIC 20231205

if (empty($templateId)) {
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": No ID received.");
Expand All @@ -331,11 +328,7 @@ public function parseEmailTemplateById($templateId, $replacementObjects, $lang =
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": Template with ID [{$templateId}] not found.");
return false;
}
// STIC 20231205 - ART - Enable custom email template for assigned user
// STIC#1224
// return $this->parseEmailTemplate($template, $replacementObjects, $lang);
return $this->parseEmailTemplate($template, $replacementObjects, $objWeb, $lang);
// End STIC 20231205
}

/**
Expand All @@ -348,11 +341,8 @@ public function parseEmailTemplateById($templateId, $replacementObjects, $lang =
*/
public function parseEmailTemplateByName($templateName, $replacementObjects, $lang = null, $type = 'email')
{
// STIC 20231205 - ART - Enable custom email template for assigned user
// STIC#1224
// Calling the object from the form to parse the entire template
$objWeb = $replacementObjects[0];
// End STIC 20231205

if (empty($templateName)) {
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": No name has been received.");
Expand All @@ -367,11 +357,7 @@ public function parseEmailTemplateByName($templateName, $replacementObjects, $la
$GLOBALS['log']->error('Line ' . __LINE__ . ': ' . __METHOD__ . ": Template not found with name [{$templateName}]");
return false;
}
// STIC 20231205 - ART - Enable custom email template for assigned user
// STIC#1224
// return $this->parseEmailTemplate($template, $replacementObjects, $lang);
return $this->parseEmailTemplate($template, $replacementObjects, $objWeb, $lang);
// End STIC 20231205
}

/**
Expand All @@ -381,12 +367,8 @@ public function parseEmailTemplateByName($templateName, $replacementObjects, $la
* @param $replacementObjects Array of objects to be parsed
* @return String Mail body in html
*/
// STIC 20231205 - ART - Enable custom email template for assigned user
// STIC#1224
// protected function parseEmailTemplate($template, $replacementObjects, $lang) {
protected function parseEmailTemplate($template, $replacementObjects, $objWeb, $lang)
{
// End STIC 20231205
global $current_language, $app_list_strings, $app_strings;

$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Parsing template ...");
Expand All @@ -409,20 +391,11 @@ protected function parseEmailTemplate($template, $replacementObjects, $objWeb, $
$app_strings = return_application_language($current_language);
$app_list_strings = return_app_list_strings_language($current_language);

// STIC 20231205 - ART - Enable custom email template for assigned user
// STIC#1224
// $parseArr = array("subject0" => $template->subject, "text0" => $template->body, "html0" => $template->body_html);
$parseArr = array("subject1" => $template->subject, "text1" => $template->body, "html1" => $template->body_html);
// End STIC 20231205
$replacementObjectsLength = (empty($replacementObjects) || !is_array($replacementObjects) ? 0 : count($replacementObjects));

// STIC 20231205 - ART - Enable custom email template for assigned user
// STIC#1224
// $j = 0;
// for ($i = 0; $i < $replacementObjectsLength; $i++) {
$j = 1;
for ($i = 1; $i < $replacementObjectsLength ; $i++) {
// End STIC 20231205
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Parsing object [{$i}] [{$replacementObjects[$i]->module_dir}] ... ");
$macro_nv = array();
$obj = $this->prepareBean2EmailTemplate($replacementObjects[$i]);
Expand All @@ -434,9 +407,7 @@ protected function parseEmailTemplate($template, $replacementObjects, $objWeb, $
$parseArr["subject{$j}"] = $parseArr["subject{$i}"];
$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Result [{$i}] -> " . $parseArr["html{$j}"]);
}

// STIC 20230905 - ART - Enable custom email template for assigned user
// STIC#1224

// Replace on the email template the param of form_contact to contact
$parseArr["html{$i}"] = str_replace('$form_contact', '$contact', $parseArr["html{$i}"]);
$obj = $this->prepareBean2EmailTemplate($objWeb);
Expand All @@ -446,7 +417,6 @@ protected function parseEmailTemplate($template, $replacementObjects, $objWeb, $
$parseArr["text{$j}"] = $parseArr["text{$i}"];
$parseArr["html{$j}"] = $parseArr["html{$i}"];
$parseArr["subject{$j}"] = $parseArr["subject{$i}"];
// End STIC 20231205

$GLOBALS['log']->debug('Line ' . __LINE__ . ': ' . __METHOD__ . ": Recovering original language files ...");
$current_language = $prev_lang;
Expand Down

0 comments on commit 79d9180

Please sign in to comment.