CREATE OR REPLACE FORCE VIEW "VWITEMDETAIL" ("ITEMDETAIL_ID", "ITEM_LKP_ID", "ITEM_NAME", "PATIENT_ID", "QUANTITY", "ITEM_COST", "STORE_LOCATION", "ASSIGNED_USER_ID", "RECURRENT_ID", "IS_ACTIVE", "START_DATE", "WHEN_TO_END", "END_TIME", "TO_TIME", "ISTIMEBOUND", "ADD_TO_CALENDAR", "UPDATED_DATE", "PATIENT_NAME", "PATIENT_LAST_NAME", "PATIENT_MIDDLE_INITIAL", "PATIENT_NICK_NAME", "USER_NAME", "USER_EMAIL", "FIRST_NAME", "USER_LAST_NAME", "USER_MIDDLE_INITIAL", "CREATED_BY", "RECURRENT_TYPE")
AS
  SELECT id.itemdetail_id,
    il.item_lkp_id,
    il.item_name AS item_name,
    id.patient_id,
    NVL(id.quantity,0)          AS quantity,
    NVL(id.item_cost,0)         AS item_cost,
    NVL(id.store_location,' ')  AS store_location,
    NVL(id.assigned_user_id, 0) AS assigned_user_id,
    id.recurrent_id,
    id.is_active,
    id.start_date,
    NVL(id.when_to_end,' ') AS when_to_end,
    NVL(id.end_time, '')    AS end_time,
    NVL(id.to_time,'')      AS to_time,
    id.istimebound,
    id.add_to_calendar,
    id.updated_date,
    p.name                AS patient_name,
    p.last_name           AS patient_last_name,
    p.middle_initial      AS patient_middle_initial,
    p.nick_name           AS patient_nick_name,
    up.user_name          AS user_name,
    up.user_email         AS user_email,
    up.first_name         AS first_name,
    up.last_name          AS user_last_name,
    up.middle_initial     AS user_middle_initial,
    NVL(id.created_by, 0) AS created_by,
    rl.recurrent_type     AS recurrent_type
  FROM item_lkp il ,
    recurrent_type_lkp rl,
    item_detail id
  LEFT JOIN patient_profile p
  ON id.patient_id = p.patient_id
  LEFT JOIN user_profile up
  ON id.assigned_user_id = up.user_id
  WHERE id.item_lkp_id   =il.item_lkp_id
  AND id.recurrent_id    = rl.recurrent_id;


update invitation_templates set messagebody='<p>Hello [$SecondaryCaregiver],</p><p>Reminder:</p><p>You have been invited by [$PrimaryCaregiver] to join the Caregiver Network for [@Care Recipient] on StrengthForCaring, a place for caregivers.</p><p>[$messagefromUser]</p><p><a href="$RegisterUrl">Register for Care Connector</a>&#160;&#160;&#160;<a href="$RejectUrl">Reject</a></P>' where template_type='Resend Invites';

CREATE OR REPLACE FORCE VIEW "VW_PATIENT_DETAILS"
AS
  SELECT p.patient_id,
    p.name,
    p.last_name,
    p.middle_initial,
    p.dob,
    p.blood_group_id,
    bl.bg_type,
    p.is_active,
    p.is_deleted,
    p.birth_country,
    p.spoken_language,
    p.ethnic,
    p.maritial_status,
    p.height_feet,
    p.weight,
    p.nick_name,
    p.height_inches,
    p.gender,
    p.created_by
  FROM patient_profile p
  LEFT JOIN blood_group_lkp bl
  ON p.blood_group_id = bl.blood_group_id;



CREATE OR REPLACE FORCE VIEW "VW_MODULE_CACHE_PATIENT"
                       AS
  SELECT 'Appointment' AS module_name,
    UCH.PATIENT_ID,
    greatest(MAX(uch.updated_date), NVL(MAX(ucha.updated_date),'27-Oct-2010')) AS lastdate
  FROM user_calender_header uch
  LEFT JOIN user_calender_header_archive ucha
  ON uch.patient_id = ucha.patient_id,
    event_type_lkp el
  WHERE el.event_type       = 'Appointment'
  AND uch.event_type_lkp_id = el.event_type_lkp_id
  GROUP BY 'Appointment',
    UCH.PATIENT_ID
  UNION
  SELECT 'Todo',
    UCH.PATIENT_ID,
    greatest(MAX(uch.updated_date),NVL(MAX(ucha.updated_date),'27-Oct-2010'))
  FROM user_calender_header uch
  LEFT JOIN user_calender_header_archive ucha
  ON uch.patient_id = ucha.patient_id,
    event_type_lkp el
  WHERE el.event_type       = 'Todo'
  AND uch.event_type_lkp_id = el.event_type_lkp_id
  GROUP BY UCH.PATIENT_ID
  UNION
  SELECT 'Prescription',
    pl.PATIENT_ID ,
    greatest(MAX(pl.updated_date), NVL(MAX(pa.updated_date),'27-Oct-2010'))
  FROM prescription_lnk pl
  LEFT JOIN prescription_archive pa
  ON pl.patient_id = pa.patient_id
  GROUP BY pl.PATIENT_ID
  UNION
  SELECT 'Shoppinglist',
    itd.PATIENT_ID ,
    greatest(MAX(itd.updated_date), NVL(MAX(itda.updated_date),'27-Oct-2010'))
  FROM item_detail itd
  LEFT JOIN item_detail_archive itda
  ON itd.patient_id = itda.patient_id
  GROUP BY itd.PATIENT_ID
  UNION
  SELECT 'Allergies',
    pil.PATIENT_ID,
    MAX(pil.updated_date)
  FROM patient_issues_lnk pil,
    medical_issue_types mit
  WHERE mit.issue_type_name = 'Allergy'
  AND pil.issue_type_id     = mit.issue_type_id
  GROUP BY pil.PATIENT_ID
  UNION
  SELECT 'Conditions',
    pil.PATIENT_ID ,
    MAX(pil.updated_date)
  FROM patient_issues_lnk pil,
    medical_issue_types mit
  WHERE mit.issue_type_name = 'Condition'
  AND pil.issue_type_id     = mit.issue_type_id
  GROUP BY pil.PATIENT_ID
  UNION
  SELECT 'Procedures',
    pil.PATIENT_ID ,
    MAX(pil.updated_date)
  FROM patient_issues_lnk pil,
    medical_issue_types mit
  WHERE mit.issue_type_name = 'Procedures'
  AND pil.issue_type_id     = mit.issue_type_id
  GROUP BY pil.PATIENT_ID
  UNION
  SELECT 'Treatments',
    pil.PATIENT_ID ,
    MAX(pil.updated_date)
  FROM patient_issues_lnk pil,
    medical_issue_types mit
  WHERE mit.issue_type_name = 'Treatement'
  AND pil.issue_type_id     = mit.issue_type_id
  GROUP BY pil.PATIENT_ID
  UNION
  SELECT 'Personaldata',
    p.PATIENT_ID ,
    MAX(p.updated_date)
  FROM patient_profile p
  GROUP BY p.PATIENT_ID
  UNION
  SELECT 'Immunizations',
    i.PATIENT_ID ,
    greatest(MAX(i.updated_date), NVL(MAX(ipa.updated_date),'27-Oct-2010'))
  FROM immunization_patient_lnk i
  LEFT JOIN immunization_patient_archive ipa
  ON i.patient_id = ipa.patient_id
  GROUP BY i.PATIENT_ID
  UNION
  SELECT 'Contacts',
    cl.PATIENT_ID ,
    greatest(MAX(cl.updated_date),NVL(MAX(ca.updated_date),'27-Oct-2010'),NVL(MAX(cp.updated_date),'27-Oct-2010'),NVL(MAX(cla.updated_date),'27-Oct-2010'))
  FROM contact_lkp cl
  LEFT JOIN contact_phone cp
  ON cp.contact_lkp_id = cl.contact_lkp_id
  LEFT JOIN contact_address ca
  ON ca.contact_lkp_id = cl.contact_lkp_id
  LEFT JOIN contact_lkp_archive cla
  ON cl.patient_id = cla.patient_id
  GROUP BY cl.PATIENT_ID
  UNION
  SELECT 'Insurance',
    il.PATIENT_ID ,
    greatest(MAX(il.updated_date),NVL(MAX(pa.updated_date),'27-Oct-2010'))
  FROM patient_insurance_lnk il
  LEFT JOIN patient_insurance_archive pa
  ON il.patient_id = pa.patient_id
  GROUP BY il.PATIENT_ID
  UNION
  SELECT 'Journal',
    jl.PATIENT_ID ,
    greatest(MAX(jl.updated_date),NVL(MAX(ja.updated_date),'27-Oct-2010'))
  FROM journal_lnk jl
  LEFT JOIN journal_archive ja
  ON jl.patient_id = ja.patient_id
  GROUP BY jl.PATIENT_ID
  UNION
  SELECT 'Legal',
    le.PATIENT_ID ,
    greatest(MAX(le.updated_date),NVL(MAX(la.updated_date),'27-Oct-2010'))
  FROM patient_legal_lnk le
  LEFT JOIN patient_legal_archive la
  ON le.patient_id = la.patient_id
  GROUP BY le.PATIENT_ID
  UNION
  SELECT 'Financial',
    pf.PATIENT_ID ,
    greatest(MAX(pf.updated_date),NVL(MAX(fa.updated_date), '27-Oct-2010'))
  FROM patient_financial_lnk pf
  LEFT JOIN patient_financial_archive fa
  ON pf.patient_id = fa.patient_id
  GROUP BY pf.PATIENT_ID
  UNION
  SELECT 'EmergencyProcedure',
    ep.PATIENT_ID ,
    greatest(MAX(ep.updated_date),NVL(MAX(epa.updated_date),'27-Oct-2010'))
  FROM emergency_procedure_lnk ep
  LEFT JOIN emergency_procedure_archive epa
  ON ep.patient_id = epa.patient_id
  GROUP BY ep.PATIENT_ID
  UNION
  SELECT 'GroupMessages',
    m.PATIENT_ID ,
    greatest(MAX(m.updated_date), NVL(MAX(ma.updated_date),'27-Oct-2010'))
  FROM messages m
  LEFT JOIN messages_archive ma
  ON m.patient_id = ma.patient_id
  GROUP BY m.PATIENT_ID
  UNION
  SELECT 'Invitation',
    upi.patient_id,
    greatest(MAX(upi.updated_date), NVL(MAX(upa.updated_date),'27-Oct-2010'))
  FROM user_profile_invites upi
  LEFT JOIN user_profile_invites_archive upa
  ON upi.patient_id = upa.patient_id
  GROUP BY upi.patient_id
  UNION
  SELECT 'Schedule',
    vc.patient_id,
    greatest(MAX(vc.updated_date), NVL(MAX(pa.updated_date),'27-Oct-2010'), NVL(MAX(itda.updated_date),'27-Oct-2010'))
  FROM vw_user_calendar_iteration vc
  LEFT JOIN item_detail_archive itda
  ON vc.patient_id = itda.patient_id
  LEFT JOIN prescription_archive pa
  ON vc.patient_id = pa.patient_id
  GROUP BY vc.patient_id
  UNION
  SELECT 'Notes',
    uch.patient_id,
    greatest(MAX(n.updated_date),NVL(MAX(na.updated_date),'27-Oct-2010'),NVL(MAX(uch.updated_date),'27-Oct-2010'))
  FROM notes_lnk n
  LEFT JOIN notes_archive na
  ON n.user_calender_header_id = na.user_calender_header_id
  LEFT JOIN user_calender_header uch
  ON n.user_calender_header_id = uch.user_calender_header_id
  GROUP BY uch.patient_id
  UNION
  SELECT 'PatientPicture',
    pp.patient_id,
    MAX(pp.updated_date)
  FROM patient_profile_picture pp
  GROUP BY pp.patient_id
  UNION
  SELECT 'Permissions',
    urp.patient_id,
    MAX(urp.updated_date)
  FROM user_role_patient_lnk urp
  GROUP BY urp.patient_id
  UNION
  SELECT 'Permissions',
    nrl.patient_id,
    MAX(nrm.updated_date)
  FROM network_role_module_permission nrm,
    network_role_lkp nrl
  WHERE nrl.network_role_id = nrm.network_role_id
  GROUP BY nrl.patient_id,
    nrm.network_role_id;


ALTER TABLE INVITATION_TEMPLATES ADD (SUBJECT VARCHAR2(500) );


insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Legal','<p>Hello [$CareGiver],</p><p>New Legal information has been posted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Legal Information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_Legal','<p>Hello [$CareGiver],</p><p>Legal information has been edited for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Legal Information has been edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Legal','<p>Hello [$CareGiver],</p><p>Legal information has been deleted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Legal Information deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Emergency_Procedure','<p>Hello [$CareGiver],</p><p>New emergency Procedure information has been posted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Emergency Procedure Information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_Emergency_Procedure','<p>Hello [$CareGiver],</p><p>Emergency Procedure information has been edited for  [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Emergency Procedure Information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Emergency_Procedure','<p>Hello [$CareGiver],</p><p>Emergency Procedure information has been deleted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Emergency Procedure Information has been deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Shopping_List','<p>Hello [$CareGiver],</p><p>[$Primary Caregiver] has asked you to please do the following:</p><p>Remember to pick up [$what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Shopping list item has been assigned to you for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Update_Shopping_List','<p>Hello [$CareGiver],</p><p>Shopping List information has been edited for [$Care Recipient]</p><p>Remember to pick up [$what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Shopping List Information edited for [$Care Recipient]');

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Shopping List information has been deleted for [$Care Recipient]</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>' , subject='Shopping List Information has been deleted for [$Care Recipient]' where template_type='Shopping List Delete';

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Reminder_Shopping_List','<p>Hello [$CareGiver],</p><p>This is a shopping list reminder from your [$SiteName] CarePlanner for [$CareGiver]</p><p>Remember to pick up [$what] for [$Care Recipient] on [$date] at [$time].</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Shopping list reminder for [$Care Giver]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Appointment_List','<p>Hello [$CareGiver],</p><p>[$Primary Caregiver] has asked you to please do the following:</p><p> [what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Appointment item has been assigned to you for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Update_Appointment_List','<p>Hello [$CareGiver],</p><p>Appointment information has been edited for [$Care Recipient]</p><p> [$what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Appointment Information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Appointment_List','<p>Hello [$CareGiver],</p><p>Appointment information has been deleted for [$Care Recipient]</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Appointment Information has been deleted for [$Care Recipient]');

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p>This is an appointment reminder from your [$SiteName] Organizer for [$Care Recipient]</p><p> [$what] for [$Care Recipient] on [$date] at [$time].</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>' , subject='Appointment reminder for [$Care Giver]' where template_type='Appointment Reminder';

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Todo_List','<p>Hello [$CareGiver],</p><p>[$Primary Caregiver] has asked you to please do the following:</p><p>[$Name of to-do] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'A To-do list item has been assigned to you  for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_Todo_List','<p>Hello [$CareGiver],</p><p>A to-do list item has been edited for [$Care Recipient]</p><p>[$Name of to-do] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'A To-do item has been edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Todo_List','<p>Hello [$CareGiver],</p><p>A to-do list item has been deleted for [$Care Recipient]</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'To-do item deleted for [$Care Recipient]');

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p>This is a to-do reminder from your [$SiteName] Organizer for [$Care Recipient]:</p><p> [$Name of to-do] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>' , subject='To-do reminder for [$Care Giver]' where template_type='TODO List Reminder';

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Journal','<p>Hello [$CareGiver],</p><p> New Journal Information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Journal Information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_Journal','<p>Hello [$CareGiver],</p><p> Journal Information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Journal Information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Journal','<p>Hello [$CareGiver],</p><p>Journal Information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Journal Information has been deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_PersonalData','<p>Hello [$CareGiver],</p><p>Personal Information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Personal Information has been edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Insurance','<p>Hello [$CareGiver],</p><p>New Insurance information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Insurance Information has been added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_Insurance','<p>Hello [$CareGiver],</p><p>Insurance information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Insurance Information has been edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Insurance','<p>Hello [$CareGiver],</p><p>Insurance information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Insurance Information deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Conditions','<p>Hello [$CareGiver],</p><p>New Conditions information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Conditions Information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_Conditions','<p>Hello [$CareGiver],</p><p>Conditions information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Conditions Information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Conditions','<p>Hello [$CareGiver],</p><p>Conditions information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Conditions Information has been deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Add_Allergies','<p>Hello [$CareGiver],</p><p>New Allergy information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Allergy Information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Edit_Allergies','<p>Hello [$CareGiver],</p><p>Allergy information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Allergy Information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values('Delete_Allergies','<p>Hello [$CareGiver],</p><p>Allergy information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteName]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Allergy Information has been deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Add_Immunizztion','<p>Hello [$CareGiver],</p><p>New immunization information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Immunization Information added for [$Care Recipient]');
 
insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Edit_Immunization','<p>Hello [$CareGiver],</p><p>Immunization information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Immunization Information edited for [$Care Recipient]');
 
insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Delete_Immunization','<p>Hello [$CareGiver],</p><p>Immunization information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Immunization Information has been deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Add_Group_Message','<p>Hello [$CareGiver],</p><p>The following group message has been posted by [$Caregiver Message sender] [$Group Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p>',1,sysdate,1,sysdate,'Group Message added for [$Care Recipient]');
 
insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Delete_Group_Message','<p>Hello [$CareGiver],</p><p>The following group message has been deleted by [$Caregiver Message sender] [$Group Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p>',1,sysdate,1,sysdate,'Group Message deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Add_Group_Message_Alert','<p>Hello [$CareGiver],</p><p>The following group alert message has been posted by [$Caregiver Message sender] [$Group Alert Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p>',1,sysdate,1,sysdate,'URGENT Group Alert added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Delete_Group_Message_Alert','<p>Hello [$CareGiver],</p><p>The following alert group message has been deleted by [$Caregiver Message sender] [$Group Alert Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p>',1,sysdate,1,sysdate,'URGENT Group Alert Message deleted for [$Care Recipient]');                                       

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Edit_Prescription','<p>Hello [$CareGiver],</p><p>A prescription item has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'A Prescription item has been edited for [$Care Recipient]');
 
insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Delete_Prescription','<p>Hello [$CareGiver],</p><p>A prescription item has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'A Prescription item deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Add_Prescription','<p>Hello [$Caregiver],</p><p>[$Assigning Caregiver] has asked you to please do the following:</p><p>[$Name of prescription],[$dosage] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Prescription list item has been assigned to you for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Reminder_Prescription','<p>Hello [$Caregiver],</p><p>This is a prescripition reminder from your [$SiteName] Organizer for [$Care Recipient]</p><p>[$Name of prescription],[$dosage] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Prescription reminder for [$Caregiver]');

insert into invitation_templates(template_type,messagebody,created_by,create\d_date,updated_by,updated_date,subject) values ('ADD_FINANCIAL','<p>Hello [$CareGiver],</p><p>New Financial information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> YourCaregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Financial Information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('EDIT_FINANCIAL','<p>Hello [$CareGiver],</p><p>Financial information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> YourCaregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Financial Information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('DELETE_FINANCIAL','<p>Hello [$CareGiver],</p><p>Financial information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Financial Information has been deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('ADD_MEASUREMENTS','<p>Hello [$CareGiver],</p><p>New measurement information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Measurement Information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Edit_Measurements','<p>Hello [$CareGiver],</p><p>Measurement information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Measurement information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Delete_Measurements','<p>Hello [$CareGiver],</p><p>Measurement information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Measurement information has been deleted for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Add_Contacts','<p>Hello [$CareGiver],</p><p>New contact information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Contact information added for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Edit_Contacts','<p>Hello [$CareGiver],</p><p>Contact information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Contact information edited for [$Care Recipient]');

insert into invitation_templates(template_type,messagebody,created_by,created_date,updated_by,updated_date,subject) values ('Delete_Contacts','<p>Hello [$CareGiver],</p><p>Contact information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteName]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>',1,sysdate,1,sysdate,'Contact information has been deleted for [$Care Recipient]');

update invitation_templates set messagebody='<p>Hello [$Caregiver],</p><p>We thank you for becoming a valued member of [$SiteName] as a supplemetary caregiver. We hope [$SiteName] makes caregiving easier for you and your loved ones. We invite you to take a minute to explore the features of the site. In case you have any difficulties while there, please contact our site administrator through this <a href="$Siteurl">link</a>.</p><p>Thank you!</p><p>All of us at [$SiteName], a place for caregivers</p>' where template_type='Registration Confirmation';

update invitation_templates set subject='Welome $Caregiver' where template_type='Registration Confirmation';

update invitation_templates set messagebody='<p>Hello $Caregiver,</P><p>As requested, here''s a link to a page where you can reset your [$SiteName] password:<a href="[$Password change link]">ChangePassword</a></p><p>If you cannot click on the link above, please highlight the link, copy it, and paste it into your browser. </p><p>All the best from [$SiteName] -- let us know how we can be helpful.</p>' where template_type='Forgot Password';

update invitation_templates set subject='Here''s how to reset your [$SiteName] password' where template_type='Forgot Password';

update invitation_templates set messagebody='<p>Hello [$SecondaryCaregiver],</p><p>You have been invited by [$PrimaryCaregiver] to join the Caregiver Network for [@Care Recipient] on [$SiteName], a place for caregivers.</p><p> <a href="$RegisterUrl">Register for Care Connector</a>  <a href="$RejectUrl">Reject</a> </p>' where template_type='Send Invites';

update invitation_templates set subject='Join $Care Recipient''s caregiver network' where template_type='Send Invites';

update invitation_templates set messagebody='<p>Hello [$SecondaryCaregiver],</p><p>Reminder:</p><p>You have been invited by [$PrimaryCaregiver] to join the Caregiver Network for [@Care Recipient] on [$SiteName], a place for caregivers.</p><p>[$messagefromUser]</p><p><a href="$RegisterUrl">Register for Care Connector</a>&#160;&#160;&#160;<a href="$RejectUrl">Reject</a></P>' where template_type='Resend Invites';

update invitation_templates set subject='Join $Care Recipient''s caregiver network' where template_type='Resend Invites';

update invitation_templates set messagebody='<p>Hello [$PrimaryCaregiver],</p><p>We are happy to tell you that [$SecondaryCaregiver] has accepted your invitation to join the Caregiver Network for $Care Recipient.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>' where template_type='Accept Invites';

update invitation_templates set subject='Invitation Accepted' where template_type='Accept Invites';

update invitation_templates set messagebody='<p>Hello [$PrimaryCaregiver],</p><p>We just wanted to inform you that [$SecondaryCaregiver] has chosen not to accept your invitation to join the Caregiver Network for $Care Recipient.</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>' where template_type='Reject Invites';

update invitation_templates set subject='Invitation Refused' where template_type='Reject Invites';

update invitation_templates set messagebody='<p>Hello [$SecondaryCaregiver],</p><p>We are writing to let you know that your name has been removed from $Care Recipients caregivers network. You will be no longer have access to the CarePlanner for this care recipient.</p><p>If you feel this removal was made in error, please contact the [$SiteName] administrator: <a href="$Siteurl">mail link</a></p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>' where template_type='Group Member';

update invitation_templates set subject='Removed from $Care Recipient''s network' where template_type='Group Member';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p>This is an appointment reminder from your [$SiteName] Organizer for [$Care Recipient]</p><p> [$what] for [$Care Recipient] on [$date] at [$time].</p><p>Best wishes from all of us at [$SiteName], a place for caregivers.</p>' where template_type='Appointment Reminder';

update invitation_templates set subject='Appointment reminder for $Caregiver' where template_type='Appointment Reminder';

CREATE OR REPLACE FORCE VIEW "VW_MESSAGE_ALERT_COUNT" AS SELECT v.user_id,
p.patient_id,
lower(p.name) AS name,
lower(p.last_name) AS last_name,
lower(p.nick_name) as nick_name,
v.message_count,
v1.message_count AS alert_count,
v.message_updated_date,
v1.alert_updated_date
FROM vw_message_count_list v,
vw_message_alert_count_list v1,
patient_profile p,
user_role_patient_lnk urpl
WHERE p.patient_id =v.patient_id
AND v1.patient_id =p.patient_id
AND urpl.patient_id = p.patient_id
AND urpl.is_active = 1
AND urpl.user_id = v.user_id
AND v1.user_id =v.user_id
AND p.is_deleted =0
AND p.is_active =1;

update site_settings set value = '<footer><div style="color:#6790B1;font-family:Arial,Helvetica,sans-serif;font-size:11px;text-align:center;width:700px;"> <p><a title="Terms of Use" href="http://dev-drupal.cc.cl.datapipe.net/terms-conditions">Terms of Use</a><span> | </span><a title="Legal Notice" href="http://dev-drupal.cc.cl.datapipe.net/legal-notice">Legal Notice</a><span> | </span><a title="Privacy Policy" href="http://dev-drupal.cc.cl.datapipe.net/privacy-policy">Privacy Policy</a><br><span>&#169; Wellness &#38; Prevention, Inc., 2010 All Rights Reserved.</span> <br><span>This site is published by Wellness &#38; Prevention, Inc., which is solely responsible for its contents. </span></p></div></footer>' where variable_name='html_footer';


update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New immunization information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Immunizztion';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Immunization information has been edited for[$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Immunization';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Immunization information has been deleted for[$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Immunization';


update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>A Prescription item has been edited for[$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Prescription';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>A prescription item has been deleted for[$Care Recipient].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Prescription';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>[$Assigning CareGiver] has asked you to please do the following:</p><p>[$Name of prescription],[$dosage] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Prescription';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>This is a prescripition reminder from your [$SiteTitle] Organizer for [$Care Recipient]</p><p>[$Name of prescription],[$dosage] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Reminder_Prescription';


update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>The following group message has been posted by [$Caregiver Message sender] [$Group Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p>' where template_type='Add_Group_Message';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>The following group message has been deleted by [$Caregiver Message sender] [$Group Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p>' where template_type='Delete_Group_Message';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>The following group alert message has been posted by[$Caregiver Message sender] [$Group Alert Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p>' where template_type='Add_Group_Message_Alert';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>The following alert group message has been deleted by [$Caregiver Message sender] [$Group Alert Message].</p><p><a href="[$BaseURL]">Click here to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p>' where template_type='Delete_Group_Message_Alert';


update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New Financial information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='ADD_FINANCIAL';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Financial information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='EDIT_FINANCIAL';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Financial information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='DELETE_FINANCIAL';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New measurement information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='ADD_MEASUREMENTS';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Measurement information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Measurements';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Measurement information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Measurements';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New contact information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Contacts';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Contact information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]:</a> Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Contacts';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Contact information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion'' site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Contacts';

update invitation_templates set messagebody='<p>Hello [$Caregiver],</p><p>We thank you for becoming a valued member of [$SiteTitle] as a supplemetary caregiver. We hope [$SiteTitle] makes caregiving easier for you and your loved ones. We invite you to take a minute to explore the features of the site. In case you have any difficulties while there, please contact our site administrator through this <a href="$Siteurl">link</a>.</p><p>Thank you!</p><p>All of us at Strength for Caring, a place for caregivers</p>' where template_type='Registration Confirmation';

update invitation_templates set messagebody='<p>Hello $Caregiver,</P><p>As requested, here''s a link to a page where you can reset your [$SiteTitle] password:<a href="[$Password change link]">ChangePassword</a></p><p>If you cannot click on the link above, please highlight the link, copy it, and paste it into your browser. </p><p>All the best from Strength for Caring -- let us know how we can be helpful.</p>' where template_type='Forgot Password';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New Legal information has been posted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Legal';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Legal information has been edited for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Legal';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Legal information has been deleted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Legal';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New emergency Procedure information has been posted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Emergency_Procedure';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Emergency Procedure information has been edited for  [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Emergency_Procedure';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Emergency Procedure information has been deleted for [$Care Recipient]</P><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Emergency_Procedure';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>[$Primary Caregiver] has asked you to please do the following:</p><p>Remember to pick up [$what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Shopping_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Shopping List information has been edited for [$Care Recipient]</p><p>Remember to pick up [$what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Update_Shopping_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Shopping List information has been deleted for [$Care Recipient]</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Shopping List Delete';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>This is a shopping list reminder from your [$SiteTitle] CarePlanner for [$CareGiver]</p><p>Remember to pick up [$what] for [$Care Recipient] on [$date] at [$time].</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Reminder_Shopping_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>[$Primary Caregiver] has asked you to please do the following:</p><p> [$what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Appointment_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Appointment information has been edited for [$Care Recipient]</p><p> [$what] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Update_Appointment_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Appointment information has been deleted for [$Care Recipient]</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Appointment_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p>This is an appointment reminder from your [$SiteTitle] Organizer for [$Care Recipient]</p><p> [$what] for [$Care Recipient] on [$date] at [$time].</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Appointment Reminder';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>[$Primary Caregiver] has asked you to please do the following:</p><p>[$Name of to-do] for [$Care Recipient] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Todo_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>A to-do list item has been edited for [$Care Recipient]</p><p>[$Name of to-do] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Todo_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>A to-do list item has been deleted for [$Care Recipient]</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Todo_List';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p>This is a to-do reminder from your [$SiteTitle] Organizer for [$Care Recipient]:</p><p> [$Name of to-do] on [$date] at [$time].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site.</p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='TODO List Reminder';


update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p> New Journal Information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Journal';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p> Journal Information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Journal';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Journal Information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Journal';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Personal Information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_PersonalData';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New Insurance information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Insurance';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Insurance information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Insurance';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Insurance information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Insurance';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New Conditions information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Conditions';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Conditions information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Conditions';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Conditions information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Conditions';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>New Allergy information has been posted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Add_Allergies';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Allergy information has been edited for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Edit_Allergies';

update invitation_templates set messagebody='<p>Hello [$CareGiver],</p><p>Allergy information has been deleted for [$Care Recipient].</p><p><a href="[$BaseURL]">Click here</a> to access [$SiteTitle]: Your Caregiving Companion site. </p><p>Best wishes from all of us at [$SiteTitle], a place for caregivers.</p>' where template_type='Delete_Allergies';

commit;

