Skip to content

Commit

Permalink
Merge pull request #371 from Hystepik/fix-#361
Browse files Browse the repository at this point in the history
fix setCategories will remove all other tags of a customer :-( #361
  • Loading branch information
eldy committed Jul 3, 2024
2 parents d039822 + 406551c commit 6b6e794
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion myaccount/register_instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,14 @@
if (! empty($conf->global->SELLYOURSAAS_DEFAULT_CUSTOMER_CATEG)) {
dol_syslog("register_instance.php We will set customer into the categroy");

$result = $tmpthirdparty->setCategories(array($conf->global->SELLYOURSAAS_DEFAULT_CUSTOMER_CATEG => $conf->global->SELLYOURSAAS_DEFAULT_CUSTOMER_CATEG), 'customer');
// To prevent deletion of categories already present
$categories = $tmpthirdparty->getCategoriesCommon('customer');
$arraycateg = array($conf->global->SELLYOURSAAS_DEFAULT_CUSTOMER_CATEG => $conf->global->SELLYOURSAAS_DEFAULT_CUSTOMER_CATEG);
if (is_array($categories) && !in_array($conf->global->SELLYOURSAAS_DEFAULT_CUSTOMER_CATEG, $categories)){
$categories = array_merge($categories, $arraycateg);
}

$result = $tmpthirdparty->setCategories($categories, 'customer');
if ($result < 0) {
$db->rollback();

Expand Down

0 comments on commit 6b6e794

Please sign in to comment.