mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 23:36:08 -06:00
#503 fixed updated ad for deleted category
This commit is contained in:
parent
6b7af0233f
commit
b28bc5c212
@ -22,4 +22,5 @@ return [
|
||||
'cancelBtn' => "or Cancel",
|
||||
'link' => "",
|
||||
],
|
||||
'update_category_info' => 'Please update category.',
|
||||
];
|
||||
|
||||
@ -22,4 +22,5 @@ return [
|
||||
'cancelBtn' => "ve ya İptal",
|
||||
'link' => "",
|
||||
],
|
||||
'update_category_info' => 'Lütfen kategoriyi güncelleyiniz.',
|
||||
];
|
||||
@ -250,12 +250,17 @@ class AdvRepository extends EntryRepository implements AdvRepositoryInterface
|
||||
$cat1 = CategoryModel::query()->where('cats_category.id', $adv->cat1)->first();
|
||||
$cat2 = CategoryModel::query()->where('cats_category.id', $adv->cat2)->first();
|
||||
|
||||
if (!is_null($cat1))
|
||||
$adv->setAttribute('cat1_name', $cat1->name);
|
||||
if ($cat2 == null) {
|
||||
$adv->setAttribute('cat2_name', "");
|
||||
} else {
|
||||
else
|
||||
$adv->setAttribute('cat1_name', "");
|
||||
|
||||
if (!is_null($cat2))
|
||||
$adv->setAttribute('cat2_name', $cat2->name);
|
||||
}
|
||||
|
||||
else
|
||||
$adv->setAttribute('cat2_name', "");
|
||||
|
||||
|
||||
return $adv;
|
||||
}
|
||||
|
||||
@ -257,12 +257,15 @@ class AdvsController extends PublicController
|
||||
$cat = "cat" . $i;
|
||||
if ($adv->$cat != null) {
|
||||
$item = $this->category_repository->getItem($adv->$cat);
|
||||
if (!is_null($item)) {
|
||||
$categories['cat' . $i] = [
|
||||
'name' => $item->name,
|
||||
'id' => $item->id
|
||||
];
|
||||
$categories_id[] = $item->id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->adv_model->is_enabled('customfields')) {
|
||||
@ -681,8 +684,13 @@ class AdvsController extends PublicController
|
||||
for ($i = 1; $i < 7; $i++) {
|
||||
if ($adv[$cat . $i] != null) {
|
||||
$name = $categoryRepository->getSingleCat($adv[$cat . $i]);
|
||||
if (!is_null($name)) {
|
||||
$cats_d['cat' . $i] = $name->name;
|
||||
$cats['cat' . $i] = $name->id;
|
||||
} else {
|
||||
$this->messages->info(trans('visiosoft.module.advs::message.update_category_info'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user