#2609 ad detail error when store not installed

This commit is contained in:
Diatrex 2020-11-16 10:31:16 +03:00
parent 7deba2ab1a
commit 50f371896b
3 changed files with 7 additions and 1 deletions

View File

@ -26,4 +26,5 @@ return [
'replicated_success' => 'The ad has been replicated successfully!',
'ad_doesnt_exist' => "This ad doesn't exist!",
'select_location_error' => "Please select a location on the map!",
'this_ad_is_not_valid_anymore' => "This ad is not valid anymore!",
];

View File

@ -62,7 +62,7 @@ class AdvPresenter extends EntryPresenter
public function isCorporate()
{
$user_id = $this->getObject()->created_by;
if ($user_id && $user_id->register_type != null) {
if ($user_id->register_type != null) {
return $user_id->register_type;
} else {
return 1;

View File

@ -485,6 +485,11 @@ class AdvsController extends PublicController
$adv = $this->adv_repository->getListItemAdv($id);
if ($adv && (!$adv->expired() || $adv->created_by_id === \auth()->id())) {
// Check if created by exists
if (!$adv->created_by) {
$this->messages->error('visiosoft.module.advs::message.this_ad_is_not_valid_anymore');
return $this->redirect->route('visiosoft.module.advs::list');
}
if ($this->adv_model->is_enabled('complaints')) {
$complaints = ComplaintsComplainTypesEntryModel::all();