Modifying email template for user

Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/36b05015
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/36b05015
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/36b05015

Branch: refs/heads/dreg-gateway
Commit: 36b05015c6842cfa2f92cd04455391dbaceb742d
Parents: 4ef56fe
Author: Sneha Tilak <tilaks@Snehas-MacBook-Pro.local>
Authored: Tue Jul 4 11:30:10 2017 -0500
Committer: Sneha Tilak <tilaks@Snehas-MacBook-Pro.local>
Committed: Tue Jul 4 11:30:10 2017 -0500

----------------------------------------------------------------------
 app/config/email_templates.json     | 16 ----------------
 app/controllers/AdminController.php |  4 ++--
 app/libraries/EmailUtilities.php    | 24 ++++++------------------
 3 files changed, 8 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/36b05015/app/config/email_templates.json
----------------------------------------------------------------------
diff --git a/app/config/email_templates.json b/app/config/email_templates.json
index 300aefc..4a4f8d8 100644
--- a/app/config/email_templates.json
+++ b/app/config/email_templates.json
@@ -93,22 +93,6 @@
   "update_to_user" : {
     "subject" : "Gateway Details Updated",
     "body" : [
-        "<div>",
-            "<p>",
-                "Dear $firstName $lastName,<br/>",
-
-                "There has been an update in the Gateway info for your Gateway 
with ID - $gatewayId.",
-                " Please click the link below to view the changes.<br/>",
-
-                "<a href=\"$url\">$url</a><br/>",
-            "</p>",
-        "</div>"
-    ]
-  },
-
-  "update_to_empty_user" : {
-    "subject" : "Gateway Details Updated",
-    "body" : [
       "<div>",
       "<p>",
       "Hello,<br/>",

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/36b05015/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php 
b/app/controllers/AdminController.php
index 6b2ec4d..440ef48 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -175,7 +175,7 @@ class AdminController extends BaseController {
                if( Request::ajax()){
                        if( $returnVal == 1) {
                 $email = Config::get('pga_config.portal')['admin-emails'];
-                
EmailUtilities::gatewayUpdateMailToProvider($gateway->gatewayAdminFirstName, 
$gateway->gatewayAdminLastName, $gateway->emailAddress, 
Input::get("gateway_id"));
+                
EmailUtilities::gatewayUpdateMailToProvider($gateway->emailAddress, 
Input::get("gateway_id"));
                 EmailUtilities::gatewayUpdateMailToAdmin($email, 
Input::get("gateway_id"));
                 if (isset($gatewayData["createTenant"]))
                     Session::put("successMessages", "Tenant has been created 
successfully!");
@@ -190,7 +190,7 @@ class AdminController extends BaseController {
                else{
                        if( $returnVal) {
                 $email = Config::get('pga_config.portal')['admin-emails'];
-                
EmailUtilities::gatewayUpdateMailToProvider($gateway->gatewayAdminFirstName, 
$gateway->gatewayAdminLastName, $gateway->emailAddress, 
Input::get("gateway_id"));
+                
EmailUtilities::gatewayUpdateMailToProvider($gateway->emailAddress, 
Input::get("gateway_id"));
                 EmailUtilities::gatewayUpdateMailToAdmin($email, 
Input::get("gateway_id"));
                 Session::put("message", "Gateway has been updated 
successfully!");
             }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/36b05015/app/libraries/EmailUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/EmailUtilities.php b/app/libraries/EmailUtilities.php
index 4d9a85b..561cd88 100644
--- a/app/libraries/EmailUtilities.php
+++ b/app/libraries/EmailUtilities.php
@@ -106,26 +106,14 @@ class EmailUtilities
     }
 
     //PGA sends email to User when Gateway is UPDATED
-    public static function gatewayUpdateMailToProvider($firstName, $lastName, 
$email, $gatewayId){
+    public static function gatewayUpdateMailToProvider($email, $gatewayId){
 
-        if ($firstName == null || $lastName == null){
-            $emailTemplates = json_decode(File::get(app_path() . 
'/config/email_templates.json'));
-            $subject = $emailTemplates->update_to_empty_user->subject;
-            $body = trim(implode($emailTemplates->update_to_empty_user->body));
+        $emailTemplates = json_decode(File::get(app_path() . 
'/config/email_templates.json'));
+        $subject = $emailTemplates->update_to_user->subject;
+        $body = trim(implode($emailTemplates->update_to_user->body));
 
-            $body = str_replace("\$url", URL::to('/') . '/admin/dashboard', 
$body);
-            $body = str_replace("\$gatewayId", $gatewayId, $body);
-        }
-        else{
-            $emailTemplates = json_decode(File::get(app_path() . 
'/config/email_templates.json'));
-            $subject = $emailTemplates->update_to_user->subject;
-            $body = trim(implode($emailTemplates->update_to_user->body));
-
-            $body = str_replace("\$url", URL::to('/') . '/admin/dashboard', 
$body);
-            $body = str_replace("\$firstName", $firstName, $body);
-            $body = str_replace("\$lastName", $lastName, $body);
-            $body = str_replace("\$gatewayId", $gatewayId, $body);
-        }
+        $body = str_replace("\$url", URL::to('/') . '/admin/dashboard', $body);
+        $body = str_replace("\$gatewayId", $gatewayId, $body);
 
 
         EmailUtilities::sendEmail($subject, [$email], $body);

Reply via email to