Baufreigabe checks for missing required fields
This commit is contained in:
@@ -79,7 +79,7 @@
|
||||
<div style="height:1.5pt;"></div>
|
||||
|
||||
<div>
|
||||
<p>Gemäß der EU Datenschutzverordung sind wir dazu verpflichtet, vor der Beauskunftung
|
||||
<p>Gemäß der EU Datenschutzverordnung sind wir dazu verpflichtet, vor der Beauskunftung
|
||||
von persönlichen Daten eine Kundenidentifizierung vorzunehmen. Daher werden wir und
|
||||
unsere Partner Sie bei zukünftigen Kontaktaufnahmen (z.B. vergessenen Passwörtern,
|
||||
Rechnungsauskünfte, etc) nach Ihrem <strong>persönlichen Service-PIN</strong> fragen.</p>
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<?=$building->email?>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<label><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?>> Baufreigabe</label>
|
||||
<label <?=(!$building->pipeworker_id) ? "class='text-danger' title='Keine Tiefbaufirma ausgewählt'" : ""?>><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?> <?=(!$building->pipeworker_id || !$me->is(["Admin", "Pipeplanner "])) ? "disabled='disabled'" : ""?>> Baufreigabe</label>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<button type="button" class="btn btn-primary" form="wf-building-<?=$building->id?>" onclick="document.getElementById(this.getAttribute('form')).submit()">Speichern</button>
|
||||
@@ -224,6 +224,40 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$('select[name=wfitem_pipework_finished]').each(function() {
|
||||
var elem = this;
|
||||
//console.log(elem);
|
||||
$(elem).click(function() {
|
||||
var id_match = $(this).attr("id").match(/wfitem_pipework_finished_(\d+)$/);
|
||||
var id = id_match[1];
|
||||
//console.log(id);
|
||||
|
||||
var ap_type=$('#wfitem_anschlusspunkt_typ_' + id).val();
|
||||
var ap_name=$('#wfitem_anschlusspunkt_name_' + id).val();
|
||||
var rohrname=$('#wfitem_rohrverband_name_' + id).val();
|
||||
var rohrtype=$('#wfitem_rohrtype_' + id).val();
|
||||
var rohrfarbe=$('#wfitem_rohrfarbe_' + id).val();
|
||||
|
||||
var ist_ap_type=$('#wfitem_ist_anschlusspunkt_typ_' + id).val();
|
||||
var ist_ap_name=$('#wfitem_ist_anschlusspunkt_name_' + id).val();
|
||||
var ist_rohrname=$('#wfitem_ist_rohrverband_name_' + id).val();
|
||||
var ist_rohrtype=$('#wfitem_ist_rohrtype_' + id).val();
|
||||
var ist_rohrfarbe=$('#wfitem_ist_rohrfarbe_' + id).val();
|
||||
|
||||
//console.log(ap_type, ap_name, rohrname, rohrtype, rohrfarbe);
|
||||
|
||||
if((!ap_type && !ist_ap_type) || (!ap_name && !ist_ap_type) || (!rohrname && !ist_rohrname) || (!rohrtype || !ist_rohrtype) || (!rohrfarbe && !ist_rohrfarbe)) {
|
||||
$(this).find("option").attr("disabled", true);
|
||||
}
|
||||
|
||||
if((ap_type || ist_ap_type) && (ap_name || ist_ap_name) && (rohrname || ist_rohrname) && (rohrtype || ist_rohrtype) && (rohrfarbe || ist_rohrfarbe)) {
|
||||
//console.log("enable");
|
||||
$(this).find("option").removeAttr("disabled");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,20 @@ class Building extends mfBaseModel {
|
||||
return $address;
|
||||
}
|
||||
|
||||
protected function afterSave() {
|
||||
$this->resetProperties();
|
||||
}
|
||||
|
||||
public function resetProperties() {
|
||||
$this->network = null;
|
||||
$this->pop = null;
|
||||
$this->type = null;
|
||||
$this->status = null;
|
||||
$this->pipeworder = null;
|
||||
$this->terminations = null;
|
||||
$this->workflowitems = null;
|
||||
$this->files = null;
|
||||
}
|
||||
|
||||
public function getNewObjectCode() {
|
||||
if(!$this->zip) {
|
||||
|
||||
@@ -187,6 +187,8 @@ class PipeworkController extends mfBaseController {
|
||||
//var_dump($item);exit;
|
||||
$item->value->save();
|
||||
|
||||
$building->resetProperties();
|
||||
|
||||
// set pipework finished flag in building
|
||||
if($name == TT_WORKFLOW_ITEM_PIPEWORK_DONE) {
|
||||
if($value && $building->workflow_finished == 0) {
|
||||
@@ -200,6 +202,23 @@ class PipeworkController extends mfBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Custom checks
|
||||
*/
|
||||
|
||||
if($building->workflowitems['pipework_finished']->value->value_string) {
|
||||
// unset Tiefbau abgeschlossen if missing values
|
||||
if( (!$building->workflowitems['anschlusspunkt_typ']->value->value_string && !$building->workflowitems['ist_anschlusspunkt_typ']->value->value_string)
|
||||
|| (!$building->workflowitems['anschlusspunkt_name']->value->value_string && !$building->workflowitems['ist_anschlusspunkt_name']->value->value_string)
|
||||
|| (!$building->workflowitems['rohrverband_name']->value->value_string && !$building->workflowitems['ist_rohrverband_name']->value->value_string)
|
||||
|| (!$building->workflowitems['rohrtype']->value->value_string && !$building->workflowitems['ist_rohrtype']->value->value_string)
|
||||
|| (!$building->workflowitems['rohrfarbe']->value->value_string && !$building->workflowitems['ist_rohrfarbe']->value->value_string)
|
||||
) {
|
||||
$building->workflowitems['pipework_finished']->value->value_string = "";
|
||||
$building->workflowitems['pipework_finished']->value->save();
|
||||
}
|
||||
}
|
||||
|
||||
// set building status if Status field was set
|
||||
if(defined("TT_WORKFLOW_ITEM_STATUS_FIELD") && defined("TT_WORKFLOW_ITEM_STATUS_VALUE_PASSED") && defined("TT_WORKFLOW_ITEM_STATUS_VALUE_CONNECTED")) {
|
||||
$status_value = $building->workflowitems[TT_WORKFLOW_ITEM_STATUS_FIELD]->value->value_string;
|
||||
|
||||
Reference in New Issue
Block a user