--- ./casetracker.module.orig 2006-05-24 23:12:07.000000000 +0200 +++ ./casetracker.module 2006-05-25 00:31:49.000000000 +0200 @@ -449,16 +449,17 @@ $headers = array( array('data' => t('Project ID'), 'field' => 'cp.project_no'), array('data' => t('Title'), 'field' => 'n.title'), - array('data' => t('Last updated'), 'field' => 'c.last_comment_timestamp'), + array('data' => t('Last updated'), 'field' => 'c.last_comment_timestamp'), array('data' => t('Edit')), array('data' => t('Add a case to this project'))); if ($argument == 'all_projects') { - $sql = db_rewrite_sql("SELECT n.*, cp.* FROM {node} n INNER JOIN {casetracker_project} cp on n.vid = cp.vid LEFT JOIN {node_comment_statistics} c ON c.nid = n.nid WHERE n.type ='%s'"); + // **EC need to do something here + $sql = db_rewrite_sql("SELECT n.*, cp.* FROM {node} n INNER JOIN {casetracker_project} cp ON n.vid = cp.vid LEFT JOIN {node_comment_statistics} c ON c.nid = n.nid WHERE n.type ='%s'"); $arguments = array('casetracker_project'); - } else { - $sql = db_rewrite_sql("SELECT n.*, cp.* FROM {node} n INNER JOIN {casetracker_project} cp on n.vid = cp.vid LEFT JOIN {node_comment_statistics} c ON c.nid = n.nid WHERE n.uid = %d AND n.type = '%s'"); + // **EC need to do something here + $sql = db_rewrite_sql("SELECT n.*, cp.* FROM {node} n INNER JOIN {casetracker_project} cp ON n.vid = cp.vid LEFT JOIN {node_comment_statistics} c ON c.nid = n.nid WHERE n.uid = %d AND n.type = '%s'"); $arguments = array($user->uid, 'casetracker_project'); } @@ -600,7 +601,10 @@ '#collapsed' => TRUE); $case_status_options = casetracker_case_state_option('status'); $keys = array_keys($case_status_options); - $result = db_query(db_rewrite_sql("SELECT * FROM {node} n WHERE n.type = 'casetracker_project'")); + // **EC replace the query with one looks for node types that act as project + // $result = db_query(db_rewrite_sql("SELECT * FROM {node} n WHERE n.type = 'casetracker_project'")); + $result = db_query(db_rewrite_sql("SELECT nid, title FROM {node} n WHERE n.type = 'casetracker_project' OR n.type IN (".str_pad('', count(variable_get('casetracker_project_node_types',array('casetracker_project'))) * 5 - 1, "'%s',")).")",variable_get('casetracker_project_node_types',array('casetracker_project'))); + while ($row = db_fetch_array($result)) { $project_options[$row['nid']] = $row['title']; } @@ -2273,8 +2277,11 @@ */ function casetracker_settings() { - $result = db_query("SELECT nid, title FROM {node} n WHERE n.type IN (".str_pad('', count(variable_get('casetracker_project_node_types',array('casetracker_project'))) * 5 - 1, "'%s',").")",variable_get('casetracker_project_node_types',array('casetracker_project'))); - while($row = db_fetch_array($result)) { + // **EC replace the query with one looks for node types that act as project + // $result = db_query("SELECT nid, title FROM {node} n WHERE n.type IN (".str_pad('', count(variable_get('casetracker_project_node_types',array('casetracker_project'))) * 5 - 1, "'%s',").")",variable_get('casetracker_project_node_types',array('casetracker_project'))); + $result = db_query(db_rewrite_sql("SELECT nid, title FROM {node} n WHERE n.type = 'casetracker_project' OR n.type IN (".str_pad('', count(variable_get('casetracker_project_node_types',array('casetracker_project'))) * 5 - 1, "'%s',")).")",variable_get('casetracker_project_node_types',array('casetracker_project'))); + + while($row = db_fetch_array($result)) { $options[$row['nid']] = $row['title']; } $form['project_xmlrpc'] = array( @@ -2292,7 +2299,6 @@ ); $form['casetracker_mailbox'] = array( '#type' => 'textfield', - '#title' => t('Enter the email address from where the replies to email notification sent by casetracker will be received'), '#default_value' => variable_get('casetracker_mailbox','sandbox@HotPOP.com'), '#description' => t('This is the email address from where mailhandler will receive mails sent as replies to email nofifications sent by casetracker') @@ -2307,15 +2313,16 @@ '#description' => t('This status value will be assigned to those cases which has not be explicitly assigned a case status by the user.') ); $form['casetracker_default_assign_to'] = array( - '#type' => 'textfield', - '#title' => t('Enter the name of the person to whom the case will be assigned'), - '#maxlength' => 60, - '#autocomplete_path' => 'casetracker/autocomplete', - '#required' => TRUE, - '#default_value' => variable_get('casetracker_default_assign_to','anonymous'), - '#description' => t('This person is will be assigned the case if the case creator does not explicitly mention the name of the person to whom the case has to be assigned')); + '#type' => 'textfield', + '#title' => t('Enter the name of the person to whom the case will be assigned'), + '#maxlength' => 60, + '#autocomplete_path' => 'casetracker/autocomplete', + '#required' => TRUE, + '#default_value' => variable_get('casetracker_default_assign_to','anonymous'), + '#description' => t('This person is will be assigned the case if the case creator does not explicitly mention the name of the person to whom the case has to be assigned')); - $result = db_query("SELECT DISTINCT type FROM {node}"); + // **EC I guess that "casetracker_case" and "casetracker_project" should not be in this list ? + $result = db_query("SELECT DISTINCT type FROM {node} n WHERE n.type NOT IN ('casetracker_case', 'casetracker_project')"); while($row = db_fetch_array($result)) { $options_types[$row[type]] = $row[type]; } @@ -2714,6 +2721,7 @@ function casetracker_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { switch ($op) { case 'view': + // **EC need to do something here if(in_array($node->type, variable_get('casetracker_project_node_types',array('casetracker_project')))&& $node->type == 'casetracker_project'){ //casetracker_project_view1($node, $teaser = FALSE, $page = FALSE); //$node = node_prepare($node, $teaser);