function globallink_block_update_ticket_id in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.5 globallink_block/globallink_block.inc \globallink_block_update_ticket_id()
Updates block ticket ID.
Parameters
array $arr: Array of GlobalLink objects.
string $project_code: The block's project code.
1 call to globallink_block_update_ticket_id()
- globallink_block_dashboard_form_submit in globallink_block/
globallink_block_send.inc - Handles block form submission.
File
- globallink_block/
globallink_block.inc, line 181
Code
function globallink_block_update_ticket_id($arr, $project_code) {
foreach ($arr as $globallink) {
$target_locale_arr = $globallink->targetLocale;
$type = $globallink->type;
if ($type == 'block') {
$bid = $globallink->otherObjectId;
$block = globallink_block_load_data($bid);
foreach ($target_locale_arr as $target_locale) {
$row = globallink_block_get_row($bid, $type, $globallink->sourceLocale, $target_locale);
if ($row) {
db_update('globallink_core_block')
->fields(array(
'title' => $block[0]->info,
'document_ticket' => $globallink->documentTicket,
'submission' => $globallink->submissionName,
'submission_ticket' => $globallink->submissionTicket,
'status' => 'Sent for Translations',
'timestamp' => REQUEST_TIME,
'last_modified' => REQUEST_TIME,
'project_code' => $project_code,
))
->condition('rid', $row->rid, '=')
->execute();
}
else {
db_insert('globallink_core_block')
->fields(array(
'object_id' => $bid,
'object_type' => $globallink->type,
'title' => $block[0]->info,
'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' => REQUEST_TIME,
'project_code' => $project_code,
))
->execute();
}
}
}
}
}