mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
add info alert for heimatadresse, tune duplicate zustellkontakt handling
This commit is contained in:
@@ -873,7 +873,7 @@ class ProfilUpdate extends FHCAPI_Controller
|
||||
$insert_kontakt_id = $insertID;
|
||||
$insert_kontakt_id = $this->getDataOrTerminateWithError($insert_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_insertKontakt_error'));
|
||||
if ($insert_kontakt_id) {
|
||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $insert_kontakt_id, $personID);
|
||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $insert_kontakt_id, $requested_change['kontakttyp'], $personID);
|
||||
}
|
||||
}
|
||||
//! DELETE
|
||||
@@ -890,7 +890,7 @@ class ProfilUpdate extends FHCAPI_Controller
|
||||
$update_kontakt_id = $this->KontaktModel->update($kontakt_id, $requested_change);
|
||||
$update_kontakt_id = $this->getDataOrTerminateWithError($update_kontakt_id, $this->p->t('profilUpdate', 'profilUpdate_updateKontakt_error'));
|
||||
if ($update_kontakt_id) {
|
||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $update_kontakt_id, $personID);
|
||||
$this->handleDupplicateZustellKontakte($requested_change['zustellung'], $update_kontakt_id, $requested_change['kontakttyp'], $personID);
|
||||
}
|
||||
}
|
||||
return isset($insertID) ? $insertID : null;
|
||||
@@ -925,12 +925,16 @@ class ProfilUpdate extends FHCAPI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
private function handleDupplicateZustellKontakte($zustellung, $kontakt_id, $person_id)
|
||||
private function handleDupplicateZustellKontakte($zustellung, $kontakt_id, $kontakttyp, $person_id)
|
||||
{
|
||||
if ($zustellung) {
|
||||
$this->PersonModel->addSelect("public.tbl_kontakt.kontakt_id");
|
||||
$this->PersonModel->addJoin("public.tbl_kontakt", "public.tbl_kontakt.person_id = public.tbl_person.person_id");
|
||||
$zustellKontakteArray = $this->PersonModel->loadWhere(["public.tbl_person.person_id" => $person_id, "zustellung" => TRUE]);
|
||||
$zustellKontakteArray = $this->PersonModel->loadWhere([
|
||||
"public.tbl_person.person_id" => $person_id,
|
||||
"zustellung" => TRUE,
|
||||
"kontakttyp" => $kontakttyp
|
||||
]);
|
||||
if (!isSuccess($zustellKontakteArray)) {
|
||||
return error($this->p->t('profilUpdate', 'profilUpdate_loadingZustellkontakte_error'));
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ class Profil_update_model extends DB_Model
|
||||
$this->addSelect(["public.tbl_profil_update.*", "public.tbl_person.vorname"]);
|
||||
$this->addJoin("public.tbl_benutzer", "public.tbl_benutzer.uid = public.tbl_profil_update.uid");
|
||||
$this->addJoin("public.tbl_person", "public.tbl_person.person_id = public.tbl_benutzer.person_id");
|
||||
$this->db->order_by('COALESCE(public.tbl_profil_update.updateamum, public.tbl_profil_update.insertamum)', 'DESC', false);
|
||||
$res = $this->loadWhere($whereClause);
|
||||
if (isError($res)) {
|
||||
return $res;
|
||||
|
||||
@@ -120,10 +120,10 @@ export const Profil = {
|
||||
},
|
||||
sortProfilUpdates: (ele1, ele2) => {
|
||||
let result = 0;
|
||||
if (ele1.status === "pending") {
|
||||
if (ele1.status.toLowerCase() === "pending") {
|
||||
result = -1;
|
||||
} else if (ele1.status === "accepted") {
|
||||
result = ele2.status === "rejected" ? -1 : 1;
|
||||
} else if (ele1.status.toLowerCase() === "accepted") {
|
||||
result = ele2.status.toLowerCase() === "rejected" ? -1 : 1;
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
@@ -226,10 +226,13 @@ export const Profil = {
|
||||
kontakteArray = kontakteArray.concat(
|
||||
this.data.profilUpdates
|
||||
.filter((update) => {
|
||||
return update.requested_change.zustellung;
|
||||
return update.status === 'Pending' && update.requested_change.zustellung;
|
||||
})
|
||||
.map((kontant) => {
|
||||
return kontant.requested_change.kontakt_id;
|
||||
return {
|
||||
kontakt_id: kontant.requested_change.kontakt_id,
|
||||
kontakttyp: kontant.requested_change.kontakttyp
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -241,7 +244,7 @@ export const Profil = {
|
||||
.every((kontakt) =>
|
||||
this.data.profilUpdates.some(
|
||||
(update) =>
|
||||
update.requested_change.kontakt_id == kontakt.kontakt_id
|
||||
update.status === 'Pending' && update.requested_change.kontakt_id == kontakt.kontakt_id
|
||||
)
|
||||
)
|
||||
) {
|
||||
@@ -251,7 +254,10 @@ export const Profil = {
|
||||
return kontakt.zustellung;
|
||||
})
|
||||
.map((kon) => {
|
||||
return kon.kontakt_id;
|
||||
return {
|
||||
kontakt_id: kon.kontakt_id,
|
||||
kontakttyp: kon.kontakttyp
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
view:String,
|
||||
withZustelladresse:{
|
||||
type:Boolean,
|
||||
default:false,
|
||||
default:true,
|
||||
},
|
||||
},
|
||||
data(){
|
||||
|
||||
@@ -160,10 +160,8 @@ export default {
|
||||
<div class="gy-3 row justify-content-center align-items-center">
|
||||
<!-- warning message for too many zustellungs Adressen -->
|
||||
<div v-if="showZustellAdressenWarning" class="col-12 ">
|
||||
<div class="card bg-danger mx-2">
|
||||
<div class="card-body text-white ">
|
||||
<div class="alert alert-warning mx-2">
|
||||
<span>{{$p.t('profilUpdate','zustell_adressen_warning')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End of warning -->
|
||||
@@ -173,7 +171,7 @@ export default {
|
||||
<div class="form-check mb-2">
|
||||
<input class="form-check-input" type="checkbox" @change="updateValue($event,'zustelladresse')" :checked="data.zustelladresse" id="flexCheckDefault">
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
{{$p.t('person','zustelladresse')}}
|
||||
{{$p.t('person','zustelladresse')}} {{$p.t('profilUpdate','infoZustelladresse')}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,12 +30,15 @@ export default {
|
||||
// if the kontakt is already a zustellungskontakt when the user is editing the kontakt, then no warning is shown and the zustellung will be overwritten
|
||||
if (JSON.parse(this.originalValue).zustellung) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const kontakteOfSelectedType = this.zustellKontakteCount.filter((element) => {
|
||||
return element.kontakttyp === this.data?.kontakttyp
|
||||
});
|
||||
// if zustellKontakteCount is not 0 and the own kontakt has the flag zustellung set to true
|
||||
if (!this.zustellKontakteCount.includes(this.data.kontakt_id)) {
|
||||
return this.data.zustellung && this.zustellKontakteCount.length;
|
||||
if (!this.zustellKontakteCount.some((element) => element.kontakt_id === this.data.kontakt_id)) {
|
||||
return this.data.zustellung && kontakteOfSelectedType.length;
|
||||
}
|
||||
return this.zustellKontakteCount.length >= 2 && this.data.zustellung;
|
||||
return this.kontakteOfSelectedType.length >= 2 && this.data.zustellung;
|
||||
},
|
||||
isChanged: function () {
|
||||
//? returns true if the original passed data object was changed
|
||||
@@ -57,16 +60,6 @@ export default {
|
||||
|
||||
<div class="gy-3 row align-items-center justify-content-center">
|
||||
|
||||
<!-- warning message for too many zustellungs Kontakte -->
|
||||
<div v-if="showZustellKontakteWarning" class="col-12 ">
|
||||
<div class="card bg-danger mx-2">
|
||||
<div class="card-body text-white ">
|
||||
<span>{{$p.t('profilUpdate','zustell_kontakte_warning')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End of warning -->
|
||||
|
||||
<div v-if="!data.kontakt_id" class="col-12">
|
||||
|
||||
|
||||
@@ -108,6 +101,14 @@ export default {
|
||||
|
||||
</div>
|
||||
|
||||
<!-- warning message for too many zustellungs Kontakte -->
|
||||
<div v-if="showZustellKontakteWarning" class="col-12 ">
|
||||
<div class="alert alert-warning mx-2">
|
||||
<span>{{$p.t('profilUpdate','zustell_kontakte_warning')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End of warning -->
|
||||
|
||||
<div class="d-flex flex-row justify-content-start col-12 allign-middle">
|
||||
<span style="opacity: 0.65; font-size: .85rem; " class="px-2">{{$p.t('profilUpdate','zustellungsKontakt')}}</span>
|
||||
|
||||
|
||||
@@ -148,16 +148,32 @@ export default {
|
||||
<template v-if="!view">
|
||||
<div class="list-group">
|
||||
<template v-for="item in data">
|
||||
<div v-if="!(this.isMitarbeiter === false && item.listview === 'Adresse' && item.data.heimatadresse === true)" class="d-flex flex-row align-items-center">
|
||||
<button style="position:relative" type="button" class=" list-group-item list-group-item-action" @click="updateOptions($event,item)" >
|
||||
<div class="d-flex flex-row align-items-center">
|
||||
<button
|
||||
style="position:relative"
|
||||
type="button" class="list-group-item list-group-item-action"
|
||||
@click="updateOptions($event,item)"
|
||||
:disabled="(this.isMitarbeiter === false && item.listview === 'Adresse' && item.data.heimatadresse === true)"
|
||||
>
|
||||
<!-- render title of options -->
|
||||
<p v-if="item.title" class="my-1" >{{item.title}}</p>
|
||||
<!-- else render list view of items -->
|
||||
<div v-else class="my-2 me-4" >
|
||||
<component :is="item.listview" v-bind="item"></component>
|
||||
<div
|
||||
v-if="(this.isMitarbeiter === false && item.listview === 'Adresse' && item.data.heimatadresse === true)"
|
||||
class="gy-2 row justify-content-center align-items-center"
|
||||
>
|
||||
<div class="col-1"> </div>
|
||||
<div class="col-11">
|
||||
<div class="alert alert-info mt-4" role="alert">
|
||||
{{ $p.t('profilUpdate','infoHeimatadresse') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<button v-if="item.listview && !(item.listview === 'Adresse' && item.data.heimatadresse === true)" @click="deleteItem(item)" type="button" class="mx-3 btn btn-danger btn-circle" :aria-label="$p.t('profilUpdate','deleteItem')" :title="$p.t('profilUpdate','deleteItem')" ><i class="fa fa-trash" aria-hide="true"></i></button>
|
||||
<button v-if="item.listview" :disabled="(this.isMitarbeiter === false && item.listview === 'Adresse' && item.data.heimatadresse === true)" @click="deleteItem(item)" type="button" class="mx-3 btn btn-danger btn-circle" :aria-label="$p.t('profilUpdate','deleteItem')" :title="$p.t('profilUpdate','deleteItem')" ><i class="fa fa-trash" aria-hide="true"></i></button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -28928,13 +28928,13 @@ array(
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Einer ihrer Adressen wird bereits zur Zustellung verwendet, möchten sie diese Adressen als Zustellungsadresse übernehmen?',
|
||||
'text' => 'Eine andere Adresse wird aktuell zur Zustellung verwendet, in Zukunft würde diese Adresse als Zustellungsadresse verwendet werden!',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'One of your addresses is already used as a contact address, would you like to use this address as your new contact address?',
|
||||
'text' => 'Another address is currently used as contact address, in the future this address would be used as contact address!',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
@@ -28948,13 +28948,13 @@ array(
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Einer ihrer Kontakte wird bereits zur Zustellung verwendet, möchten sie diesen Kontakt als Zustellungskontakt übernehmen?',
|
||||
'text' => 'Ein anderer Kontakt wird aktuell zur Zustellung verwendet, in Zukunft würde dieser Kontakt als Zustellungskontakt verwendet werden!',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'One of your contacts is already used as a communication mean, would you like to use this contact as your new communication mean?',
|
||||
'text' => 'Another contact is currently used for communication, in the future this contact would be used for communication!',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
@@ -30381,6 +30381,46 @@ array(
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'profilUpdate',
|
||||
'phrase' => 'infoHeimatadresse',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Die initiale Meldeadresse kann aufgrund von Berichtspflichten nicht verändert oder gelöscht werden.',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'The initial official address can not be changed or deleted due to reporting obligations.',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'profilUpdate',
|
||||
'phrase' => 'infoZustelladresse',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => '(Soll etwaige Post an diese Adresse geschickt werden?)',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => '(Should any paper mail be sent to this address?)',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
//ProfilUpdate Phrasen ende
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user