Various code cleanup.

This commit is contained in:
James Cole 2017-01-20 08:03:26 +01:00
parent be868d37f2
commit 61d58a354e
6 changed files with 27 additions and 11 deletions

View File

@ -162,6 +162,30 @@ class JournalFormRequest extends Request
{
$string = $this->get($field) ?? '';
$search = [
"\xa0", // non-breaking space
"\u{1680}", // OGHAM SPACE MARK
"\u{180E}", // MONGOLIAN VOWEL SEPARATOR
"\u{2000}", // EN QUAD
"\u{2001}", // EM QUAD
"\u{2002}", //EN SPACE
"\u{2003}", //EM SPACE
"\u{2004}", //THREE-PER-EM SPACE
"\u{2005}", //FOUR-PER-EM SPACE
"\u{2006}", //SIX-PER-EM SPACE
"\u{2007}", //FIGURE SPACE
"\u{2008}", //PUNCTUATION SPACE
"\u{2009}", //THIN SPACE
"\u{200A}", //HAIR SPACE
"\u{200B}", //ZERO WIDTH SPACE
"\u{202F}", //NARROW NO-BREAK SPACE
"\u{205F}", //MEDIUM MATHEMATICAL SPACE
"\u{3000}", //IDEOGRAPHIC SPACE
"\u{FEFF}", // ZERO WIDTH NO -BREAK SPACE
];
$replace = "\x20"; // plain old normal space
$string = str_replace($search, $replace, $string);
return trim($string);
}
}

View File

@ -108,9 +108,6 @@ class AccountTasker implements AccountTaskerInterface
*/
public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array
{
$startAmount = '0';
$endAmount = '0';
$diff = '0';
$ids = $accounts->pluck('id')->toArray();
$yesterday = clone $start;
$yesterday->subDay();
@ -153,10 +150,6 @@ class AccountTasker implements AccountTaskerInterface
$return['accounts'][$id] = $entry;
}
foreach ($accounts as $account) {
$id = $account->id;
$diff = bcadd($diff, bcsub($return['accounts'][$id]['end_balance'], $return['accounts'][$id]['start_balance']));
}
$return['difference'] = bcsub($return['end'], $return['start']);
return $return;

View File

@ -13,7 +13,6 @@ $(document).ready(function () {
// destination account names:
if ($('input[name^="destination_account_name["]').length > 0) {
console.log('multi dest account');
$.getJSON('json/expense-accounts').done(function (data) {
$('input[name^="destination_account_name["]').typeahead({source: data});
});

View File

@ -6,7 +6,7 @@
* See the LICENSE file for details.
*/
/** global: what, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, doSwitch, middleCrumbUrl */
/** global: what,Modernizr, title, breadcrumbs, middleCrumbName, button, piggiesLength, txt, doSwitch, middleCrumbUrl */
$(document).ready(function () {
"use strict";

View File

@ -8,7 +8,7 @@
* See the LICENSE file for details.
*/
/** global: what */
/** global: what, Modernizr */
$(document).ready(function () {
"use strict";

View File

@ -70,7 +70,7 @@ then
php artisan migrate:refresh --seed
# call test data generation script
$(which php) /sites/FF3/test-data/artisan generate:data testing sqlite
$(which php) /sites/FF3/test-data/artisan generate:data local sqlite
# copy new database over backup (resets backup)
cp $DATABASE $DATABASECOPY
fi