Preorder: Status can now be changed manually
This commit is contained in:
@@ -58,14 +58,12 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="filter_status">Status</label>
|
||||
<select name="filter[status][]" id="filter_status" class="form-control" multiple="multiple">
|
||||
<option value="new" <?=(isset($filter) && array_key_exists("status", $filter) && in_array("new", $filter['status'])) ? "selected='selected'" : ""?>>Aufgenommen</option>
|
||||
<option value="approved" <?=(isset($filter) && array_key_exists("status", $filter) && in_array("approved", $filter['status'])) ? "selected='selected'" : ""?>>Freigegeben</option>
|
||||
<option value="pipework" <?=(isset($filter) && array_key_exists("status", $filter) && in_array("pipework", $filter['status'])) ? "selected='selected'" : ""?>>Tiefbau</option>
|
||||
<option value="linework" <?=(isset($filter) && array_key_exists("status", $filter) && in_array("linework", $filter['status'])) ? "selected='selected'" : ""?>>Leitungsbau</option>
|
||||
<option value="finished" <?=(isset($filter) && array_key_exists("status", $filter) && in_array("finished", $filter['status'])) ? "selected='selected'" : ""?>>Hergestellt</option>
|
||||
<?php foreach(PreorderstatusModel::getAll() as $status): ?>
|
||||
<option value="<?=$status->id?>" <?=(isset($filter) && array_key_exists("status", $filter) && in_array($status->id, $filter['status'])) ? "selected='selected'" : ""?>><?=$status->code?> - <?=$status->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -258,7 +256,7 @@
|
||||
<?=__($preorder->type, "preorder")?><br />
|
||||
<?=$preorder->ucode?>
|
||||
</td>
|
||||
<td>Aufgenommen</td>
|
||||
<td class="status"><?=$preorder->status->code?> - <?=$preorder->status->name?></td>
|
||||
<?php if($preorder->building_id): ?>
|
||||
<td><?=$preorder->building->street?><br /><?=$preorder->building->zip?> <?=$preorder->building->city?></td>
|
||||
<?php elseif($preorder->adb_hausnummer_id): ?>
|
||||
|
||||
@@ -35,7 +35,20 @@
|
||||
<td><?=$preorder->campaign->name?></td>
|
||||
</tr><tr>
|
||||
<th>Status:</th>
|
||||
<td class="text-monospace"><?=$preorder->status->code?> - <?=$preorder->status->name?></td>
|
||||
<td class="text-monospace">
|
||||
<span id="preorder-detail-status-<?=$preorder->id?>-text"><span id="preorder-detail-status-<?=$preorder->id?>-statustext"><?=$preorder->status->code?> - <?=$preorder->status->name?></span> <a href="#" onclick="return toggleStatusControl(<?=$preorder->id?>, <?=$preorder->status_id?>)"><i class="fas fa-fw fa-edit"></i></a></span>
|
||||
<div class="input-group" id="preorder-detail-status-<?=$preorder->id?>-input" style="display:none">
|
||||
<select class="form-control">
|
||||
<?php foreach(PreorderstatusModel::getAll() as $status): ?>
|
||||
<option value="<?=$status->id?>" <?=($preorder->status_id == $status->id) ? "selected='selected'" : ""?>><?=$status->code?> - <?=$status->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary" title="Speichern" onclick="savePreorderStatusControl(<?=$preorder->id?>, 'email')"><i class="fas fa-check"></i></button>
|
||||
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleStatusControl(<?=$preorder->id?>, 'email')"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>OAID:</th>
|
||||
<td class="text-monospace text-pink"><?=$preorder->oaid?></td>
|
||||
@@ -329,4 +342,42 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function toggleStatusControl(pid, sid) {
|
||||
$("#preorder-detail-status-" + pid + "-input select").val(sid);
|
||||
$("#preorder-detail-status-" + pid + "-text").toggle();
|
||||
$("#preorder-detail-status-" + pid + "-input").toggle();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function savePreorderStatusControl(pid) {
|
||||
if(!Number.isInteger(pid) || pid < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var value = $("#preorder-detail-status-" + pid + "-input select").val();
|
||||
|
||||
$.post("<?=self::getUrl("Preorder","Api")?>",
|
||||
{
|
||||
'do': "updateStatus",
|
||||
id: pid,
|
||||
status_id: value
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
$("#preorder-detail-status-" + pid + "-statustext").text(success.result.status_code + " - " + success.result.status_text);
|
||||
|
||||
$("#preorder-detail-status-" + pid + "-text").addClass("text-success");
|
||||
setTimeout(() => { $("#preorder-detail-status-" + pid + "-text").removeClass("text-success") }, 1500);
|
||||
|
||||
$("#preorder-" + pid + " .status").text(success.result.status_code + " - " + success.result.status_text);
|
||||
$("#preorder-" + pid + " .status").addClass("text-success");
|
||||
setTimeout(() => { $("#preorder-" + pid + " .status").removeClass("text-success") }, 1500);
|
||||
toggleStatusControl(pid);
|
||||
}
|
||||
},
|
||||
'json');
|
||||
}
|
||||
</script>
|
||||
@@ -43,15 +43,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<!--div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="name">Taktung *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="increment" class="form-control" name="increment" id="increment" value="<?=($plan->increment_first && $plan->increment) ? $plan->increment_first."/".$plan->increment : ""?>" placeholder="60/30" />
|
||||
</div>
|
||||
</div>
|
||||
</div-->
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="first">Destinations kopieren von bestehendem Tarifpaket</label>
|
||||
<label class="col-lg-2 col-form-label" for="first">Zonen und Destinationen aus bestehendem Tarifpaket kopieren</label>
|
||||
<div class="col-lg-10">
|
||||
<select name="copy_from_plan_id" class="form-control">
|
||||
<option value=""></option>
|
||||
@@ -63,10 +65,11 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="first">oder Destinations Importieren</label>
|
||||
<label class="col-lg-2 col-form-label" for="first">oder Zonen und Destinationen neu importieren</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="file" class="form-control" name="voiceplanfile" />
|
||||
<small class="text-danger">ACHTUNG: Bestehende Destinations werden gelöscht!</small>
|
||||
Zonen File: <input type="file" class="form-control" name="voiceplanzonefile" />
|
||||
Destinations File: <input type="file" class="form-control" name="voiceplandestinationfile" />
|
||||
<?php if($voiceplan->id): ?><small class="text-danger">ACHTUNG: Bestehende Zonen und Destinationen werden gelöscht!</small><?php endif; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -151,7 +151,7 @@ class AdminController extends mfBaseController {
|
||||
}
|
||||
|
||||
protected function ivtAdminImportAction() {
|
||||
exit;
|
||||
//exit;
|
||||
$doit = false;
|
||||
if($this->request->doit == 1) {
|
||||
$doit = true;
|
||||
|
||||
@@ -211,6 +211,8 @@ class Preorder extends mfBaseModel {
|
||||
return $this->ucode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function generateNewUcode() {
|
||||
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
|
||||
$charsLength = strlen($chars);
|
||||
@@ -221,6 +223,25 @@ class Preorder extends mfBaseModel {
|
||||
return $ucode;
|
||||
}
|
||||
|
||||
public function createCifCode() {
|
||||
$cifcode = $this->generateNewCifcode();
|
||||
while(PreorderModel::search(['cifcode' => $cifcode])) {
|
||||
$cifcode = $this->generateNewCifcode();
|
||||
}
|
||||
$this->cifcode = $cifcode;
|
||||
return $this->cifcode;
|
||||
}
|
||||
|
||||
private function generateNewCifcode() {
|
||||
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxzy';
|
||||
$charsLength = strlen($chars);
|
||||
$cifcode = '';
|
||||
for ($i = 0; $i < 16; $i++) {
|
||||
$cifcode .= $chars[rand(0, $charsLength - 1)];
|
||||
}
|
||||
return $cifcode;
|
||||
}
|
||||
|
||||
public function getApiArray() {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
@@ -233,6 +254,8 @@ class Preorder extends mfBaseModel {
|
||||
|
||||
$a = [];
|
||||
$a['code'] = strtoupper($this->ucode);
|
||||
$a['cifcode'] = $this->cifcode;
|
||||
$a['cifurl'] = $this->cifurl;
|
||||
$a['oaid'] = $this->oaid;
|
||||
$a['extref'] = $this->extref;
|
||||
$a['status'] = $this->getProperty("status")->getApiArray();
|
||||
|
||||
@@ -249,6 +249,15 @@ class PreorderController extends mfBaseController {
|
||||
unset($filter['oaid']);
|
||||
}
|
||||
|
||||
if(array_key_exists("status", $filter) && is_array($filter['status']) && count($filter['status'])) {
|
||||
$new_filter['status_id'] = [];
|
||||
foreach($filter["status"] as $s) {
|
||||
if(is_numeric($s) && $s > 0) {
|
||||
$new_filter['status_id'][] = $s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if(array_key_exists("attributes", $filter) && count($filter['attributes'])) {
|
||||
|
||||
}*/
|
||||
@@ -785,6 +794,9 @@ class PreorderController extends mfBaseController {
|
||||
case "getFilteredPreorders":
|
||||
$return = $this->getFilteredPreordersApi();
|
||||
break;
|
||||
case "updateStatus":
|
||||
$return = $this->updateStatusApi();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
@@ -926,4 +938,32 @@ class PreorderController extends mfBaseController {
|
||||
|
||||
}
|
||||
|
||||
private function updateStatusApi() {
|
||||
$preorder_id = $this->request->id;
|
||||
|
||||
if(!is_numeric($preorder_id) || $preorder_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$preorder = new Preorder($preorder_id);
|
||||
if(!$preorder->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$status_id = $this->request->status_id;
|
||||
if(!is_numeric($status_id) || $status_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$status = new Preorderstatus($status_id);
|
||||
if(!$status->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$preorder->status_id = $status_id;
|
||||
$preorder->save();
|
||||
|
||||
return ["message" => "Status saved successfully", "id" => $preorder_id, "status_id" => $status->id, "status_code" => $status->code, "status_text" => $status->name];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -321,21 +321,23 @@ class PreorderModel {
|
||||
if(array_key_exists("status_id", $filter)) {
|
||||
$status_id = $filter['status_id'];
|
||||
if(is_numeric($status_id)) {
|
||||
$where .= " AND status_id=$status_id";
|
||||
$where .= " AND tt_preorder.status_id=$status_id";
|
||||
} elseif(is_array($status_id)) {
|
||||
$where .= " AND tt_preorder.status_id IN (". implode(",", $status_id).")";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("<status_id", $filter)) {
|
||||
$status_id = $filter['<status_id'];
|
||||
if(is_numeric($status_id)) {
|
||||
$where .= " AND status_id < $status_id";
|
||||
$where .= " AND tt_preorder.status_id < $status_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists(">status_id", $filter)) {
|
||||
$status_id = $filter['>status_id'];
|
||||
if(is_numeric($status_id)) {
|
||||
$where .= " AND status_id > $status_id";
|
||||
$where .= " AND tt_preorder.status_id > $status_id";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,6 +457,13 @@ class PreorderModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("cifcode", $filter)) {
|
||||
$cifcode = FronkDB::singleton()->escape($filter['cifcode']);
|
||||
if($cifcode) {
|
||||
$where .= " AND cifcode LIKE '$cifcode'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("oaid", $filter)) {
|
||||
$oaid = $filter['oaid'];
|
||||
if($oaid) {
|
||||
|
||||
@@ -44,7 +44,7 @@ class PreorderstatusModel {
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Preorderstatus", "*");
|
||||
if($db->num_rows($res)) {
|
||||
@@ -57,7 +57,7 @@ class PreorderstatusModel {
|
||||
}
|
||||
|
||||
public static function getFirst($filter = false) {
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Preorderstatus", "*", "$where ORDER BY code, name");
|
||||
@@ -74,7 +74,7 @@ class PreorderstatusModel {
|
||||
}
|
||||
|
||||
public static function count($filter) {
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM Preorderstatus
|
||||
@@ -93,7 +93,7 @@ class PreorderstatusModel {
|
||||
|
||||
public static function search($filter, $limit = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
|
||||
|
||||
@@ -65,6 +65,44 @@ class Voiceplan extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
public function importZonesFromCsv(File $file) {
|
||||
if(!$this->id) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
$i = 0;
|
||||
$filename = $file->getFullPath();
|
||||
$input = fopen($filename, "r");
|
||||
while($csv = fgetcsv($input, 0, ",")) {
|
||||
$i++;
|
||||
if($i == 1) continue;
|
||||
|
||||
if(!trim($csv[0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = trim($csv[0]);
|
||||
$prefix = trim($csv[1]);
|
||||
$price_ek = str_replace(",",".", trim($csv[2]));
|
||||
$price_vk = str_replace(",",".", trim($csv[3]));
|
||||
|
||||
if(!$name || !$prefix || !$price_ek || !$price_vk) {
|
||||
$this->log->warning("not Importing Voiceplandestination with empty value: destination: $name | prefix: $prefix | ek: $price_ek | vk: $price_vk");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
} catch(Exception $e) {
|
||||
echo $e->getCode().": ".$e->getMessage();exit;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getProperty($name) {
|
||||
if($this->$name == null) {
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class VoiceplanController extends mfBaseController {
|
||||
$data['name'] = $r->name;
|
||||
$data['description'] = $r->description;
|
||||
|
||||
if($r->increment) {
|
||||
/*if($r->increment) {
|
||||
$increments = explode("/",$r->increment);
|
||||
if(count($increments) != 2) {
|
||||
$this->layout()->setFlash("Ungültige Taktung", "error");
|
||||
@@ -134,7 +134,7 @@ class VoiceplanController extends mfBaseController {
|
||||
|
||||
$data["increment_first"] = $increments[0];
|
||||
$data["increment"] = $increments[1];
|
||||
}
|
||||
}*/
|
||||
|
||||
if(!$data['name']) {
|
||||
$this->layout()->setFlash("Bitte Name eingeben", "error");
|
||||
@@ -153,39 +153,69 @@ class VoiceplanController extends mfBaseController {
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
|
||||
if(is_array($_FILES) && array_key_exists("voiceplanfile", $_FILES) && !$_FILES['voiceplanfile']['error']) {
|
||||
// import zones
|
||||
if(is_array($_FILES) && array_key_exists("voiceplanzonefile", $_FILES) && !$_FILES['voiceplanzonefile']['error']) {
|
||||
// look for uploaded import file
|
||||
try {
|
||||
// returns File object or throws Exception on error
|
||||
$file = mfUpload::handleFormUpload("voiceplanfile");
|
||||
$file = mfUpload::handleFormUpload("voiceplanzonefile");
|
||||
} catch (Exception $ex) {
|
||||
$this->layout()->setFlash("Fehler beim Dateiupload: ".$ex->getMessage(), "error");
|
||||
$this->layout()->setFlash("Fehler beim Upload des Zonenfiles: ".$ex->getMessage(), "error");
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
|
||||
$vpf = VoiceplanFileModel::create([
|
||||
'voiceplan_id' => $id,
|
||||
'file_id' => $file->id,
|
||||
'name' => "voiceplan-import-".date("Y-m-d_H-i-s").".csv",
|
||||
'name' => "voiceplan-zone-import-".date("Y-m-d_H-i-s").".csv",
|
||||
]);
|
||||
$voiceplanfile_id = $vpf->save();
|
||||
if(!$voiceplanfile_id) {
|
||||
$voiceplanzonefile_id = $vpf->save();
|
||||
if(!$voiceplanzonefile_id) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern der hochgeladenen Datei", "error");
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
|
||||
// if file was uploaded successfully, delete old destinations
|
||||
// if file was uploaded successfully, delete old destinations and zones
|
||||
foreach(VoiceplandestinationModel::search(['voiceplan_id' => $id]) as $destination) {
|
||||
$destination->delete();
|
||||
|
||||
}
|
||||
foreach(VoiceplanzoneModel::search(['voiceplan_id' => $id]) as $zone) {
|
||||
$zone->delete();
|
||||
}
|
||||
|
||||
if(!$voiceplan->importDestinationsFromCsv($file)) {
|
||||
$this->layout()->setFlash("Fehler beim Importieren!", "error");
|
||||
|
||||
if(!$voiceplan->importZonesFromCsv($file)) {
|
||||
$this->layout()->setFlash("Fehler beim Importieren der Zonen!", "error");
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
// import destinations
|
||||
if(is_array($_FILES) && array_key_exists("voiceplandestinationfile", $_FILES) && !$_FILES['voiceplandestinationfile']['error']) {
|
||||
// look for uploaded import file
|
||||
try {
|
||||
// returns File object or throws Exception on error
|
||||
$file = mfUpload::handleFormUpload("voiceplandestinationfile");
|
||||
} catch (Exception $ex) {
|
||||
$this->layout()->setFlash("Fehler beim Upload des Destinationfiles: ".$ex->getMessage(), "error");
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
$vpf = VoiceplanFileModel::create([
|
||||
'voiceplan_id' => $id,
|
||||
'file_id' => $file->id,
|
||||
'name' => "voiceplan-dest-import-".date("Y-m-d_H-i-s").".csv",
|
||||
]);
|
||||
$voiceplandestinationfile_id = $vpf->save();
|
||||
if(!$voiceplandestinationfile_id) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern der hochgeladenen Datei", "error");
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
if(!$voiceplan->importDestinationsFromCsv($file)) {
|
||||
$this->layout()->setFlash("Fehler beim Importieren!", "error");
|
||||
return $this->editAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Sprachtarifpaket erfolgreich gespeichert!", "success");
|
||||
|
||||
@@ -70,8 +70,12 @@ class VoiceplandestinationModel {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT COUNT(*) as cnt FROM Voiceplandestination
|
||||
WHERE $where
|
||||
$sql = "SELECT COUNT(*) as cnt FROM (
|
||||
SELECT Voiceplandestination.id FROM Voiceplandestination
|
||||
LEFT JOIN Voiceplanzone ON (Voiceplanzone.id = Voiceplandestination.voiceplanzone_id)
|
||||
WHERE $where
|
||||
GROUP BY Voiceplandestination.id
|
||||
) as v
|
||||
";
|
||||
|
||||
$res = $db->query($sql);
|
||||
@@ -87,7 +91,8 @@ class VoiceplandestinationModel {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$sql = "SELECT * FROM Voiceplandestination
|
||||
$sql = "SELECT Voiceplandestination.* FROM Voiceplandestination
|
||||
LEFT JOIN Voiceplanzone ON (Voiceplanzone.id = Voiceplandestination.voiceplanzone_id)
|
||||
WHERE $where
|
||||
ORDER BY destination,prefix";
|
||||
|
||||
@@ -126,6 +131,13 @@ class VoiceplandestinationModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("voiceplan_id", $filter)) {
|
||||
$voiceplan_id = $filter['voiceplan_id'];
|
||||
if(is_numeric($voiceplan_id)) {
|
||||
$where .= " AND Voiceplanzone.voiceplan_id = $voiceplan_id";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("name", $filter)) {
|
||||
$name = $db->escape($filter['name']);
|
||||
if($name) {
|
||||
|
||||
@@ -28,6 +28,17 @@ final class AddVoiceplanZone extends AbstractMigration
|
||||
$table->removeColumn("increment");
|
||||
$table->renameColumn("voiceplan_id", "voiceplanzone_id");
|
||||
$table->update();
|
||||
|
||||
$table = $this->table("VoiceplanFile");
|
||||
$table->addColumn("voiceplan_id", "integer", ["null" => false]);
|
||||
$table->addColumn("file_id", "integer", ["null" => false]);
|
||||
$table->addColumn("name", "string", ["null" => false, "limit" => 255]);
|
||||
$table->addColumn("description", "text", ["null" => true, "default" => null]);
|
||||
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$table->addColumn("create", "integer", ["null" => false]);
|
||||
$table->addColumn("edit", "integer", ["null" => false]);
|
||||
$table->create();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
@@ -38,6 +49,8 @@ final class AddVoiceplanZone extends AbstractMigration
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("VoiceplanFile")->drop()->save();
|
||||
|
||||
$table = $this->table("Voiceplandestination");
|
||||
$table->renameColumn("voiceplanzone_id", "voiceplan_id");
|
||||
$table->addColumn("purchase_price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
||||
|
||||
@@ -23,9 +23,9 @@ final class AddContractTables extends AbstractMigration
|
||||
$contract->addColumn("product_external", "integer", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
||||
$contract->addColumn("product_external_id", "integer", ["null" => true, "default" => null]);
|
||||
$contract->addColumn("price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
||||
$contract->addColumn("price_setup", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
||||
$contract->addColumn("price_nne", "decimal", ["null" => false, "default" => null, "precision" => 14, "scale" => 4]);
|
||||
$contract->addColumn("price_nbe", "decimal", ["null" => false, "default" => null, "precision" => 14, "scale" => 4]);
|
||||
$contract->addColumn("price_setup", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$contract->addColumn("price_nne", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$contract->addColumn("price_nbe", "decimal", ["null" => false, "default" => 0, "precision" => 14, "scale" => 4]);
|
||||
$contract->addColumn("billing_delay", "integer", ["null" => false, "default" => 0]);
|
||||
$contract->addColumn("billing_period", "integer", ["null" => false, "default" => 1]);
|
||||
$contract->addColumn("order_date", "integer", ["null" => true, "default" => null]);
|
||||
@@ -102,7 +102,7 @@ final class AddContractTables extends AbstractMigration
|
||||
$cj = $this->table("Contractjournal");
|
||||
$cj->addColumn("contract_id", "integer", ["null" => false]);
|
||||
$cj->addColumn("type", "string", ["null" => false, "limit" => 64]);
|
||||
$cj->addColumn("string", "string", ["null" => true, "default" => null, "limit" => 64]);
|
||||
$cj->addColumn("value", "string", ["null" => true, "default" => null, "limit" => 64]);
|
||||
$cj->addColumn("text", "text", ["null" => true, "default" => null]);
|
||||
$cj->addColumn("create_by", "integer", ["null" => false]);
|
||||
$cj->addColumn("edit_by", "integer", ["null" => false]);
|
||||
|
||||
35
db/migrations/20231103123714_preorder_add_cif_token.php
Normal file
35
db/migrations/20231103123714_preorder_add_cif_token.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class PreorderAddCifToken extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Preorder");
|
||||
$table->addColumn("ciftoken", "string", ["null" => true, "default" => null, "limit" => 64, "after" => "ucode"]);
|
||||
$table->addColumn("cifurl", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "ciftoken"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Preorder");
|
||||
$table->removeColumn("cifurl");
|
||||
$table->removeColumn("ciftoken");
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,6 +173,14 @@ h1, h2, h3, h4, h5, h6 {
|
||||
margin-right: 5px !important;
|
||||
}
|
||||
|
||||
.select2-results > .select2-results__options {
|
||||
max-height: 400px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-results > .select2-results__options {
|
||||
max-height: 400px !important;
|
||||
}
|
||||
|
||||
#banned_rimo_fcp + .select2-container .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: var(--red) !important;
|
||||
}
|
||||
|
||||
@@ -638,15 +638,15 @@ paths:
|
||||
$ref: '#/components/schemas/preorderStatusDetail'
|
||||
'401':
|
||||
description: Unauthorized
|
||||
/preorder/{code}:
|
||||
/preorder/{id}:
|
||||
get:
|
||||
tags:
|
||||
- preorder
|
||||
summary: Details und Status zur Vorbestellung
|
||||
description: Gibt Details zum Status der Vorbestellung/Bestellung zurück
|
||||
description: Gibt Details zum Status der Vorbestellung/Bestellung zurück. id kann automatisch generierter **code** der Vorbestellung, **OAID** der Wohneinheit oder providereigene ID (**extref**) sein.
|
||||
operationId: getPreorderStatus
|
||||
parameters:
|
||||
- name: code
|
||||
- name: id
|
||||
in: path
|
||||
description: Automatisch generierter **code** der Vorbestellung, **OAID** der Wohneinheit oder providereigene ID (**extref**)
|
||||
required: true
|
||||
@@ -708,7 +708,7 @@ paths:
|
||||
description: Erstellt einen Storno Request
|
||||
operationId: cancelPreorder
|
||||
parameters:
|
||||
- name: code
|
||||
- name: id
|
||||
in: path
|
||||
description: Automatisch generierter **code** der Vorbestellung, **OAID** der Wohneinheit oder providereigene ID (**extref**)
|
||||
required: true
|
||||
@@ -739,6 +739,48 @@ paths:
|
||||
description: Keine Berechtigung oder Storno Request bereits vorhanden
|
||||
'404':
|
||||
description: Bestellung nicht gefunden oder bereits storniert
|
||||
/preorder/{id}/clientIntallationFinished:
|
||||
post:
|
||||
tags:
|
||||
- preorder
|
||||
summary: Bestellung auf Status 200 - Rohr im Gebäude setzen
|
||||
description: Setzt Status der Bestellung auf 200 - Rohr im Gebäude. Wird gesetzt wenn beim Kunden die Lehrrohrinstallation abgeschlossen ist.
|
||||
operationId: setClientIntallationFinished
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
description: Automatisch generierter **code** der Vorbestellung, **OAID** der Wohneinheit oder providereigene ID (**extref**)
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
'401':
|
||||
description: Unauthorized
|
||||
'404':
|
||||
description: Vorbestellung nicht gefunden
|
||||
/preorder/{id}/inhouseInstallationFinished:
|
||||
post:
|
||||
tags:
|
||||
- preorder
|
||||
summary: Bestellung auf Status 500 - Fertiggestellt setzen
|
||||
description: Setzt Status der Bestellung auf 500 - Fertiggestellt. Wird gesetzt, wenn beim Kunden alle Installationsarbeiten abgeschlossen sind und der Service aktiv ist.
|
||||
operationId: setInhouseIntallationFinished
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
description: Automatisch generierter **code** der Vorbestellung, **OAID** der Wohneinheit oder providereigene ID (**extref**)
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
'401':
|
||||
description: Unauthorized
|
||||
'404':
|
||||
description: Vorbestellung nicht gefunden
|
||||
components:
|
||||
schemas:
|
||||
timestampString:
|
||||
@@ -1371,6 +1413,14 @@ components:
|
||||
type: string
|
||||
description: Statustext
|
||||
example: Fiber installation work assigned
|
||||
ciftoken:
|
||||
type: string
|
||||
description: Customer Installation Feedback Token
|
||||
example: "XArjnWQXGq4a8JWF"
|
||||
cifurl:
|
||||
type: string
|
||||
description: Customer Installation Feedback Url
|
||||
example: "https://pro.ichwillglasfaser.at/ClientSubmit/finishedInstallationWork?c=XArjnWQXGq4a8JWF"
|
||||
connectionType:
|
||||
type: string
|
||||
enum: [single-dwelling, multi-dwelling, apartment-building, apartment, business]
|
||||
|
||||
@@ -110,6 +110,10 @@ while($csv = fgetcsv($input, 0, ";")) {
|
||||
$strasse_name = trim($m[1]);
|
||||
}
|
||||
|
||||
if($hausnummer_extref == "25012392") {
|
||||
// Zettling 53 is 25011191, would be overwritten with this extref
|
||||
continue;
|
||||
}
|
||||
|
||||
if($strasse_name == "GST") continue;
|
||||
if(preg_match('/^L\d+/',$strasse_name) && !$adrcd) continue;
|
||||
|
||||
@@ -15,23 +15,7 @@ $me = new User(1);
|
||||
define("INTERNAL_USER_ID", $me->id);
|
||||
define("INTERNAL_USER_USERNAME", $me->username);
|
||||
|
||||
$contract = new Contract(22);
|
||||
require_once(APPDIR."Contractconfig/hooks/Contractconfig_Hook.php");
|
||||
require_once(APPDIR."Contractconfig/hooks/Voicenumberblock.php");
|
||||
|
||||
$hook = new Contractconfig_Hook_Voicenumberblock($contract);
|
||||
|
||||
if(!$hook->isResponsible()) {
|
||||
echo "is responsible: no\n";
|
||||
exit;
|
||||
} else {
|
||||
$hook->afterSave();
|
||||
}
|
||||
if($hook->errors) {
|
||||
echo "Fehler beim speichern: \n";
|
||||
foreach($hook->errors as $error) {
|
||||
echo $error."\n";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
echo "All done.\n";
|
||||
$preorder = new Preorder(5458);
|
||||
$preorder->createCifCode();
|
||||
echo $preorder->cifcode;
|
||||
echo "\n";
|
||||
Reference in New Issue
Block a user