Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Workflow » How to redirect to another url in batch ?
Re: How to redirect to another url in batch ? [message #4225 is a reply to message #4224] Thu, 05 June 2014 21:37 Go to previous messageGo to previous message
rainfallwu is currently offline  rainfallwu
Messages: 8
Registered: May 2014
Junior Member
Thanks. According to the workflow, after finishing this 'add_person' task, the task of person_addr_add should run. But this task don't run. the code of person_addr_add.php below:
------------------------------------------------------------ ------------------------------------------------------------ ---------------------------
<?php


$stdout = '../logs/x_person_addr.html';
$csvout = '../logs/x_person_addr.csv';
ini_set('include_path', '.');
require 'std.batch.inc';

batchInit(__FILE__);
$table_id = 'x_person_addr'; // table name
$task_id = basename($task_id, '.php'); // replaces 'batch'
$role_id = 'DEMO'; // replaces 'batch'

$filename = 'E:\xampp\htdocs\files\upload\addr.csv';

$dbobject = RDCsingleton::getInstance('x_person_addr');

// do not fail if record already exists when inserting
$dbobject->no_duplicate_error = TRUE;

require('std.csv.class.inc');
$CSVobj = new csv_class($dbobject);

// read first line to obtain delimiter (comma, tab or pipe)
$CSVobj->open_read($filename);
check_errors($CSVobj);

$count = 0;
while ($data = $CSVobj->read_file()) {
// give this array to the database object
$dbobject->startTransaction();
print('************************');
print_r($data);
print('************************');
$data = $dbobject->insertRecord($data);
check_errors($dbobject);
$dbobject->commit();
$count ++;

if (!$result = fwrite($stdouth, $output)) {
trigger_error("Cannot write to file $stdout", E_USER_ERROR);
} // if
$output = '';
} // while
check_errors($CSVobj);



$output = "<p>$count records processed.<p>";
if (!$result = fwrite($stdouth, $output)) {
trigger_error("Cannot write to file $stdout", E_USER_ERROR);
} // if

fclose($handle);

batchEnd();

?>


the addr.csv file is:
person_id,address_no,addr_line_1,town,postcode
test_100,tst100addr,hahaStreet,London,EH1 4AS

the person.csv file is:
person_id,nat_ins_no,pers_type_id,node_id,star_sign
test_100,tes100,test10,2,CAN


[Updated on: Thu, 05 June 2014 21:47]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Having problem starting a case
Next Topic: Work item assignments
Goto Forum:
  


Current Time: Mon May 20 16:53:38 EDT 2024

Total time taken to generate the page: 0.01443 seconds