backend.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class CoreWorkflow::Custom::Backend
  3. def initialize(condition_object:, result_object:)
  4. @condition_object = condition_object
  5. @result_object = result_object
  6. end
  7. def saved_attribute_match?
  8. false
  9. end
  10. def selected_attribute_match?
  11. false
  12. end
  13. def perform; end
  14. def object?(object)
  15. @condition_object.attributes.instance_of?(object)
  16. end
  17. def screen?(screen)
  18. @result_object.payload['screen'] == screen
  19. end
  20. def selected
  21. @condition_object.attribute_object.selected
  22. end
  23. def selected_only
  24. @condition_object.attribute_object.selected_only
  25. end
  26. def saved
  27. @condition_object.attribute_object.saved
  28. end
  29. def saved_only
  30. @condition_object.attribute_object.saved_only
  31. end
  32. def current_user
  33. @result_object.user
  34. end
  35. def params
  36. @condition_object.payload['params']
  37. end
  38. def result(backend, field, value = nil, skip_rerun: false)
  39. @result_object.run_backend_value(backend, field, value, skip_rerun: skip_rerun)
  40. end
  41. def change_flags(flags)
  42. @result_object.change_flags(flags)
  43. end
  44. end