Invoice: BMD Export button now use filter
This commit is contained in:
@@ -18,6 +18,10 @@ class InvoiceController extends mfBaseController {
|
||||
if(!$this->me->can("Billing")) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
if($this->request->export_type == "bmd-invoice" || $this->request->export_type == "bmd-credit") {
|
||||
return $this->exportBmdAction();
|
||||
}
|
||||
|
||||
$this->layout()->setTemplate("Invoice/Index");
|
||||
|
||||
if ($this->request->resetFilter) {
|
||||
@@ -593,7 +597,7 @@ class InvoiceController extends mfBaseController {
|
||||
|
||||
//var_dump($this->request->type);exit;
|
||||
$type = "normal";
|
||||
if($this->request->type == "credit") {
|
||||
if($this->request->export_type == "bmd-credit") {
|
||||
$type = "credit";
|
||||
}
|
||||
|
||||
@@ -606,9 +610,20 @@ class InvoiceController extends mfBaseController {
|
||||
}
|
||||
$csv_out = "";
|
||||
|
||||
$filter = [
|
||||
"bmd_export_date" => null,
|
||||
];
|
||||
$filter = [];
|
||||
if (is_array($this->request->filter)) {
|
||||
$filter = $this->request->filter;
|
||||
$_SESSION[MFAPPNAME . '-Invoice-filter'] = $filter;
|
||||
} else {
|
||||
if (array_key_exists(MFAPPNAME . '-Invoice-filter', $_SESSION) && count($_SESSION[MFAPPNAME . '-Invoice-filter'])) {
|
||||
$filter = $_SESSION[MFAPPNAME . '-Invoice-filter'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout->set("filter", $filter);
|
||||
$filter = $this->getPreparedFilter($filter);
|
||||
|
||||
$filter["bmd_export_date"] = null;
|
||||
|
||||
if($type == "credit") {
|
||||
$filter["vatgroup_id"] = TT_VATGROUP_CREDIT;
|
||||
@@ -616,7 +631,7 @@ class InvoiceController extends mfBaseController {
|
||||
$filter["!vatgroup_id"] = TT_VATGROUP_CREDIT;
|
||||
}
|
||||
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if(!InvoiceModel::search($filter)) {
|
||||
$this->layout()->setFlash("Keine neuen Rechnungen seit letztem BMD-Export vorhanden.");
|
||||
$this->redirect("Invoice");
|
||||
|
||||
Reference in New Issue
Block a user