24 lines
795 B
PHP
24 lines
795 B
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class AccountModel extends CI_Model
|
|
{
|
|
public function existingIds(array $ids)
|
|
{
|
|
if (empty($ids)) {
|
|
return array();
|
|
}
|
|
|
|
$this->db->select('id')
|
|
->where_in('id', array_values(array_unique($ids)))
|
|
->where('is_active', 1)
|
|
->where('allow_posting', 1);
|
|
if ($this->db->field_exists('company_id', 'accounts')) {
|
|
$companyId = isset($this->companycontext) ? (int)$this->companycontext->id() : (int)$this->session->userdata('company_id');
|
|
$this->db->where('company_id', $companyId);
|
|
}
|
|
$rows = $this->db->get('accounts')->result_array();
|
|
return array_map('intval', array_column($rows, 'id'));
|
|
}
|
|
}
|