bugfix if no results in subquery for BillDetails
This commit is contained in:
parent
ae3ae2df5d
commit
77d4fd938c
@ -27,8 +27,11 @@ class mBills extends Model {
|
|||||||
$quelle = model('App\Models\mAccounts');
|
$quelle = model('App\Models\mAccounts');
|
||||||
$this->where('datum >=', date( 'Y-m-d', strtotime($start)));
|
$this->where('datum >=', date( 'Y-m-d', strtotime($start)));
|
||||||
$this->where('datum <=', date( 'Y-m-d', strtotime($ende)));
|
$this->where('datum <=', date( 'Y-m-d', strtotime($ende)));
|
||||||
|
// alle Detailsbuchungen wo account id übereinstimmt
|
||||||
if ($source > 0) {
|
if ($source > 0) {
|
||||||
$subs = $details->select('bill_id')->where('account_id',$source)->findAll();
|
$subs = $details->select('bill_id')->where('account_id',$source)->findAll();
|
||||||
|
// log_message('error', 'Get Entries Det {msg}', ['msg'=>(string)$this->db->getLastQuery()]);
|
||||||
|
if (0 < sizeof($subs)){
|
||||||
$keys=array();
|
$keys=array();
|
||||||
foreach ($subs as $value) {
|
foreach ($subs as $value) {
|
||||||
$keys[] = intval($value->bill_id);
|
$keys[] = intval($value->bill_id);
|
||||||
@ -37,8 +40,17 @@ class mBills extends Model {
|
|||||||
$this->where('source_id', $source );
|
$this->where('source_id', $source );
|
||||||
$this->orWhereIn('id', $keys );
|
$this->orWhereIn('id', $keys );
|
||||||
$this->groupEnd();
|
$this->groupEnd();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->where('source_id', $source );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->orderBy('datum','desc')->where('lkz',null)->findAll();
|
$result = $this->orderBy('datum','desc')->where('lkz',null)->findAll();
|
||||||
|
if (0 == sizeof($result)){
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
$keys=array();
|
$keys=array();
|
||||||
foreach ($result as $value) {
|
foreach ($result as $value) {
|
||||||
$keys[] = intval($value->id);
|
$keys[] = intval($value->id);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user