Forums / Developer / Inside workflow ....

Inside workflow ....

Author Message

SathishKumar Subramanian

Monday 19 July 2004 10:07:36 am

HI ,

I am using ez version 3.2-4 . A workflow was created inside kernel\classes\workflowtypes\event\

While submitting an object (say it as <b>school</b>) in ezpublish admin interface, I am calling the workflow and that will check the object is 'school' or not. If it is a 'school' object then my requirement is to collect all 'school' object details from the <b>ezPublish database (ezDb)</b> and using 'mysql_select_db' I am connecting to another <b>database (reportDb) </b> and inserting/updating the object details in the 'reportDb' database.

Inside the workflow - php file, using a loop statement and <b>mysql_select_db(ezDb,$connect)</b> I am getting all the <b>ezDb - school object</b> details and inserting them inside the <b>reportDb</b> after the <b>mysql_select_db('reportDb',$connect) </b> statement.

<b>mycoding is like :</b>

if ( $object_class == '45') //school object class is 45
{
$connect=mysql_connect("server", "user", "password");
mysql_select_db('ezDb',$connect);
$sql="select school_object ...";
$rs = mysql_query($sql);
for($i=0; $i< ...) //for loop to get all school object details
{
//get all school object details

mysql_select_db('reportDb',$connect); //connect to reportDb database
//if bible school object not in tbSchool table then insert
$sql="insert into tbSchool ....";
//else update
$sql="update tbSchool set ...";

$rs = mysql_query($sql); //execute

}
}
//---------------------end -----------------

Here while trying to switch between the two databases, the workflow is not accepting the required flow. Its not calling the mysql_select_db database method.

So I have created a <b>separate file</b> like <b>'bibleSchool.php'</b> with the code like the above and tried to call the <b>'bibleSchool.php'</b> file inside the <b>workflow</b>.

so now the workflow code is like :

if ( $object_class == '45')//school object class is 45
{
//the 'bibleSchool.php' file resides in ez Publish root directory
include('bibleSchool.php');
}

But the Ez system is not running the bibleSchool.php file. So I am not getting the result in the reportDb database. All queries are running in database and passing data are correct. But while trying to run it inside workflow this code is not working.

Am I wrong in any place? How can I make it to run better.

Pls help. Thanx in advance.

Sathizh