Jump to content
  • 0

Migrating from WHMCS - Import Errors


zooky

Question

Hello,

I am testing out Blesta and trying to import data from my WHMCS 8.1.2 installation.  I have created a copy of the WHMCS DB.

I am getting the below errors.  If I keep trying and then go back to the admin area, I can see clients, details, transactions etc, but don't quite trust the import.  I've also done the "password change" in the blesta.php file but the test WHMCS client I have cannot login, doesn't matter what combo I use (username and/or email) unless I reset the password.

Is there is a way to check "line 196" or what client doesn't have a "client id"?

 

importStaff
-----------------
importStaff took: 0.9778 seconds
-----------------

importClients
-----------------
importClients took: 0.6809 seconds
-----------------

importContacts
-----------------
importTaxes
-----------------
importCurrencies
-----------------
importInvoices
-----------------
importTransactions
-----------------
importPackages
-----------------
importPackageOptions
-----------------
importPackageOptions took: 0.0007 seconds
-----------------

importServices
-----------------
importSupportDepartments
-----------------
importSupportTickets
-----------------
importAffiliates
-----------------
importMisc
-----------------
decrypted 0 values using WHMCS' custom algorithm
decrypt took: 0 seconds
total time took: 1.7446 seconds
Array
(
    [error] => Array
        (
            [0] => 
            [1] => importContacts: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null on line 196
            [2] => importTaxes: There is already an active transaction on line 231
            [3] => importCurrencies: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 196
            [4] => importInvoices: There is already an active transaction on line 231
            [5] => importTransactions: There is already an active transaction on line 231
            [6] => importPackages: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 196
            [7] => importServices: There is already an active transaction on line 231
            [8] => importSupportDepartments: There is already an active transaction on line 231
            [9] => importSupportTickets: There is already an active transaction on line 231
            [10] => importAffiliates: There is already an active transaction on line 231
            [11] => importMisc: There is already an active transaction on line 231
        )

)

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
On 4/10/2021 at 3:12 AM, zooky said:

[1] => importContacts: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null on line 196

Did you have any errors in ../logs_blesta/ also, from the import?

The first error usually kicks off the others. In this case, it looks like a contact is trying to be created that may not be associated with a client_id. Do you have any contacts in your WHMCS database that have a null client_id? Not associated with a client? If so, this is likely the reason.

Link to comment
Share on other sites

  • 0

What would be the best way to check null client_id’s?

general error log - looks like i may have a permission problem on my copied DB?

[2021-04-10T03:05:30.925713+00:00] general.ERROR: PDOException: SQLSTATE[HY000] [1044] Access denied for user 'XXXXX'@'localhost' to database 'whmcs_copy' in /xxxxx/customers/vendors/minphp/db/src/PdoConnection.php:329 Stack trace: #0 /xxxx/customers/vendors/minphp/db/src/PdoConnection.php(329): PDO->__construct('mysql:host=loca...', 'xxxxx', 'xxxXXxx', Array) #1 /xxxxxxx/customers/vendors/minphp/db/src/PdoConnection.php(114): Minphp\Db\PdoConnection->makeConnection('mysql:host=loca...', 'xxxx', 'xxXXxx', Array) #2 /xxxxx/customers/vendors/minphp/db/src/PdoConnection.php(190): Minphp\Db\PdoConnection->connect() #3 /xxxxx/customers/vendors/minphp/record/src/Record.php(834): Minphp\Db\PdoConnection->query('SELECT * FROM `...', Array) #4 /xxxxx/customers/plugins/import_manager/components/migrators/whmcs/8.0/models/whmcs_products.php(20): Minphp\Record\Record->getStatement() #5 /xxxxx/customers/plugins/import_manager/components/migrators/whmcs/8.0/whmcs8_0.php(157): WhmcsProducts->get() #6 /xxx/customers/plugins/import_manager/controllers/admin_manage_plugin.php(94): Whmcs8_0->getConfiguration(Array) #7 /xxxxx/customers/app/controllers/admin_company_plugins.php(141): AdminManagePlugin->import() #8 /xxxxx/customers/vendors/minphp/bridge/src/Lib/Dispatcher.php(142): AdminCompanyPlugins->manage() #9 /xxxxx/customers/index.php(21): Dispatcher::dispatch('/customers/admi...') #10 {main}  

 

Other logs attached.

general-notice-2021-04-10.log general-warning-2021-04-10.log

Link to comment
Share on other sites

  • 0
On 4/12/2021 at 2:55 PM, zooky said:

What would be the best way to check null client_id’s?

general error log - looks like i may have a permission problem on my copied DB?


[2021-04-10T03:05:30.925713+00:00] general.ERROR: PDOException: SQLSTATE[HY000] [1044] Access denied for user 'XXXXX'@'localhost' to database 'whmcs_copy' in /xxxxx/customers/vendors/minphp/db/src/PdoConnection.php:329 Stack trace: #0 /xxxx/customers/vendors/minphp/db/src/PdoConnection.php(329): PDO->__construct('mysql:host=loca...', 'xxxxx', 'xxxXXxx', Array) #1 /xxxxxxx/customers/vendors/minphp/db/src/PdoConnection.php(114): Minphp\Db\PdoConnection->makeConnection('mysql:host=loca...', 'xxxx', 'xxXXxx', Array) #2 /xxxxx/customers/vendors/minphp/db/src/PdoConnection.php(190): Minphp\Db\PdoConnection->connect() #3 /xxxxx/customers/vendors/minphp/record/src/Record.php(834): Minphp\Db\PdoConnection->query('SELECT * FROM `...', Array) #4 /xxxxx/customers/plugins/import_manager/components/migrators/whmcs/8.0/models/whmcs_products.php(20): Minphp\Record\Record->getStatement() #5 /xxxxx/customers/plugins/import_manager/components/migrators/whmcs/8.0/whmcs8_0.php(157): WhmcsProducts->get() #6 /xxx/customers/plugins/import_manager/controllers/admin_manage_plugin.php(94): Whmcs8_0->getConfiguration(Array) #7 /xxxxx/customers/app/controllers/admin_company_plugins.php(141): AdminManagePlugin->import() #8 /xxxxx/customers/vendors/minphp/bridge/src/Lib/Dispatcher.php(142): AdminCompanyPlugins->manage() #9 /xxxxx/customers/index.php(21): Dispatcher::dispatch('/customers/admi...') #10 {main}  

 

Other logs attached.

general-notice-2021-04-10.log 63.77 kB · 0 downloads general-warning-2021-04-10.log 18.15 kB · 0 downloads

It does appear that the user may be lacking some permissions, check that the user has all privileges. The logs you attached don't seem to be related. What version of PHP are you running?

Link to comment
Share on other sites

  • 0

I had the same error.

I opened the file, blesta\plugins\import_manager\components\migrations\whmcs\8.0\whmcs8_0.php and everywhere where there was a 
 

catch (Exception $e) {

I added a
 

 echo $e->getMessage();

 

This gave me the correct error messages why it didn't go (I had debug checked as well)
2 errors stopped my, duplicate email address (i had a customer email on an account and as a contact on another account) and a company name too long.

I also changed the Create client section to print the vars array:
 

            // Create client
            $client_id = null;
            try {
                $vars = [
                    'id_format' => '{num}',
                    'id_value' => $client->id,
                    'user_id' => $user_id,
                    'client_group_id' => $this->mappings['client_groups'][$client->groupid],
                    'status' => strtolower($client->status) == 'closed' ? 'inactive' : 'active'
                ];
			print_r($vars); //added this so I can the the whmcs ID of the problem account

 

Once I fixed the 2 accounts the Import went smooth (for the accounts, it didn't import any services yet, troubleshooting that next ... ?

Hope this helps.

I am not sure if there are any log files around that would have contained that information. 
I just installed Blesta to give it a try yesterday ... :)
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...