Skip to content
Code-Schnipsel Gruppen Projekte
Commit a3a9b994 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: #63

Übergeordneter cbc9d409
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -228,10 +228,13 @@ public function searchForGrid()
$this->cache = [];
// select display invoices
$invoices = $this->executeQueryParams($this->getQuery());
$query = $this->getQuery();
$countQuery = $this->getQueryCount();
$invoices = $this->executeQueryParams($query);
// count
$count = $this->executeQueryParams($this->getQueryCount());
$count = $this->executeQueryParams($countQuery);
$count = (int)$count[0]['count'];
......@@ -407,7 +410,7 @@ protected function getQuery($count = false)
if (!empty($this->search)) {
$where[] = '(
id LIKE :search OR
id LIKE :searchId OR
customer_id LIKE :search OR
hash LIKE :search OR
global_process_id LIKE :search OR
......@@ -438,6 +441,30 @@ protected function getQuery($count = false)
sum LIKE :search
)';
$prefix = Settings::getInstance()->getInvoicePrefix();
$tempPrefix = Settings::getInstance()->getTemporaryInvoicePrefix();
if (\strpos($this->search, $prefix) === 0) {
$idSearch = \substr($this->search, \strlen($prefix));
$binds['searchId'] = [
'value' => $idSearch.'%',
'type' => \PDO::PARAM_STR
];
} elseif (\strpos($this->search, $tempPrefix) === 0) {
$idSearch = \substr($this->search, \strlen($tempPrefix));
$binds['searchId'] = [
'value' => $idSearch.'%',
'type' => \PDO::PARAM_STR
];
} else {
$binds['searchId'] = [
'value' => '%'.$this->search.'%',
'type' => \PDO::PARAM_STR
];
}
$binds['search'] = [
'value' => '%'.$this->search.'%',
'type' => \PDO::PARAM_STR
......@@ -478,8 +505,10 @@ protected function getQuery($count = false)
* @return array
* @throws QUI\Exception
*/
protected function executeQueryParams($queryData = [])
{
protected
function executeQueryParams(
$queryData = []
) {
$PDO = QUI::getDataBase()->getPDO();
$binds = $queryData['binds'];
$query = $queryData['query'];
......@@ -508,8 +537,10 @@ protected function executeQueryParams($queryData = [])
*
* @throws QUI\Exception
*/
protected function parseListForGrid($data)
{
protected
function parseListForGrid(
$data
) {
$Invoices = Handler::getInstance();
$Locale = QUI::getLocale();
$Payments = Payments::getInstance();
......@@ -744,7 +775,8 @@ protected function parseListForGrid($data)
/**
* @return array
*/
protected function getAllowedFields()
protected
function getAllowedFields()
{
return [
'id',
......
......@@ -101,8 +101,6 @@ public function sendMailAtInvoiceCreation()
* eq: PREFIX-10022 (default = INV-)
*
* @return string
*
* @throws QUI\Exception
*/
public function getInvoicePrefix()
{
......@@ -110,8 +108,15 @@ public function getInvoicePrefix()
return \strftime($this->invoicePrefix);
}
$Package = QUI::getPackage('quiqqer/invoice');
$Config = $Package->getConfig();
try {
$Package = QUI::getPackage('quiqqer/invoice');
$Config = $Package->getConfig();
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeException($Exception);
return 'INV-';
}
$setting = $Config->getValue('invoice', 'prefix');
$this->invoicePrefix = 'INV-';
......@@ -128,8 +133,6 @@ public function getInvoicePrefix()
* eq: PREFIX-10022 (default = EDIT-)
*
* @return string
*
* @throws QUI\Exception
*/
public function getTemporaryInvoicePrefix()
{
......@@ -137,8 +140,15 @@ public function getTemporaryInvoicePrefix()
return \strftime($this->temporaryInvoicePrefix);
}
$Package = QUI::getPackage('quiqqer/invoice');
$Config = $Package->getConfig();
try {
$Package = QUI::getPackage('quiqqer/invoice');
$Config = $Package->getConfig();
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeException($Exception);
return 'EDIT-';
}
$setting = $Config->getValue('temporaryInvoice', 'prefix');
$this->temporaryInvoicePrefix = 'EDIT-';
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren