Hi again! i have a ISPConfig instance here with around 500 customers. All these customers belong to 1 reseller, as for the longest time we didn't need the reseller functionality we didn't bother setting it up. But now we need to use this functionality. To make my life easier i just thought i can make this work within the database. So i've checked the id of my reseller which is "301": Code: select client_id, customer_no, parent_client_id from client where customer_no = 104997; +-----------+-------------+------------------+ | client_id | customer_no | parent_client_id | +-----------+-------------+------------------+ | 301 | 104997 | 0 | +-----------+-------------+------------------+ So i've figured changing the parent_client_id of all clients where the parent_client_id is NOT 0 should do the trick: Code: UPDATE client SET parent_client_id = 301 WHERE parent_client_id != 0; And after checking within ISPConfig, all customers had the correct reseller under "Limits -> Customer of Reseller". However after logging in as the reseller, there is not a single customer listet there. The value "limit_client" is 0 for all customers. And 1 for the reseller 301. Am i missing something here? Is there another value that needs to be set so that the customer is a customer of reseller within the database?
I've checked and run it again. Still no customers when i log in as reseller. When i check the "Websites" Tab i get this error: Code: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '271) AND b.sys_perm_group like '%r%') OR b.sys_perm_other like '%r%')) ORDER B' at line 1 But i guess that is due to the issue that there are no customers at all?
If ISPConfig makes syntax error just for having no customer entry, it is a fault in the code. Maybe your database modification caused this error state? Do you have database backup from before the modification? Did you also change something else? Does the error say which file has that syntax error? Maybe try to find the string in the source tree? Just to rule out some error in the code. I think you need advice from ISPConfig developer who knows how the customer and reseller relation works.
I guess the syntax error is caused by a wrong manual database modification. Did you add the reseller user to the client group in sys_group table?
Well the error was there before, and only occures in the reseller portal. The machine get's backed up every day so there are quiet a few backups i can use. I have a testing enviorenment, the same issue occurs there too.
301 is the client_id of my reseller. Code: select * from sys_group where client_id = 301; +---------+--------+-------------+-----------+ | groupid | name | description | client_id | +---------+--------+-------------+-----------+ | 302 | 104997 | | 301 | +---------+--------+-------------+-----------+ some other entries from that table for reference: Code: +---------+--------+-------------+-----------+ | groupid | name | description | client_id | | 434 | 104909 | | 433 | | 435 | 120500 | | 434 | | 436 | 120118 | | 435 | Are these entries correct?
Ok i've checked some stuff. This is the output for the client 270 without a Reseller set(Note: parent_client_id is wrong here because of manually changing it): Code: select * from client where client_id = 270; +-----------+------------+-------------+-------------+ | client_id | sys_userid | sys_groupid | parent_client_id | | 270 | 300 | 300 | 299 | This is the same client with Reseller set through ISPConfig(Note: 493 is a Test-Reseller): Code: select * from client where client_id = 270; +-----------+------------+-------------+-------------+ | client_id | sys_userid | sys_groupid | parent_client_id | | 270 | 495 | 494 | 493| So after changing the reseller of a customer through ispconfig the 2 fields sys_userid and sys_groupid change too. Is there any sane way to modify all customers so that the reseller is set under limits? Maybe with a soap php script?
There is both a soap and a rest API you can use for updates like that. There are examples in the ispconfig source as well as in the forums here at times.
Can you link me to one of those examples? I'm can't find any example on the forum. I know how to change a users settings with a soap script as i am using one to import customers from our CR database, but that problem is i have to fill in the fields like "parent_client_id" too. Which leads again to the questions: What values do i need to set in insys_userid and sys_groupid, beacuase when i assign the reseller manually these fields change too.
I already got the remoting_client examples. Is it enough to update the user with the correct $reseller_id with this update code? PHP: $affected_rows = $client->client_update($session_id, $c_id, $reseller_id, $client_record);
Generally to update a value you read the old values (which is effectively reading a row from the db table), change whatever it is you need changed, and write it back. You can't tell if the single line of code you posted looks right or not without a lot more context.
My question is which values need to be changed to assign a customer to a reseller. I already have a script to change the values for a customer, but simply chaning "parent_client_id" didn't do the trick. So my last question was, if it is enough to achieve this to load the old customer values, set the new parent_client_id and then updated the customer with the correct reseller_id like: Code: $affected_rows = $client->client_update($session_id, $c_id, $reseller_id, $client_record);
I don't know off the top of my head; what I would do is add a new client to the reseller via the ui and compare the values of the existing and the new client.