Skip to content

Commit bb977ae

Browse files
committed
Handling SubItems Trait for not even Invoices added
1 parent 2308971 commit bb977ae

File tree

6 files changed

+45
-11
lines changed

6 files changed

+45
-11
lines changed

src/FlexiPeeHP/Adresar.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
class Adresar extends FlexiBeeRW
1717
{
1818
use Stitky;
19+
use SubItems;
20+
use Firma;
1921

2022
/**
2123
* Evidence užitá objektem.

src/FlexiPeeHP/Cenik.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
class Cenik extends FlexiBeeRW
1818
{
1919
use Stitky;
20+
use SubItems;
21+
2022
/**
2123
* Evidence užitá objektem.
2224
*

src/FlexiPeeHP/FakturaPrijata.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* FlexiPeeHP - Invoice Incomed.
45
*
@@ -13,11 +14,13 @@
1314
*
1415
* @link https://demo.flexibee.eu/c/demo/faktura-prijata/properties
1516
*/
16-
class FakturaPrijata extends FlexiBeeRW
17-
{
17+
class FakturaPrijata extends FlexiBeeRW {
18+
1819
use Stitky;
1920
use Firma;
2021
use Sum;
22+
use SubItems;
23+
2124
/**
2225
* Evidence použitá třídou.
2326
*

src/FlexiPeeHP/FakturaVydana.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class FakturaVydana extends FlexiBeeRW
1919
use Stitky;
2020
use Firma;
2121
use Sum;
22+
use SubItems;
23+
2224
/**
2325
* Evidence užitá objektem.
2426
*

src/FlexiPeeHP/FlexiBeeRO.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,15 +1579,6 @@ public function recordExists($data = []) {
15791579
return $found;
15801580
}
15811581

1582-
/**
1583-
* Subitems - ex. items of invoice
1584-
*
1585-
* @return array of document items or null
1586-
*/
1587-
public function getSubItems() {
1588-
return array_key_exists('polozkyFaktury', $this->getData()) ? $this->getDataValue('polozkyFaktury') : (array_key_exists('polozkyDokladu', $this->getData()) ? $this->getDataValue('polozkyDokladu') : null);
1589-
}
1590-
15911582
/**
15921583
* Vrací z FlexiBee sloupečky podle podmínek.
15931584
*

src/FlexiPeeHP/SubItems.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
/*
4+
* To change this license header, choose License Headers in Project Properties.
5+
* To change this template file, choose Tools | Templates
6+
* and open the template in the editor.
7+
*/
8+
9+
namespace FlexiPeeHP;
10+
11+
/**
12+
*
13+
* @author vitex
14+
*/
15+
trait SubItems {
16+
/**
17+
* Subitems - ex. items of invoice
18+
*
19+
* @return array of document items or null
20+
*/
21+
public function getSubItems() {
22+
return $this->getDataValue($this->getSubmenuName());
23+
}
24+
25+
public function setSubitems(array $subitems) {
26+
return $this->setDataValue($this->getSubmenuName(), $subitems);
27+
}
28+
29+
public function getSubMenuName() {
30+
return array_key_exists('polozkyFaktury', $this->getData()) ? 'polozkyFaktury' : (array_key_exists('polozkyDokladu', $this->getData()) ? 'polozkyDokladu' : null);
31+
32+
}
33+
34+
}

0 commit comments

Comments
 (0)