You are here

function tmgmt_update_7009 in Translation Management Tool 7

Update data item status of accepted job items to accepted.

File

./tmgmt.install, line 706
Installation hooks for the Translation Management module.

Code

function tmgmt_update_7009() {

  // First set count_accepted to the value of count_reviewed.
  db_update('tmgmt_job_item')
    ->expression('count_accepted', 'count_reviewed + count_pending + count_translated')
    ->condition('state', TMGMT_JOB_ITEM_STATE_ACCEPTED)
    ->execute();

  // Then set count_reviewed to 0.
  db_update('tmgmt_job_item')
    ->fields(array(
    'count_reviewed' => 0,
    'count_translated' => 0,
    'count_pending' => 0,
  ))
    ->condition('state', TMGMT_JOB_ITEM_STATE_ACCEPTED)
    ->execute();
}