1
0
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:
aggepagge 2014-06-23 22:31:21 +02:00
parent 0f6e374402
commit 92fdf49c10
2 changed files with 16 additions and 3 deletions

View File

@ -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);
}

View File

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