accounting workflows
This commit is contained in:
@@ -59,6 +59,42 @@ class UserManager {
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function getProfilePicture(): string
|
||||
{
|
||||
$sth = $this->pdo->prepare(
|
||||
"SELECT profile_picture
|
||||
FROM user
|
||||
WHERE user_id = :user_id
|
||||
LIMIT 1"
|
||||
);
|
||||
$sth->execute([':user_id' => $this->user_id]);
|
||||
return (string)($sth->fetchColumn() ?: '');
|
||||
}
|
||||
|
||||
public function updateProfile(array $data, string $profile_picture): void
|
||||
{
|
||||
$this->pdo->prepare(
|
||||
"UPDATE user SET
|
||||
name = :name,
|
||||
surname = :surname,
|
||||
email = :email,
|
||||
phone = :phone,
|
||||
country = :country,
|
||||
address = :address,
|
||||
profile_picture = :profile_picture
|
||||
WHERE user_id = :user_id"
|
||||
)->execute([
|
||||
':name' => trim($data['name'] ?? ''),
|
||||
':surname' => trim($data['surname'] ?? ''),
|
||||
':email' => trim($data['email'] ?? ''),
|
||||
':phone' => trim($data['phone'] ?? ''),
|
||||
':country' => trim($data['country'] ?? ''),
|
||||
':address' => trim($data['address'] ?? ''),
|
||||
':profile_picture' => $profile_picture,
|
||||
':user_id' => $this->user_id,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all companies the current user belongs to, plus their role in each.
|
||||
*
|
||||
@@ -79,6 +115,19 @@ class UserManager {
|
||||
return $sth->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function getCompanyAccess(int $company_id): ?array
|
||||
{
|
||||
$sth = $this->pdo->prepare(
|
||||
"SELECT company_id, role
|
||||
FROM company_map_user
|
||||
WHERE company_id = :company_id AND user_id = :user_id
|
||||
LIMIT 1"
|
||||
);
|
||||
$sth->execute([':company_id' => $company_id, ':user_id' => $this->user_id]);
|
||||
$row = $sth->fetch(PDO::FETCH_ASSOC);
|
||||
return $row ?: null;
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────
|
||||
// COMPANY MEMBER BASIS
|
||||
// ─────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user