From b771f0bc9b882d754c37c7d133cece12430aff0a Mon Sep 17 00:00:00 2001 From: diashalabi Date: Sun, 10 Oct 2021 17:43:31 +0300 Subject: [PATCH] #654 [customfields] Improvments --- .../visiosoft/advs-module/src/Adv/AdvModel.php | 11 ++++++++++- .../advs-module/src/Adv/Contract/AdvInterface.php | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php index 1206b5420..2b73fceed 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php +++ b/addons/default/visiosoft/advs-module/src/Adv/AdvModel.php @@ -387,15 +387,24 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface if ($cFs = (array) json_decode($this->cf_json)) { $cFs = array_keys($cFs); + $cFIDs = array_map(function ($cF) { + return ltrim($cF, 'cf'); + }, $cFs); + return app(CustomFieldRepositoryInterface::class) ->newQuery() - ->whereIn('id', $cFs) + ->whereIn('id', $cFIDs) ->get(); } return []; } + public function cFJSON() + { + return (array) json_decode($this->cf_json); + } + // public function getCustomFieldEditId($id) { // $custom_field = AdvsCustomFieldsEntryModel::query()->where('advs_custom_fields.id', $id)->first(); // return DB::table('streams_assignments')->where('field_id', $custom_field->field_id)->first(); diff --git a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php index 693d69980..105da9504 100644 --- a/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php +++ b/addons/default/visiosoft/advs-module/src/Adv/Contract/AdvInterface.php @@ -60,6 +60,8 @@ interface AdvInterface extends EntryInterface public function customfields(); + public function cFJSON(); + public function priceFormat($adv); public function AddAdsDefaultCoverImage($ad);