Hello I am new to EPESI. I only downloaded it 7 days ago. I must say I find it to be a fantastic product. I am developing a custom module that has two recordsets. One is a header record and the other is a detail record much like what obtains with say a PO Header record and PO Line Item record. The header and detail records are generated in a batch run. When the header record is created I use a post processing callback function to create the detail record. The problem I am having is that I am not able to access the id of the record created in the header record. The id appears to be NULL in all the detail records generated. I am posting the code below used to create the header and detail records. I will appreciate any help to resolve this problem.
The cod that generates the header records
public function generate_formt() {
$technician = DB::GetCol('SELECT DISTINCT (f_ticket_owner) FROM premium_tickets_data_1 WHERE (f_sent_for_customer_verification <> 1)');
$rsft = new RBO_RecordsetAccessor('CTSHSIARepairsFormT');
$rsftli = new RBO_RecordsetAccessor('CTSHSIARepairsFormTLineItem');
$rspt = new RBO_RecordsetAccessor('premium_tickets');
foreach ($technician as $tech) {
$crits = array('ticket_owner'=>$tech, 'completion_type'=>1, 'sent_for_customer_verification'=>0);
if ($rspt->get_records_count($crits) > 0) {
$ft_record = $rsft->new_record();
$ft_record->technician = $tech;
$ft_record->completion_type = 1;
$ft_record->save();
}
$crits = array('ticket_owner'=>$tech, 'completion_type'=>2, 'sent_for_customer_verification'=>0);
if ($rspt->get_records_count($crits) > 0) {
$ft_record = $rsft->new_record();
$ft_record->technician = $tech;
$ft_record->completion_type = 2;
$ft_record->save();
}
}
}
The code in the post processing function that generates the detail records:
public static function add_formt_line_items($data, $mode) {
if ($mode == 'added') {
$crits = array('ticket_owner'=>$data['technician'], 'completion_type'=>$data['completion_type'], 'sent_for_customer_verification'=>0);
$rsftli = new RBO_RecordsetAccessor('CTSHSIARepairsFormTLineItem');
$rspt = new RBO_RecordsetAccessor('premium_tickets');
$rsft = new RBO_RecordsetAccessor('CTSHSIARepairsFormT');
do {
$ftli_no = 0;
$there_are_completion_type_tickets_for_tech = false;
$tech_completion_type_ticket = $rspt->get_records($crits);
foreach ($tech_completion_type_ticket as $ticket) {
$ftli_no = $ftli_no + 1;
$ftli_record = $rsftli->new_record();
$ftli_record->formt_id = $data['id'];
$ftli_record->line_item_no = $ftli_no;
$ftli_record->ticket_id = $ticket->id;
$ftli_record->completion_type = $data['completion_type'];
$ftli_record->save();
$pt_record = $rspt->get_record($ticket->id);
$pt_record->sent_for_customer_verification = 1;
$pt_record->save();
if ($ftli_no == 30) {
$there_are_completion_type_tickets_for_tech = true;
break;
}
}
$rsft->get_record($data['id']);
$rsft->proposed_repairs = $ftli_no;
$rsft->update_record($data['id']);
} while ($there_are_completion_type_tickets_for_tech);
}
}