Go to the source code of this file.
Defines function to initialize a TPPS Submission in the database.
Definition in file init_project.inc.
◆ tpps_init_project()
tpps_init_project |
( |
array & |
$form_state, |
|
|
|
$accession = NULL |
|
) |
| |
This function initializes the TPPS Submission in the database.
Creates an entry for the submission in the tpps_submission table and also adds it to the chado.dbxref table.
- Parameters
-
array | $form_state | The state of the submission form. |
- Returns
- int The dbxref_id of the submission.
Definition at line 20 of file init_project.inc.
22 if (empty($accession)) {
43 $result_query = chado_query(
"SELECT *, substr(accession, 5)::INTEGER as accession_number " .
44 "FROM chado.dbxref WHERE accession LIKE 'TGDR%' " .
45 "ORDER BY accession_number DESC LIMIT 1;", []);
47 if (empty($result_query)) {
48 $accession =
'TGDR001';
52 $result[] = $result_query->fetchObject();
53 $accession = substr($result[0]->accession, 4) + 1;
54 while (strlen($accession) < 3) {
55 $accession =
"0$accession";
57 $accession =
"TGDR$accession";
61 $dbxref_id = chado_insert_record(
'dbxref', array(
62 'db_id' => variable_get(
'tpps_local_db')->db_id,
63 'accession' => $accession,
66 $form_state[
'dbxref_id'] = $dbxref_id[
'dbxref_id'];
67 $form_state[
'created'] = time();
68 $form_state[
'accession'] = $accession;
69 $form_state[
'saved_values'][
'frontpage'][
'accession'] = $accession;
70 $form_state[
'status'] =
'Incomplete';