changed some workflowitems to update every termination in building

This commit is contained in:
Frank Schubert
2021-11-06 14:12:55 +01:00
parent 5935571887
commit 9c84e82d3c
6 changed files with 171 additions and 65 deletions

View File

@@ -249,10 +249,15 @@ class LineworkController extends mfBaseController {
* Custom checks
*/
if($termination->workflowitems[TT_WORKFLOW_ITEM_LINEWORK_DONE]->value_int) {
$required_fields = ["baugruppe","modul","ports","abschlusstyp","bb_kabel","bb_fasern","kundenkabel_typ","kundenkabel_fasern","backbone_finished","inhouse_cabling_supplied","inhouse_cabling_deployed","bep_deployed","customer_cable_injected","spliced_network","spliced_customer"];
$required_fields = ["baugruppe","modul","ports","abschlusstyp","bb_kabel","bb_fasern","kundenkabel_typ","kundenkabel_fasern","backbone_finished","bep_deployed","customer_cable_injected","spliced_network","spliced_customer"];
//,"inhouse_cabling_supplied","inhouse_cabling_deployed"
if($termination->workflowitems['abschlusstyp']->value->value_string != "SC/APC in FTU" && $termination->workflowitems['ist_abschlusstyp']->value->value_string != "SC/APC in FTU") {
$required_fields[] = "inhouse_cabling_supplied";
$required_fields[] = "inhouse_cabling_deployed";
}
$can_finish = true;
foreach($required_fields as $f) {
$type = $termination->workflowitems[$f]->type;
@@ -262,12 +267,64 @@ class LineworkController extends mfBaseController {
}
if(!$can_finish) {
$this->log->info("Resetting customer_passive_finished because of missing");
$this->log->info("Resetting customer_passive_finished because of missing values");
$termination->workflowitems[TT_WORKFLOW_ITEM_LINEWORK_DONE]->value->value_int = 0;
$termination->workflowitems[TT_WORKFLOW_ITEM_LINEWORK_DONE]->value->save();
}
}
// set values for all terminations in this building
if($termination->workflowitems['bb_kabel']->value->value_string) {
$value = $termination->workflowitems['bb_kabel']->value->value_string;
foreach($termination->building->terminations as $t) {
$t->workflowitems['bb_kabel']->value->value_string = $value;
$t->workflowitems['bb_kabel']->value->save();
}
}
if($termination->workflowitems['bb_kabel_steps']->value->value_string) {
$value = $termination->workflowitems['bb_kabel_steps']->value->value_string;
foreach($termination->building->terminations as $t) {
$t->workflowitems['bb_kabel_steps']->value->value_string = $value;
$t->workflowitems['bb_kabel_steps']->value->save();
}
}
if($termination->workflowitems['kundenkabel_typ']->value->value_string) {
$value = $termination->workflowitems['kundenkabel_typ']->value->value_string;
foreach($termination->building->terminations as $t) {
$t->workflowitems['kundenkabel_typ']->value->value_string = $value;
$t->workflowitems['kundenkabel_typ']->value->save();
}
}
$value = $termination->workflowitems['customer_cable_injected']->value->value_int;
foreach($termination->building->terminations as $t) {
$t->workflowitems['customer_cable_injected']->value->value_int = $value;
$t->workflowitems['customer_cable_injected']->value->save();
}
if($termination->workflowitems['ist_bb_kabel']->value->value_string) {
$value = $termination->workflowitems['ist_bb_kabel']->value->value_string;
foreach($termination->building->terminations as $t) {
$t->workflowitems['ist_bb_kabel']->value->value_string = $value;
$t->workflowitems['ist_bb_kabel']->value->save();
}
}
if($termination->workflowitems['ist_bb_kabel_steps']->value->value_string) {
$value = $termination->workflowitems['ist_bb_kabel_steps']->value->value_string;
foreach($termination->building->terminations as $t) {
$t->workflowitems['ist_bb_kabel_steps']->value->value_string = $value;
$t->workflowitems['ist_bb_kabel_steps']->value->save();
}
}
if($termination->workflowitems['ist_kundenkabel_typ']->value->value_string) {
$value = $termination->workflowitems['ist_kundenkabel_typ']->value->value_string;
foreach($termination->building->terminations as $t) {
$t->workflowitems['ist_kundenkabel_typ']->value->value_string = $value;
$t->workflowitems['ist_kundenkabel_typ']->value->save();
}
}
// file upload
//var_dump($_FILES);exit;
if(array_key_exists("LineworkFileUpload", $_FILES) && !$_FILES['LineworkFileUpload']['error']) {