diff --git a/Layout/default/Preorder/Index.php b/Layout/default/Preorder/Index.php index 263879811..537eeb979 100644 --- a/Layout/default/Preorder/Index.php +++ b/Layout/default/Preorder/Index.php @@ -136,6 +136,25 @@ + +
+ + +
+ +
+ + +
+ diff --git a/application/Preorder/PreorderController.php b/application/Preorder/PreorderController.php index bb6dec5be..78358d980 100644 --- a/application/Preorder/PreorderController.php +++ b/application/Preorder/PreorderController.php @@ -163,10 +163,26 @@ class PreorderController extends mfBaseController { unset($filter['unit_missing']); } - if(array_key_exists("attributes", $filter) && count($filter['attributes'])) { - + if(array_key_exists("rimo_home_extref", $filter)) { + if($filter['rimo_home_extref'] == "1") { + $new_filter['add-where'] = " AND (adb_wohneinheit.extref IS NOT NULL AND adb_wohneinheit.extref like 'SDIHome_%')"; + } elseif($filter['rimo_home_extref'] == "0") { + $new_filter['add-where'] = " AND (adb_wohneinheit.extref IS NULL OR adb_wohneinheit.extref NOT LIKE 'SDIHome_%')"; + } } + if(array_key_exists("rimo_workorder", $filter)) { + if($filter["rimo_workorder"] == "1") { + $new_filter['workorder_export_date'] = true; + } else { + $new_filter['workorder_export_date'] = false; + } + } + + /*if(array_key_exists("attributes", $filter) && count($filter['attributes'])) { + + }*/ + if(is_array($filter) && count($filter)) { foreach($filter as $name => $value) { $new_filter[$name] = $value; diff --git a/application/Preorder/PreorderModel.php b/application/Preorder/PreorderModel.php index 3f4a1be80..acf6989da 100644 --- a/application/Preorder/PreorderModel.php +++ b/application/Preorder/PreorderModel.php @@ -220,6 +220,7 @@ class PreorderModel { $sql = "SELECT COUNT(*) as cnt FROM `".FRONKDB_DBNAME."`.Preorder tt_preorder LEFT JOIN `".FRONKDB_DBNAME."`.Preorderstatus tt_preorderstatus ON (tt_preorder.status_id = tt_preorderstatus.id) LEFT JOIN `".ADDRESSDB_DBNAME."`.view_hausnummer as adb_hausnummer ON (tt_preorder.adb_hausnummer_id = adb_hausnummer.hausnummer_id) + LEFT JOIN `".ADDRESSDB_DBNAME."`.Wohneinheit as adb_wohneinheit ON (tt_preorder.adb_hausnummer_id = adb_wohneinheit.hausnummer_id) WHERE $where "; @@ -242,6 +243,7 @@ class PreorderModel { $sql = "SELECT tt_preorder.* FROM `".FRONKDB_DBNAME."`.Preorder tt_preorder LEFT JOIN `".FRONKDB_DBNAME."`.Preorderstatus tt_preorderstatus ON (tt_preorder.status_id = tt_preorderstatus.id) LEFT JOIN `".ADDRESSDB_DBNAME."`.view_hausnummer as adb_hausnummer ON (tt_preorder.adb_hausnummer_id = adb_hausnummer.hausnummer_id) + LEFT JOIN `".ADDRESSDB_DBNAME."`.Wohneinheit as adb_wohneinheit ON (tt_preorder.adb_hausnummer_id = adb_wohneinheit.hausnummer_id) WHERE $where ORDER BY lastname, firstname "; @@ -445,6 +447,8 @@ class PreorderModel { $workorder_export_date = $filter['workorder_export_date']; if($workorder_export_date === null || $workorder_export_date === false) { $where .= " AND (tt_preorder.workorder_export_date IS NULL OR tt_preorder.workorder_export_date = 0)"; + } elseif($workorder_export_date) { + $where .= " AND tt_preorder.workorder_export_date > 1"; } } diff --git a/application/Preordercampaign/PreordercampaignController.php b/application/Preordercampaign/PreordercampaignController.php index 576804b1e..2a1472fe9 100644 --- a/application/Preordercampaign/PreordercampaignController.php +++ b/application/Preordercampaign/PreordercampaignController.php @@ -447,7 +447,7 @@ class PreordercampaignController extends mfBaseController { $workorders_created = 0; $workorders_failed = 0; - foreach(PreorderModel::search(["preordercampaign_id" => $id, "workorder_export_date" => null]) as $preorder) { + foreach(PreorderModel::search(["preordercampaign_id" => $id, "workorder_export_date" => null, 'deleted' => 0]) as $preorder) { if($preorder->workorder_export_date) { $this->log->warning(__METHOD__.": workorder_export_date not null"); } diff --git a/scripts/addressdb/st-stefan-ob-stainz/01-addressdb_update_buildings.php b/scripts/addressdb/st-stefan-ob-stainz/01-addressdb_update_buildings.php index 756450a31..e6bfcc420 100644 --- a/scripts/addressdb/st-stefan-ob-stainz/01-addressdb_update_buildings.php +++ b/scripts/addressdb/st-stefan-ob-stainz/01-addressdb_update_buildings.php @@ -113,8 +113,8 @@ while($csv = fgetcsv($input, 0, ";")) { if($strasse_name == "Schilcherlandsiedlung") $strasse_name = "Schilcherland Siedlung"; //if($strasse_name == "Bierbaumer Strasse") $strasse_name = "Bierbaumerstrasse"; if(preg_match('/GST(\s+\.)?$/', $strasse_name) && !$adrcd) continue; - if(preg_match('/^L\d+/',$strasse_name)) continue; - if(preg_match('/^BP/',$strasse_name)) continue; + if(preg_match('/^L\d+/',$strasse_name) && !$adrcd) continue; + if(preg_match('/^BP/',$strasse_name) && !$adrcd) continue; if($strasse_name == "Lemsitz GNR") { @@ -209,7 +209,7 @@ while($csv = fgetcsv($input, 0, ";")) { $sql = "SELECT * FROM view_hausnummer WHERE gemeinde_id = $gemeinde_id AND strasse IN ('". implode("', '", $strasse_search)."') AND hausnummer='$hausnummer_name'"; - echo "$sql\n"; + //echo "$sql\n"; /*if(preg_match('/^Tobelbader/i',$strasse_name)) { echo "$sql\n"; }*/