--THIS FILE IS NEEDED ONLY FOR THE ONLINE UPDATE!!!

-- TT 13085 Update of new profile tab rights based on the profile details edit right
-- PLEASE RUN ONLY ONCE!!!

delete from wusr where wusr_name like 'Customer ProfilesTabs%';

insert into wusr
select seq_wusr.nextval, a.wusr_xcms_id, a.wusr_wegr_id, 'Customer ProfilesProfile TabsMore FieldsEdit', a.wusr_value
from wusr a
where a.wusr_name='Customer ProfilesProfile DetailsEdit';

insert into wusr
select seq_wusr.nextval, a.wusr_xcms_id, a.wusr_wegr_id, 'Customer ProfilesProfile TabsNotesEdit', a.wusr_value
from wusr a
where a.wusr_name='Customer ProfilesProfile DetailsEdit';

insert into wusr
select seq_wusr.nextval, a.wusr_xcms_id, a.wusr_wegr_id, 'Customer ProfilesProfile TabsMarketingEdit', a.wusr_value
from wusr a
where a.wusr_name='Customer ProfilesProfile DetailsEdit';

insert into wusr
select seq_wusr.nextval, a.wusr_xcms_id, a.wusr_wegr_id, 'Customer ProfilesProfile TabsLinked ProfilesEdit', a.wusr_value
from wusr a
where a.wusr_name='Customer ProfilesProfile DetailsEdit';

insert into wusr
select seq_wusr.nextval, a.wusr_xcms_id, a.wusr_wegr_id, 'Customer ProfilesProfile TabsLinked DocumentsEdit', a.wusr_value
from wusr a
where a.wusr_name='Customer ProfilesProfile DetailsEdit';

insert into wusr
select seq_wusr.nextval, a.wusr_xcms_id, a.wusr_wegr_id, 'Customer ProfilesProfile TabsFamilyEdit', a.wusr_value
from wusr a
where a.wusr_name='Customer ProfilesProfile DetailsEdit';


commit;


-- TT 13930 update of new profile marketing information rights based on profile details marketing information user rights
-- PLEASE RUN ONLY ONCE!!!

insert into wusr
select seq_wusr.nextval, a.wusr_xcms_id, a.wusr_wegr_id, 'Customer ProfilesMarketing information'||b.OpName wusr_name, a.wusr_value
from
wusr a,
(
 select 'Insert' Op, a.xpac_shortdesc||' '||a.xpac_longdesc||'Insert' OpName
 from xpac a
 where nvl(a.xpac_applcomp, 0)=1 or nvl(a.xpac_applind,0)=1
 union
 select 'Delete' Op, a.xpac_shortdesc||' '||a.xpac_longdesc||'Delete' OpName
 from xpac a
 where nvl(a.xpac_applcomp, 0)=1 or nvl(a.xpac_applind,0)=1
) b
where wusr_name='Customer ProfilesMarketing information'||b.Op;


delete from wusr where wusr_name='Customer ProfilesMarketing informationDelete';

delete from wusr where wusr_name='Customer ProfilesMarketing informationInsert';

delete from wusr where wusr_name='Customer ProfilesMarketing informationManagersInsert';

delete from wusr where wusr_name='Customer ProfilesMarketing informationManagersDelete';

delete from wusr where wusr_name='Customer ProfilesMarketing informationEdit';

delete from wusr where wusr_name='Customer ProfilesMarketing informationView';

commit;
