From 6caf1ff30d72fd2fdea264392abdc01cf431cb58 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 19 May 2016 09:47:57 +0300 Subject: [PATCH] Minor fixes --- app/Http/routes.php | 2 + app/Ninja/Repositories/ExpenseRepository.php | 21 ++++--- app/Services/BankAccountService.php | 2 +- resources/lang/en/texts.php | 58 ++++++++++---------- 4 files changed, 45 insertions(+), 38 deletions(-) diff --git a/app/Http/routes.php b/app/Http/routes.php index 34dd41872cf7..18d6e8640cfe 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -247,6 +247,8 @@ Route::group([ Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable')); Route::post('account_gateways/bulk', 'AccountGatewayController@bulk'); + Route::get('bank_accounts/import_ofx', 'BankAccountController@showImportOFX'); + Route::post('bank_accounts/import_ofx', 'BankAccountController@doImportOFX'); Route::resource('bank_accounts', 'BankAccountController'); Route::get('api/bank_accounts', array('as'=>'api.bank_accounts', 'uses'=>'BankAccountController@getDatatable')); Route::post('bank_accounts/bulk', 'BankAccountController@bulk'); diff --git a/app/Ninja/Repositories/ExpenseRepository.php b/app/Ninja/Repositories/ExpenseRepository.php index 442af74bd32b..0ce0e155cf50 100644 --- a/app/Ninja/Repositories/ExpenseRepository.php +++ b/app/Ninja/Repositories/ExpenseRepository.php @@ -12,7 +12,7 @@ use Session; class ExpenseRepository extends BaseRepository { protected $documentRepo; - + // Expenses public function getClassName() { @@ -23,7 +23,7 @@ class ExpenseRepository extends BaseRepository { $this->documentRepo = $documentRepo; } - + public function all() { return Expense::scope() @@ -156,7 +156,7 @@ class ExpenseRepository extends BaseRepository $rate = isset($input['exchange_rate']) ? Utils::parseFloat($input['exchange_rate']) : 1; $expense->exchange_rate = round($rate, 4); $expense->amount = round(Utils::parseFloat($input['amount']), 2); - + $expense->save(); // Documents @@ -169,7 +169,7 @@ class ExpenseRepository extends BaseRepository $document->save(); } } - + if(!empty($input['documents']) && Auth::user()->can('create', ENTITY_DOCUMENT)){ // Fallback upload $doc_errors = array(); @@ -188,11 +188,14 @@ class ExpenseRepository extends BaseRepository Session::flash('error', implode('
',array_map('htmlentities',$doc_errors))); } } - - foreach ($expense->documents as $document){ - if(!in_array($document->public_id, $document_ids)){ - // Not checking permissions; deleting a document is just editing the invoice - $document->delete(); + + // prevent loading all of the documents if we don't have to + if ( ! $expense->wasRecentlyCreated) { + foreach ($expense->documents as $document){ + if ( ! in_array($document->public_id, $document_ids)){ + // Not checking permissions; deleting a document is just editing the invoice + $document->delete(); + } } } diff --git a/app/Services/BankAccountService.php b/app/Services/BankAccountService.php index cd8776c8b111..688bd866d3ad 100644 --- a/app/Services/BankAccountService.php +++ b/app/Services/BankAccountService.php @@ -206,7 +206,7 @@ class BankAccountService extends BaseService $vendorMap[$transaction['vendor_orig']] = $vendor; $countVendors++; } - + // create the expense record $this->expenseRepo->save([ 'vendor_id' => $vendor->id, diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 871c89e78611..f73e936f5fb5 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -978,8 +978,8 @@ $LANG = array( 'first_page' => 'First page', 'all_pages' => 'All pages', 'last_page' => 'Last page', - 'all_pages_header' => 'Show header on', - 'all_pages_footer' => 'Show footer on', + 'all_pages_header' => 'Show Header on', + 'all_pages_footer' => 'Show Footer on', 'invoice_currency' => 'Invoice Currency', 'enable_https' => 'We strongly recommend using HTTPS to accept credit card details online.', 'quote_issued_to' => 'Quote issued to', @@ -1040,14 +1040,14 @@ $LANG = array( 'enable_portal_password_help'=>'Allows you to set a password for each contact. If a password is set, the contact will be required to enter a password before viewing invoices.', 'send_portal_password'=>'Generate password automatically', 'send_portal_password_help'=>'If no password is set, one will be generated and sent with the first invoice.', - + 'expired' => 'Expired', 'invalid_card_number' => 'The credit card number is not valid.', 'invalid_expiry' => 'The expiration date is not valid.', 'invalid_cvv' => 'The CVV is not valid.', 'cost' => 'Cost', 'create_invoice_for_sample' => 'Note: create your first invoice to see a preview here.', - + // User Permissions 'owner' => 'Owner', 'administrator' => 'Administrator', @@ -1065,8 +1065,8 @@ $LANG = array( 'create_all_help' => 'Allow user to create and modify records', 'view_all_help' => 'Allow user to view records they didn\'t create', 'edit_all_help' => 'Allow user to modify records they didn\'t create', - 'view_payment' => 'View Payment', - + 'view_payment' => 'View Payment', + 'january' => 'January', 'february' => 'February', 'march' => 'March', @@ -1079,7 +1079,7 @@ $LANG = array( 'october' => 'October', 'november' => 'November', 'december' => 'December', - + // Documents 'documents_header' => 'Documents:', 'email_documents_header' => 'Documents:', @@ -1092,17 +1092,15 @@ $LANG = array( 'document_email_attachment' => 'Attach Documents', 'download_documents' => 'Download Documents (:size)', 'documents_from_expenses' => 'From Expenses:', - 'dropzone' => array(// See http://www.dropzonejs.com/#config-dictDefaultMessage - 'DefaultMessage' => 'Drop files or click to upload', - 'FallbackMessage' => 'Your browser does not support drag\'n\'drop file uploads.', - 'FallbackText' => 'Please use the fallback form below to upload your files like in the olden days.', - 'FileTooBig' => 'File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.', - 'InvalidFileType' => 'You can\'t upload files of this type.', - 'ResponseError' => 'Server responded with {{statusCode}} code.', - 'CancelUpload' => 'Cancel upload', - 'CancelUploadConfirmation' => 'Are you sure you want to cancel this upload?', - 'RemoveFile' => 'Remove file', - ), + 'dropzone_default_message' => 'Drop files or click to upload', + 'dropzone_fallback_message' => 'Your browser does not support drag\'n\'drop file uploads.', + 'dropzone_fallback_text' => 'Please use the fallback form below to upload your files like in the olden days.', + 'dropzone_file_too_big' => 'File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.', + 'dropzone_invalid_file_type' => 'You can\'t upload files of this type.', + 'dropzone_response_error' => 'Server responded with {{statusCode}} code.', + 'dropzone_cancel_upload' => 'Cancel upload', + 'dropzone_cancel_upload_confirmation' => 'Are you sure you want to cancel this upload?', + 'dropzone_remove_file' => 'Remove file', 'documents' => 'Documents', 'document_date' => 'Document Date', 'document_size' => 'Size', @@ -1111,11 +1109,11 @@ $LANG = array( 'enable_client_portal_help' => 'Show/hide the client portal.', 'enable_client_portal_dashboard' => 'Dashboard', 'enable_client_portal_dashboard_help' => 'Show/hide the dashboard page in the client portal.', - + // Plans 'account_management' => 'Account Management', 'plan_status' => 'Plan Status', - + 'plan_upgrade' => 'Upgrade', 'plan_change' => 'Change Plan', 'pending_change_to' => 'Changes To', @@ -1145,9 +1143,9 @@ $LANG = array( 'plan_paid' => 'Term Started', 'plan_started' => 'Plan Started', 'plan_expires' => 'Plan Expires', - + 'white_label_button' => 'White Label', - + 'pro_plan_year_description' => 'One year enrollment in the Invoice Ninja Pro Plan.', 'pro_plan_month_description' => 'One month enrollment in the Invoice Ninja Pro Plan.', 'enterprise_plan_product' => 'Enterprise Plan', @@ -1167,8 +1165,8 @@ $LANG = array( 'add_users_not_supported' => 'Upgrade to the Enterprise plan to add additional users to your account.', 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments.', 'return_to_app' => 'Return to app', - - + + // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1185,7 +1183,7 @@ $LANG = array( 'activity_39' => ':user cancelled a :payment_amount payment (:payment)', 'activity_40' => ':user refunded :adjustment of a :payment_amount payment (:payment)', 'card_expiration' => 'Exp: :expires', - + 'card_creditcardother' => 'Unknown', 'card_americanexpress' => 'American Express', 'card_carteblanche' => 'Carte Blanche', @@ -1237,7 +1235,7 @@ $LANG = array( 'remove' => 'Remove', 'payment_method_removed' => 'Removed payment method.', 'bank_account_verification_help' => 'We have made two deposits into your account with the description "VERIFICATION". These deposits will take 1-2 business days to appear on your statement. Please enter the amounts below.', - 'bank_account_verification_next_steps' => 'We have made two deposits into your account with the description "VERIFICATION". These deposits will take 1-2 business days to appear on your statement. + 'bank_account_verification_next_steps' => 'We have made two deposits into your account with the description "VERIFICATION". These deposits will take 1-2 business days to appear on your statement. Once you have the amounts, come back to this payment methods page and click "Complete Verification" next to the account.', 'unknown_bank' => 'Unknown Bank', 'ach_verification_delay_help' => 'You will be able to use the account after completing verification. Verification usually takes 1-2 business days.', @@ -1279,7 +1277,11 @@ $LANG = array( 'no_payment_method_specified' => 'No payment method specified', - + 'chart_type' => 'Chart Type', + 'format' => 'Format', + 'import_ofx' => 'Import OFX', + 'ofx_file' => 'OFX File', + 'ofx_parse_failed' => 'Failed to parse OFX file', // WePay 'wepay' => 'WePay', @@ -1307,4 +1309,4 @@ $LANG = array( return $LANG; -?>. \ No newline at end of file +?>