Skip to content

Fix ModuleClientMeta passing row ID instead of module ID#12

Open
mendozal wants to merge 1 commit intoblesta:masterfrom
mendozal:fix/module-client-meta
Open

Fix ModuleClientMeta passing row ID instead of module ID#12
mendozal wants to merge 1 commit intoblesta:masterfrom
mendozal:fix/module-client-meta

Conversation

@mendozal
Copy link
Copy Markdown

When creating a service, the module was always attempting to create a new customer in Enhance even when one already existed for the client, resulting in a 409 Login already exists error from the Enhance API.

ModuleClientMeta::get() and set() signatures are:

public function get($client_id, $key, $module_id, $module_row_id = 0)
public function set($client_id, $module_id, $module_row_id = 0, array $fields = [])

All calls in enhance.php were passing $row->id as the module_id parameter. However, $row is the object returned by getModuleRow(), which queries the module_rows table — so $row->id is the module row primary key, not the module ID. The correct value is $row->module_id.

This mismatch caused get() to never find stored customer data, and set() to store it under the wrong module ID, making it permanently unfindable.

Fix

Replaced $row->id with $row->module_id in all 5 affected instances:

  • addService()ModuleClientMeta->get() x2 and ModuleClientMeta->set() x1
  • tabChangePassword()ModuleClientMeta->get() x1
  • tabClientChangePassword()ModuleClientMeta->get() x1

Note for existing installations

Any records already stored in module_client_meta with the wrong module_id will need to be corrected manually in the database:

UPDATE module_client_meta
SET module_id = <correct_module_id>
WHERE `key` IN ('enhance_org_id', 'enhance_login_id');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant