new OAID type "other" / added adrcd to preorderreporting api
This commit is contained in:
@@ -165,7 +165,7 @@
|
|||||||
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->units?></td>
|
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->units?></td>
|
||||||
<td onclick="toggleBuilding(<?=$building->id?>)" class="text-monospace"><?=__($building->status->name."-b")?></td>
|
<td onclick="toggleBuilding(<?=$building->id?>)" class="text-monospace"><?=__($building->status->name."-b")?></td>
|
||||||
<!--td><input type="checkbox" class="form-control" id="snopp-export-<?=$building->id?>" data-building-id="<?=$building->id?>" /></td-->
|
<!--td><input type="checkbox" class="form-control" id="snopp-export-<?=$building->id?>" data-building-id="<?=$building->id?>" /></td-->
|
||||||
<td class="text-monospace">
|
<td class="text-monospace" onclick="toggleBuilding(<?=$building->id?>)">
|
||||||
<?=date('d.m.Y H:i:s',$building->create)?> (<?=$building->creator->name?>)<br />
|
<?=date('d.m.Y H:i:s',$building->create)?> (<?=$building->creator->name?>)<br />
|
||||||
<?=date('d.m.Y H:i:s',$building->edit)?> (<?=$building->editor->name?>)
|
<?=date('d.m.Y H:i:s',$building->edit)?> (<?=$building->editor->name?>)
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -158,6 +158,9 @@
|
|||||||
<option value="ofaa" <?= ($campaign->oaid_origin == "ofaa") ? "selected='selected'" : "" ?>>
|
<option value="ofaa" <?= ($campaign->oaid_origin == "ofaa") ? "selected='selected'" : "" ?>>
|
||||||
OFAA
|
OFAA
|
||||||
</option>
|
</option>
|
||||||
|
<option value="other" <?= ($campaign->oaid_origin == "other") ? "selected='selected'" : "" ?>>
|
||||||
|
Andere (importieren, aber nicht verarbeiten)
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -377,73 +380,81 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4>Emailbenachrichtigungen</h4>
|
<h4>Emailbenachrichtigungen</h4>
|
||||||
<div class="card">
|
<?php if(isset($campaign) && $campaign): ?>
|
||||||
<div class="card-body">
|
<div class="card">
|
||||||
<h4 class="">Absender</h4>
|
<div class="card-body">
|
||||||
<div class="form-group row">
|
<h4 class="">Absender</h4>
|
||||||
<label class="col-lg-2 col-form-label" for="from_email_name">Name</label>
|
<div class="form-group row">
|
||||||
<div class="col-lg-10">
|
<label class="col-lg-2 col-form-label" for="from_email_name">Name</label>
|
||||||
<input type="text" class="form-control" name="from_email_name" id="from_email_name" value="<?= $campaign->from_email_name ?>"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<label class="col-lg-2 col-form-label" for="from_email">Emailadresse</label>
|
|
||||||
<div class="col-lg-10">
|
|
||||||
<input type="text" class="form-control" name="from_email" id="from_email" value="<?= $campaign->from_email ?>"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4 class="mt-3">Emailtemplates</h4>
|
|
||||||
<?php $i=0; foreach(PreorderstatusModel::getAll() as $status): ?>
|
|
||||||
<div class="form-group row p-2 mb-0 border-bottom" id="statustemplate-<?=$status->code?>" style="background-color: #<?=($i%2 == 0) ? "fafafa" : "fff"?>">
|
|
||||||
|
|
||||||
<label class="col-lg-2 col-form-label text-right text-monospace" for="mailtemplates_<?=$status->code?>"><?=$status->name?></label>
|
|
||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
<div class="row">
|
<input type="text" class="form-control" name="from_email_name" id="from_email_name" value="<?= $campaign->from_email_name ?>"/>
|
||||||
<div class="col-8">
|
</div>
|
||||||
<div class="input-group">
|
</div>
|
||||||
<div class="input-group-prepend text-monospace">
|
<div class="form-group row">
|
||||||
<span class="input-group-text" id="basic-addon1"><?=$status->code?></span>
|
<label class="col-lg-2 col-form-label" for="from_email">Emailadresse</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" name="from_email" id="from_email" value="<?= $campaign->from_email ?>"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="mt-3">Emailtemplates</h4>
|
||||||
|
<?php $i=0; foreach(PreorderstatusModel::getAll() as $status): ?>
|
||||||
|
<div class="form-group row p-2 mb-0 border-bottom" id="statustemplate-<?=$status->code?>" style="background-color: #<?=($i%2 == 0) ? "fafafa" : "fff"?>">
|
||||||
|
|
||||||
|
<label class="col-lg-2 col-form-label text-right text-monospace" for="mailtemplates_<?=$status->code?>"><?=$status->name?></label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend text-monospace">
|
||||||
|
<span class="input-group-text" id="basic-addon1"><?=$status->code?></span>
|
||||||
|
</div>
|
||||||
|
<select name="mailtemplates[<?=$status->code?>][mailtemplate_id]" id="mailtemplate-<?=$status->code?>" class="form-control select2">
|
||||||
|
<option value=""></option>
|
||||||
|
<?php foreach(MailtemplateModel::search(["is_include" => "0"]) as $template): ?>
|
||||||
|
<option value="<?=$template->id?>" <?=(is_array($campaign->statusnotifcation_mailtemplates) && array_key_exists($status->code, $campaign->statusnotifcation_mailtemplates) && $campaign->statusnotifcation_mailtemplates[$status->code]->mailtemplate_id == $template->id) ? "selected='selected'" : ""?>><?=$template->name?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<select name="mailtemplates[<?=$status->code?>][mailtemplate_id]" id="mailtemplate-<?=$status->code?>" class="form-control select2">
|
|
||||||
<option value=""></option>
|
|
||||||
<?php foreach(MailtemplateModel::search(["is_include" => "0"]) as $template): ?>
|
|
||||||
<option value="<?=$template->id?>" <?=(is_array($campaign->statusnotifcation_mailtemplates) && array_key_exists($status->code, $campaign->statusnotifcation_mailtemplates) && $campaign->statusnotifcation_mailtemplates[$status->code]->mailtemplate_id == $template->id) ? "selected='selected'" : ""?>><?=$template->name?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col">
|
||||||
<div class="col">
|
<div class="input-group">
|
||||||
<div class="input-group">
|
<div class="input-group-prepend text-monospace">
|
||||||
<div class="input-group-prepend text-monospace">
|
<span class="input-group-text">@</span>
|
||||||
<span class="input-group-text">@</span>
|
</div>
|
||||||
</div>
|
<input type="text" class="form-control" name="test_to" id="test-to-<?=$status->code?>" value="" placeholder="Test Emailadresse" />
|
||||||
<input type="text" class="form-control" name="test_to" id="test-to-<?=$status->code?>" value="" placeholder="Test Emailadresse" />
|
<div class="input-group-append">
|
||||||
<div class="input-group-append">
|
<button class="btn btn-outline-success" type="button" onclick="sendTestStatusEmail(<?=$status->code?>)"><i class="fas fa-envelope"></i> Testmail versenden</button>
|
||||||
<button class="btn btn-outline-success" type="button" onclick="sendTestStatusEmail(<?=$status->code?>)"><i class="fas fa-envelope"></i> Testmail versenden</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row mt-1">
|
||||||
<div class="row mt-1">
|
<div class="col-lg">
|
||||||
<div class="col-lg">
|
<label>
|
||||||
<label>
|
<input type="checkbox" name="mailtemplates[<?=$status->code?>][allow_on_skip]" value="1" id="allow_on_skip-<?=$status->code?>" <?=(is_array($campaign->statusnotifcation_mailtemplates) && array_key_exists($status->code, $campaign->statusnotifcation_mailtemplates) && $campaign->statusnotifcation_mailtemplates[$status->code]->allow_on_skip) ? "checked='checked'" : ""?> />
|
||||||
<input type="checkbox" name="mailtemplates[<?=$status->code?>][allow_on_skip]" value="1" id="allow_on_skip-<?=$status->code?>" <?=(is_array($campaign->statusnotifcation_mailtemplates) && array_key_exists($status->code, $campaign->statusnotifcation_mailtemplates) && $campaign->statusnotifcation_mailtemplates[$status->code]->allow_on_skip) ? "checked='checked'" : ""?> />
|
Benachrichtigung darf bei Überspringen versendet werden, wenn nötig
|
||||||
Benachrichtigung darf bei Überspringen versendet werden, wenn nötig
|
</label><br />
|
||||||
</label><br />
|
<label>
|
||||||
<label>
|
<input type="checkbox" name="mailtemplates[<?=$status->code?>][prevent_previous]" value="1" id="prevent_previous-<?=$status->code?>" <?=(is_array($campaign->statusnotifcation_mailtemplates) && array_key_exists($status->code, $campaign->statusnotifcation_mailtemplates) && $campaign->statusnotifcation_mailtemplates[$status->code]->prevent_previous) ? "checked='checked'" : ""?> />
|
||||||
<input type="checkbox" name="mailtemplates[<?=$status->code?>][prevent_previous]" value="1" id="prevent_previous-<?=$status->code?>" <?=(is_array($campaign->statusnotifcation_mailtemplates) && array_key_exists($status->code, $campaign->statusnotifcation_mailtemplates) && $campaign->statusnotifcation_mailtemplates[$status->code]->prevent_previous) ? "checked='checked'" : ""?> />
|
Keine vorigen Benachrichtigungen versenden, wenn dieser Status ohne Mailtemplate eintritt
|
||||||
Keine vorigen Benachrichtigungen versenden, wenn dieser Status ohne Mailtemplate eintritt
|
</label>
|
||||||
</label>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<?php $i++; endforeach; ?>
|
||||||
|
</div>
|
||||||
<?php $i++; endforeach; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php else: ?>
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<i>Verfügbar nach Speichern...</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
<h4>API-User</h4>
|
<h4>API-User</h4>
|
||||||
@@ -566,30 +577,32 @@
|
|||||||
background: "bg-danger"
|
background: "bg-danger"
|
||||||
});
|
});
|
||||||
|
|
||||||
function sendTestStatusEmail(status_code) {
|
<?php if(isset($campaign) && $campaign): ?>
|
||||||
if(!status_code) return;
|
function sendTestStatusEmail(status_code) {
|
||||||
|
if(!status_code) return;
|
||||||
|
|
||||||
var template_id = $("#mailtemplate-" + status_code).val();
|
var template_id = $("#mailtemplate-" + status_code).val();
|
||||||
var email_to = $("#test-to-" + status_code).val();
|
var email_to = $("#test-to-" + status_code).val();
|
||||||
|
|
||||||
$.post("<?=self::getUrl("Preordercampaign", "Api")?>",
|
$.post("<?=self::getUrl("Preordercampaign", "Api")?>",
|
||||||
{
|
{
|
||||||
do: "sendStatusEmail",
|
do: "sendStatusEmail",
|
||||||
campaign_id: <?=$campaign->id?>,
|
campaign_id: <?=$campaign->id?>,
|
||||||
template_id: template_id,
|
template_id: template_id,
|
||||||
to_email: email_to
|
to_email: email_to
|
||||||
},
|
},
|
||||||
(success) => {
|
(success) => {
|
||||||
if(success.status == "OK") {
|
if(success.status == "OK") {
|
||||||
window.notify("success", "Testmail wurde versendet");
|
window.notify("success", "Testmail wurde versendet");
|
||||||
} else {
|
} else {
|
||||||
window.notify("error", "Beim versenden ist ein Fehler aufgetragen.");
|
window.notify("error", "Beim versenden ist ein Fehler aufgetragen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(success);
|
console.log(success);
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
<?php endif; ?>
|
||||||
</script>
|
</script>
|
||||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||||
@@ -8,6 +8,7 @@ class ADBWohneinheit extends mfBaseModel {
|
|||||||
private $status;
|
private $status;
|
||||||
private $statusflags; // TODO
|
private $statusflags; // TODO
|
||||||
private $preorders;
|
private $preorders;
|
||||||
|
private $active_preorders;
|
||||||
|
|
||||||
protected function init() {
|
protected function init() {
|
||||||
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
$this->db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||||
@@ -316,6 +317,15 @@ class ADBWohneinheit extends mfBaseModel {
|
|||||||
return $this->preorders;
|
return $this->preorders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($name == "active_preorders") {
|
||||||
|
$preorders = PreorderModel::searchActive(["adb_wohneinheit_id" => $this->id]);
|
||||||
|
if(!count($preorders)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$this->preorders = $preorders;
|
||||||
|
return $this->preorders;
|
||||||
|
}
|
||||||
|
|
||||||
if($name == "ftu_data") {
|
if($name == "ftu_data") {
|
||||||
$rimo_data = $this->getExternalRimoData();
|
$rimo_data = $this->getExternalRimoData();
|
||||||
|
|
||||||
|
|||||||
@@ -1066,7 +1066,7 @@ class AddressDBController extends mfBaseController {
|
|||||||
$u['zusatz'] = $unit->zusatz;
|
$u['zusatz'] = $unit->zusatz;
|
||||||
$u['usage'] = $unit->nutzung;
|
$u['usage'] = $unit->nutzung;
|
||||||
$u['oaid'] = $unit->oaid;
|
$u['oaid'] = $unit->oaid;
|
||||||
$u['preorder_count'] = count($unit->preorders);
|
$u['preorder_count'] = count($unit->active_preorders);
|
||||||
$results[] = $u;
|
$results[] = $u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -447,6 +447,9 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
|||||||
'sort_key' => $sort_key,
|
'sort_key' => $sort_key,
|
||||||
'oaid' => $data->hausnummer_oaid,
|
'oaid' => $data->hausnummer_oaid,
|
||||||
'cluster_id' => $data->netzgebiet_extref,
|
'cluster_id' => $data->netzgebiet_extref,
|
||||||
|
'visibility' => null,
|
||||||
|
'adrcd' => null,
|
||||||
|
'subcd' => null,
|
||||||
'zip' => $data->plz,
|
'zip' => $data->plz,
|
||||||
'city' => $data->gemeinde,
|
'city' => $data->gemeinde,
|
||||||
"municipality" => "",
|
"municipality" => "",
|
||||||
@@ -472,6 +475,15 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
|||||||
} else {
|
} else {
|
||||||
unset($tmp_addresses[$address_key]['municipality']);
|
unset($tmp_addresses[$address_key]['municipality']);
|
||||||
}
|
}
|
||||||
|
if($this->me->is("preorderaddressreporting")) {
|
||||||
|
$tmp_addresses[$address_key]['visibility'] = $data->visibility;
|
||||||
|
$tmp_addresses[$address_key]['adrcd'] = $data->adrcd;
|
||||||
|
$tmp_addresses[$address_key]['subcd'] = $data->subcd;
|
||||||
|
} else {
|
||||||
|
unset($tmp_addresses[$address_key]["visibility"]);
|
||||||
|
unset($tmp_addresses[$address_key]["adrcd"]);
|
||||||
|
unset($tmp_addresses[$address_key]["subcd"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$unit_data = [
|
$unit_data = [
|
||||||
@@ -589,6 +601,9 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
|||||||
$new_address['ordered'] = $u['ordered'];
|
$new_address['ordered'] = $u['ordered'];
|
||||||
$new_address['orderType'] = $u['orderType'];
|
$new_address['orderType'] = $u['orderType'];
|
||||||
$new_address['ispName'] = $u['ispName'];
|
$new_address['ispName'] = $u['ispName'];
|
||||||
|
$new_address['visibility'] = $ta['visibility'];
|
||||||
|
$new_address['adrcd'] = $ta['adrcd'];
|
||||||
|
$new_address['subcd'] = $ta['subcd'];
|
||||||
}
|
}
|
||||||
$new_address['oaid'] = $u['oaid'];
|
$new_address['oaid'] = $u['oaid'];
|
||||||
$new_address['building_oaid'] = $ta['oaid'];
|
$new_address['building_oaid'] = $ta['oaid'];
|
||||||
@@ -743,6 +758,9 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
|||||||
$tmp_addresses[$address_key] = [
|
$tmp_addresses[$address_key] = [
|
||||||
'oaid' => $data->hausnummer_oaid,
|
'oaid' => $data->hausnummer_oaid,
|
||||||
'cluster_id' => $data->netzgebiet_extref,
|
'cluster_id' => $data->netzgebiet_extref,
|
||||||
|
'visibility' => null,
|
||||||
|
'adrcd' => null,
|
||||||
|
'subcd' => null,
|
||||||
'zip' => $data->plz,
|
'zip' => $data->plz,
|
||||||
'city' => $data->gemeinde,
|
'city' => $data->gemeinde,
|
||||||
"municipality" => "",
|
"municipality" => "",
|
||||||
@@ -768,7 +786,15 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
|||||||
} else {
|
} else {
|
||||||
unset($tmp_addresses[$address_key]['municipality']);
|
unset($tmp_addresses[$address_key]['municipality']);
|
||||||
}
|
}
|
||||||
|
if($this->me->is("preorderaddressreporting")) {
|
||||||
|
$tmp_addresses[$address_key]['visibility'] = $data->visibility;
|
||||||
|
$tmp_addresses[$address_key]['adrcd'] = $data->adrcd;
|
||||||
|
$tmp_addresses[$address_key]['subcd'] = $data->subcd;
|
||||||
|
} else {
|
||||||
|
unset($tmp_addresses[$address_key]["visibility"]);
|
||||||
|
unset($tmp_addresses[$address_key]["adrcd"]);
|
||||||
|
unset($tmp_addresses[$address_key]["subcd"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$unit_data = [
|
$unit_data = [
|
||||||
@@ -808,6 +834,9 @@ class AddressdbApicontroller extends mfBaseApicontroller {
|
|||||||
$new_address['ordered'] = $u['ordered'];
|
$new_address['ordered'] = $u['ordered'];
|
||||||
$new_address['orderType'] = $u['orderType'];
|
$new_address['orderType'] = $u['orderType'];
|
||||||
$new_address['ispName'] = $u['ispName'];
|
$new_address['ispName'] = $u['ispName'];
|
||||||
|
$new_address['visibility'] = $ta['visibility'];
|
||||||
|
$new_address['adrcd'] = $ta['adrcd'];
|
||||||
|
$new_address['subcd'] = $ta['subcd'];
|
||||||
}
|
}
|
||||||
$new_address['oaid'] = $u['oaid'];
|
$new_address['oaid'] = $u['oaid'];
|
||||||
$new_address['building_oaid'] = $ta['oaid'];
|
$new_address['building_oaid'] = $ta['oaid'];
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ class Preorder extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function beforeSave() {
|
||||||
|
if(!isset($this->data->status_id)) {
|
||||||
|
$this->data->status_id = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function afterSave() {
|
public function afterSave() {
|
||||||
// reset auto magic properties
|
// reset auto magic properties
|
||||||
$this->status = null;
|
$this->status = null;
|
||||||
@@ -111,6 +117,9 @@ class Preorder extends mfBaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$campaign = $this->getProperty("campaign");
|
||||||
|
if($campaign->oaid_origin == "other") return true;
|
||||||
|
|
||||||
if($this->adb_wohneinheit_id && is_array($this->getProperty("adb_wohneinheit")->rimo_workorders)) {
|
if($this->adb_wohneinheit_id && is_array($this->getProperty("adb_wohneinheit")->rimo_workorders)) {
|
||||||
foreach($this->getProperty("adb_wohneinheit")->rimo_workorders as $workorder) {
|
foreach($this->getProperty("adb_wohneinheit")->rimo_workorders as $workorder) {
|
||||||
Rimoapi::updateWorkorder($workorder->rimo_id, $update);
|
Rimoapi::updateWorkorder($workorder->rimo_id, $update);
|
||||||
@@ -425,7 +434,7 @@ class Preorder extends mfBaseModel {
|
|||||||
|
|
||||||
$new_status = new Preorderstatus($this->status_id);
|
$new_status = new Preorderstatus($this->status_id);
|
||||||
if(!$new_status->id) {
|
if(!$new_status->id) {
|
||||||
$this->log->warning(__METHOD__ . ": Preorder has invalid status!");
|
$this->log->warning(__METHOD__ . ": Preorder has invalid status! ".print_r($this, true));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,6 +592,23 @@ class Preorder extends mfBaseModel {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*if($campaign->oaid_origin == "other") {
|
||||||
|
// oaid in wohneinheit übernehmen, falls in Preorder schon vorhanden
|
||||||
|
if($this->oaid)
|
||||||
|
// oaid aus wohneinheit übernehmen, falls vorhanden
|
||||||
|
|
||||||
|
|
||||||
|
$this->log->debug(__METHOD__.": Kampagne unterstützt keine OAIDs");
|
||||||
|
return true;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if($campaign->oaid_origin == "other") {
|
||||||
|
if($wohneinheit->oaid != $this->oaid) {
|
||||||
|
$this->oaid = $wohneinheit->oaid;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if($this->oaid) {
|
if($this->oaid) {
|
||||||
// If current OAID is from correct Origin then do nothing
|
// If current OAID is from correct Origin then do nothing
|
||||||
if($campaign->oaid_origin == "thetool") {
|
if($campaign->oaid_origin == "thetool") {
|
||||||
@@ -755,6 +781,13 @@ class Preorder extends mfBaseModel {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$campaign = new Preordercampaign($this->preordercampaign_id);
|
||||||
|
|
||||||
|
if($campaign->oaid_origin == "other") {
|
||||||
|
$this->log->debug(__METHOD__.": Kampagne unterstützt keine OAIDs");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(!$this->oaid) {
|
if(!$this->oaid) {
|
||||||
$this->setOrCreateOaid();
|
$this->setOrCreateOaid();
|
||||||
if(!$this->oaid) {
|
if(!$this->oaid) {
|
||||||
|
|||||||
@@ -399,6 +399,28 @@ class PreorderController extends mfBaseController {
|
|||||||
$this->redirect("Preordercampaign");
|
$this->redirect("Preordercampaign");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$new_status = false;
|
||||||
|
if($data['adb_wohneinheit_id']) {
|
||||||
|
$unit = new ADBWohneinheit($data['adb_wohneinheit_id']);
|
||||||
|
if ($unit->id) {
|
||||||
|
$new_status = PreorderstatusModel::getFirst(["code" => $unit->status->code]);
|
||||||
|
if ($unit->hausnummer->status->code > $unit->status->code) {
|
||||||
|
$new_status = PreorderstatusModel::getFirst(["code" => $unit->hausnummer->status->code]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif($data['adb_hausnummer_id']) {
|
||||||
|
$h = new ADBHausnummer($data['adb_hausnummer_id']);
|
||||||
|
if($h->id) {
|
||||||
|
$new_status = PreorderstatusModel::getFirst(["code" => $h->status->code]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($new_status) {
|
||||||
|
$data["status_id"] = $new_status->id;
|
||||||
|
} else {
|
||||||
|
$data["status_id"] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($campaign->product_type != "setup_only") {
|
if($campaign->product_type != "setup_only") {
|
||||||
$data['product_id'] = $r->product_id;
|
$data['product_id'] = $r->product_id;
|
||||||
|
|||||||
@@ -257,8 +257,10 @@ class PreordercampaignController extends mfBaseController {
|
|||||||
|
|
||||||
if($r->oaid_origin == "ofaa") {
|
if($r->oaid_origin == "ofaa") {
|
||||||
$data['oaid_origin'] = "ofaa";
|
$data['oaid_origin'] = "ofaa";
|
||||||
} else {
|
} elseif($r->oaid_origin == "thetool") {
|
||||||
$data['oaid_origin'] = "thetool";
|
$data['oaid_origin'] = "thetool";
|
||||||
|
} else {
|
||||||
|
$data['oaid_origin'] = "other";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($r->product_type == "setup_only") {
|
if($r->product_type == "setup_only") {
|
||||||
@@ -776,7 +778,7 @@ class PreordercampaignController extends mfBaseController {
|
|||||||
|
|
||||||
protected function assignOpenAccessIdsToPreordersAction() {
|
protected function assignOpenAccessIdsToPreordersAction() {
|
||||||
$this->layout()->setTemplate("Preordercampaign/Admin");
|
$this->layout()->setTemplate("Preordercampaign/Admin");
|
||||||
|
|
||||||
$id = $this->request->id;
|
$id = $this->request->id;
|
||||||
if(!is_numeric($id) || !$id) {
|
if(!is_numeric($id) || !$id) {
|
||||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||||
@@ -788,6 +790,11 @@ class PreordercampaignController extends mfBaseController {
|
|||||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||||
$this->redirect("Preordercampaign");
|
$this->redirect("Preordercampaign");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($campaign->oaid_origin == "other") {
|
||||||
|
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs", "warning");
|
||||||
|
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
$assigned_oaids = 0;
|
$assigned_oaids = 0;
|
||||||
$multiple_unit = 0;
|
$multiple_unit = 0;
|
||||||
@@ -865,6 +872,11 @@ class PreordercampaignController extends mfBaseController {
|
|||||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||||
$this->redirect("Preordercampaign");
|
$this->redirect("Preordercampaign");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($campaign->oaid_origin == "other") {
|
||||||
|
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs, somit können keine Workorders erstellt werden", "warning");
|
||||||
|
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
$missing_units = [];
|
$missing_units = [];
|
||||||
$missing_extrefs = [];
|
$missing_extrefs = [];
|
||||||
@@ -992,6 +1004,11 @@ class PreordercampaignController extends mfBaseController {
|
|||||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||||
$this->redirect("Preordercampaign");
|
$this->redirect("Preordercampaign");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($campaign->oaid_origin == "other") {
|
||||||
|
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs", "warning");
|
||||||
|
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
$oaid_assigned = 0;
|
$oaid_assigned = 0;
|
||||||
$missing_units = 0;
|
$missing_units = 0;
|
||||||
@@ -1058,6 +1075,11 @@ class PreordercampaignController extends mfBaseController {
|
|||||||
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
$this->layout()->setFlash("Vorbestellkampagne nicht gefunden", "error");
|
||||||
$this->redirect("Preordercampaign");
|
$this->redirect("Preordercampaign");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($campaign->oaid_origin == "other") {
|
||||||
|
$this->layout()->setFlash("Kampagne unterstützt keine OAIDs", "warning");
|
||||||
|
$this->redirect("Preordercampaign", "Admin", ["id" => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
$oaid_updated = 0;
|
$oaid_updated = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ if ($argc > 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//$netowners = ["estmk", "rml"];
|
//$netowners = ["estmk", "rml"];
|
||||||
$netowners = ["estmk", "rml"];
|
//$netowners = ["estmk", "rml"];
|
||||||
|
$netowners = ["sbidi"];
|
||||||
//$netowners = ["rml"];
|
//$netowners = ["rml"];
|
||||||
$apiEdition = "prod";
|
$apiEdition = "prod";
|
||||||
|
|
||||||
@@ -188,6 +189,11 @@ foreach ($clusters as $cluster_data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$preorder_only_oaid = false;
|
||||||
|
$preorder_only_oaid = $adb_netzgebiet->getOption("preorder_only_oaid");
|
||||||
|
$option_wo_ignore_status = $adb_netzgebiet->getOption("wo_ignore_status");
|
||||||
|
|
||||||
$AddressHelper = new ADBAddressHelper\AddressHelper(["log" => $log, "db" => $adb, "netzgebiet" => $adb_netzgebiet]);
|
$AddressHelper = new ADBAddressHelper\AddressHelper(["log" => $log, "db" => $adb, "netzgebiet" => $adb_netzgebiet]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -436,7 +442,13 @@ foreach ($clusters as $cluster_data) {
|
|||||||
$rimo_oaid = $home->ftus->item[0]->oaidObject->name;
|
$rimo_oaid = $home->ftus->item[0]->oaidObject->name;
|
||||||
$oaid = \OpenAccessIdModel::getFirst(["oaid" => $rimo_oaid]);
|
$oaid = \OpenAccessIdModel::getFirst(["oaid" => $rimo_oaid]);
|
||||||
if (!$oaid) {
|
if (!$oaid) {
|
||||||
echo "!!! Home hat fremde OAID: $rimo_oaid (Home " . $unit->id . "\n";
|
if($preorder_only_oaid) {
|
||||||
|
// if campaign oaid handling "other" just import OAID and nothing else
|
||||||
|
$unit->oaid = $rimo_oaid;
|
||||||
|
$unit->save();
|
||||||
|
} else {
|
||||||
|
echo "!!! Home hat fremde OAID: $rimo_oaid (Home " . $unit->id . "\n";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$unit->oaid = $rimo_oaid;
|
$unit->oaid = $rimo_oaid;
|
||||||
|
|
||||||
@@ -471,7 +483,7 @@ foreach ($clusters as $cluster_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
// TODO maybe check if OAIDs match?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -709,6 +721,8 @@ foreach ($clusters as $cluster_data) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if(($option_wo_ignore_status == "Documented" && $workorder_status == "Documented") || $workorder_status == "Cancelled") continue; // dont import status > Executed
|
||||||
|
|
||||||
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
\mfValuecache::singleton()->set("adbhausnummer-save-nesting-level-".$hausnummer->id, 0);
|
||||||
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
\mfValuecache::singleton()->set("adbwohneinheit-save-nesting-level-".$unit->id, 0);
|
||||||
//echo "Creating Workorder $rimo_workorder_id ($workorder_home_id)\n";
|
//echo "Creating Workorder $rimo_workorder_id ($workorder_home_id)\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user