diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 4807591b9f3e4..d3f629952b1e4 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -519,7 +519,8 @@ $error=$object->error; $errors=$object->errors; } } - + + // Customer categories association $custcats = GETPOST( 'custcats', 'array' ); $object->setCategories($custcats, 'customer'); @@ -527,7 +528,7 @@ // Supplier categories association $suppcats = GETPOST('suppcats', 'array'); $object->setCategories($suppcats, 'supplier'); - + // Logo/Photo save $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); @@ -634,15 +635,16 @@ { $error = $object->error; $errors = $object->errors; } + // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) + if(!empty($user->rights->categorie->lire)){ + // Customer categories association + $categories = GETPOST( 'custcats', 'array' ); + $object->setCategories($categories, 'customer'); - // Customer categories association - $categories = GETPOST( 'custcats', 'array' ); - $object->setCategories($categories, 'customer'); - - // Supplier categories association - $categories = GETPOST('suppcats', 'array'); - $object->setCategories($categories, 'supplier'); - + // Supplier categories association + $categories = GETPOST('suppcats', 'array'); + $object->setCategories($categories, 'supplier'); + } // Logo/Photo save $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);