$xtpl->parse('main.quote_info'); } if (!is_null($estimate->clientrequest_id)) { $focus->clientrequest_id = $estimate->clientrequest_id; $ClientRequest = new ClientRequest(); $ClientRequest->retrieve($estimate->clientrequest_id); $xtpl->assign("clientrequest_id", $ClientRequest->id); $xtpl->assign("clientrequest_name", $ClientRequest->name); $xtpl->assign('clientrequest_number', $ClientRequest->number); $xtpl->assign('clientrequest_assigned_user_name', $ClientRequest->assigned_user_name); $xtpl->assign('clientrequest_due_date', $ClientRequest->due_date); $xtpl->parse('main.client_request_info'); } $focus->save($GLOBALS['check_notify']); $Components = new EstimateComponents(); $components_array = $Components->get_full_list("id", "parent_id='" . $estimate->id . "'"); for ($i = 0; $i < count($components_array); $i++) { $EstimateComponents = new EstimateComponents(); $fields = $components_array[$i]->column_fields; foreach ($fields as $field) { $EstimateComponents->{$field} = $components_array[$i]->{$field}; } $EstimateComponents->id = null; $EstimateComponents->date_entered = null; $EstimateComponents->date_modified = null; $EstimateComponents->created_by = null; $EstimateComponents->modified_user_id = null; $EstimateComponents->assigned_user_id = null; $EstimateComponents->assigned_user_name = null; $EstimateComponents->parent_bean = 'ClientOrders'; $EstimateComponents->parent_id = $focus->id;
$focus->quantity = $ClientRequest->quantity; //TO DO: add sub_status //$focus->status = $ClientRequest->status; $focus->period = $ClientRequest->periodic; $focus->samples = $ClientRequest->samples; $focus->file = $ClientRequest->files; $focus->note = $ClientRequest->special_requirements; $focus->description = $ClientRequest->description; $focus->operation_description = $ClientRequest->operation_description; //To Do: add operations : temp done. //Transport //Pack $focus->save($GLOBALS['check_notify']); $focus->retrieve(); $Components = new EstimateComponents(); $components_array = $Components->get_full_list("id", "parent_id='" . $ClientRequest->id . "'"); for ($i = 0; $i < count($components_array); $i++) { $EstimateComponents = new EstimateComponents(); $fields = $components_array[$i]->column_fields; foreach ($fields as $field) { $EstimateComponents->{$field} = $components_array[$i]->{$field}; } $EstimateComponents->id = null; $EstimateComponents->date_entered = null; $EstimateComponents->date_modified = null; $EstimateComponents->created_by = null; $EstimateComponents->modified_user_id = null; $EstimateComponents->assigned_user_id = null; $EstimateComponents->assigned_user_name = null; $EstimateComponents->parent_bean = 'Estimates'; $EstimateComponents->parent_id = $focus->id;
function getEstimateComponentsRows() { $return_array = array(); if ($this->id != "") { $estimateComponent = new EstimateComponents(); $return_array = $estimateComponent->get_full_list("id", "parent_id='" . $this->id . "'"); } return $return_array; }