qual: clean code (#29457)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
thibdrev 2024-04-25 10:40:05 +02:00 committed by GitHub
parent e2eb4e9168
commit 86b219a17f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -56,8 +56,8 @@ $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
// Security check
$fieldvalue = (!empty($id) ? $id : $ref);
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
$fieldvalue = $id ?: $ref;
$fieldtype = !empty($ref) ? 'ref' : 'rowid';
$prodstatic = new Product($db);
$prodattr = new ProductAttribute($db);
@ -68,8 +68,8 @@ if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
$selectedvariant = !empty($_SESSION['addvariant_'.$object->id]) ? $_SESSION['addvariant_'.$object->id] : array();
$selected = "";
$selectedvariant = $_SESSION['addvariant_'.$object->id] ?: array();
$selected = '';
// Security check
if (!isModEnabled('variants')) {
accessforbidden('Module not enabled');
@ -79,10 +79,10 @@ if ($user->socid > 0) { // Protection if external user
}
if ($object->id > 0) {
if ($object->type == $object::TYPE_PRODUCT) {
if ($object->type == Product::TYPE_PRODUCT) {
restrictedArea($user, 'produit', $object->id, 'product&product', '', '');
}
if ($object->type == $object::TYPE_SERVICE) {
if ($object->type == Product::TYPE_SERVICE) {
restrictedArea($user, 'service', $object->id, 'product&product', '', '');
}
} else {