Initialize fork and rebrand app to event_manager
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2026, BWH Studios and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Pohodex Event Manager Campaign", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "prompt",
|
||||
"creation": "2026-01-23 14:27:04.947771",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"enabled",
|
||||
"title",
|
||||
"event",
|
||||
"qr_code",
|
||||
"column_break_onhk",
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"description": "Will be shown to the user",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Markdown Editor",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "event",
|
||||
"fieldtype": "Link",
|
||||
"label": "Event",
|
||||
"options": "Pohodex Event Manager Event"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_onhk",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "qr_code",
|
||||
"fieldtype": "Attach Image",
|
||||
"label": "QR Code",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "enabled",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enabled?"
|
||||
},
|
||||
{
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Title",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"image_field": "qr_code",
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2026-01-23 17:23:01.011762",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Pohodex Event Manager Marketing",
|
||||
"name": "Pohodex Event Manager Campaign",
|
||||
"naming_rule": "Set by user",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Event Manager",
|
||||
"select": 1,
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"rows_threshold_for_grid_search": 20,
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2026, BWH Studios and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
from event_manager.utils import generate_qr_code_file, is_app_installed
|
||||
|
||||
|
||||
class BuzzCampaign(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
description: DF.MarkdownEditor
|
||||
enabled: DF.Check
|
||||
event: DF.Link | None
|
||||
qr_code: DF.AttachImage | None
|
||||
title: DF.Data
|
||||
# end: auto-generated types
|
||||
|
||||
def before_save(self):
|
||||
if not self.enabled:
|
||||
return
|
||||
|
||||
previous = self.get_doc_before_save()
|
||||
name_changed = previous and previous.name != self.name
|
||||
if not self.qr_code or name_changed:
|
||||
self.generate_qr_code()
|
||||
|
||||
def validate(self):
|
||||
self.validate_crm_installed()
|
||||
|
||||
def validate_crm_installed(self):
|
||||
if self.enabled and not is_app_installed("crm"):
|
||||
frappe.throw(_("Please install Frappe CRM to use campaigns feature"))
|
||||
|
||||
def generate_qr_code(self):
|
||||
register_url = f"{frappe.utils.get_url()}/dashboard/register-interest/{self.name}"
|
||||
self.qr_code = generate_qr_code_file(
|
||||
doc=self,
|
||||
data=register_url,
|
||||
field_name="qr_code",
|
||||
file_prefix="campaign-qr-code",
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
# Copyright (c) 2026, BWH Studios and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests import IntegrationTestCase
|
||||
|
||||
# On IntegrationTestCase, the doctype test records and all
|
||||
# link-field test record dependencies are recursively loaded
|
||||
# Use these module variables to add/remove to/from that list
|
||||
EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"]
|
||||
|
||||
|
||||
class IntegrationTestBuzzCampaign(IntegrationTestCase):
|
||||
"""
|
||||
Integration tests for BuzzCampaign.
|
||||
Use this class for testing interactions between multiple components.
|
||||
"""
|
||||
|
||||
pass
|
||||
Reference in New Issue
Block a user