cytech / BillingTrack

BillingTrack quote, invoice, workorder management
48 stars 39 forks source link

Error Exception, Undefined index after database creation #10

Closed gpfti closed 4 years ago

gpfti commented 4 years ago

I got created the database, I can see tables and everything ok in the database. I could also check every query transaction on laravel log. After clicking the button for creating a new user, I get an error on line 38 on BeforeMiddleware.php. It's something related with date format:

app/Http/Middleware/BeforeMiddleware.php :38 config(['bt.datepickerFormat' => $dateFormats[config('bt.dateFormat')]['datepicker']]);

If I comment this line I get the new user form, but I get a new error later.

Regards,

Guillermo

cytech commented 4 years ago

maybe settings table did not get seeded properly. check database settings table for entries (should be over 150 rows) check for id=11 setting_key=dateFormat setting_value=m/d/y if these do not exist, drop the schema, recreate schema and run setup again

gpfti commented 4 years ago

Hi, It's true, settings table has lesser row than expected. I'll drop the database and recreate it. Maybe I'll check apache and php.ini timeout as database creation exceeds timeout. I'll write back to confirm results.

Thanks a lot

gpfti commented 4 years ago

It's curious. Although have I dropped and created Billingtrack Mariadb database, after setup, it only inserts 19 rows on settings table (none of them date settings related). I'm still having a look to it if I could give you more information.

Regards,

Guillermo

cytech commented 4 years ago

i just did a fresh install and settings table is actually 104 rows before user create. database setup took a little over 2 minutes on my local system. sounds like something is timing out. there is one large mysql insert statement in the SettingsTableSeeder.php (that really needs to be laravelized...)

you can try manual migration on empty database: goto billingtrack directory and run: php artisan migrate --seed hopefully it will give you an indication of what is failing. if it completes without error (which would be strange), you can then run setup and it should take you to user creation

gpfti commented 4 years ago

Perfect. I’ll do it and I write you back as soon as I get any result.

:-)

Thanks a lot

Regards,

Guillermo

Sent with GitHawk

gpfti commented 4 years ago

Hi again,

I followed your instructions and finally I could see what it happends. It stays too long with the command: Migrating: 2018_08_17_000100_version_400

Migrated:  2018_08_17_000035_create_invoice_items_table (2.62 seconds)
Migrating: 2018_08_17_000036_create_recurring_invoice_amounts_table
Migrated:  2018_08_17_000036_create_recurring_invoice_amounts_table (2.45 second             s)
Migrating: 2018_08_17_000037_create_quote_amounts_table
Migrated:  2018_08_17_000037_create_quote_amounts_table (2.34 seconds)
Migrating: 2018_08_17_000038_create_time_tracking_tasks_table
Migrated:  2018_08_17_000038_create_time_tracking_tasks_table (4.81 seconds)
Migrating: 2018_08_17_000039_create_quote_items_table
Migrated:  2018_08_17_000039_create_quote_items_table (2.73 seconds)
Migrating: 2018_08_17_000040_create_invoice_transactions_table
Migrated:  2018_08_17_000040_create_invoice_transactions_table (2.79 seconds)
Migrating: 2018_08_17_000041_create_invoices_custom_table
Migrated:  2018_08_17_000041_create_invoices_custom_table (1.97 seconds)
Migrating: 2018_08_17_000042_create_expenses_table
Migrated:  2018_08_17_000042_create_expenses_table (8.88 seconds)
Migrating: 2018_08_17_000043_create_schedule_occurrences_table
Migrated:  2018_08_17_000043_create_schedule_occurrences_table (2.67 seconds)
Migrating: 2018_08_17_000044_create_invoice_amounts_table
Migrated:  2018_08_17_000044_create_invoice_amounts_table (2.45 seconds)
Migrating: 2018_08_17_000045_create_payments_table
Migrated:  2018_08_17_000045_create_payments_table (6.96 seconds)
Migrating: 2018_08_17_000046_create_schedule_reminders_table
Migrated:  2018_08_17_000046_create_schedule_reminders_table (2.59 seconds)
Migrating: 2018_08_17_000047_create_recurring_invoice_items_table
Migrated:  2018_08_17_000047_create_recurring_invoice_items_table (2.79 seconds)
Migrating: 2018_08_17_000048_create_workorder_item_amounts_table
Migrated:  2018_08_17_000048_create_workorder_item_amounts_table (2.68 seconds)
Migrating: 2018_08_17_000049_create_quotes_custom_table
Migrated:  2018_08_17_000049_create_quotes_custom_table (1.92 seconds)
Migrating: 2018_08_17_000050_create_recurring_invoices_custom_table
Migrated:  2018_08_17_000050_create_recurring_invoices_custom_table (2.2 seconds             )
Migrating: 2018_08_17_000051_create_schedule_resources_table
Migrated:  2018_08_17_000051_create_schedule_resources_table (2.23 seconds)
Migrating: 2018_08_17_000052_create_expenses_custom_table
Migrated:  2018_08_17_000052_create_expenses_custom_table (2.04 seconds)
Migrating: 2018_08_17_000053_create_merchant_payments_table
Migrated:  2018_08_17_000053_create_merchant_payments_table (3.07 seconds)
Migrating: 2018_08_17_000054_create_time_tracking_timers_table
Migrated:  2018_08_17_000054_create_time_tracking_timers_table (2.14 seconds)
Migrating: 2018_08_17_000055_create_invoice_item_amounts_table
Migrated:  2018_08_17_000055_create_invoice_item_amounts_table (2.31 seconds)
Migrating: 2018_08_17_000056_create_quote_item_amounts_table
Migrated:  2018_08_17_000056_create_quote_item_amounts_table (2.39 seconds)
Migrating: 2018_08_17_000057_create_recurring_invoice_item_amounts_table
Migrated:  2018_08_17_000057_create_recurring_invoice_item_amounts_table (2.45 seconds)
Migrating: 2018_08_17_000058_create_payments_custom_table
Migrated:  2018_08_17_000058_create_payments_custom_table (1.88 seconds)
Migrating: 2018_08_17_000100_version_400

It stays there forever. It seems it stops processing task because I have another ssh window monitorizing activity (with top) and Although mysqld needs up to 57% CPU resources while processing previous queries, when it reaches _2018_08_17_000100_version400 mysqld stops using CPU.

Regards,

Guillermo

cytech commented 4 years ago

that migration is where the seeder is first called. can you try manual again on empty database with verbose option and see if it tells us anything more? php artisan migrate -vvv (don't need the --seed option) Ill try and investigate further next week

cytech commented 4 years ago

also check your max_allowed_packet size in mysql conf. should be 16MB older version defaults were 1mb or 4 mb

gpfti commented 4 years ago

also check your max_allowed_packet size in mysql conf. should be 16MB older version defaults were 1mb or 4 mb

Hi, It's a brand new mariadb installation. On mysqldump.cnf it was already set to 16mb. I discommented 16mb max_allowed_packet on /etc/mysql/mariadb.conf.d/50-server.cnf

After checking that and rebooting machine, y executed php artisan migrate -vvv, again it stays at: Migrating: 2018_08_17_000100_version_400.

But if I hit intro, it goes on (yesterday I did not realize about that).

Now it arrives to Migrating: 2019_05_29_000100_version_510 and stays there... This time hitting intro didn't worked. Meanwhile I write this post, it finished 510 (it stayed there for 210 seconds). Now is migrating version_5103 (doesn't react to "intro") and stays there a for 158 seconds and... finish!

**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes

Migration table created successfully.
Migrating: 2018_08_17_000000_create_activities_table
Migrated:  2018_08_17_000000_create_activities_table (1.39 seconds)
Migrating: 2018_08_17_000001_create_currencies_table
Migrated:  2018_08_17_000001_create_currencies_table (1.09 seconds)
Migrating: 2018_08_17_000002_create_users_table
Migrated:  2018_08_17_000002_create_users_table (0.6 seconds)
Migrating: 2018_08_17_000003_create_workorders_table
Migrated:  2018_08_17_000003_create_workorders_table (1.69 seconds)
Migrating: 2018_08_17_000004_create_mail_queue_table
Migrated:  2018_08_17_000004_create_mail_queue_table (0.26 seconds)
Migrating: 2018_08_17_000005_create_products_table
Migrated:  2018_08_17_000005_create_products_table (0.39 seconds)
Migrating: 2018_08_17_000006_create_item_lookups_table
Migrated:  2018_08_17_000006_create_item_lookups_table (1.07 seconds)
Migrating: 2018_08_17_000007_create_employees_table
Migrated:  2018_08_17_000007_create_employees_table (0.4 seconds)
Migrating: 2018_08_17_000008_create_expense_vendors_table
Migrated:  2018_08_17_000008_create_expense_vendors_table (0.47 seconds)
Migrating: 2018_08_17_000009_create_company_profiles_table
Migrated:  2018_08_17_000009_create_company_profiles_table (0.39 seconds)
Migrating: 2018_08_17_000011_create_payment_methods_table
Migrated:  2018_08_17_000011_create_payment_methods_table (0.37 seconds)
Migrating: 2018_08_17_000012_create_schedule_categories_table
Migrated:  2018_08_17_000012_create_schedule_categories_table (0.38 seconds)
Migrating: 2018_08_17_000013_create_clients_table
Migrated:  2018_08_17_000013_create_clients_table (1.18 seconds)
Migrating: 2018_08_17_000014_create_tax_rates_table
Migrated:  2018_08_17_000014_create_tax_rates_table (0.41 seconds)
Migrating: 2018_08_17_000015_create_groups_table
Migrated:  2018_08_17_000015_create_groups_table (0.45 seconds)
Migrating: 2018_08_17_000016_create_expense_categories_table
Migrated:  2018_08_17_000016_create_expense_categories_table (0.33 seconds)
Migrating: 2018_08_17_000017_create_addons_table
Migrated:  2018_08_17_000017_create_addons_table (0.46 seconds)
Migrating: 2018_08_17_000018_create_settings_table
Migrated:  2018_08_17_000018_create_settings_table (0.67 seconds)
Migrating: 2018_08_17_000019_create_custom_fields_table
Migrated:  2018_08_17_000019_create_custom_fields_table (0.53 seconds)
Migrating: 2018_08_17_000020_create_clients_custom_table
Migrated:  2018_08_17_000020_create_clients_custom_table (1.49 seconds)
Migrating: 2018_08_17_000021_create_workorder_items_table
Migrated:  2018_08_17_000021_create_workorder_items_table (3.34 seconds)
Migrating: 2018_08_17_000022_create_attachments_table
Migrated:  2018_08_17_000022_create_attachments_table (2.5 seconds)
Migrating: 2018_08_17_000023_create_contacts_table
Migrated:  2018_08_17_000023_create_contacts_table (2.02 seconds)
Migrating: 2018_08_17_000024_create_invoices_table
Migrated:  2018_08_17_000024_create_invoices_table (9.22 seconds)
Migrating: 2018_08_17_000025_create_notes_table
Migrated:  2018_08_17_000025_create_notes_table (3.14 seconds)
Migrating: 2018_08_17_000026_create_schedule_table
Migrated:  2018_08_17_000026_create_schedule_table (4.34 seconds)
Migrating: 2018_08_17_000027_create_users_custom_table
Migrated:  2018_08_17_000027_create_users_custom_table (2.14 seconds)
Migrating: 2018_08_17_000028_create_time_tracking_projects_table
Migrated:  2018_08_17_000028_create_time_tracking_projects_table (7.6 seconds)
Migrating: 2018_08_17_000029_create_quotes_table
Migrated:  2018_08_17_000029_create_quotes_table (10.11 seconds)
Migrating: 2018_08_17_000030_create_recurring_invoices_table
Migrated:  2018_08_17_000030_create_recurring_invoices_table (8.81 seconds)
Migrating: 2018_08_17_000031_create_company_profiles_custom_table
Migrated:  2018_08_17_000031_create_company_profiles_custom_table (1.81 seconds)
Migrating: 2018_08_17_000032_create_merchant_clients_table
Migrated:  2018_08_17_000032_create_merchant_clients_table (3.14 seconds)
Migrating: 2018_08_17_000033_create_workorder_amounts_table
Migrated:  2018_08_17_000033_create_workorder_amounts_table (2.03 seconds)
Migrating: 2018_08_17_000034_create_workorders_custom_table
Migrated:  2018_08_17_000034_create_workorders_custom_table (1.92 seconds)
Migrating: 2018_08_17_000035_create_invoice_items_table
Migrated:  2018_08_17_000035_create_invoice_items_table (2.73 seconds)
Migrating: 2018_08_17_000036_create_recurring_invoice_amounts_table
Migrated:  2018_08_17_000036_create_recurring_invoice_amounts_table (2.6 seconds)
Migrating: 2018_08_17_000037_create_quote_amounts_table
Migrated:  2018_08_17_000037_create_quote_amounts_table (2.52 seconds)
Migrating: 2018_08_17_000038_create_time_tracking_tasks_table
Migrated:  2018_08_17_000038_create_time_tracking_tasks_table (5.11 seconds)
Migrating: 2018_08_17_000039_create_quote_items_table
Migrated:  2018_08_17_000039_create_quote_items_table (2.93 seconds)
Migrating: 2018_08_17_000040_create_invoice_transactions_table
Migrated:  2018_08_17_000040_create_invoice_transactions_table (2.78 seconds)
Migrating: 2018_08_17_000041_create_invoices_custom_table
Migrated:  2018_08_17_000041_create_invoices_custom_table (2.12 seconds)
Migrating: 2018_08_17_000042_create_expenses_table
Migrated:  2018_08_17_000042_create_expenses_table (9.9 seconds)
Migrating: 2018_08_17_000043_create_schedule_occurrences_table
Migrated:  2018_08_17_000043_create_schedule_occurrences_table (2.25 seconds)
Migrating: 2018_08_17_000044_create_invoice_amounts_table
Migrated:  2018_08_17_000044_create_invoice_amounts_table (2.29 seconds)
Migrating: 2018_08_17_000045_create_payments_table
Migrated:  2018_08_17_000045_create_payments_table (6.64 seconds)
Migrating: 2018_08_17_000046_create_schedule_reminders_table
Migrated:  2018_08_17_000046_create_schedule_reminders_table (2.49 seconds)
Migrating: 2018_08_17_000047_create_recurring_invoice_items_table
Migrated:  2018_08_17_000047_create_recurring_invoice_items_table (3.19 seconds)
Migrating: 2018_08_17_000048_create_workorder_item_amounts_table
Migrated:  2018_08_17_000048_create_workorder_item_amounts_table (3.07 seconds)
Migrating: 2018_08_17_000049_create_quotes_custom_table
Migrated:  2018_08_17_000049_create_quotes_custom_table (2.37 seconds)
Migrating: 2018_08_17_000050_create_recurring_invoices_custom_table
Migrated:  2018_08_17_000050_create_recurring_invoices_custom_table (2.21 seconds)
Migrating: 2018_08_17_000051_create_schedule_resources_table
Migrated:  2018_08_17_000051_create_schedule_resources_table (2.81 seconds)
Migrating: 2018_08_17_000052_create_expenses_custom_table
Migrated:  2018_08_17_000052_create_expenses_custom_table (2.07 seconds)
Migrating: 2018_08_17_000053_create_merchant_payments_table
Migrated:  2018_08_17_000053_create_merchant_payments_table (4.1 seconds)
Migrating: 2018_08_17_000054_create_time_tracking_timers_table
Migrated:  2018_08_17_000054_create_time_tracking_timers_table (2.49 seconds)
Migrating: 2018_08_17_000055_create_invoice_item_amounts_table
Migrated:  2018_08_17_000055_create_invoice_item_amounts_table (2.49 seconds)
Migrating: 2018_08_17_000056_create_quote_item_amounts_table
Migrated:  2018_08_17_000056_create_quote_item_amounts_table (2.76 seconds)
Migrating: 2018_08_17_000057_create_recurring_invoice_item_amounts_table
Migrated:  2018_08_17_000057_create_recurring_invoice_item_amounts_table (2.57 seconds)
Migrating: 2018_08_17_000058_create_payments_custom_table
Migrated:  2018_08_17_000058_create_payments_custom_table (1.87 seconds)
Migrating: 2018_08_17_000100_version_400

Migrated:  2018_08_17_000100_version_400 (182.48 seconds)
Migrating: 2018_09_07_000100_version_401
Migrated:  2018_09_07_000100_version_401 (0.12 seconds)
Migrating: 2018_10_17_000100_version_402
Migrated:  2018_10_17_000100_version_402 (0.08 seconds)
Migrating: 2018_11_08_000100_version_410
Migrated:  2018_11_08_000100_version_410 (0.62 seconds)
Migrating: 2018_12_16_000100_version_411
Migrated:  2018_12_16_000100_version_411 (0.12 seconds)
Migrating: 2018_12_17_000100_version_412
Migrated:  2018_12_17_000100_version_412 (0.13 seconds)
Migrating: 2019_03_19_000100_version_500
Migrated:  2019_03_19_000100_version_500 (0.05 seconds)
Migrating: 2019_03_25_000100_version_501
Migrated:  2019_03_25_000100_version_501 (0.1 seconds)
Migrating: 2019_05_29_000100_version_510

Migrated:  2019_05_29_000100_version_510 (210.7 seconds)
Migrating: 2019_06_11_000100_version_5102
Migrated:  2019_06_11_000100_version_5102 (7.61 seconds)
Migrating: 2019_06_14_000010_create_purchaseorders_table
Migrated:  2019_06_14_000010_create_purchaseorders_table (9.33 seconds)
Migrating: 2019_06_14_000020_create_purchaseorder_items_table
Migrated:  2019_06_14_000020_create_purchaseorder_items_table (2.88 seconds)
Migrating: 2019_06_14_000040_create_purchaseorders_custom_table
Migrated:  2019_06_14_000040_create_purchaseorders_custom_table (2.16 seconds)
Migrating: 2019_06_14_000050_create_purchaseorder_amounts_table
Migrated:  2019_06_14_000050_create_purchaseorder_amounts_table (2.36 seconds)
Migrating: 2019_06_14_000060_create_purchaseorder_item_amounts_table
Migrated:  2019_06_14_000060_create_purchaseorder_item_amounts_table (2.28 seconds)
Migrating: 2019_06_17_000010_version_5103

Migrated:  2019_06_17_000010_version_5103 (158.86 seconds)

After that I checked settings table. It only gets the same 19 rows of always. I put them here:

"id","setting_key","setting_value","deleted_at","created_at","updated_at"
"1","version","5.1.0",NULL,"2020-02-16 07:30:12","2020-02-16 07:33:44"
"2","jquiTheme","cupertino",NULL,"2020-02-16 07:30:12","2020-02-16 07:30:12"
"3","resultsPerPage","10",NULL,"2020-02-16 07:30:12","2020-02-16 07:30:12"
"4","enabledModules","127",NULL,"2020-02-16 07:30:12","2020-02-16 07:36:49"
"5","skin","{""headBackground"":""purple"",""headClass"":""dark"",""sidebarBackground"":""white"",""sidebarClass"":""light"",""sidebarMode"":""open""}",NULL,"2020-02-16 07:30:12","2020-02-16 07:36:50"
"6","convertWorkorderDate","jobdate",NULL,"2020-02-16 07:30:13","2020-02-16 07:30:13"
"7","headerTitleText","BillingTrack",NULL,"2020-02-16 07:30:13","2020-02-16 07:30:13"
"8","purchaseorderTemplate","default.blade.php",NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"9","purchaseorderGroup","4",NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"10","purchaseordersDueAfter","30",NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"11","purchaseorderStatusFilter","all_statuses",NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"12","purchaseorderTerms",,NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"13","purchaseorderFooter",,NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"14","resetPurchaseorderDateEmailDraft","0",NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"15","updateProductsDefault","1",NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"16","updateInvProductsDefault","1",NULL,"2020-02-16 07:36:49","2020-02-16 07:36:49"
"17","purchaseorderEmailSubject","Purchase Order #{{ $purchaseorder->number }}",NULL,"2020-02-16 07:36:50","2020-02-16 07:36:50"
"18","purchaseorderEmailBody","<p>Please find the attached purchase order from {{ $purchaseorder->user->name }}</p>",NULL,"2020-02-16 07:36:50","2020-02-16 07:36:50"
"19","currencyConversionKey",,NULL,"2020-02-16 07:36:50","2020-02-16 07:36:50"

I have another Billingtrack succesfull installation. I made an export and I'll also try import that database (after emptying it) to the database to see what happends.

If I'm successfull, I'll keep this version to find the issue if you want it.

Regards,

Guillermo

gpfti commented 4 years ago

I'm thinking before trying to import full emptied database (with an user), I'll try to import settings table only and see what happends.

gpfti commented 4 years ago

Hi again,

Finally I could import settings table and I could set up an user succesfully. After that I had also to import currencies table data rows (just in case it helps). After that I could access dashboard.

Regards,

cytech commented 4 years ago

you will run into problems if the migrations and seeds did not complete properly. I am not sure what the problem is,probably some simple difference between mysql/mariadb or php version.... I uploaded a fresh sql dump of the newly installed database (without user) it is in the repository -->> resources/misc/Billingtrack-dev.sql grab this file, change the database name in the first 2 lines, and run for new database. then run billingtrack/setup and it should quickly pass thru database creation and take you to user creation. This also assumes you have installed the latest billingtrack 5.1.0

gpfti commented 4 years ago

Hi cytech,

I have tested to create the incomplete database from the web interface setup and after that execute your query. I got an error with the groups table (that already existed).

For the moment it works better with the database backup I recovered (without user information, that I could create later an login).

It's true I got an error after login, but it's related with the the email sending config and one incorrect key stored that I think I can correct.

I'll tell you more tomorrow.

By the way, I have translated more than a half resources/lang/bt.php into spanish. It's possible that I will get it translated y revised by one professional translator in the future. If it's helps, I can provide it now and later when it's finished

Regards,

Guillermo

gpfti commented 4 years ago

Confirmed,

That error that I got was related to a smtp password encryption, that I would need to change it anyway (because of the user wasn't going to be me hehe). After adjusting that, for the moment I don't get any more errors (for the moment, I repeat, hehe).

So, I got it working for now. It works for me. The thing is that I can get a "void" .sql file for importing an initial database without user for importing it if it's necessary by any kind of problem. My "void sql file" has some options translated into spanish and my smtp mail options.

The first system I installed billingtrack under was as simple as a raspberry pi 3 B+. I can generate a new void .sql file completely void and in english with default options if it helps for uploading here.

Regards,

Guillermo

PS: I have another different question/issue to place you that it's related with amounts, point and commas (that are different talking about Euros and not Dollars). I expect to place it in a few days,

Thank you very much for your help!!