forked from mirrors/easyappointments
Merge unset statements wherever possible
This commit is contained in:
parent
e4e285931f
commit
cb410f739d
3 changed files with 30 additions and 12 deletions
|
@ -194,7 +194,10 @@ class Admins_model extends EA_Model {
|
|||
$admin['id_roles'] = $this->get_admin_role_id();
|
||||
|
||||
$settings = $admin['settings'];
|
||||
unset($admin['settings']);
|
||||
|
||||
unset(
|
||||
$admin['settings']
|
||||
);
|
||||
|
||||
$admin['create_datetime'] = date('Y-m-d H:i:s');
|
||||
$admin['update_datetime'] = date('Y-m-d H:i:s');
|
||||
|
@ -225,8 +228,12 @@ class Admins_model extends EA_Model {
|
|||
protected function update(array $admin): int
|
||||
{
|
||||
$settings = $admin['settings'];
|
||||
|
||||
$settings['id_users'] = $admin['id'];
|
||||
unset($admin['settings']);
|
||||
|
||||
unset(
|
||||
$admin['settings']
|
||||
);
|
||||
|
||||
if ( ! empty($settings['password']))
|
||||
{
|
||||
|
|
|
@ -211,10 +211,13 @@ class Providers_model extends EA_Model {
|
|||
$provider['id_roles'] = $this->get_provider_role_id();
|
||||
|
||||
$service_ids = $provider['services'];
|
||||
unset($provider['services']);
|
||||
|
||||
$settings = $provider['settings'];
|
||||
unset($provider['settings']);
|
||||
|
||||
unset(
|
||||
$provider['services'],
|
||||
$provider['settings']
|
||||
);
|
||||
|
||||
if ( ! $this->db->insert('users', $provider))
|
||||
{
|
||||
|
@ -245,10 +248,13 @@ class Providers_model extends EA_Model {
|
|||
$provider['update_datetime'] = date('Y-m-d H:i:s');
|
||||
|
||||
$service_ids = $provider['services'];
|
||||
unset($provider['services']);
|
||||
|
||||
$settings = $provider['settings'];
|
||||
unset($provider['settings']);
|
||||
|
||||
unset(
|
||||
$provider['services'],
|
||||
$provider['settings']
|
||||
);
|
||||
|
||||
if (isset($settings['password']))
|
||||
{
|
||||
|
|
|
@ -209,12 +209,14 @@ class Secretaries_model extends EA_Model {
|
|||
|
||||
$secretary['id_roles'] = $this->get_secretary_role_id();
|
||||
|
||||
$providers = $secretary['providers'] ?? [];
|
||||
unset($secretary['providers']);
|
||||
$provider_ids = $secretary['providers'] ?? [];
|
||||
|
||||
$settings = $secretary['settings'];
|
||||
unset($secretary['settings']);
|
||||
|
||||
unset(
|
||||
$secretary['providers'],
|
||||
$secretary['settings']
|
||||
);
|
||||
|
||||
if ( ! $this->db->insert('users', $secretary))
|
||||
{
|
||||
|
@ -226,7 +228,7 @@ class Secretaries_model extends EA_Model {
|
|||
$settings['password'] = hash_password($settings['salt'], $settings['password']);
|
||||
|
||||
$this->save_settings($secretary['id'], $settings);
|
||||
$this->save_provider_ids($secretary['id'], $providers);
|
||||
$this->save_provider_ids($secretary['id'], $provider_ids);
|
||||
|
||||
return $secretary['id'];
|
||||
}
|
||||
|
@ -245,10 +247,13 @@ class Secretaries_model extends EA_Model {
|
|||
$secretary['update_datetime'] = date('Y-m-d H:i:s');
|
||||
|
||||
$provider_ids = $secretary['providers'] ?? [];
|
||||
unset($secretary['providers']);
|
||||
|
||||
$settings = $secretary['settings'];
|
||||
unset($secretary['settings']);
|
||||
|
||||
unset(
|
||||
$secretary['providers'],
|
||||
$secretary['settings']
|
||||
);
|
||||
|
||||
if (isset($settings['password']))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue