Email_Sending event error in register.php

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Plorenzo9
User
Posts: 17

Email_Sending event error in register.php

Post by Plorenzo9 »

I cant acces to Args["rs"] values in the mail event. Error:

Notice: Undefined property: cregister::$AuditTrailOnAdd in C:\xampp\htdocs\pedidosentresectores\register.php on line 1021

Fatal error: Cannot use object of type mysqlt_driver_ResultSet as array in C:\xampp\htdocs\pedidosentresectores\register.php on line 1109

Paste the code here:

// Email Sending event
function Email_Sending(&$Email, &$Args) {
$Email->Subject = "PeS. Registro Nuevo Usuario."; // Change subject
$Email->Content ="<p>Gracias por registrarse en el sistema de Pedidos entre Sectores.<br>";
$Email->Content .= "<br>";
$Email->Content .= "Los datos de registro son los soguientes:<br>";
$Email->Content .= "<br>";
$Email->Content .="<br>";
$Email->Content .= "Sitio: ".$Args["rs"]["sitio"]."<br>"; //line 1109 Fatal Error.
$Email->Content .= "<br>";
$Email->Content .= "Sector: ".$Args["rs"]["sector"]."<br>";
$Email->Content .= "<br>";
$Email->Content .="Nombre: ".$Args["rs"]["nombre"]."<br>";
$Email->Content .="<br>";
$Email->Content .="Usuario: ".$Args["rs"]["usuario"]."<br>";
$Email->Content .="<br>";
$Email->Content .="Iniciales: ".$Args["rs"]["iniciales"]."<br>";
$Email->Content .="<br>";
$Email->Content .="Email: ".$Args["rs"]["email"]."<br>";
$Email->Content .="<br>";
$Email->Content .="<br>";
$Email->Content .="<br>";
$Email->Content .="Su usuario requiere ser activado por el administrador de sistemas, hasta";
$Email->Content .="tanto no podra acceder al mismo.<br>";
$Email->Content .="Cualquier duda o consulta, por favor escriba a xxx@xxx.com<br>";
$Email->Content .="<br>";
$Email->Content .="Saludos, Dto Sistemas Amegabiotech.</p>";

	//var_dump($Email); var_dump($Args); exit();
	return TRUE;
}

Any Help? TKS.-


mobhar
User
Posts: 11747

Post by mobhar »

What is the code in line 1021 and 1109 in your generated register.php file?


danielc
User
Posts: 1601

Post by danielc »

You are loading recordset not array. Use:
$Args["rs"]->fields("sitio")
// not $Args["rs"]["sitio"]


Plorenzo9
User
Posts: 17

Post by Plorenzo9 »

Hi Mobhar, here are the lines, im using phpm v10.1, audit trail is enabled.
<<---<<----1021 marked down in line

// Write Audit Trail (add page)
function WriteAuditTrailOnAdd(&$rs) {
if (!$this->AuditTrailOnAdd) return;//fatal error 1021 <<------------<<---------<<--------<<---------<<--------<<---
$table = 'usuarios';

<<----<<----1109 marked down in line

// Email Sending event
function Email_Sending(&$Email, &$Args) {
$Email->Subject = "PeS. Registro Nuevo Usuario."; // Change subject
$Email->Content ="<p>Gracias por registrarse en el sistema de Pedidos entre Sectores.<br>";
$Email->Content .= "<br>";
$Email->Content .= "Los datos de registro son los soguientes:<br>";
$Email->Content .= "<br>";
$Email->Content .="<br>";
$Email->Content .= "Sitio: ".$Args["rs"]["sitio"]."<br>"; //line 1109 Fatal Error.<<--------<<<-------<<------<<<--------<<<----
$Email->Content .= "<br>";
$Email->Content .= "Sector: ".$Args["rs"]["sector"]."<br>";
$Email->Content .= "<br>";
$Email->Content .="Nombre: ".$Args["rs"]["nombre"]."<br>";
$Email->Content .="<br>";
$Email->Content .="Usuario: ".$Args["rs"]["usuario"]."<br>";
$Email->Content .="<br>";
$Email->Content .="Iniciales: ".$Args["rs"]["iniciales"]."<br>";
$Email->Content .="<br>";
$Email->Content .="Email: ".$Args["rs"]["email"]."<br>";
$Email->Content .="<br>";
$Email->Content .="<br>";
$Email->Content .="<br>";
$Email->Content .="Su usuario requiere ser activado por el administrador de sistemas, hasta";
$Email->Content .="tanto no podra acceder al mismo.<br>";
$Email->Content .="Cualquier duda o consulta, por favor escriba a xxx@xxx.com<br>";
$Email->Content .="<br>";
$Email->Content .="Saludos, Dto Sistemas Amegabiotech.</p>";

//var_dump($Email); var_dump($Args); exit();
return TRUE;
}


Plorenzo9
User
Posts: 17

Post by Plorenzo9 »

Perfect! Tks Danielc, that its the error.

Postby danielc » Thu Aug 08, 2013 11:49 am
You are loading recordset not array. Use:
$Args["rs"]->fields("sitio")
// not $Args["rs"]["sitio"]

TKS Again.


Webmaster
User
Posts: 9430

Post by Webmaster »

That is inconsistent with other pages, to be changed in next build. For the time being, you can modify register.php, change:

$Args["rs"] = &$rsnew;

to:

$Args["rs"] = $rsnew->fields;

Then you'll be able to access the data as in other pages, e.g. $Args["rs"]["xxx"].


Plorenzo9
User
Posts: 17

Post by Plorenzo9 »

Tks Webmaster, tks DanielC.


Post Reply