diff --git a/app/models/contact.rb b/app/models/contact.rb index e1e1f6f971fc26e73e3fc2bc2b20156e756e225b..f8f234aef7450e44c631140bcce9f737446b82b7 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -86,6 +86,8 @@ class Contact < ApplicationRecord end def update_staffomatic + return true unless StaffomaticService.configured? + contactable.update_staffomatic! if contactable.is_a?(Volunteer) end end diff --git a/app/policies/group_offer_policy.rb b/app/policies/group_offer_policy.rb index d94645070a9aa1b6e17ca76334030feccea2191e..78b7076d4cb655c3466df5867f8e1f9f66264687 100644 --- a/app/policies/group_offer_policy.rb +++ b/app/policies/group_offer_policy.rb @@ -17,7 +17,7 @@ class GroupOfferPolicy < ApplicationPolicy group_assignments_attributes ] attributes << :department_id if edit? - attributes << :staffomatic_department_ids if superadmin? + attributes << :staffomatic_department_ids if superadmin? && StaffomaticService.configured? attributes end diff --git a/app/views/volunteers/_buttons.html.slim b/app/views/volunteers/_buttons.html.slim index 1ecd15e50eaa57f419fcf155b9bc963ce5c1784f..de15d166b0e5c64830d552d3e4f4be59a4f983c1 100644 --- a/app/views/volunteers/_buttons.html.slim +++ b/app/views/volunteers/_buttons.html.slim @@ -28,6 +28,6 @@ ul.list-inline li= button_link icon_span(:email_subject), '#', title: 'Email subject', data: { subject: "[fw #{@volunteer.id}]" } - if policy(Event).index? li= button_link 'Veranstaltungen', events_path(q: { event_volunteers_volunteer_id_eq: @volunteer.id }) - - if policy(@volunteer).superadmin? && @volunteer.staffomatic_user_id.blank? + - if policy(@volunteer).superadmin? && @volunteer.staffomatic_user_id.blank? && StaffomaticService.configured? li= button_link 'Invite to Staffomatic', staffomatic_invite_volunteer_path(@volunteer), { class: 'btn btn-default', title: 'Invite to Staffomatic' } diff --git a/config/schedule.rb b/config/schedule.rb index d0e555a7e41eeb2ef3440a4cd605db633fc2180e..4a61b889dad7bf985951a16436c918fa56f6c4c2 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -15,7 +15,8 @@ every 5.minutes do rake 'email_journal:create_journals' end -every 5.minutes do - rake 'staffomatic:synchronize' - rake 'staffomatic:clean_volunteers' -end +# disabled +# every 5.minutes do +# rake 'staffomatic:synchronize' +# rake 'staffomatic:clean_volunteers' +# end