Please Log in to join the conversation.
Do you happen to have a stack call for this error? Can only see this happening if "$this->_cbTabs" isn't populated and if it isn't then the entire registration wouldn't work right. Does this only happen when you use the queries in a CBSubs SQL Action? For SQL Actions your queries should be as follows.But this just fails with an error in the back end
Fatal error: Call to a member function commitTabsContents() on a non-object in /Applications/MAMP/htdocs/activnew/administrator/components/com_comprofiler/library/cb/cb.tables.php on line 1494
INSERT INTO `#__enmasse_sales_person` ( `name`, `user_name`, `address`, `phone`, `email`, `zip_code`, `city`, `country`, `published`, `created_at`,`updated_at` ) VALUES( '[name]', '[username]', '[address]', '[phone]', '[email]', '[zipcode]', '[city]', '[country]', '1', NOW(), NOW() );
INSERT INTO `#__enmasse_merchant_branch` ( `name`, `user_name`, `sales_person_id`, `branches`, `zip_code`, `city`, `country`, `published`, `created_at`, `updated_at` ) VALUES( '[name]', '[username]', LAST_INSERT_ID(), '{"branch1":{"branchname":"branch1","name":"[name]","description":"","google_map_width":"200","google_map_height":"200","address":"[address]","telephone":"[phone]","fax":"[fax]","google_map_lat":"","google_map_long":"","google_map_zoom":""}}', '[zipcode]', '[city]', '[country]', '1', NOW(), NOW() );
INSERT INTO `#__user_usergroup_map` ( `user_id`, `group_id` ) VALUES ( '[user_id]', ( SELECT `merchant_group` FROM `#__enmasse_setting` ) ), ( '[user_id]', ( SELECT `sale_group` FROM `#__enmasse_setting` ) );
Please Log in to join the conversation.
DELIMITER ##
#DROP PROCEDURE IF EXISTS curCbupdate;
CREATE PROCEDURE curCbupdate()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE username VARCHAR(255);
DECLARE curSales CURSOR FOR SELECT `user_name` FROM `#__enmasse_sales_person` WHERE `user_name` = "[username]";
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN curSales;
read_loop: LOOP
FETCH curSales INTO username;
IF done THEN
LEAVE read_loop;
END IF;
# UPDATE enmasse_sales_person
IF LENGTH(username)>0 THEN
UPDATE #__enmasse_sales_person SET `name` = "[name]",`address` = "[address]",`phone` = "[phone]",`email` = "[email]",`zip_code` = "[zipcode]",`city` = "[city]",`country` = "[country]", `updated_at` = NOW() WHERE `user_name` = username;
ELSE IF
INSERT INTO `#__enmasse_sales_person`(`name`,`user_name`,`address`,`phone`,`email`,`zip_code`,`city`,`country`,`published`,`created_at`,`updated_at`) VALUES ("[name]","[username]","[address]","[phone]","[email]","[zipcode]","[city]","[country]","1",NOW(),NOW());
END IF;
# UPDATE enmasse_merchant_branch
IF LENGTH(username)>0 THEN
UPDATE `#__enmasse_merchant_branch` SET `name` = '[name]',`branches` = '{"branch1":{"branchname":"branch1","name":"[name]","description":"","google_map_width":"200","google_map_height":"200","address":"[address]","telephone":"[phone]","fax":"[fax]","google_map_lat":"","google_map_long":"","google_map_zoom":""}}' WHERE `user_name` = username;
ELSE IF
INSERT INTO `#__enmasse_merchant_branch`(`name`,`user_name`,`sales_person_id`,`branches`,`zip_code`,`city`,`country`,`published`,`created_at`,`updated_at`) VALUES ('[name]','[username]',(SELECT `id` FROM `#__enmasse_sales_person` WHERE `user_name` = '[username]'),'{"branch1":{"branchname":"branch1","name":"[name]","description":"","google_map_width":"200","google_map_height":"200","address":"[address]","telephone":"[phone]","fax":"[fax]","google_map_lat":"","google_map_long":"","google_map_zoom":""}}','[zipcode]','[city]','[country]','1',NOW(),NOW());
END IF;
# UPDATE user_usergroup_map
IF (SELECT COUNT(`group_id`) FROM `#__user_usergroup_map` WHERE `user_id` = '[user_id]') < 2 THEN
DELETE FROM `#__user_usergroup_map` WHERE `user_id` = '[user_id]';
END IF;
INSERT INTO `#__user_usergroup_map`(`user_id`,`group_id`)
VALUES
('[user_id]', (SELECT `merchant_group` FROM `#__enmasse_setting`)),
('[user_id]', (SELECT `sale_group` FROM `#__enmasse_setting`));
END LOOP;
CLOSE curSales;
END;
CALL curCbupdate;
Please Log in to join the conversation.
I've no experience with procedures so can't comment on whether it'll work or not and why it's failing. Very likely it won't work with the substitutions. Please test the query I provided in my previous post and confirm if working or not.Thanks for the tip about Replace, but we would like to use only one query with the cb_cursor, which would be simpler for upgrading ou users.
Do you have an idea why this cb_cursor script would fail ?
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.