FIX creer into lire

This commit is contained in:
atm-quentin 2018-02-05 16:07:08 +01:00
parent ae9c7ad6b6
commit 2081aefc84

View File

@ -519,15 +519,16 @@ if (empty($reshook))
$error=$object->error; $errors=$object->errors; $error=$object->error; $errors=$object->errors;
} }
} }
if(!empty($user->rights->categorie->creer)){
// Customer categories association
$custcats = GETPOST( 'custcats', 'array' ); // Customer categories association
$object->setCategories($custcats, 'customer'); $custcats = GETPOST( 'custcats', 'array' );
$object->setCategories($custcats, 'customer');
// Supplier categories association // Supplier categories association
$suppcats = GETPOST('suppcats', 'array'); $suppcats = GETPOST('suppcats', 'array');
$object->setCategories($suppcats, 'supplier'); $object->setCategories($suppcats, 'supplier');
}
// Logo/Photo save // Logo/Photo save
$dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
@ -634,15 +635,16 @@ if (empty($reshook))
{ {
$error = $object->error; $errors = $object->errors; $error = $object->error; $errors = $object->errors;
} }
//Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire
if(!empty($user->rights->categorie->lire)){
// Customer categories association
$categories = GETPOST( 'custcats', 'array' );
$object->setCategories($categories, 'customer');
// Customer categories association // Supplier categories association
$categories = GETPOST( 'custcats', 'array' ); $categories = GETPOST('suppcats', 'array');
$object->setCategories($categories, 'customer'); $object->setCategories($categories, 'supplier');
}
// Supplier categories association
$categories = GETPOST('suppcats', 'array');
$object->setCategories($categories, 'supplier');
// Logo/Photo save // Logo/Photo save
$dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);