Error due to no search type restriction in nodes with same project title

This commit is contained in:
Manuel Cillero 2017-08-11 12:30:22 +02:00
parent 7eaffe9bbb
commit 183372ebe3

View file

@ -728,7 +728,11 @@ function stormproject_nodeapi(&$node, $op, $teaser, $page) {
case 'validate':
$nid = $node->nid;
// 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));
$project_nid = db_result(
db_query(
"SELECT nid FROM {node} WHERE type = 'stormproject' AND 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!',