mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:44:30 -04:00
validate and save to account_gateways
This commit is contained in:
parent
0f6e374402
commit
92fdf49c10
@ -605,6 +605,12 @@ class AccountController extends \BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$creditcards = Input::get('creditCardTypes');
|
||||||
|
if (count($creditcards) < 1)
|
||||||
|
{
|
||||||
|
$rules['creditCardTypes'] = 'required';
|
||||||
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails())
|
if ($validator->fails())
|
||||||
@ -629,7 +635,14 @@ class AccountController extends \BaseController {
|
|||||||
$config->$field = trim(Input::get($gateway->id.'_'.$field));
|
$config->$field = trim(Input::get($gateway->id.'_'.$field));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cardCount = 0;
|
||||||
|
foreach($creditcards as $card => $value)
|
||||||
|
{
|
||||||
|
$cardCount += intval($value);
|
||||||
|
}
|
||||||
|
|
||||||
$accountGateway->config = json_encode($config);
|
$accountGateway->config = json_encode($config);
|
||||||
|
$accountGateway->accepted_credit_cards = $cardCount;
|
||||||
$account->account_gateways()->save($accountGateway);
|
$account->account_gateways()->save($accountGateway);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<!-- TODO: creditcard-types IS SET IN JS FURTHER DOWN IN THE SCRIPT PART,
|
<!-- 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 -->
|
AND THEN IN INLINE STYLE. REMOVE THIS WHEN RAZI HAS FIXED THE IMAGES AND STYLE -->
|
||||||
<div class="two-column">
|
<div class="two-column">
|
||||||
{{ Former::checkboxes('creditCardType_id')
|
{{ Former::checkboxes('creditCardTypes[]')
|
||||||
->label('Accepted Credit Cards')
|
->label('Accepted Credit Cards')
|
||||||
->checkboxes($creditCardTypes)
|
->checkboxes($creditCardTypes)
|
||||||
->class('creditcard-types')
|
->class('creditcard-types')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user