mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Working on speech rec
This commit is contained in:
parent
2581e529e4
commit
d2b90ac4b6
@ -80,6 +80,13 @@ class BaseIntent
|
|||||||
return new $className($state, $data);
|
return new $className($state, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function hasField($field, $value = false)
|
||||||
|
{
|
||||||
|
$fieldValue = $this->getField($field);
|
||||||
|
|
||||||
|
return $value ? $value == $fieldValue : !!$fieldValue;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getField($field)
|
protected function getField($field)
|
||||||
{
|
{
|
||||||
foreach ($this->data->entities as $entity) {
|
foreach ($this->data->entities as $entity) {
|
||||||
@ -106,7 +113,7 @@ class BaseIntent
|
|||||||
|
|
||||||
protected function loadStates($entityType)
|
protected function loadStates($entityType)
|
||||||
{
|
{
|
||||||
$states = array_filter($this->getFields('State'), function($state) {
|
$states = array_filter($this->getFields('Filter'), function($state) {
|
||||||
return in_array($state, [STATUS_ACTIVE, STATUS_ARCHIVED, STATUS_DELETED]);
|
return in_array($state, [STATUS_ACTIVE, STATUS_ARCHIVED, STATUS_DELETED]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class InvoiceIntent extends BaseIntent
|
|||||||
protected function loadStatuses($entityType)
|
protected function loadStatuses($entityType)
|
||||||
{
|
{
|
||||||
$statusIds = [];
|
$statusIds = [];
|
||||||
$statuses = $this->getFields('State');
|
$statuses = $this->getFields('Filter');
|
||||||
|
|
||||||
foreach ($statuses as $status) {
|
foreach ($statuses as $status) {
|
||||||
if ($statusId = InvoiceStatus::getIdFromAlias($status)) {
|
if ($statusId = InvoiceStatus::getIdFromAlias($status)) {
|
||||||
|
@ -11,7 +11,7 @@ class ListInvoiceIntent extends InvoiceIntent
|
|||||||
$this->loadStates(ENTITY_INVOICE);
|
$this->loadStates(ENTITY_INVOICE);
|
||||||
$this->loadStatuses(ENTITY_INVOICE);
|
$this->loadStatuses(ENTITY_INVOICE);
|
||||||
|
|
||||||
if ($client = $this->requestClient()) {
|
if (! $this->hasField('Filter', 'all') && $client = $this->requestClient()) {
|
||||||
$url = $client->present()->url . '#invoices';
|
$url = $client->present()->url . '#invoices';
|
||||||
} else {
|
} else {
|
||||||
$url = '/invoices';
|
$url = '/invoices';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user