Merge branch 'fronkdev' into 'master'
Added Preorderinfrastructre Api (external patchport assignment) See merge request fronk/thetool!2092
This commit is contained in:
@@ -271,6 +271,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="create_external_patchports">Patchports in externen Systemen erzeugen:</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="form-control" name="create_external_patchports" id="create_external_patchports">
|
||||
<option value="0" <?= (!$campaign || !$campaign->create_external_patchports) ? "selected='selected'" : "" ?>>Nein</option>
|
||||
<option value="1" <?= ($campaign && $campaign->create_external_patchports) ? "selected='selected'" : "" ?>>Ja</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="form-group row">
|
||||
|
||||
@@ -81,6 +81,15 @@ class ADBWohneinheit extends mfBaseModel {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($hausnummer->netzgebiet->source == "citycom-oan-api") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!preg_match('/^SDIBuilding_\d+_\d+$/', $hausnummer->rimo_id)) {
|
||||
$this->log->info("[".$this->_ruid."] ".__METHOD__.": invalid rimo_id in Hausnummer ".$hausnummer->id);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get RIMO API credentials
|
||||
$creds = $hausnummer->getNetownerRimoApiCredentials();
|
||||
if(!$creds) {
|
||||
|
||||
48
application/Api/v1/PreorderinfrastructureApicontroller.php
Normal file
48
application/Api/v1/PreorderinfrastructureApicontroller.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
class PreorderinfrastructureApiController extends mfBaseApicontroller {
|
||||
|
||||
protected function init() {
|
||||
$this->allowMissingOrigin = true;
|
||||
}
|
||||
|
||||
protected function registerRoutes() {
|
||||
$this->addRoute("/preorderinfrastructure/patchportAssignmentOrders", "getPatchportAssignmentOrders", "GET");
|
||||
|
||||
}
|
||||
|
||||
protected function authenticated() {
|
||||
$this->registerRoutes();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /preorderinfrastructure/patchportAssignmentOrders
|
||||
* Returns Homes in patching enabled campaigns with status 245
|
||||
*
|
||||
* @return array mfRequest
|
||||
*/
|
||||
protected function getPatchportAssignmentOrders() {
|
||||
if($this->me->username != "system.preorder.infra.api.snopp") {
|
||||
return mfResponse::Forbidden();
|
||||
}
|
||||
|
||||
$campaigns = PreordercampaignModel::search(["create_external_patchports" => 1]);
|
||||
if(!$campaigns) {
|
||||
return mfResponse::Ok(["homes" => []]);
|
||||
}
|
||||
|
||||
// get IDs of campaigns
|
||||
$campaign_ids = array_map(fn($c): int => $c->id, $campaigns);
|
||||
|
||||
$homes = [];
|
||||
foreach(PreorderModel::search(["preordercampaign_id" => $campaign_ids, "status_code" => 245]) as $preorder) {
|
||||
if(!$preorder->adb_wohneinheit_id) continue;
|
||||
$home = $preorder->adb_wohneinheit;
|
||||
if(!$home->extref) continue;
|
||||
$homes[] = $home->extref;
|
||||
}
|
||||
|
||||
return mfResponse::Ok(["homes" => $homes]);
|
||||
}
|
||||
}
|
||||
@@ -286,6 +286,12 @@ class PreordercampaignController extends mfBaseController {
|
||||
$data['exist_is_error'] = 0;
|
||||
}
|
||||
|
||||
if($r->create_external_patchports == 1) {
|
||||
$data['create_external_patchports'] = 1;
|
||||
} else {
|
||||
$data['create_external_patchports'] = 0;
|
||||
}
|
||||
|
||||
//var_dump($r->banned_rimo_fcp);exit;
|
||||
if($r->banned_rimo_fcp && is_array($r->banned_rimo_fcp) && count($r->banned_rimo_fcp)) {
|
||||
$banned_fcp_json = json_encode($r->banned_rimo_fcp);
|
||||
|
||||
@@ -15,6 +15,7 @@ class PreordercampaignModel {
|
||||
public $district_is_city;
|
||||
public $hausnummer_add_zusatz;
|
||||
public $exist_is_error;
|
||||
public $create_external_patchports;
|
||||
public $require_connectiontype;
|
||||
public $allow_unit_update;
|
||||
public $netowner_fibu_cost_code;
|
||||
@@ -164,6 +165,15 @@ class PreordercampaignModel {
|
||||
$where .= " AND `Preordercampaign`.`fulfillment` = '$fulfillment'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("create_external_patchports", $filter)) {
|
||||
$create_external_patchports = $filter['create_external_patchports'];
|
||||
if($create_external_patchports) {
|
||||
$where .= " AND create_external_patchports=1";
|
||||
} else {
|
||||
$where .= " AND create_external_patchports=0";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("name", $filter)) {
|
||||
$name = FronkDB::singleton()->escape($filter['name']);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class PreordercampaignAddCreateExternalPatchports extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Preordercampaign");
|
||||
$table->addColumn("create_external_patchports", "integer", ["null" => false, "default" => 0, "length" => Phinx\Db\Adapter\MysqlAdapter::INT_TINY, "after" => "allow_unit_update"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user