mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
validate and save to account_gateways
This commit is contained in:
parent
0f6e374402
commit
92fdf49c10
@ -569,7 +569,7 @@ class AccountController extends \BaseController {
|
||||
}
|
||||
|
||||
private function savePayments()
|
||||
{
|
||||
{
|
||||
Validator::extend('notmasked', function($attribute, $value, $parameters)
|
||||
{
|
||||
return $value != str_repeat('*', strlen($value));
|
||||
@ -604,6 +604,12 @@ class AccountController extends \BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$creditcards = Input::get('creditCardTypes');
|
||||
if (count($creditcards) < 1)
|
||||
{
|
||||
$rules['creditCardTypes'] = 'required';
|
||||
}
|
||||
|
||||
$validator = Validator::make(Input::all(), $rules);
|
||||
|
||||
@ -627,9 +633,16 @@ class AccountController extends \BaseController {
|
||||
foreach ($fields as $field => $details)
|
||||
{
|
||||
$config->$field = trim(Input::get($gateway->id.'_'.$field));
|
||||
}
|
||||
}
|
||||
|
||||
$cardCount = 0;
|
||||
foreach($creditcards as $card => $value)
|
||||
{
|
||||
$cardCount += intval($value);
|
||||
}
|
||||
|
||||
$accountGateway->config = json_encode($config);
|
||||
$accountGateway->accepted_credit_cards = $cardCount;
|
||||
$account->account_gateways()->save($accountGateway);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
<!-- TODO: creditcard-types IS SET IN JS FURTHER DOWN IN THE SCRIPT PART,
|
||||
AND THEN IN INLINE STYLE. REMOVE THIS WHEN RAZI HAS FIXED THE IMAGES AND STYLE -->
|
||||
<div class="two-column">
|
||||
{{ Former::checkboxes('creditCardType_id')
|
||||
{{ Former::checkboxes('creditCardTypes[]')
|
||||
->label('Accepted Credit Cards')
|
||||
->checkboxes($creditCardTypes)
|
||||
->class('creditcard-types')
|
||||
|
Loading…
Reference in New Issue
Block a user