Removing PID field in projects to use only the project name
This commit is contained in:
parent
58d5a92811
commit
7eaffe9bbb
2 changed files with 10 additions and 39 deletions
|
@ -27,7 +27,7 @@ function stormproject_list() {
|
|||
'field' => 'spr.projectstatus',
|
||||
),
|
||||
array(
|
||||
'data' => t('Title') . ' / ' . t('Organization') . ' » ' . t('Project manager'),
|
||||
'data' => t('Name') . ' / ' . t('Organization') . ' » ' . t('Project manager'),
|
||||
'field' => 'n.title',
|
||||
),
|
||||
array(
|
||||
|
@ -426,4 +426,3 @@ function _stormproject_organization_projects_js($organization_nid=0) {
|
|||
print drupal_to_js($projects);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -601,20 +601,6 @@ function stormproject_form(&$node) {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function stormproject_form_stormproject_node_form_alter(&$form, &$form_state) {
|
||||
if (isset($form['#node']) && isset($form['#method'])) {
|
||||
// We will autogenerate the title later:
|
||||
if (empty($form['#node']->nid)) {
|
||||
$form['title']['#value'] = t('Project');
|
||||
}
|
||||
$form['title']['#type'] = 'value';
|
||||
$form['title']['#required'] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
function stormproject_insert($node) {
|
||||
_stormproject_beforesave($node);
|
||||
|
||||
|
@ -741,23 +727,15 @@ function stormproject_nodeapi(&$node, $op, $teaser, $page) {
|
|||
|
||||
case 'validate':
|
||||
$nid = $node->nid;
|
||||
$project_name = $node->field_stormproject_name[0]['value'];;
|
||||
if (!empty($project_name)) {
|
||||
// Checking if there is another project with the same name:
|
||||
$project_nid = db_result(
|
||||
db_query(
|
||||
"SELECT nid FROM {content_type_stormproject} WHERE field_stormproject_name_value = '%s'" . (isset($nid) ? " AND nid != $nid" : ''),
|
||||
$project_name
|
||||
// Checking if there is another project with the same name:
|
||||
$project_nid = db_result(db_query("SELECT nid FROM {node} WHERE title = '%s'" . (isset($nid) ? " AND nid != $nid" : ''), $node->title));
|
||||
if (!empty($project_nid)) {
|
||||
form_set_error('title',
|
||||
t('Already exists a !project with this name. Please check!',
|
||||
array('!project' => l(t('project'), drupal_get_path_alias('node/' . $project_nid)))
|
||||
)
|
||||
);
|
||||
if (!empty($project_nid)) {
|
||||
form_set_error('field_stormproject_name',
|
||||
t('Already exists a !project with this name. Please check!',
|
||||
array('!project' => l(t('project'), drupal_get_path_alias('node/' . $project_nid)))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!($node->datebegin['year'] == -1 && $node->dateend['year'] == -1)) {
|
||||
if ($node->datebegin['year'] == -1) {
|
||||
form_set_error('datebegin', t('If date end field is not empty then date begin field must have a value.'));
|
||||
|
@ -772,19 +750,13 @@ function stormproject_nodeapi(&$node, $op, $teaser, $page) {
|
|||
case 'insert':
|
||||
case 'update':
|
||||
if (!empty($node->nid)) {
|
||||
$title = $node->field_stormproject_pid[0]['value'] . ': ' . $node->field_stormproject_name[0]['value'];
|
||||
db_query("UPDATE {node} SET title = '%s' WHERE nid = %d", $title, $node->nid);
|
||||
if (!empty($node->vid)) {
|
||||
db_query("UPDATE {node_revisions} SET title = '%s' WHERE nid = %d AND vid = %d", $title, $node->nid, $node->vid);
|
||||
}
|
||||
$node->title = $title;
|
||||
module_invoke_all('stormproject_change', $node->nid, $node->title);
|
||||
|
||||
// Update team project:
|
||||
if ($node->field_stormproject_team[0]['value'] && empty($node->assigned_nid)) {
|
||||
$equipo = new stdClass();
|
||||
$equipo->title = t('Project team for !pid', array('!pid' => $node->field_stormproject_pid[0]['value']));
|
||||
$equipo->body = t('Project team automatically created for !project.', array('!project' => l($node->field_stormproject_name[0]['value'], 'node/' . $node->nid)));
|
||||
$equipo->title = t('Project team for !projectname', array('!projectname' => $node->title));
|
||||
$equipo->body = t('Project team automatically created for !project.', array('!project' => l($node->title, 'node/' . $node->nid)));
|
||||
$equipo->body = '<p>' . $equipo->body . '</p>';
|
||||
$equipo->format = 2;
|
||||
$equipo->type = 'stormteam';
|
||||
|
|
Reference in a new issue