/[gnats]/gnats/gnats/file-pr.c
ViewVC logotype

Diff of /gnats/gnats/file-pr.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47 by yngves, Sat Oct 12 22:52:02 2002 UTC revision 1.48 by andrewg, Thu Oct 24 12:45:09 2002 UTC
# Line 35  static int run_atpr(PR *pr, AdmEntry *su Line 35  static int run_atpr(PR *pr, AdmEntry *su
35  static int getBugNumber        (const DatabaseInfo database, ErrorDesc *err);  static int getBugNumber        (const DatabaseInfo database, ErrorDesc *err);
36  static char* derive_submitter  (PR *pr);  static char* derive_submitter  (PR *pr);
37    
38    static int missing_required_fields (const DatabaseInfo database, PR *pr,
39                                        ErrorDesc *err);
40    
41    
42  /* Creates a PR file using the contents of PR.  If an error occurs, a  /* Creates a PR file using the contents of PR.  If an error occurs, a
43     negative value will be returned an an appropriate error code will     negative value will be returned an an appropriate error code will
# Line 69  createNewPRFile (PR *pr, int flag_autocr Line 72  createNewPRFile (PR *pr, int flag_autocr
72        return -1;        return -1;
73      }      }
74    
75      if (missing_required_fields (database, pr, err) > 0)
76        {
77          return -1;
78        }
79    
80    /*  If we don't have a valid submitter ID, try to get it from the "From:"    /*  If we don't have a valid submitter ID, try to get it from the "From:"
81        header.  If that doesn't work, use the default from the config file.  */        header.  If that doesn't work, use the default from the config file.  */
82    
# Line 429  createNewPRFile (PR *pr, int flag_autocr Line 437  createNewPRFile (PR *pr, int flag_autocr
437    return bug_number;    return bug_number;
438  }  }
439    
440    static int
441    missing_required_fields (const DatabaseInfo database, PR *pr, ErrorDesc *err)
442    {
443      int cnt = 0;
444      FieldList fields = getRequiredInputFields(database);
445    
446      while (fields != NULL)
447        {
448          const char *fldval = get_field_value (pr, NULL, fields->ent, NULL, NULL);
449          if (fldval == NULL || *fldval == '\0')
450            {
451              setError (err, CODE_INVALID_PR_CONTENTS,
452                        "Required field %s missing from new PR - cannot submit.",
453                        complexFieldIndexToString (fields->ent),
454                        field_value (pr, NUMBER (pr->database)));
455              cnt++;
456            }
457          fields = fields->next;
458        }
459      return cnt;
460    }
461    
462  /* XXX ??? !!! FIXME Shouldn't be hardcoded.   */  /* XXX ??? !!! FIXME Shouldn't be hardcoded.   */
463  static int  static int
464  needs_analysis (PR *pr)  needs_analysis (PR *pr)

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26