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 |
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 |
|
|
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) |