Minor fixes

This commit is contained in:
Hillel Coren 2016-05-19 09:47:57 +03:00
parent 617ac98a75
commit 6caf1ff30d
4 changed files with 45 additions and 38 deletions

View File

@ -247,6 +247,8 @@ Route::group([
Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable')); Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable'));
Route::post('account_gateways/bulk', 'AccountGatewayController@bulk'); 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::resource('bank_accounts', 'BankAccountController');
Route::get('api/bank_accounts', array('as'=>'api.bank_accounts', 'uses'=>'BankAccountController@getDatatable')); Route::get('api/bank_accounts', array('as'=>'api.bank_accounts', 'uses'=>'BankAccountController@getDatatable'));
Route::post('bank_accounts/bulk', 'BankAccountController@bulk'); Route::post('bank_accounts/bulk', 'BankAccountController@bulk');

View File

@ -12,7 +12,7 @@ use Session;
class ExpenseRepository extends BaseRepository class ExpenseRepository extends BaseRepository
{ {
protected $documentRepo; protected $documentRepo;
// Expenses // Expenses
public function getClassName() public function getClassName()
{ {
@ -23,7 +23,7 @@ class ExpenseRepository extends BaseRepository
{ {
$this->documentRepo = $documentRepo; $this->documentRepo = $documentRepo;
} }
public function all() public function all()
{ {
return Expense::scope() return Expense::scope()
@ -156,7 +156,7 @@ class ExpenseRepository extends BaseRepository
$rate = isset($input['exchange_rate']) ? Utils::parseFloat($input['exchange_rate']) : 1; $rate = isset($input['exchange_rate']) ? Utils::parseFloat($input['exchange_rate']) : 1;
$expense->exchange_rate = round($rate, 4); $expense->exchange_rate = round($rate, 4);
$expense->amount = round(Utils::parseFloat($input['amount']), 2); $expense->amount = round(Utils::parseFloat($input['amount']), 2);
$expense->save(); $expense->save();
// Documents // Documents
@ -169,7 +169,7 @@ class ExpenseRepository extends BaseRepository
$document->save(); $document->save();
} }
} }
if(!empty($input['documents']) && Auth::user()->can('create', ENTITY_DOCUMENT)){ if(!empty($input['documents']) && Auth::user()->can('create', ENTITY_DOCUMENT)){
// Fallback upload // Fallback upload
$doc_errors = array(); $doc_errors = array();
@ -188,11 +188,14 @@ class ExpenseRepository extends BaseRepository
Session::flash('error', implode('<br>',array_map('htmlentities',$doc_errors))); Session::flash('error', implode('<br>',array_map('htmlentities',$doc_errors)));
} }
} }
foreach ($expense->documents as $document){ // prevent loading all of the documents if we don't have to
if(!in_array($document->public_id, $document_ids)){ if ( ! $expense->wasRecentlyCreated) {
// Not checking permissions; deleting a document is just editing the invoice foreach ($expense->documents as $document){
$document->delete(); if ( ! in_array($document->public_id, $document_ids)){
// Not checking permissions; deleting a document is just editing the invoice
$document->delete();
}
} }
} }

View File

@ -206,7 +206,7 @@ class BankAccountService extends BaseService
$vendorMap[$transaction['vendor_orig']] = $vendor; $vendorMap[$transaction['vendor_orig']] = $vendor;
$countVendors++; $countVendors++;
} }
// create the expense record // create the expense record
$this->expenseRepo->save([ $this->expenseRepo->save([
'vendor_id' => $vendor->id, 'vendor_id' => $vendor->id,

View File

@ -978,8 +978,8 @@ $LANG = array(
'first_page' => 'First page', 'first_page' => 'First page',
'all_pages' => 'All pages', 'all_pages' => 'All pages',
'last_page' => 'Last page', 'last_page' => 'Last page',
'all_pages_header' => 'Show header on', 'all_pages_header' => 'Show Header on',
'all_pages_footer' => 'Show footer on', 'all_pages_footer' => 'Show Footer on',
'invoice_currency' => 'Invoice Currency', 'invoice_currency' => 'Invoice Currency',
'enable_https' => 'We strongly recommend using HTTPS to accept credit card details online.', 'enable_https' => 'We strongly recommend using HTTPS to accept credit card details online.',
'quote_issued_to' => 'Quote issued to', '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.', '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'=>'Generate password automatically',
'send_portal_password_help'=>'If no password is set, one will be generated and sent with the first invoice.', 'send_portal_password_help'=>'If no password is set, one will be generated and sent with the first invoice.',
'expired' => 'Expired', 'expired' => 'Expired',
'invalid_card_number' => 'The credit card number is not valid.', 'invalid_card_number' => 'The credit card number is not valid.',
'invalid_expiry' => 'The expiration date is not valid.', 'invalid_expiry' => 'The expiration date is not valid.',
'invalid_cvv' => 'The CVV is not valid.', 'invalid_cvv' => 'The CVV is not valid.',
'cost' => 'Cost', 'cost' => 'Cost',
'create_invoice_for_sample' => 'Note: create your first invoice to see a preview here.', 'create_invoice_for_sample' => 'Note: create your first invoice to see a preview here.',
// User Permissions // User Permissions
'owner' => 'Owner', 'owner' => 'Owner',
'administrator' => 'Administrator', 'administrator' => 'Administrator',
@ -1065,8 +1065,8 @@ $LANG = array(
'create_all_help' => 'Allow user to create and modify records', 'create_all_help' => 'Allow user to create and modify records',
'view_all_help' => 'Allow user to view records they didn\'t create', 'view_all_help' => 'Allow user to view records they didn\'t create',
'edit_all_help' => 'Allow user to modify 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', 'january' => 'January',
'february' => 'February', 'february' => 'February',
'march' => 'March', 'march' => 'March',
@ -1079,7 +1079,7 @@ $LANG = array(
'october' => 'October', 'october' => 'October',
'november' => 'November', 'november' => 'November',
'december' => 'December', 'december' => 'December',
// Documents // Documents
'documents_header' => 'Documents:', 'documents_header' => 'Documents:',
'email_documents_header' => 'Documents:', 'email_documents_header' => 'Documents:',
@ -1092,17 +1092,15 @@ $LANG = array(
'document_email_attachment' => 'Attach Documents', 'document_email_attachment' => 'Attach Documents',
'download_documents' => 'Download Documents (:size)', 'download_documents' => 'Download Documents (:size)',
'documents_from_expenses' => 'From Expenses:', 'documents_from_expenses' => 'From Expenses:',
'dropzone' => array(// See http://www.dropzonejs.com/#config-dictDefaultMessage 'dropzone_default_message' => 'Drop files or click to upload',
'DefaultMessage' => 'Drop files or click to upload', 'dropzone_fallback_message' => 'Your browser does not support drag\'n\'drop file uploads.',
'FallbackMessage' => '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.',
'FallbackText' => '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.',
'FileTooBig' => 'File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.', 'dropzone_invalid_file_type' => 'You can\'t upload files of this type.',
'InvalidFileType' => 'You can\'t upload files of this type.', 'dropzone_response_error' => 'Server responded with {{statusCode}} code.',
'ResponseError' => 'Server responded with {{statusCode}} code.', 'dropzone_cancel_upload' => 'Cancel upload',
'CancelUpload' => 'Cancel upload', 'dropzone_cancel_upload_confirmation' => 'Are you sure you want to cancel this upload?',
'CancelUploadConfirmation' => 'Are you sure you want to cancel this upload?', 'dropzone_remove_file' => 'Remove file',
'RemoveFile' => 'Remove file',
),
'documents' => 'Documents', 'documents' => 'Documents',
'document_date' => 'Document Date', 'document_date' => 'Document Date',
'document_size' => 'Size', 'document_size' => 'Size',
@ -1111,11 +1109,11 @@ $LANG = array(
'enable_client_portal_help' => 'Show/hide the client portal.', 'enable_client_portal_help' => 'Show/hide the client portal.',
'enable_client_portal_dashboard' => 'Dashboard', 'enable_client_portal_dashboard' => 'Dashboard',
'enable_client_portal_dashboard_help' => 'Show/hide the dashboard page in the client portal.', 'enable_client_portal_dashboard_help' => 'Show/hide the dashboard page in the client portal.',
// Plans // Plans
'account_management' => 'Account Management', 'account_management' => 'Account Management',
'plan_status' => 'Plan Status', 'plan_status' => 'Plan Status',
'plan_upgrade' => 'Upgrade', 'plan_upgrade' => 'Upgrade',
'plan_change' => 'Change Plan', 'plan_change' => 'Change Plan',
'pending_change_to' => 'Changes To', 'pending_change_to' => 'Changes To',
@ -1145,9 +1143,9 @@ $LANG = array(
'plan_paid' => 'Term Started', 'plan_paid' => 'Term Started',
'plan_started' => 'Plan Started', 'plan_started' => 'Plan Started',
'plan_expires' => 'Plan Expires', 'plan_expires' => 'Plan Expires',
'white_label_button' => 'White Label', 'white_label_button' => 'White Label',
'pro_plan_year_description' => 'One year enrollment in the Invoice Ninja Pro Plan.', '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.', 'pro_plan_month_description' => 'One month enrollment in the Invoice Ninja Pro Plan.',
'enterprise_plan_product' => 'Enterprise 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.', '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.', 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments.',
'return_to_app' => 'Return to app', 'return_to_app' => 'Return to app',
// Payment updates // Payment updates
'refund_payment' => 'Refund Payment', 'refund_payment' => 'Refund Payment',
'refund_max' => 'Max:', 'refund_max' => 'Max:',
@ -1185,7 +1183,7 @@ $LANG = array(
'activity_39' => ':user cancelled a :payment_amount payment (:payment)', 'activity_39' => ':user cancelled a :payment_amount payment (:payment)',
'activity_40' => ':user refunded :adjustment of a :payment_amount payment (:payment)', 'activity_40' => ':user refunded :adjustment of a :payment_amount payment (:payment)',
'card_expiration' => 'Exp:&nbsp:expires', 'card_expiration' => 'Exp:&nbsp:expires',
'card_creditcardother' => 'Unknown', 'card_creditcardother' => 'Unknown',
'card_americanexpress' => 'American Express', 'card_americanexpress' => 'American Express',
'card_carteblanche' => 'Carte Blanche', 'card_carteblanche' => 'Carte Blanche',
@ -1237,7 +1235,7 @@ $LANG = array(
'remove' => 'Remove', 'remove' => 'Remove',
'payment_method_removed' => 'Removed payment method.', '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_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.', Once you have the amounts, come back to this payment methods page and click "Complete Verification" next to the account.',
'unknown_bank' => 'Unknown Bank', '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.', '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', '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' => 'WePay', 'wepay' => 'WePay',
@ -1307,4 +1309,4 @@ $LANG = array(
return $LANG; return $LANG;
?>. ?>