Merge branch 'fronkdev' of code.fronk.at:fronk/thetool into fronkdev

This commit is contained in:
Frank Schubert
2025-03-28 13:43:31 +01:00
27 changed files with 2350 additions and 175 deletions

View File

@@ -22,18 +22,29 @@
<h3>RTR Reporting CSVs herunterladen</h3>
<div class="card">
<div class="card-body">
<div class="row col mb-3">
<a class="btn btn-primary" href="<?=self::getUrl("Admin", "rtrReporting", ["do" => "a10report"])?>"><i class="fas fa-fw fa-download"></i> A10</a>
</div>
<div class="row col mb-3">
<a class="btn btn-primary" href="<?=self::getUrl("Admin", "rtrReporting", ["do" => "b10report"])?>"><i class="fas fa-fw fa-download"></i> B10</a>
</div>
<div class="row col mb-3">
<a class="btn btn-primary" href="<?=self::getUrl("Admin", "rtrReporting", ["do" => "c10report"])?>"><i class="fas fa-fw fa-download"></i> C10</a>
<div class="row">
<div class="col-6">
<div class="row col mb-3">
<a class="btn btn-primary" href="<?=self::getUrl("Admin", "rtrReporting", ["do" => "a10report"])?>"><i class="fas fa-fw fa-download"></i> A10</a>
</div>
<div class="row col mb-3">
<a class="btn btn-primary" href="<?=self::getUrl("Admin", "rtrReporting", ["do" => "b10report"])?>"><i class="fas fa-fw fa-download"></i> B10</a>
</div>
<div class="row col mb-3">
<a class="btn btn-primary" href="<?=self::getUrl("Admin", "rtrReporting", ["do" => "c10report"])?>"><i class="fas fa-fw fa-download"></i> C10</a>
</div>
</div>
<div class="col-6">
<div class="row col mb-3">
<a class="btn btn-primary" href="<?=self::getUrl("Admin", "rtrReporting", ["do" => "activeVoiceNumbersReport"])?>"><i class="fas fa-fw fa-download"></i> Aktive Telefonnummern</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -8,8 +8,12 @@
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("ConstructionConsentProject")?>">Zustimmungserklärungsprojekte</a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("ConstructionConsent")?>">Zustimmungserklärungen</a></li>
<?php if(isset($item)): ?>
<li class="breadcrumb-item"><a href="<?=self::getUrl("ConstructionConsent", "View", ["id" => $item->id])?>"><?=htmlentities($item->name)?></a></li>
<li class="breadcrumb-item active">bearbeiten</li>
<?php endif; ?>
<li class="breadcrumb-item active">
<?= ($Action == "add") ? "Neue " : "" ?>Zustimmungserklärung <?= ($Action == "edit") ? "bearbeiten " : "" ?>
</li>
</ol>
</div>
<h4 class="page-title">Zustimmungserklärung</h4>
@@ -37,7 +41,7 @@
<label class="col-lg-2 col-form-label" for="constructionconsentproject_id">Projekt *</label>
<div class="col-lg-10">
<select class="form-control" name="constructionconsentproject_id" id="constructionconsentproject_id">
<?php foreach(ConstructionConsentProject::getAll() as $project): ?>
<?php foreach(ConstructionConsentProject::search(['id' => $allowed_projects]) as $project): ?>
<option value="<?=$project->id?>" <?=(isset($project_id) && $project_id == $project->id || isset($item) && $item->constructionconsentproject_id == $project->id) ? "selected='selected'" : ""?>><?=$project->name?></option>
<?php endforeach; ?>
</select>
@@ -204,7 +208,7 @@
<h5 class="card-header">Plan Vorschau <button type='button' id="delete-rimo-plan" class='ml-2 btn btn-sm btn-outline-danger pointer <?=($item->file && $item->file->file && $item->file->file->fileExists()) ? "" : "hidden" ?>' onclick='deletePlan()'><i class='fas fa-fw fa-trash'></i> Plan löschen</button></h5>
<div class="card-body" id="rimo-plan-container">
<input type="hidden" name="submit_plan_file_id" id="submit_plan_file_id" value="" />
<img id="plan_preview" style="max-width: 1200px;" <?=($item->file && $item->file->file && $item->file->file->fileExists()) ? "src=".$item->file->file->asDataUrl()."" : "" ?> />
<img id="plan_preview" style="max-width: 1200px;" <?=(isset($item) && $item->file && $item->file->file && $item->file->file->fileExists()) ? "src=".$item->file->file->asDataUrl()."" : "" ?> />
</div>
</div>

View File

@@ -37,7 +37,7 @@ $pagination_entity_name = "Zustimmungserklärungen";
<label class="form-label" for="filter_project_id">Projekt</label>
<select name="filter[project_id]" id="filter_project_id" class="form-control">
<option value="">Alle</option>
<?php foreach(ConstructionConsentProject::getAll() as $p): ?>
<?php foreach(ConstructionConsentProject::search(['id' => $allowed_projects]) as $p): ?>
<option value="<?=$p->id?>" <?=(is_array($filter) && array_key_exists("project_id", $filter) && $p->id == $filter["project_id"]) ? "selected='selected'" : ""?>><?=$p->name?></option>
<?php endforeach; ?>
</select>
@@ -328,10 +328,10 @@ $pagination_entity_name = "Zustimmungserklärungen";
<th>Name</th>
<th>Objekttyp</th>
<th>Objektadresse</th>
<th>KG</th>
<th>GST-Nr.</th>
<th>Einlagezahl</th>
<th class="text-center">Anzahl Eigentümer</th>
<th>Anfragestatus</th>
<th>Anfrageresultat</th>
<th></th>
</tr>
@@ -351,9 +351,9 @@ $pagination_entity_name = "Zustimmungserklärungen";
<?=$item->adb_hausnummer->strasse->gemeinde->name?>
<?php endif; ?>
</td>
<td><?=$item->kg?></td>
<td><?=$item->gst?></td>
<td><?=$item->ez?></td>
<td class="text-center">
<?php
@@ -364,14 +364,16 @@ $pagination_entity_name = "Zustimmungserklärungen";
<?=$owner_count?>
<?php } ?>
</td>
<td><?=($item->status) ? __($item->status,"consent") : ""?></td>
<td>
<?php
// Determine the status based on the counts
$status_class = 'blue'; // Default to blue (all open)
if (isset($item->owner_result_counts['denied']) && $item->owner_result_counts['denied'] > 0) {
$status_class = 'red'; // Red if at least one denied
$approve_override = $item->approve_override;
if (isset($approve_override) && $approve_override) {
$status_class = 'green'; // Blue if approve override
} elseif (isset($item->owner_result_counts['denied']) && $item->owner_result_counts['denied'] > 0) {
$status_class = 'red';
// Red if at least one denied
} elseif ((isset($item->owner_result_counts['unresolvable']) && $item->owner_result_counts['unresolvable'] > 0) ||
(isset($item->owner_result_counts['moved']) && $item->owner_result_counts['moved'] > 0)) {
$status_class = 'yellow'; // Yellow if at least one unresolvable or moved

View File

@@ -111,6 +111,12 @@ $pagination_entity_name = "Adressen";
Die Nutzung der Liegenschaft seitens BB dient der Eigenversorgung der GE und/oder dessen Nutzer(in) und wird dieser entgeltlos zugestimmt
</td>
</tr>
<tr>
<th>Genehmigung überschreiben</th>
<td>
<input type="checkbox" id="approve_override" class="switchery" data-size="small" data-color="#25b343" data-toggle-param="approve_override" <?=($item->approve_override) ? "checked='checked'" : ""?> />
</td>
</tr>
<?php if($item->object_type == "building"): ?>
<tr>
<td colspan="2"><h4>Metadaten</h4></td>
@@ -223,15 +229,21 @@ $pagination_entity_name = "Adressen";
<th></th>
</tr>
<?php foreach($item->contacts as $type => $contacts): ?>
<?php foreach($contacts as $contact): ?>
<tr>
<?php foreach($contacts as $contact):
if (substr($contact->phone, 0, 2) != "43" && substr($contact->phone, 0, 2) != "49" && substr($contact->phone, 0, 1) != "0") {
$phone = "0".$contact->phone;
} else {
$phone = $contact->phone;
}
?>
<tr id="contact-data-<?=$contact->id?>" data-name="<?=$contact->name?>" data-phone="<?=$phone?>" data-fax="<?=$contact->fax?>" data-email="<?=$contact->email?>" data-type="<?=$contact->type?>" data-street="<?=$contact->street?>" data-zip="<?=$contact->zip?>" data-city="<?=$contact->city?>" data-country="<?=$contact->country?>">
<td class="text-monospace"><?=__($contact->type, "consent")?></td>
<td><?=$contact->name?></td>
<td><?=$contact->phone?></td>
<td><?=$phone?></td>
<td><?=$contact->fax?></td>
<td><?=$contact->email?></td>
<td>
<!--a href="<?=self::getUrl("ConstructionConsentContact", "edit", ["contact_id" => $contact->id])?>" title="Ansprechpartner bearbeiten"><i class="far fa-fw fa-edit"></i></a-->
<a href="#" title="Ansprechpartner bearbeiten" onclick="editContact(<?=$contact->id?>); return false;"><i class="far fa-fw fa-edit"></i></a>
<a href="<?=self::getUrl("ConstructionConsentContact", "delete", ["contact_id" => $contact->id])?>" onclick="if(!confirm('Ansprechpartner wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
@@ -303,8 +315,14 @@ $pagination_entity_name = "Adressen";
<th>Ergebnis</th>
<th></th>
</tr>
<?php foreach($item->owners as $owner): ?>
<tr id="owner-data-<?=$owner->id?>" data-title="<?=$owner->title?>" data-firstname="<?=$owner->firstname?>" data-lastname="<?=$owner->lastname?>" data-street="<?=$owner->street?>" data-zip="<?=$owner->zip?>" data-city="<?=$owner->city?>" data-country="<?=$owner->country?>" data-phone="<?=$owner->phone?>" data-phone2="<?=$owner->phone2?>" data-fax="<?=$owner->fax?>" data-email="<?=$owner->email?>" data-birthdate="<?=($owner->birthdate) ? (new DateTime($owner->birthdate))->format("d.m.Y"): ""?>">
<?php foreach($item->owners as $owner):
if (substr($owner->phone, 0, 2) != "43" && substr($owner->phone, 0, 2) != "49" && substr($owner->phone, 0, 1) != "0") {
$phone = "0".$owner->phone;
} else {
$phone = $owner->phone;
}
?>
<tr id="owner-data-<?=$owner->id?>" data-title="<?=$owner->title?>" data-firstname="<?=$owner->firstname?>" data-lastname="<?=$owner->lastname?>" data-street="<?=$owner->street?>" data-zip="<?=$owner->zip?>" data-city="<?=$owner->city?>" data-country="<?=$owner->country?>" data-phone="<?=$phone?>" data-phone2="<?=$owner->phone2?>" data-fax="<?=$owner->fax?>" data-email="<?=$owner->email?>" data-birthdate="<?=($owner->birthdate) ? (new DateTime($owner->birthdate))->format("d.m.Y"): ""?>">
<td style="font-size: 1.4em;">
<a href="<?=self::getUrl("ConstructionConsent", "Download", ["owner_id" => $owner->id])?>" title="Zustimmungserklärungsformular herunterladen"><i class="far fa-fw fa-file-download"></i></a>
</td>
@@ -316,7 +334,7 @@ $pagination_entity_name = "Adressen";
<?=$owner->country?>
</td>
<td>
<?=$owner->phone?><br />
<?=$phone?><br />
<?=$owner->fax?><br />
<?=$owner->email?>
</td>
@@ -461,6 +479,15 @@ $pagination_entity_name = "Adressen";
</button>
</div>
<div class="modal-body">
<?php if ($is_admin): ?>
<div class="form-group">
<label for="owner_id_not_included" class="col-form-label">Besitzer aus Vorbestellung suchen:</label>
<select class="form-control" name="owner_id_not_included" id="search-owner">
<option></option>
</select>
</div>
<hr>
<?php endif; ?>
<input type="hidden" name="constructionconsent_id" value="<?=$item->id?>" />
<input type="hidden" name="id" value="" />
@@ -556,12 +583,6 @@ $pagination_entity_name = "Adressen";
<input type="hidden" name="owner_id" id="owner-upload-owner_id" value="" />
<div class="form-group">
<label for="owner-upload-name" class="col-form-label">Name *</label>
<input type="text" class="form-control" name="name" id="owner-upload-name" />
<small>Beschreibender Kurzname, z.B: Zustimmung oder Ablehnung</small>
</div>
<div class="form-group">
<label for="consentOwnerUpload" class="col-form-label">Datei auswählen *</label>
<input type="file" class="form-control" name="consentOwnerUpload" id="consentOwnerUpload" />
@@ -592,6 +613,7 @@ $pagination_entity_name = "Adressen";
<div class="modal-body">
<input type="hidden" name="constructionconsent_id" value="<?=$item->id?>" />
<input type="hidden" name="contact_id" value="" />
<div class="form-group">
<label for="street" class="col-form-label">Kontakttyp:</label>
@@ -851,6 +873,25 @@ $pagination_entity_name = "Adressen";
}
function editContact(contact_id) {
if(!contact_id) return;
$("#newContactModal input[name=contact_id]").val(contact_id);
$("#newContactModal input[name=type]").val($("#contact-data-" + contact_id).data("type"));
$("#newContactModal textarea[name=name]").val($("#contact-data-" + contact_id).data("name"));
$("#newContactModal input[name=street]").val($("#contact-data-" + contact_id).data("street"));
$("#newContactModal input[name=zip]").val($("#contact-data-" + contact_id).data("zip"));
$("#newContactModal input[name=city]").val($("#contact-data-" + contact_id).data("city"));
$("#newContactModal input[name=phone]").val($("#contact-data-" + contact_id).data("phone"));
$("#newContactModal input[name=fax]").val($("#contact-data-" + contact_id).data("fax"));
$("#newContactModal input[name=email]").val($("#contact-data-" + contact_id).data("email"));
$("#newContactModelLabel").text("Ansprechpartner bearbeiten");
$("#newContactModal").modal("show");
}
function toggleStatusControl(oid) {
// set select to current status id
$("#status-" + oid + "-input select").val($("#status-" + oid + "-text").data("status-id"));
@@ -1033,6 +1074,76 @@ $pagination_entity_name = "Adressen";
});
}
$(document).ready(function() {
$('#search-owner').select2({
dropdownParent: $('#newOwnerModal'),
ajax: {
url: "<?=self::getUrl("ConstructionConsentOwner", "searchOwner")?>",
dataType: 'json',
delay: 250,
data: function(params) {
return {
search: params.term
};
},
processResults: function(data) {
return {
results: data.map(function(item) {
return {
id: item.id,
text: item.text,
fullData: item
};
})
};
},
cache: true
},
minimumInputLength: 2,
placeholder: 'Besitzer suchen...'
});
$('#search-owner').on('select2:select', function(e) {
var selectedData = e.params.data.fullData;
$("#newOwnerModal input[name=firstname]").val(selectedData.firstname);
$("#newOwnerModal input[name=lastname]").val(selectedData.lastname);
$("#newOwnerModal input[name=street]").val(selectedData.street);
$("#newOwnerModal input[name=zip]").val(selectedData.zip);
$("#newOwnerModal input[name=city]").val(selectedData.city);
$("#newOwnerModal input[name=phone]").val(selectedData.phone);
$("#newOwnerModal input[name=email]").val(selectedData.email);
});
$("#approve_override").on("change", function() {
const reason = prompt("Bitte geben Sie einen Grund für das Überschreiben der Genehmigung ein:");
if (reason != null) {
$.post("<?php echo self::getUrl("ConstructionConsentJournal", "save")?>", {
consent_id: <?=$item->id?>,
text: `Genehmigung überschreiben wurde ${$(this).prop("checked") ? "aktiviert" : "deaktiviert"} | Begründung: ${reason}`
}, function(success) {
if (success.status != "OK") {
notify("error", "Status konnte nicht gespeichert werden");
} else {
notify("success", "Status erfolgreich gespeichert");
}
}, 'json');
$.get("<?php echo self::getUrl("ConstructionConsent", "approveOverride")?>", {
consent_id: <?=$item->id?>,
checked: $(this).prop("checked") ? 1 : 0
}, function(success) {
if (success.status != "OK") {
notify("error", "Status konnte nicht gespeichert werden");
setTimeout(() => {location.reload()}, 150);
} else {
notify("success", "Status erfolgreich gespeichert");
setTimeout(() => {location.reload()}, 150);
}
}, 'json');
}
});
});
</script>

View File

@@ -184,7 +184,11 @@
function(success) {
console.log(success);
if(success.status == "OK") {
$("#sent-label-" + success.result.preorder_id).show();
if(checked) {
$("#sent-label-" + success.result.preorder_id).show();
} else {
$("#sent-label-" + success.result.preorder_id).hide();
}
}
},
"json"

View File

@@ -257,6 +257,38 @@ $siteTitle = "Benutzer";
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<h4 class="card-title mb-3">Zustimmungserklärungen</h4>
<div class="form-group" id="constructionconsent-projects-container">
<label for="constructionconsent_projects">Zustimmungserklärungsprojekte:</label>
<?php
$constructionConsent_projects = [];
if($user->id) {
$constructionConsent_projects = json_decode((new WorkerFlag($user->id, "constructionConsent_projects"))->value());
if(!$constructionConsent_projects) {
$constructionConsent_projects = [];
}
}
?>
<select name="constructionconsent_projects[]" id="constructionconsent_projects"
class="form-control" multiple="multiple">
<?php foreach(ConstructionConsentProject::getAll() as $project): ?>
<option value="<?=$project->id?>" <?=(in_array($project->id, $constructionConsent_projects)) ? "selected='selected'" : ""?>><?=$project->name?></option>
<?php endforeach; ?>
</select>
<small>Benutzer kann nur Zustimmungserklärungen in diesen Projekten sehen</small>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
@@ -481,6 +513,11 @@ $siteTitle = "Benutzer";
placeholder: "",
closeOnSelect: false
});
$("#constructionconsent_projects").select2({
allowClear: true,
placeholder: "",
closeOnSelect: false
});
<?php if(!$user || (!$user->is("preorderfront") && !$user->is("preorderaddressreporting")) ): ?>
//$("#preorder-network-container").hide();

View File

@@ -11,7 +11,7 @@
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Preorder")?>"><i class="far fa-fw fa-calendar-lines text-info"></i> Vorbestellung</a></li>
<?php if($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187])): ?>
<?php if ($me->isAdmin() || !empty(json_decode((new WorkerFlag($me->id, "constructionConsent_projects"))->value() ?? '[]'))): ?>
<li><a href="<?=self::getUrl("ConstructionConsentProject")?>"><i class="far fa-fw fa-clipboard-question text-info"></i> Zustimmungserklärungen</a></li>
<?php endif; ?>
</ul>
@@ -92,7 +92,7 @@
</li>
<?php endif; ?>
<?php if($me->is(["Admin", "netowner", "salespartner"]) && ($me->is("employee") || $me->can(["Fibu", "Billing", "Preorderpricing", "Preorderbilling"])) || in_array($me->address_id, [1,209,5908,2187])): ?>
<?php if($me->is(["Admin", "netowner", "salespartner"]) && ($me->is("employee") || $me->can(["Fibu", "Billing", "Preorderpricing", "Preorderbilling"])) || !empty(json_decode((new WorkerFlag($me->id, "constructionConsent_projects"))->value() ?? '[]'))): ?>
<li class="has-submenu mobile-hide">
<a href="#">
<i class="fas fa-fw fa-money-from-bracket"></i> Backoffice <div class="arrow-down"></div>
@@ -112,7 +112,7 @@
<?php if($me->is(["Admin","netowner","salespartner"]) && $me->can("Preorderbilling")): ?>
<li><a href="<?=self::getUrl("PreorderBilling")?>"><i class="far fa-fw fa-cash-register text-info"></i> Vorbestellkampagnen Verrechnung</a></li>
<?php endif; ?>
<?php if($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187])): ?>
<?php if($me->isAdmin() || !empty(json_decode((new WorkerFlag($me->id, "constructionConsent_projects"))->value() ?? '[]'))): ?>
<li><a href="<?=self::getUrl("ConstructionConsentProject")?>"><i class="far fa-fw fa-clipboard-question text-info"></i> Zustimmungserklärungen</a></li>
<?php endif; ?>

View File

@@ -196,6 +196,38 @@ class Admin_RtrReporting {
];
}
public function activeVoiceNumbersReportAction() {
$csv = "number_start;number_end;date_reported;type;csp;note\n";
$today = new DateTime();
$today_string = $today->format('Y-m-d');
foreach(VoicenumberModel::search(["contract_id" => true]) as $number) {
//$ported = ($number->voicenumberblock_id) ? false : true;
if(in_array($number->number, [4331528575200,4331528575400,4331528575500]) ) {
continue;
}
if(substr($number->number, 0, 9) == "437208004") continue;
if(substr($number->number, 0, 8) == "43720102") continue;
if(substr($number->number, 0, 8) == "43720103") continue;
if(substr($number->number, 0, 10) == "4331154520") continue;
$csv .= $number->number.";";
$csv .= $number->number.";";
$csv .= $today_string.";";
$csv .= "UA;";
$csv .= ";";
$csv .= ";\n";
}
header("Content-type: text/csv; charset=utf-8");
header('Content-disposition: attachment; filename="rtr-active-numbers-report-'.date('Y-m-d_H-i-s').'.csv"');
echo $csv;
exit;
}
public function a10reportAction() {
// alle anschlüsse

View File

@@ -386,22 +386,46 @@ class ConstructionConsent extends mfBaseModel {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT
ConstructionConsent.*,
COALESCE(SUM(cwo.result = 'denied'), 0) AS denied_count,
COALESCE(SUM(cwo.result = 'unresolvable'), 0) AS unresolvable_count,
COALESCE(SUM(cwo.result = 'moved'), 0) AS moved_count,
COALESCE(SUM(cwo.result = 'accepted'), 0) AS accepted_count,
COUNT(cwo.id) AS total_owners,
CASE
WHEN COALESCE(SUM(cwo.result = 'denied'), 0) > 0 THEN 'red'
WHEN COALESCE(SUM(cwo.result = 'unresolvable'), 0) > 0
OR COALESCE(SUM(cwo.result = 'moved'), 0) > 0 THEN 'yellow'
WHEN COALESCE(SUM(cwo.result = 'accepted'), 0) = COUNT(cwo.id)
AND COUNT(cwo.id) > 0 THEN 'green'
ELSE 'blue'
END AS status_light
FROM ConstructionConsent
$sql = "SELECT ConstructionConsent.*,
COALESCE(SUM(CASE
WHEN ConstructionConsent.approve_override = 1 THEN 0
ELSE (cwo.result = 'denied')
END), 0) AS denied_count,
COALESCE(SUM(CASE
WHEN ConstructionConsent.approve_override = 1 THEN 0
ELSE (cwo.result = 'unresolvable')
END), 0) AS unresolvable_count,
COALESCE(SUM(CASE
WHEN ConstructionConsent.approve_override = 1 THEN 0
ELSE (cwo.result = 'moved')
END), 0) AS moved_count,
COALESCE(SUM(CASE
WHEN ConstructionConsent.approve_override = 1 THEN 1
ELSE (cwo.result = 'accepted')
END), 0) AS accepted_count,
COUNT(cwo.id) AS total_owners,
CASE
WHEN ConstructionConsent.approve_override = 1 THEN 'green'
WHEN COALESCE(SUM(CASE
WHEN approve_override = 1 THEN 0
ELSE (cwo.result = 'denied')
END), 0) > 0 THEN 'red'
WHEN COALESCE(SUM(CASE
WHEN approve_override = 1 THEN 0
ELSE (cwo.result = 'unresolvable')
END), 0) > 0
OR COALESCE(SUM(CASE
WHEN approve_override = 1 THEN 0
ELSE (cwo.result = 'moved')
END), 0) > 0 THEN 'yellow'
WHEN COALESCE(SUM(CASE
WHEN approve_override = 1 THEN 1
ELSE (cwo.result = 'accepted')
END), 0) = COUNT(cwo.id)
AND COUNT(cwo.id) > 0 THEN 'green'
ELSE 'blue'
END AS status_light
FROM ConstructionConsent
LEFT JOIN ConstructionConsentOwner cwo ON ConstructionConsent.id = cwo.constructionconsent_id
LEFT JOIN `".ADDRESSDB_DBNAME."`.view_hausnummer vh ON ConstructionConsent.adb_hausnummer_id = vh.hausnummer_id
LEFT JOIN `".ADDRESSDB_DBNAME."`.Strasse vs ON ConstructionConsent.adb_strasse_id = vs.id
@@ -437,6 +461,8 @@ class ConstructionConsent extends mfBaseModel {
$project_id = $filter['project_id'];
if(is_numeric($project_id)) {
$where .= " AND ConstructionConsent.constructionconsentproject_id=$project_id";
} else if (is_array($project_id)) {
$where .= " AND ConstructionConsent.constructionconsentproject_id IN (".implode(",", $project_id).")";
}
}

View File

@@ -10,7 +10,11 @@ class ConstructionConsentController extends mfBaseController {
$this->me = $me;
$this->layout()->set("me", $me);
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187]))) $this->redirect("Dashboard");
if ($this->me->is("Admin")) $this->constructionConsentProjects = array_column(ConstructionConsentProject::getAll(), 'id');
else {
$constructionConsentProjects = json_decode((new WorkerFlag($this->me->id, "constructionConsent_projects"))->value() ?? '[]');
empty($constructionConsentProjects) ? $this->redirect("Dashboard") : $this->constructionConsentProjects = $constructionConsentProjects;
}
}
protected function indexAction() : void {
@@ -54,6 +58,7 @@ class ConstructionConsentController extends mfBaseController {
//var_dump($_SESSION, $filter);exit;
$this->layout->set("allowed_projects", $this->constructionConsentProjects);
$this->layout->set("filter", $filter);
$filter = $this->getPreparedFilter($filter);
@@ -93,13 +98,20 @@ class ConstructionConsentController extends mfBaseController {
}
}
if (isset($new_filter['project_id']) && !in_array($new_filter['project_id'], $this->constructionConsentProjects) && strlen($new_filter['project_id']) > 0) {
$this->redirect("ConstructionConsent");
}
if (empty($new_filter['project_id'])) {
$new_filter['project_id'] = $this->constructionConsentProjects;
}
return $new_filter;
}
protected function viewAction() : void {
$this->layout()->setTemplate("ConstructionConsent/View");
$this->layout()->set("is_admin", $this->me->isAdmin());
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
@@ -108,7 +120,7 @@ class ConstructionConsentController extends mfBaseController {
}
$item = new ConstructionConsent($id);
if(!$item || !$item->id) {
if(!$item || !$item->id || !in_array($item->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
@@ -121,6 +133,7 @@ class ConstructionConsentController extends mfBaseController {
if($this->request->project_id) {
$this->layout()->set("project_id", $this->request->project_id);
}
$this->layout()->set("allowed_projects", $this->constructionConsentProjects);
}
protected function editAction() : void {
@@ -224,7 +237,10 @@ class ConstructionConsentController extends mfBaseController {
$mode = "add";
}
//var_dump($r->get());exit;
if (!in_array($r->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie haben keine Berechtigung für dieses Projekt", "error");
$this->redirect("ConstructionConsent");
}
$data = [];
$data["constructionconsentproject_id"] = $r->constructionconsentproject_id;
@@ -1012,4 +1028,20 @@ class ConstructionConsentController extends mfBaseController {
"status_light_green" => getFilteredCount("status_light", "green", $baseFilter)
];
}
protected function approveOverrideAction() {
$consent_id = $this->request->consent_id;
$checked = $this->request->checked;
$consent = new ConstructionConsent($consent_id);
if(!$consent->id) {
$this->returnJson(["status" => "error"]);
}
$consent->update(["approve_override" => $checked]);
$consent->save();
$this->returnJson(["status" => "OK"]);
}
}

View File

@@ -1,6 +1,7 @@
<?php
class ConstructionConsentContact extends mfBaseModel {
protected $forcestr = ["zip", "name", "phone", "fax", "email"];
private $consent;
protected function beforeUpdate($data) {
@@ -187,4 +188,4 @@ class ConstructionConsentContact extends mfBaseModel {
//var_dump($filter, $where);exit;
return $where;
}
}
}

View File

@@ -11,7 +11,11 @@ class ConstructionConsentContactController extends mfBaseController
$this->me = $me;
$this->layout()->set("me", $me);
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908]))) $this->redirect("Dashboard");
if ($this->me->is("Admin")) $this->constructionConsentProjects = array_column(ConstructionConsentProject::getAll(), 'id');
else {
$constructionConsentProjects = json_decode((new WorkerFlag($this->me->id, "constructionConsent_projects"))->value() ?? '[]');
empty($constructionConsentProjects) ? $this->redirect("Dashboard") : $this->constructionConsentProjects = $constructionConsentProjects;
}
}
protected function saveAction()
@@ -38,6 +42,11 @@ class ConstructionConsentContactController extends mfBaseController
$this->redirect("ConstructionConsent");
}
if (!in_array($cc->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
$this->redirect("ConstructionConsent");
}
$data = [];
$data["constructionconsent_id"] = $cc_id;
$data["type"] = $r->type;
@@ -88,6 +97,11 @@ class ConstructionConsentContactController extends mfBaseController
$this->redirect("ConstructionConsent");
}
if (!in_array($cc->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
$this->redirect("ConstructionConsent");
}
$contact->delete();
$this->layout()->setFlash("Ansprechpartner wurde gelöscht.", "success");

View File

@@ -70,14 +70,14 @@ class ConstructionConsentHistory extends mfBaseModel {
return "Nutzung Schacht/Verteiler/Abschluss";
case "usage_owner":
return "Nutzung Eigenvers. GE";
case "approve_override":
return "Genehmigung überschreiben";
case "rimo_plan":
return "Plan/Skizze aus Rimo";
case "plan_upload":
return "Plan/Skizze Upload";
case "constructionconsentproject_id":
return "Projekt";
case "inspection_planner":
return "Status Begehung mit Planer";
case "inspection_electrician";

View File

@@ -9,7 +9,11 @@ class ConstructionConsentJournalController extends mfBaseController {
$this->me = $me;
$this->layout()->set("me",$me);
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908]))) $this->redirect("Dashboard");
if ($this->me->is("Admin")) $this->constructionConsentProjects = array_column(ConstructionConsentProject::getAll(), 'id');
else {
$constructionConsentProjects = json_decode((new WorkerFlag($this->me->id, "constructionConsent_projects"))->value() ?? '[]');
empty($constructionConsentProjects) ? $this->redirect("Dashboard") : $this->constructionConsentProjects = $constructionConsentProjects;
}
}
protected function saveAction() {
@@ -28,6 +32,11 @@ class ConstructionConsentJournalController extends mfBaseController {
$this->redirect("ConstructionConsent");
}
if (!in_array($consent->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
$this->redirect("ConstructionConsent");
}
$text = trim(htmlentities($r->text));
if(!$text) {
$this->layout()->setFlash("Bitte Text eingeben", "error");

View File

@@ -1,6 +1,7 @@
<?php
class ConstructionConsentOwner extends mfBaseModel {
protected $forcestr = ["zip", "phone", "phone2", "fax", "email"];
private $consent;
private $files;
private $result_file;

View File

@@ -11,19 +11,25 @@ class ConstructionConsentOwnerController extends mfBaseController
$this->me = $me;
$this->layout()->set("me", $me);
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187]))) $this->redirect("Dashboard");
if ($this->me->is("Admin")) $this->constructionConsentProjects = array_column(ConstructionConsentProject::getAll(), 'id');
else {
$constructionConsentProjects = json_decode((new WorkerFlag($this->me->id, "constructionConsent_projects"))->value() ?? '[]');
empty($constructionConsentProjects) ? $this->redirect("Dashboard") : $this->constructionConsentProjects = $constructionConsentProjects;
}
}
protected function uploadDocumentAction() {
$owner_id = $this->request->owner_id;
$filename = trim($this->request->name);
$owner = new ConstructionConsentOwner($owner_id);
if(!$owner->id) {
$this->layout()->setFlash("Besitzer nicht gefunden!", "error");
$this->redirect("ConstructionConsent");
}
$constructionConsent = new ConstructionConsent($owner->constructionconsent_id);
$filename = "ZU_KG" . $constructionConsent->kg . "_EZ" . $constructionConsent->ez . "_GST" . $constructionConsent->gst . "_" . $constructionConsent->name . "_" . $owner->lastname . ".pdf";
$_FILES['consentOwnerUpload']['name'] = $filename;
if(is_array($_FILES) && array_key_exists("consentOwnerUpload", $_FILES) && !$_FILES['consentOwnerUpload']['error']) {
try {
// returns File object or throws Exception on error
@@ -76,6 +82,11 @@ class ConstructionConsentOwnerController extends mfBaseController
$this->redirect("ConstructionConsent");
}
if (!in_array($cc->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
$this->redirect("ConstructionConsent");
}
$data = [];
$data["constructionconsent_id"] = $cc_id;
$data["title"] = $r->title;
@@ -128,6 +139,11 @@ class ConstructionConsentOwnerController extends mfBaseController
$consent = $owner->consent;
if (!in_array($consent->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
$this->redirect("ConstructionConsent");
}
foreach($owner->files as $file) {
$file->file->delete();
$file->delete();
@@ -207,4 +223,23 @@ class ConstructionConsentOwnerController extends mfBaseController
return ["message" => "Result saved successfully", "update" => ["id" => $owner->id, "result" => $owner->result, "result_text" => __($owner->result, "consent")]];
}
protected function searchOwnerAction() {
$search = $this->request->search;
$results = PreorderModel::search(['add-where' => " AND firstname LIKE '%$search%' OR lastname LIKE '%$search%'"]);
self::returnJson(array_map(function($result) {
return [
'id' => $result->id,
'firstname' => $result->firstname,
'lastname' => $result->lastname,
'street' => $result->street,
'zip' => $result->zip,
'city' => $result->city,
'phone' => $result->phone,
'email' => $result->email,
'text' => $result->firstname . " " . $result->lastname . " (" . $result->street . ", " . $result->zip . " " . $result->city . ") [" . $result->phone . " | " . $result->email . "]"
];
}, $results));
}
}

View File

@@ -152,21 +152,16 @@ class ConstructionConsentProject extends mfBaseModel {
public static function count($filter) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT COUNT(*) as cnt FROM ConstructionConsentProject
LEFT JOIN ConstructionConsentNetwork ON (ConstructionConsentNetwork.constructionconsentproject_id = ConstructionConsentNetwork.id)
WHERE $where
GROUP BY ConstructionConsentProject.id
";
$sql = "SELECT COUNT(*) AS cnt FROM ConstructionConsentProject WHERE $where";
//mfLoghandler::singleton()->debug($sql);
$result = $db->query($sql);
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
return $data->cnt;
if ($result && $db->num_rows($result) > 0) {
$data = $db->fetch_object($result);
return (int)$data->cnt;
}
return 0;
}
@@ -217,6 +212,22 @@ class ConstructionConsentProject extends mfBaseModel {
}
}
if(array_key_exists("id", $filter)) {
if(is_numeric($filter["id"])) {
$where .= " AND ConstructionConsentProject.id = ".$filter["id"];
} elseif(is_array($filter["id"])) {
$ids = [];
foreach($filter["id"] as $id) {
if(is_numeric($id)) {
$ids[] = $id;
}
}
if(count($ids)) {
$where .= " AND ConstructionConsentProject.id IN (".implode(",", $ids).")";
}
}
}
if(array_key_exists("add-where", $filter)) {

View File

@@ -10,45 +10,39 @@ class ConstructionConsentProjectController extends mfBaseController {
$this->me = $me;
$this->layout()->set("me", $me);
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187]))) $this->redirect("Dashboard");
if ($this->me->is("Admin")) $this->constructionConsentProjects = array_column(ConstructionConsentProject::getAll(), 'id');
else {
$constructionConsentProjects = json_decode((new WorkerFlag($this->me->id, "constructionConsent_projects"))->value() ?? '[]');
empty($constructionConsentProjects) ? $this->redirect("Dashboard") : $this->constructionConsentProjects = $constructionConsentProjects;
}
}
protected function indexAction() : void {
$this->layout()->setTemplate("ConstructionConsentProject/Index");
$sessionKey = MFAPPNAME . '-ConstructionConsentProject-filter';
if ($this->request->resetFilter) {
unset($_SESSION[MFAPPNAME . '-ConstructionConsentProject-filter']);
unset($_SESSION[$sessionKey]);
}
$filter = [];
if (is_array($this->request->filter)) {
$filter = $this->request->filter;
$_SESSION[MFAPPNAME . '-ConstructionConsentProject-filter'] = $filter;
} else {
if (array_key_exists(MFAPPNAME . '-ConstructionConsentProject-filter', $_SESSION) && count($_SESSION[MFAPPNAME . '-ConstructionConsentProject-filter'])) {
$filter = $_SESSION[MFAPPNAME . '-ConstructionConsentProject-filter'];
}
$filter = is_array($this->request->filter)
? $this->request->filter
: $_SESSION[$sessionKey] ?? [];
if (isset($this->request->filter)) {
$_SESSION[$sessionKey] = $filter;
}
$this->layout->set("filter", $filter);
$filter = $this->getPreparedFilter($filter);
// pagination defaults
$pagination = [];
$pagination['start'] = 0;
$pagination['count'] = 25;
$pagination['maxItems'] = 0;
if (is_numeric($this->request->s)) {
$pagination['start'] = intval($this->request->s);
}
//var_dump($filter);exit;
$pagination['maxItems'] = ConstructionConsentProject::count($filter);
$projects = ConstructionConsentProject::getAll();
$this->layout()->set("projects", $projects);
$this->layout()->set("pagination", $pagination);
$prepared = $this->getPreparedFilter($filter);
$prepared["id"] = $this->constructionConsentProjects;
$this->layout()->setTemplate("ConstructionConsentProject/Index");
$this->layout()->set("filter", $filter);
$this->layout()->set("projects", ConstructionConsentProject::search($prepared));
$this->layout()->set("pagination", [
'start' => (int)($this->request->s ?? 0),
'count' => 25,
'maxItems' => ConstructionConsentProject::count($prepared)
]);
}
private function getPreparedFilter($filter) {

View File

@@ -343,7 +343,7 @@ class PreorderModel
if (is_array($limit) && count($limit)) {
if (is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT " . $limit['start'] . ", " . $limit['count'];
} elseif (is_numeric($count)) {
} elseif (is_numeric($limit['count'])) {
$sql .= " LIMIT " . $limit['count'];
}
}
@@ -623,6 +623,18 @@ class PreorderModel
}
}
if (array_key_exists("preorder_status_flags_disabled", $filter)) {
$preorder_status_flags_disabled = $filter['preorder_status_flags_disabled'];
if (is_array($preorder_status_flags_disabled) && count($preorder_status_flags_disabled)) {
$where .= " AND tt_preorder.id NOT IN (
SELECT psv.preorder_id
FROM `" . FRONKDB_DBNAME . "`.PreorderStatusflagValue psv
WHERE psv.flag_id IN (" . implode(',', $preorder_status_flags_disabled) . ")
AND psv.value = 1
)";
}
}
if (array_key_exists("created_from", $filter)) {
$created_from = $filter['created_from'];
if (is_numeric($created_from)) {
@@ -955,12 +967,26 @@ class PreorderModel
}
}
if (array_key_exists("unit_count>=", $filter)) {
$unit_count = $filter['unit_count>='];
if (is_numeric($unit_count)) {
$where .= " AND adb_hausnummer.unit_count >= $unit_count";
}
}
if (array_key_exists("unit_count<=", $filter)) {
$unit_count = $filter['unit_count<='];
if (is_numeric($unit_count)) {
$where .= " AND adb_hausnummer.unit_count <= $unit_count";
}
}
if (array_key_exists("sent", $filter)) {
$sent = $filter['sent'];
if ($sent) {
$where .= " AND sent > 0";
$where .= " AND Preorderlogistics.sent > 0";
} else {
$where .= " AND (sent = 0 OR sent IS NULL)";
$where .= " AND (Preorderlogistics.sent = 0 OR Preorderlogistics.sent IS NULL)";
}
}

View File

@@ -1,53 +1,9 @@
<?php
//use \chillerlan\QRCode;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\QROptions;
use chillerlan\QRCode\Output\QROutputInterface;
class Preorderlogistics extends mfBaseModel {
private $qrfilename;
private $preorder;
public function getCifQrPng($content) {
/*$filename = $this->getProperty("qrfilename");
if(!$filename) {
return false;
}
$qrpath = MFUPLOAD_FILE_SAVE_PATH."/".TT_PREORDER_CIF_QR_SUBFOLDER."/$filename";
var_dump($qrpath);*/
$img = $this->generateCifQrFile($content);
return $img;
}
public function generateCifQrFile($content) {
$qr_opts = new QROptions();
$qr_opts->outputType = QROutputInterface::GDIMAGE_PNG;
$qr = new QRCode($qr_opts);
try {
$png_data = $qr->render($content);
} catch (Exception $ex) {
throw $ex;
}
if(!$png_data) {
echo "Kein png data!";exit;
}
/*
$filename = $this->getProperty("qrfilename");
$qrpath = MFUPLOAD_FILE_SAVE_PATH."/".TT_PREORDER_CIF_QR_SUBFOLDER."/$filename";
$data_parts = explode(",", $png_data);
file_put_contents($qrpath, base64_decode($data_parts[1]));
*/
return $png_data;
}
public function getProperty($name) {
if($this->$name == null) {

View File

@@ -1,4 +1,6 @@
<?php
include_once(BASEDIR."/lib/QRCode/QRCode.php");
use Apirone\Lib\PhpQrCode\QrCode;
class PreorderlogisticsController extends mfBaseController {
@@ -79,7 +81,15 @@ class PreorderlogisticsController extends mfBaseController {
$filter["status_code"] = 140;
//$filter["<status_code"] = 800;
$filter["deleted"] = 0;
$filter["connection_type"] = ["single-dwelling", "business"];
//$filter["connection_type"] = ["single-dwelling", "business"];
$filter["unit_count<="] = 2;
$installation_kit_status_flag = PreorderStatusflagModel::getFirst(["code" => "145"]);
if ($filter['sent'] !== true) {
$filter["preorder_status_flags_disabled"] = [$installation_kit_status_flag->id];
} else {
$filter["preorder_status_flags"] = [$installation_kit_status_flag->id];
}
$pagination['maxItems'] = PreorderModel::countWithLogistics($filter);
$preorders = PreorderModel::searchWithLogistics($filter, $pagination);
@@ -219,10 +229,12 @@ class PreorderlogisticsController extends mfBaseController {
$this->layout()->setFlash("Eintrag konnte nicht gespeichert werden");
}
}
$qrimg = $plog->getCifQrPng($preorder->cifurl);
$this->layout()->set("qr_url", $qrimg);
$qr = QRCode::init($preorder->cifurl); // $data & $options are optional
$image_encoded = $qr->base64();
$this->layout()->set("qr_url", $image_encoded);
$this->layout()->set("preorder", $preorder);
}
@@ -253,9 +265,7 @@ class PreorderlogisticsController extends mfBaseController {
private function saveSentApi() {
if(!$this->me->is(["Preorderlogistics"])) {
return false;
}
if(!$this->me->is(["Preorderlogistics"])) return false;
$preorder_id = $this->request->id;
if(!is_numeric($preorder_id) || $preorder_id < 1) {
@@ -276,28 +286,38 @@ class PreorderlogisticsController extends mfBaseController {
$sent = intval($this->request->sent);
if($sent < 0 || $sent > 1) return false;
$installation_kit_status_flag = PreorderStatusflagModel::getFirst(["code" => "145"]);
$flagvalue = PreorderStatusflagValueModel::getFirst(["preorder_id" => $preorder_id, "flag_id" => $installation_kit_status_flag->id]);
// var_dump($flagvalue);
// exit;
if(!$flagvalue) {
$flagvalue = PreorderStatusflagValueModel::create([
"preorder_id" => $preorder_id,
"flag_id" => $installation_kit_status_flag->id
]);
}
$value = ($sent) ? 1 : 0;
$flagvalue->value = $value;
try {
if(!$flagvalue->save()) {
return false;
}
} catch(Exception $e) {
$this->log->debug($e->getTraceAsString());
die("hi");
}
if($sent) {
$plog->sent_by = $this->me->id;
$plog->sent = date('U');
$new_status = PreorderstatusModel::getFirst(["code" => 145]);
if($preorder->status->code < $new_status->code) {
$plog->prev_status_code = $preorder->status->code;
$preorder->status_id = $new_status->id;
$preorder->save();
}
} else {
$plog->sent_by = null;
$plog->sent = 0;
}
if(!$plog->save()) {
return false;
}
if(!$plog->save()) return false;
return ["preorder_id" => $preorder->id];
}
}

View File

@@ -286,6 +286,13 @@ class UserController extends mfBaseController
$pn->delete();
}
$constructionConsentProjects = $user->getFlag("constructionConsent_projects");
if (is_array($r->constructionconsent_projects) && count($r->constructionconsent_projects)) {
$constructionConsentProjects->value(json_encode($r->constructionconsent_projects));
$constructionConsentProjects->save();
} else {
$constructionConsentProjects->delete();
}
// employee number
$enum = new WorkerFlag($user->id, "employee_number");

View File

@@ -50,11 +50,13 @@ class WarehouseShippingNoteController extends TTCrud {
}
protected function beforeUpdate($postData): bool {
if (!$this->user->can('WarehouseAdmin')) {
$this->validate($postData, [
fn($p) => !in_array(WarehouseShippingNoteModel::get($p['id'])->status,
['accepted', 'invoiced']) ?: 'Änderungen nicht mehr möglich',
fn($p) => $this->validateHours($p['hoursEntries'])
]);
}
$postData['positions'] = json_encode($postData['positions']);
(new WarehouseHistoryController)->create($postData, $this->mod);
return true;
@@ -187,6 +189,11 @@ class WarehouseShippingNoteController extends TTCrud {
$position['articleDescription'] = "";
$position['articleUnit'] = 'Stk.';
$positions[] = $position;
} elseif (isset($position['article_text'])) {
$position['articleTitle'] = $position['article_text'];
$position['articleDescription'] = "";
$position['articleUnit'] = 'Stk.';
$positions[] = $position;
}
}

View File

@@ -0,0 +1,23 @@
<?php declare(strict_types = 1);
use Phinx\Migration\AbstractMigration;
final class ConstrConsentAddApproveOverride extends AbstractMigration {
public function up(): void {
if ($this->getEnvironment() == "thetool") {
$ConstructionConsentTable = $this->table("ConstructionConsent");
$ConstructionConsentTable
->addColumn("approve_override", "tinyinteger", ["default" => 0])
->save();
}
}
public function down(): void {
if ($this->getEnvironment() == "thetool") {
$ConstructionConsentTable = $this->table("ConstructionConsent");
$ConstructionConsentTable
->removeColumn("approve_override")
->save();
}
}
}

1802
lib/QRCode/QRCode.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -284,7 +284,7 @@ Vue.component('warehouse-shipping-note-see-through', {
<div style="margin-top: 20px;" v-if="currentRow">
<template v-for="action in window.TT_CONFIG.CRUD_CONFIG.additionalActions">
<template v-if="typeof action.condition === 'function' ? action.condition(currentRow) : true && action.key !== 'add_log' && action.key !== 'print'">
<i @click="changeStatus('status_to_' + action.key, currentRow)" :class="action.class" style="font-size: 20px; cursor: pointer; margin-right: 10px;"></i>
<i @click="changeStatus(action.key, currentRow)" :class="action.class" style="font-size: 20px; cursor: pointer; margin-right: 10px;"></i>
</template>
</template>
</div>
@@ -342,7 +342,7 @@ Vue.component('warehouse-shipping-note-see-through', {
}
},
async changeStatus(action, row) {
this.$emit('status_to_' + action, row);
this.$emit(action, row);
await new Promise(resolve => setTimeout(resolve, 50));
await this.fetchData();
},
@@ -369,7 +369,16 @@ Vue.component('warehouse-shipping-note', {
//language=Vue
template: `
<tt-card>
<warehouse-shipping-note-see-through @close="shippingNoteSeeThrough = false" v-if="shippingNoteSeeThrough !== false" :wanted-state="'accepted'"/>
<warehouse-shipping-note-see-through
@close="shippingNoteSeeThrough = false"
v-if="shippingNoteSeeThrough !== false"
:wanted-state="shippingNoteSeeThrough"
@status_to_progress="changeStatus($event.id, 'in_progress')"
@status_to_new="changeStatus($event.id, 'new')"
@status_to_on_hold="changeStatus($event.id, 'on_hold')"
@status_to_cancelled="changeStatus($event.id, 'cancelled')"
@status_to_invoiced="changeStatus($event.id, 'invoiced')"
@status_to_accepted="changeStatus($event.id, 'accepted')"/>
<warehouse-shipping-note-modal v-if="shippingNoteModalId" :id="shippingNoteModalId"
@close="shippingNoteModalId = null;$refs.table.$refs.table.refreshTable()"
@open-signing-modal="signingShippingNoteId = $event"/>

View File

@@ -131,6 +131,7 @@ Vue.component('tt-positions-manager',
<tr v-for="(position, index) in group" :key="groupMode ? groupName + index : index">
<td v-for="(field, key) in config.fields">
<tt-resolver
:key="index + key + position[key]"
v-if="position[key] && (field.customFieldReference || field.type === 'autocomplete')"
:autocomplete="!field.customFieldReference && field.type === 'autocomplete'"
:reference="field.customFieldReference || field.apiUrl"