dali_gv
1
Hi.
I have just upgraded to 2.7 and it gives me error after login. When I revert back to 2.6.10 everything is fine. Any ideas?
Thank you
Whoops, looks like something went wrong.
1/1
FatalErrorException in HistoryUtils.php line 54:
Call to a member function setRelation() on null
in HistoryUtils.php line 54
dali_gv
2
I have also noticed that after the upgrade the company logo picture is gone. I needed to remove and re-upload it after the upgrade.
Br,
Dali
hillel
3
I’m not sure, I’m not seeing this error.
Could you please add dd($activity);
on line 53 of the file and post what it shows.
Thanks!
dali_gv
4
I just tried 2.7.1. Same problem.
Activity {#802 ▼
+timestamps: true
#connection: null
#table: null
#primaryKey: "id"
#keyType: "int"
#perPage: 15
+incrementing: true
#attributes: array:19 [▼
"id" => 2
"created_at" => "2016-04-27 12:08:18"
"updated_at" => "2016-04-27 12:08:18"
"account_id" => 1
"client_id" => 1
"user_id" => 1
"contact_id" => null
"payment_id" => null
"invoice_id" => 1
"credit_id" => null
"invitation_id" => null
"task_id" => null
"json_backup" => null
"activity_type_id" => 18
"adjustment" => "0.00"
"balance" => "0.00"
"token_id" => null
"ip" => "93.103.102.10"
"is_system" => 0
]
#original: array:19 [▼
"id" => 2
"created_at" => "2016-04-27 12:08:18"
"updated_at" => "2016-04-27 12:08:18"
"account_id" => 1
"client_id" => 1
"user_id" => 1
"contact_id" => null
"payment_id" => null
"invoice_id" => 1
"credit_id" => null
"invitation_id" => null
"task_id" => null
"json_backup" => null
"activity_type_id" => 18
"adjustment" => "0.00"
"balance" => "0.00"
"token_id" => null
"ip" => "93.103.102.10"
"is_system" => 0
]
#relations: array:3 [▼
"client" => Client {#872 ▼
#presenter: "App\Ninja\Presenters\ClientPresenter"
#dates: array:1 [▼
0 => "deleted_at"
]
#fillable: array:19 [▼
0 => "name"
1 => "id_number"
2 => "vat_number"
3 => "work_phone"
4 => "custom_value1"
5 => "custom_value2"
6 => "address1"
7 => "address2"
8 => "city"
9 => "state"
10 => "postal_code"
11 => "country_id"
12 => "private_notes"
13 => "size_id"
14 => "industry_id"
15 => "currency_id"
16 => "language_id"
17 => "payment_terms"
18 => "website"
]
+timestamps: true
#hidden: array:1 [▼
0 => "id"
]
#connection: null
#table: null
#primaryKey: "id"
#keyType: "int"
#perPage: 15
+incrementing: true
#attributes: array:30 [▼
"id" => 1
"user_id" => 1
"account_id" => 1
"currency_id" => null
"created_at" => "2016-04-27 12:04:37"
"updated_at" => "2016-06-09 18:57:52"
"deleted_at" => null
"name" => "Test"
"address1" => "Address2"
"address2" => ""
"city" => "Ljubljana"
"state" => ""
"postal_code" => "1000"
"country_id" => 705
"work_phone" => ""
"private_notes" => ""
"balance" => "0.00"
"paid_to_date" => "610.00"
"last_login" => null
"website" => "www.test.som"
"industry_id" => null
"size_id" => null
"is_deleted" => 0
"payment_terms" => 30
"public_id" => 1
"custom_value1" => null
"custom_value2" => null
"vat_number" => "SI22263414"
"id_number" => ""
"language_id" => 14
]
#original: array:30 [▼
"id" => 1
"user_id" => 1
"account_id" => 1
"currency_id" => null
"created_at" => "2016-04-27 12:04:37"
"updated_at" => "2016-06-09 18:57:52"
"deleted_at" => null
"name" => "Test"
"address1" => "Address 2"
"address2" => ""
"city" => "Ljubljana"
"state" => ""
"postal_code" => "1000"
"country_id" => 705
"work_phone" => ""
"private_notes" => ""
"balance" => "0.00"
"paid_to_date" => "610.00"
"last_login" => null
"website" => "www.cebram.si"
"industry_id" => null
"size_id" => null
"is_deleted" => 0
"payment_terms" => 30
"public_id" => 1
"custom_value1" => null
"custom_value2" => null
"vat_number" => "SI1222414"
"id_number" => ""
"language_id" => 14
]
#relations: array:1 [▼
"contacts" => Collection {#902 ▼
#items: array:1 [▼
0 => Contact {#907 ▼
#dates: array:1 [▼
0 => "deleted_at"
]
#fillable: array:5 [▼
0 => "first_name"
1 => "last_name"
2 => "email"
3 => "phone"
4 => "send_invoice"
]
+timestamps: true
#hidden: array:1 [▼
0 => "id"
]
#connection: null
#table: null
#primaryKey: "id"
#keyType: "int"
#perPage: 15
+incrementing: true
#attributes: array:20 [▼
"id" => 1
"account_id" => 1
"user_id" => 1
"client_id" => 1
"created_at" => "2016-04-27 12:04:37"
"updated_at" => "2016-08-10 07:54:41"
"deleted_at" => null
"is_primary" => 1
"send_invoice" => 1
"first_name" => "Rado"
"last_name" => "Likon"
"email" => "rado@cebram.si"
"phone" => ""
"last_login" => null
"public_id" => 1
"password" => null
"confirmation_code" => null
"remember_token" => null
"contact_key" => "duKaSUZzDOTbRgCAfzEANoc8uEJiUoRb"
"bot_user_id" => null
]
#original: array:20 [▼
"id" => 1
"account_id" => 1
"user_id" => 1
"client_id" => 1
"created_at" => "2016-04-27 12:04:37"
"updated_at" => "2016-08-10 07:54:41"
"deleted_at" => null
"is_primary" => 1
"send_invoice" => 1
"first_name" => "Name"
"last_name" => "Surname"
"email" => "rado@test.com"
"phone" => ""
"last_login" => null
"public_id" => 1
"password" => null
"confirmation_code" => null
"remember_token" => null
"contact_key" => "duKaSUZzDOTbRgCAfzEANoc8uEJiUoRb"
"bot_user_id" => null
]
#relations: []
#visible: []
#appends: []
#guarded: array:1 [▼
0 => "*"
]
#dateFormat: null
#casts: []
#touches: []
#observables: []
#with: []
#morphClass: null
+exists: true
+wasRecentlyCreated: false
#forceDeleting: false
}
]
}
]
#visible: []
#appends: []
#guarded: array:1 [▼
0 => "*"
]
#dateFormat: null
#casts: []
#touches: []
#observables: []
#with: []
#morphClass: null
+exists: true
+wasRecentlyCreated: false
#presenterInstance: ClientPresenter {#896 ▼
#entity: Client {#872}
}
#forceDeleting: false
}
"invoice" => null
"task" => null
]
#hidden: []
#visible: []
#appends: []
#fillable: []
#guarded: array:1 [▼
0 => "*"
]
#dates: []
#dateFormat: null
#casts: []
#touches: []
#observables: []
#with: []
#morphClass: null
+exists: true
+wasRecentlyCreated: false
}
hillel
5
Thanks, I think I see the problem.
Try adding the following on line 54
if ( ! $entity) {
continue;
}
dali_gv
6
Where exactly I should insert the code?
foreach ($activities as $activity)
{
if ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_CLIENT) {
$entity = $activity->client;
} else if ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_TASK || $activity->activity_type_id == ACTIVITY_TYPE_UPDATE_TASK) {
$entity = $activity->task;
$entity->setRelation('client', $activity->client);
} else {
$entity = $activity->invoice;
$entity->setRelation('client', $activity->client);
}
dali_gv
7
This solves it. Is that correct?
foreach ($activities as $activity)
{
if ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_CLIENT) {
$entity = $activity->client;
} else if ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_TASK || $activity->activity_type_id == ACTIVITY_TYPE_UPDATE_TASK) {
$entity = $activity->task;
$entity->setRelation('client', $activity->client);
} else {
$entity = $activity->invoice;
if ( ! $entity) {
continue;
}
$entity->setRelation('client', $activity->client);
}
static::trackViewed($entity);
}
dali_gv
9
It also works
Thank you!!! Please include it in the next update so I will not hit the same problem again
Thank you very much!
Br,
Dali