Skip to content

Commit

Permalink
Merge pull request #761 from o-psi/edit-currnet-expenses-amount-regex
Browse files Browse the repository at this point in the history
Allow for commas in recurring expense modals
  • Loading branch information
johnnyq authored Oct 14, 2023
2 parents 45acc58 + 29279d0 commit 21a5006
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions post/expense.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
$frequency = intval($_POST['frequency']);
$day = intval($_POST['day']);
$month = intval($_POST['month']);
$amount = floatval($_POST['amount']);
$amount = floatval(str_replace(',', '', $_POST['amount']));
$account = intval($_POST['account']);
$vendor = intval($_POST['vendor']);
$client = intval($_POST['client']);
Expand Down Expand Up @@ -195,7 +195,7 @@
$frequency = intval($_POST['frequency']);
$day = intval($_POST['day']);
$month = intval($_POST['month']);
$amount = floatval($_POST['amount']);
$amount = floatval(str_replace(',', '', $_POST['amount']));
$account = intval($_POST['account']);
$vendor = intval($_POST['vendor']);
$client = intval($_POST['client']);
Expand Down
2 changes: 1 addition & 1 deletion recurring_expense_create_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
</div>
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="amount" placeholder="0.00" required>
<input type="text" class="form-control" inputmode="numeric" pattern="^(?:\d{1,3}(?:,\d{3})*|\d+)(?:\.\d{0,2})?$" name="amount" placeholder="0.00" required>
</div>
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions recurring_expense_edit_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,15 @@
</div>

<div class="form-row">

<div class="form-group col-md">
<label>Amount <strong class="text-danger">*</strong></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-dollar-sign"></i></span>
</div>
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*\.?[0-9]{0,2}" name="amount" value="<?php echo number_format($recurring_expense_amount,2); ?>" required>
<input type="text" class="form-control" inputmode="numeric" pattern="^(?:\d{1,3}(?:,\d{3})*|\d+)(?:\.\d{0,2})?$" name="amount" value="<?php echo number_format($recurring_expense_amount,2); ?>" required>
</div>
</div>

</div>

<div class="form-row">
Expand Down

0 comments on commit 21a5006

Please sign in to comment.