CoreBOSBB
not sending customer portal pasword - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forum-18.html)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forum-4.html)
+---- Forum: coreBOS (https://discussions.corebos.org/forum-5.html)
+---- Thread: not sending customer portal pasword (/thread-2104.html)



not sending customer portal pasword - Victor Burgueño - 02-16-2021

i am working with the extinted customer fortal from MYC Make Your Cloud
and i have enabled a global variable

Application_Customer_Portal_BeingUsed vtigercrmportal

everything works fine but i am not able of send the password
variable in the wellcome email

i had tryed
$user_password
$user_password$
$password
$password$

But none of them works Huh


RE: not sending customer portal pasword - joebordes - 02-16-2021

the correct syntax is $user_password$

but that works only when sent through the activation of the contact (I think)


RE: not sending customer portal pasword - Victor Burgueño - 02-17-2021

i thinks it's related with system upgrade on activatePortalFieldsContacts
even when i tried to disable this upgrade the field that cames with it still there
and normal uldate of the vtiger_portalinfo stoped working and the system
don't add new credentials to this table

also have this 2 uprades related enabled
updatePortalinfoUsernameFieldType
delSettingsCPortalWebform

i thougt to add this proglem to github but still not sure if is related to the MYC portal interconection
global variable for this its correct? (Application_Customer_Portal_BeingUsed vtigercrmportal)


RE: not sending customer portal pasword - joebordes - 02-22-2021

the template is searched by name: https://github.com/tsolucio/corebos/blob/0e952b37820417efe2edad13cb9455567d29728e/modules/Contacts/Contacts.php#L1059

Customer Login Details

Have you changed that name?

If I remember correctly this variable is only for PDF output Application_Customer_Portal_BeingUsed


RE: not sending customer portal pasword - Victor Burgueño - 02-26-2021

searching i ad found that the function invoqued from the worqflow its SendPortalLoginDetails

the function that seems to be making this work it's Contacts_sendCustomerPortalLoginDetails
in Contactshandler.php

i had get the solution of activating the customer portal enabling this function on a workflow

but still it dont send the email maibe becouse it don't find the tempate... how it indicates which is the temlate

to be sended?

this function also seems to update the activation if the portal user is not disabled and disabling it on the database

but it doesnt work for me...

function Contacts_sendCustomerPortalLoginDetails($entityData) {
$adb = PearDatabase::getInstance();
//$moduleName = $entityData->getModuleName();
$wsId = $entityData->getId();
$parts = explode('x', $wsId);
$entityId = $parts[1];

$email = $entityData->get('email');

if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
$result = $adb->pquery('SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?', array($entityId));
$insert = false;
if ($adb->num_rows($result) == 0) {
$insert = true;
} else {
$dbusername = $adb->query_result($result, 0, 'user_name');
$isactive = $adb->query_result($result, 0, 'isactive');
if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
$update = false;
} elseif ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
$adb->pquery('UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?', array($email, $entityId));
$password = $adb->query_result($result, 0, 'user_password');
$update = true;
} else {
$adb->pquery('UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?', array($email, 0, $entityId));
$update = false;
}
}
if ($insert == true) {
$password = makeRandomPassword();
$adb->pquery(
'INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)',
array($entityId, $email, $password, 'C', 1)
);
}

if ($insert == true || $update == true) {
require_once 'modules/Emails/mail.php';
global $current_user;
$emailData = Contacts::getPortalEmailContents($entityData, $password, 'LoginDetails');
$subject = $emailData['subject'];
$contents = $emailData['body'];
send_mail('Contacts', $entityData->get('email'), $current_user->user_name, "", $subject, $contents);
}
} else {
$adb->pquery('UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?', array($email, $entityId));
}
}


RE: not sending customer portal pasword - joebordes - 02-26-2021

Contacts::getPortalEmailContents

https://github.com/tsolucio/corebos/blob/master/modules/Contacts/Contacts.php#L1059

https://github.com/tsolucio/corebos/blob/master/modules/Contacts/Contacts.php#L1069

'Customer Login Details'