Commit f856d4fb authored by xiphon's avatar xiphon

reject proposal if any mandatoriy field is missing or empty in .md

parent dbac712e
......@@ -62,6 +62,14 @@ class ProcessProposals extends Command
private const layoutToState = [ 'fr' => 'FUNDING-REQUIRED',
'wip' => 'WORK-IN-PROGRESS',
'cp' => 'COMPLETED'];
private const mandatoryFields = [ 'amount',
'author',
'date',
'layout',
'milestones',
'title'];
/**
* Execute the console command.
*/
......@@ -81,6 +89,12 @@ class ProcessProposals extends Command
$detail['name'] = $filename;
$detail['values'] = $this->getAmountFromText($file);
foreach ($this::mandatoryFields as $field) {
if (empty($detail['values'][$field])) {
throw new \Exception("Mandatory field $field is missing");
}
}
$amount = floatval(str_replace(",", ".", $detail['values']['amount']));
$author = htmlspecialchars($detail['values']['author'], ENT_QUOTES);
$date = strtotime($detail['values']['date']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment