From 2a5fd3b7272ef033612ec0f2c0030c176c88e855 Mon Sep 17 00:00:00 2001 From: DY Date: Wed, 26 Oct 2016 17:02:14 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99id=C3=A1n=C3=AD=20filtrov=C3=A1n=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + Možnost filtrace v seznamu faktur getInvoices(array('id_customer' => 123)) + Možnost filtrace v seznamu kontaktů getContacts(array('mail_to' => 'info@vyfakturuj.cz')) + Možnost filtrace v seznamu šablon a pravidelných faktur getTemplates(array('type' => 2,'end_type' => 1)) --- README.md | 6 ++++++ examples/4-template.php | 2 ++ libs/VyfakturujAPI.class.php | 17 +++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bce0f39..796d1b8 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,12 @@ Podrobnou dokumentace k API najdete na [http://docs.vyfakturujcz.apiary.io/](htt ## Changelog +### Verze 2.1.4 + ++ Možnost filtrace v seznamu faktur getInvoices(array('id_customer' => 123)) ++ Možnost filtrace v seznamu kontaktů getContacts(array('mail_to' => 'info@vyfakturuj.cz')) ++ Možnost filtrace v seznamu šablon a pravidelných faktur getTemplates(array('type' => 2,'end_type' => 1)) + ### Verze 2.1.3 + Přidání podpůrné funkce test_invoice__asPdf() - vytvoření faktury a stažení v PDF bez uložení v systému diff --git a/examples/4-template.php b/examples/4-template.php index defac4c..494023e 100644 --- a/examples/4-template.php +++ b/examples/4-template.php @@ -106,6 +106,8 @@ $ret3 = $vyfakturuj_api->getTemplate($_ID_ITEM); +// $ret3 = $vyfakturuj_api->getTemplates(); // vrati vsechny sablony a pravidelné faktury +// $ret3 = $vyfakturuj_api->getTemplates(array('type' => 2,'end_type' => 1)); // vrati vsechny pravidelné faktury, které nemají nastaveno datum ukončení echo '

Načetli jsme data o pravidelné faktuře faktuře ze systému:

'; echo '
'.print_r($ret3,true).'
'; diff --git a/libs/VyfakturujAPI.class.php b/libs/VyfakturujAPI.class.php index ec9a13b..996953a 100644 --- a/libs/VyfakturujAPI.class.php +++ b/libs/VyfakturujAPI.class.php @@ -4,7 +4,7 @@ * Třída pro práci s API Vyfakturuj.cz * * @author Ing. Martin Dostál - * @version 2.1.3 + * @version 2.1.4 */ class VyfakturujAPI{ @@ -59,8 +59,8 @@ public function getInvoice($id){ * * @return array */ - public function getInvoices(){ - return $this->_get('invoice/'); + public function getInvoices($args = array()){ + return $this->_get('invoice/?'.http_build_query($args)); } /** @@ -142,12 +142,13 @@ public function getContact($id){ } /** - * Vrátí seznam všech kontaktů + * Vrátí seznam kontaktů * + * @param array $args * @return array */ - public function getContacts(){ - return $this->_get('contact/'); + public function getContacts($args = array()){ + return $this->_get('contact/?'.http_build_query($args)); } /** @@ -196,8 +197,8 @@ public function getTemplate($id){ * * @return array */ - public function getTemplates(){ - return $this->_get('template/'); + public function getTemplates($args = array()){ + return $this->_get('template/?'.http_build_query($args)); } /**