function globallink_update_node_ticket_id in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.5 globallink_node.inc \globallink_update_node_ticket_id()
Updates the ticket id for a specified node.
Parameters
array $arr: An array of GlobalLink objects.
string $project_code: The project's registered code.
1 call to globallink_update_node_ticket_id()
- globallink_dashboard_node_form_submit in ./
globallink_send_translations.inc - Handles GlobalLink form submission.
File
- ./
globallink_node.inc, line 132
Code
function globallink_update_node_ticket_id($arr, $project_code) {
drupal_alter('transperfect_update_node_ticket_id', $arr, $project_code);
foreach ($arr as $globallink) {
$nid = $globallink->nid;
$node = node_load($nid);
$target_locale_arr = $globallink->targetLocale;
foreach ($target_locale_arr as $target_locale) {
$row = globallink_get_row_by_nid_and_locale($nid, $globallink->sourceLocale, $target_locale);
if ($row) {
db_update('globallink_core')
->fields(array(
'vid' => $globallink->vid,
'title' => $globallink->title,
'document_ticket' => $globallink->documentTicket,
'submission' => $globallink->submissionName,
'submission_ticket' => $globallink->submissionTicket,
'status' => 'Sent for Translations',
'timestamp' => REQUEST_TIME,
'last_modified' => $node->changed,
'changed' => 0,
'project_code' => $project_code,
))
->condition('rid', $row->rid, '=')
->execute();
}
else {
db_insert('globallink_core')
->fields(array(
'nid' => $globallink->nid,
'vid' => $globallink->vid,
'type' => $globallink->type,
'title' => $globallink->title,
'source' => $globallink->sourceLocale,
'target' => $target_locale,
'document_ticket' => $globallink->documentTicket,
'submission' => $globallink->submissionName,
'submission_ticket' => $globallink->submissionTicket,
'status' => 'Sent for Translations',
'timestamp' => REQUEST_TIME,
'last_modified' => $node->changed,
'changed' => 0,
'project_code' => $project_code,
))
->execute();
}
}
}
}