Can't save invoice since upgrading

Hi

Since I upgraded to the latest GitHub version, I get this error when saving a quote:

ErrorException in InvoiceRepository.php line 220:
Undefined index: client_id

I did visited the /upgrade which give me no errors?

This sounds like it’s related to our new user permissions feature.

You can check that your user is an admin with the following query:

select email, is_admin from users;

Is admin is set to 1. Is that the correct value?
I also see an contact@invoiceninja.com admin, added later then myself, how is that?

1 is the correct value, are you creating the quote with a new client or are you linking to an existing client. We recently checked in a fix related to this but it only affected non-admin users.

https://github.com/invoiceninja/invoiceninja/commit/26b0169ae91dafe831e81d4cd3c9c0331e36c728

If you’ve been using our app for a while our older versions would add contact@invoiceninja.com in order to support purchasing add-on products. It’s no longer used.

Also, is this affecting invoices as well or just quotes?

I can’t save both invoices nor quotes.
Yesterday I did a “git reset --hard” and “git pull origin master” and today I cleared the hole directory to make sure I have the latest code.
In fact I have the same problem as yesterday, but I forgot the mention this:

When I click new invoice or new quote, I get a white page with only “Forbidden”. All other pages work.
I solved this yesterday (badly and temporary) by commenting out the throw line in this code:

protected function failedAuthorization() {
throw new HttpResponseException($this->forbiddenResponse());
}

It was somewhere in vendor/laraval/http/Form or something?

The debug bar shows this exception:

/var/www/invoices.nempo.com/bootstrap/cache/compiled.php#5622

Illuminate\Http\Exception\HttpResponseException

}
protected function failedAuthorization()
{
    throw new HttpResponseException($this->forbiddenResponse());
}
public function response(array $errors)
{

So the error above is when visiting /quotes/create as a GET, so before filling in something.
The error from the opening post was after commenting out the throw and gave the exception for creating quotes or invoices on existing customers.

If you have command line access try running php artisan migrate.

You can check that all database migrations have run by comparing the list of files in database/migrations/ against the result of the following SQL query: select * from migrations

It says:

Nothing to migrate.

The database query gives me 78 records and I have 78 files in that directory.
The last file is the same as the last file in the database (2016_04_18_174135_add_page_size).

Some batch numbers have 1, others have 2 and the recent ones have 3 as value. There is one from bath 2 saying “add_user_permissions”.

I also get Forbidden when adding an expense and I can’t edit an expense anymore as it seems.
How should the user table be looking at? It now looks like this:

Volledige teksten
account_id
id
created_at
updated_at
deleted_at
first_name
last_name
phone
username
email
password
confirmation_code
registered
confirmed
notify_sent
notify_viewed
notify_paid
public_id
force_pdfjs
remember_token
news_feed_id
notify_approved
failed_logins
dark_mode
referral_code
oauth_user_id
oauth_provider_id
is_admin
permissions

That all looks correct. If you haven’t already it may be worth trying to log out and then back in.

Otherwise you’ll either need to trace through the code to find the problem or rollback to an earlier version.

Login out and in again didn’t work.
How can I get a call stack in Laravel?
Because I see this is called but I don’t know where from: /var/www/invoices.nempo.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php#125

I don’t get it. It’s like the function is called out of the blue, no other PHP-files refer to that specific first file:

# grep -rnw '/webroot/var/www/invoices.domain.com/' -e "failedAuthorization" /webroot/var/www/invoices.domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php:123: protected function failedAuthorization() /webroot/var/www/invoices.domain.com/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php:23: $this->failedAuthorization(); /webroot/var/www/invoices.domain.com/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php:71: protected function failedAuthorization()

I’ll try to provide an overview.

Take for example the create invoice page, it will initially trigger app/Http/Requests/CreateInvoiceRequest.php and call the authorize method. Based on your comments I’m guessing it’s returning false, I’m not clear on why.

I rebooted the server and it works now.
As it seems Xcache didn’t fetched the updated files, so old ones were still in cache.
Thanks for the support!

Good thinking, happy to hear it works!