*

vansebas

  • ***
  • 35 posts
How to update/renew locations without losing listings?
« on: February 24, 2021, 08:14:23 AM »
I updated my OSclass older version 3.0 of 3.2 (don't know anymore what the version was) to the latest 4.3.2 version.
Only now I discoverd that when I create a new account the region field is auto filled with a city name from my locations (and in the registration form there isn't even a field to select a land/region or city).

So that was really weird.

Now I tested it to remove all my locations (countries Belgium and The Netherlands) and added the new versions of those two countries.
After that all my listings where deleted (that was fine for the test because I made a backup) but then I created a new account and everything was fine and no auto filled city name was entered in the region field of the new user.

So something was corrupted with the upgrade of OSClass.

Has someone else experienced these same issues? And solved it?

I compared the sql export of the country/region/city names that where in the SQL database with the new version 4 locations but the only difference is the pk_i_id and fk_i_region_id fields and I had no latitude and longitude entered.

But would that be that much of a difference?

*

vansebas

  • ***
  • 35 posts
Re: How to update/renew locations without losing listings?
« Reply #1 on: February 24, 2021, 08:48:07 AM »
I found the reason why this strange behavior happend and it's because some of the regions/cities in the SQL database has a empty s_name_native field (as you can see in the red selected box on the attached image). When I changed all the empty field to the value "NULL" it's all fine and it solved the problem.

Marked as best answer by vansebas on February 24, 2021, 10:21:30 AM
*

MB Themes

Re: How to update/renew locations without losing listings?
« Reply #2 on: February 24, 2021, 08:55:00 AM »
@vansebas
This is osclass bug.
Go to oc-includes/osclass/model/Region.php

Find this line:
Code: [Select]
  public function findByName($name, $country = null)

Replace it with:
Code: [Select]
  public function findByName($name, $country = null)
  {
    if(trim($name) == '') {
      return array();
    }

Will be fixed in next osclass version
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

vansebas

  • ***
  • 35 posts
Re: How to update/renew locations without losing listings?
« Reply #3 on: February 24, 2021, 10:21:07 AM »
Nice thanks!
I already changed all the empty records in my SQL to NULL and solved it but for the time being I will update the Region.php file with the fix.

*

MB Themes

Re: How to update/renew locations without losing listings?
« Reply #4 on: February 24, 2021, 10:41:06 AM »
@vansebas
Osclass 4.4 also make sure that empty native name will be converted into null value (instead of blank string).
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots