refactor: rename EMAS to AMAS throughout application
This commit renames all references from "emas" to "amas" in the invoice_az application, including:
**DocType Changes:**
- Renamed DocType: "Emas Employees" → "Amas Employees"
- Updated autoname: EMAS-EMP-{####} → AMAS-EMP-{####}
- Updated Python class: EmasEmployees → AmasEmployees
**Files Renamed:**
- invoice_az/emas_api.py → amas_api.py
- client/emas_employees.js → amas_employees.js
- doctype/emas_employees/ → amas_employees/ (entire directory)
**Code Updates:**
- Python: All EMAS_ constants → AMAS_ constants
- Python: All emas_ functions → amas_ functions
- JavaScript: All emas references → amas references
- API paths: invoice_az.emas_api → invoice_az.amas_api
**Database Migration:**
- Asan Login fields renamed:
- emas_section → amas_section
- emas_auth_status → amas_auth_status
- emas_account_name → amas_account_name
- emas_account_number → amas_account_number
- column_break_emas → column_break_amas
- emas_account_oid → amas_account_oid
- emas_last_activity → amas_last_activity
- emas_session → amas_session
- emas_csrf_token → amas_csrf_token
**Preserved (Not Changed):**
- User-facing text with "ƏMAS" (Azerbaijani ə character)
- API requirements: ":eroom:emas", "domain": "emas"
- Report ID: "emasValidEmploymentContractOnline"
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
aa2cab8b22
commit
72cf279a64
|
|
@ -20,36 +20,36 @@ from urllib.parse import unquote
|
||||||
import frappe
|
import frappe
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# Increase header limit - EMAS returns many Set-Cookie headers
|
# Increase header limit - AMAS returns many Set-Cookie headers
|
||||||
http.client._MAXHEADERS = 1000
|
http.client._MAXHEADERS = 1000
|
||||||
|
|
||||||
|
|
||||||
# EMAS Base URL
|
# AMAS Base URL
|
||||||
EMAS_BASE_URL = "https://eroom.e-social.gov.az"
|
AMAS_BASE_URL = "https://eroom.e-social.gov.az"
|
||||||
|
|
||||||
# EMAS API Endpoints
|
# AMAS API Endpoints
|
||||||
EMAS_SSO_CALLBACK = "/ssoAsan/v2"
|
AMAS_SSO_CALLBACK = "/ssoAsan/v2"
|
||||||
EMAS_CHANGE_ACCOUNT = "/service/aas.changeAccount"
|
AMAS_CHANGE_ACCOUNT = "/service/aas.changeAccount"
|
||||||
EMAS_EXECUTE_REPORT = "/service/magusbi.executeReport"
|
AMAS_EXECUTE_REPORT = "/service/magusbi.executeReport"
|
||||||
EMAS_GET_DOMAINS = "/service/aas.domains"
|
AMAS_GET_DOMAINS = "/service/aas.domains"
|
||||||
EMAS_GET_ACCOUNTS = "/request/accounts"
|
AMAS_GET_ACCOUNTS = "/request/accounts"
|
||||||
|
|
||||||
# MyGovID OAuth API
|
# MyGovID OAuth API
|
||||||
MYGOVID_API_URL = "https://api.mygovid.gov.az"
|
MYGOVID_API_URL = "https://api.mygovid.gov.az"
|
||||||
MYGOVID_AUTH_CODES_URL = f"{MYGOVID_API_URL}/ssoauth/oauth2/auth/codes"
|
MYGOVID_AUTH_CODES_URL = f"{MYGOVID_API_URL}/ssoauth/oauth2/auth/codes"
|
||||||
|
|
||||||
# EMAS OAuth Client ID (from HAR analysis)
|
# AMAS OAuth Client ID (from HAR analysis)
|
||||||
EMAS_CLIENT_ID = "64942e33ec8d49059333a1e0ebad7fe2"
|
AMAS_CLIENT_ID = "64942e33ec8d49059333a1e0ebad7fe2"
|
||||||
EMAS_REDIRECT_URI = f"{EMAS_BASE_URL}{EMAS_SSO_CALLBACK}"
|
AMAS_REDIRECT_URI = f"{AMAS_BASE_URL}{AMAS_SSO_CALLBACK}"
|
||||||
|
|
||||||
# EMAS request headers
|
# AMAS request headers
|
||||||
EMAS_HEADERS = {
|
AMAS_HEADERS = {
|
||||||
"Accept": "text/plain, */*; q=0.01",
|
"Accept": "text/plain, */*; q=0.01",
|
||||||
"Accept-Language": "en-US,en;q=0.9",
|
"Accept-Language": "en-US,en;q=0.9",
|
||||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
"Origin": EMAS_BASE_URL,
|
"Origin": AMAS_BASE_URL,
|
||||||
"Referer": f"{EMAS_BASE_URL}/",
|
"Referer": f"{AMAS_BASE_URL}/",
|
||||||
"X-MAGUS-RECAPTCHA": "null",
|
"X-MAGUS-RECAPTCHA": "null",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ MYGOVID_HEADERS = {
|
||||||
|
|
||||||
|
|
||||||
def generate_request_number():
|
def generate_request_number():
|
||||||
"""Generate a unique request number for EMAS API calls"""
|
"""Generate a unique request number for AMAS API calls"""
|
||||||
# Format: 1XXXXXXXXXXXXXXX (alphanumeric)
|
# Format: 1XXXXXXXXXXXXXXX (alphanumeric)
|
||||||
chars = string.ascii_uppercase + string.digits
|
chars = string.ascii_uppercase + string.digits
|
||||||
return "1" + "".join(random.choices(chars, k=13))
|
return "1" + "".join(random.choices(chars, k=13))
|
||||||
|
|
@ -85,12 +85,12 @@ def parse_cookies_from_response(response):
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def connect_emas(asan_login_name):
|
def connect_amas(asan_login_name):
|
||||||
"""
|
"""
|
||||||
Connect to EMAS using MyGovID JWT token.
|
Connect to AMAS using MyGovID JWT token.
|
||||||
|
|
||||||
This is the main entry point for EMAS connection.
|
This is the main entry point for AMAS connection.
|
||||||
If MyGovID token exists - uses it to get EMAS session automatically.
|
If MyGovID token exists - uses it to get AMAS session automatically.
|
||||||
If not - returns error asking user to login with MyGovID first.
|
If not - returns error asking user to login with MyGovID first.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
|
@ -105,7 +105,7 @@ def connect_emas(asan_login_name):
|
||||||
}
|
}
|
||||||
|
|
||||||
# Step 1: Get authorization code from MyGovID
|
# Step 1: Get authorization code from MyGovID
|
||||||
auth_code_result = get_emas_auth_code(doc.mygovid_token)
|
auth_code_result = get_amas_auth_code(doc.mygovid_token)
|
||||||
|
|
||||||
if not auth_code_result.get("success"):
|
if not auth_code_result.get("success"):
|
||||||
# Token might be expired
|
# Token might be expired
|
||||||
|
|
@ -129,20 +129,20 @@ def connect_emas(asan_login_name):
|
||||||
# Step 3: Save session data (but don't save account yet - user must select)
|
# Step 3: Save session data (but don't save account yet - user must select)
|
||||||
session_data = session_result.get("session_data")
|
session_data = session_result.get("session_data")
|
||||||
|
|
||||||
doc.emas_session = json.dumps(session_data)
|
doc.amas_session = json.dumps(session_data)
|
||||||
doc.emas_csrf_token = session_data.get("xsrf_token")
|
doc.amas_csrf_token = session_data.get("xsrf_token")
|
||||||
doc.emas_auth_status = "Connected"
|
doc.amas_auth_status = "Connected"
|
||||||
doc.emas_last_activity = frappe.utils.now_datetime()
|
doc.amas_last_activity = frappe.utils.now_datetime()
|
||||||
# Clear any previous account selection - user must choose
|
# Clear any previous account selection - user must choose
|
||||||
doc.emas_account_oid = None
|
doc.amas_account_oid = None
|
||||||
doc.emas_account_name = None
|
doc.amas_account_name = None
|
||||||
doc.emas_account_number = None
|
doc.amas_account_number = None
|
||||||
|
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
# Step 4: Fetch available accounts from /request/accounts
|
# Step 4: Fetch available accounts from /request/accounts
|
||||||
accounts_result = get_emas_accounts(asan_login_name)
|
accounts_result = get_amas_accounts(asan_login_name)
|
||||||
accounts = accounts_result.get("accounts", []) if accounts_result.get("success") else []
|
accounts = accounts_result.get("accounts", []) if accounts_result.get("success") else []
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -161,7 +161,7 @@ def connect_emas(asan_login_name):
|
||||||
return {"success": False, "message": f"Error: {str(e)}"}
|
return {"success": False, "message": f"Error: {str(e)}"}
|
||||||
|
|
||||||
|
|
||||||
def get_emas_auth_code(mygovid_token):
|
def get_amas_auth_code(mygovid_token):
|
||||||
"""
|
"""
|
||||||
Get EMAS authorization code using MyGovID JWT token.
|
Get EMAS authorization code using MyGovID JWT token.
|
||||||
|
|
||||||
|
|
@ -172,10 +172,10 @@ def get_emas_auth_code(mygovid_token):
|
||||||
state = generate_state()
|
state = generate_state()
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"client_id": EMAS_CLIENT_ID,
|
"client_id": AMAS_CLIENT_ID,
|
||||||
"state": state,
|
"state": state,
|
||||||
"response_type": "code",
|
"response_type": "code",
|
||||||
"redirect_uri": EMAS_REDIRECT_URI
|
"redirect_uri": AMAS_REDIRECT_URI
|
||||||
}
|
}
|
||||||
|
|
||||||
headers = MYGOVID_HEADERS.copy()
|
headers = MYGOVID_HEADERS.copy()
|
||||||
|
|
@ -266,7 +266,7 @@ def exchange_code_for_session(code, state):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Build SSO callback URL
|
# Build SSO callback URL
|
||||||
callback_url = f"{EMAS_REDIRECT_URI}?code={code}&state={state}"
|
callback_url = f"{AMAS_REDIRECT_URI}?code={code}&state={state}"
|
||||||
|
|
||||||
# Create session to capture cookies
|
# Create session to capture cookies
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
|
|
@ -347,15 +347,15 @@ def exchange_code_for_session(code, state):
|
||||||
return {"success": False, "message": f"Error: {str(e)}"}
|
return {"success": False, "message": f"Error: {str(e)}"}
|
||||||
|
|
||||||
|
|
||||||
def get_emas_session_data(asan_login_name):
|
def get_amas_session_data(asan_login_name):
|
||||||
"""Get EMAS session data from document"""
|
"""Get EMAS session data from document"""
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
|
|
||||||
if not doc.emas_session:
|
if not doc.amas_session:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return json.loads(doc.emas_session)
|
return json.loads(doc.amas_session)
|
||||||
except (json.JSONDecodeError, TypeError):
|
except (json.JSONDecodeError, TypeError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
@ -368,7 +368,7 @@ def refresh_csrf_token_internal(asan_login_name):
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
session_data = get_emas_session_data(asan_login_name)
|
session_data = get_amas_session_data(asan_login_name)
|
||||||
if not session_data:
|
if not session_data:
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|
@ -378,13 +378,13 @@ def refresh_csrf_token_internal(asan_login_name):
|
||||||
try:
|
try:
|
||||||
# Make GET request to dashboard to get fresh CSRF token
|
# Make GET request to dashboard to get fresh CSRF token
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
f"{EMAS_BASE_URL}/core.dashboard",
|
f"{AMAS_BASE_URL}/core.dashboard",
|
||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
timeout=30
|
timeout=30
|
||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
return session_data, doc.emas_csrf_token
|
return session_data, doc.amas_csrf_token
|
||||||
|
|
||||||
# Update cookies from response
|
# Update cookies from response
|
||||||
for cookie in response.cookies:
|
for cookie in response.cookies:
|
||||||
|
|
@ -402,7 +402,7 @@ def refresh_csrf_token_internal(asan_login_name):
|
||||||
csrf_token = unquote(cookies["XSRF-TOKEN"])
|
csrf_token = unquote(cookies["XSRF-TOKEN"])
|
||||||
|
|
||||||
if csrf_token:
|
if csrf_token:
|
||||||
doc.emas_csrf_token = csrf_token
|
doc.amas_csrf_token = csrf_token
|
||||||
session_data["xsrf_token"] = csrf_token
|
session_data["xsrf_token"] = csrf_token
|
||||||
|
|
||||||
# Update token from page config if available
|
# Update token from page config if available
|
||||||
|
|
@ -411,8 +411,8 @@ def refresh_csrf_token_internal(asan_login_name):
|
||||||
session_data["token"] = html_config.get("token")
|
session_data["token"] = html_config.get("token")
|
||||||
|
|
||||||
# Save updated session
|
# Save updated session
|
||||||
doc.emas_session = json.dumps(session_data)
|
doc.amas_session = json.dumps(session_data)
|
||||||
doc.emas_last_activity = frappe.utils.now_datetime()
|
doc.amas_last_activity = frappe.utils.now_datetime()
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
@ -420,10 +420,10 @@ def refresh_csrf_token_internal(asan_login_name):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
frappe.log_error(f"CSRF refresh error: {str(e)}", "ƏMAS API Error")
|
frappe.log_error(f"CSRF refresh error: {str(e)}", "ƏMAS API Error")
|
||||||
return session_data, doc.emas_csrf_token
|
return session_data, doc.amas_csrf_token
|
||||||
|
|
||||||
|
|
||||||
def make_emas_request(asan_login_name, endpoint, data):
|
def make_amas_request(asan_login_name, endpoint, data):
|
||||||
"""
|
"""
|
||||||
Make an authenticated request to EMAS API.
|
Make an authenticated request to EMAS API.
|
||||||
|
|
||||||
|
|
@ -443,8 +443,8 @@ def make_emas_request(asan_login_name, endpoint, data):
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
|
|
||||||
# Build request headers with fresh CSRF token
|
# Build request headers with fresh CSRF token
|
||||||
headers = EMAS_HEADERS.copy()
|
headers = AMAS_HEADERS.copy()
|
||||||
csrf_token = csrf_token or doc.emas_csrf_token or session_data.get("xsrf_token", "")
|
csrf_token = csrf_token or doc.amas_csrf_token or session_data.get("xsrf_token", "")
|
||||||
headers["X-CSRF-TOKEN"] = csrf_token
|
headers["X-CSRF-TOKEN"] = csrf_token
|
||||||
headers["MAGUS-REQUEST-NUMBER"] = generate_request_number()
|
headers["MAGUS-REQUEST-NUMBER"] = generate_request_number()
|
||||||
|
|
||||||
|
|
@ -463,7 +463,7 @@ def make_emas_request(asan_login_name, endpoint, data):
|
||||||
data["currentTabToken"] = token
|
data["currentTabToken"] = token
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = f"{EMAS_BASE_URL}{endpoint}"
|
url = f"{AMAS_BASE_URL}{endpoint}"
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
url,
|
url,
|
||||||
|
|
@ -482,11 +482,11 @@ def make_emas_request(asan_login_name, endpoint, data):
|
||||||
# Update CSRF token if changed - IMPORTANT: decode URL-encoded token!
|
# Update CSRF token if changed - IMPORTANT: decode URL-encoded token!
|
||||||
if "XSRF-TOKEN" in new_cookies:
|
if "XSRF-TOKEN" in new_cookies:
|
||||||
decoded_token = unquote(new_cookies["XSRF-TOKEN"])
|
decoded_token = unquote(new_cookies["XSRF-TOKEN"])
|
||||||
doc.emas_csrf_token = decoded_token
|
doc.amas_csrf_token = decoded_token
|
||||||
session_data["xsrf_token"] = decoded_token
|
session_data["xsrf_token"] = decoded_token
|
||||||
|
|
||||||
doc.emas_session = json.dumps(session_data)
|
doc.amas_session = json.dumps(session_data)
|
||||||
doc.emas_last_activity = frappe.utils.now_datetime()
|
doc.amas_last_activity = frappe.utils.now_datetime()
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
@ -525,7 +525,7 @@ def make_emas_request(asan_login_name, endpoint, data):
|
||||||
# Update token if present in response
|
# Update token if present in response
|
||||||
if result.get("token"):
|
if result.get("token"):
|
||||||
session_data["token"] = result.get("token")
|
session_data["token"] = result.get("token")
|
||||||
doc.emas_session = json.dumps(session_data)
|
doc.amas_session = json.dumps(session_data)
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
@ -543,7 +543,7 @@ def make_emas_request(asan_login_name, endpoint, data):
|
||||||
"message": "CSRF token expired. Please reconnect to ƏMAS."
|
"message": "CSRF token expired. Please reconnect to ƏMAS."
|
||||||
}
|
}
|
||||||
elif response.status_code == 401:
|
elif response.status_code == 401:
|
||||||
doc.emas_auth_status = "Error"
|
doc.amas_auth_status = "Error"
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
return {
|
return {
|
||||||
|
|
@ -568,7 +568,7 @@ def make_emas_request(asan_login_name, endpoint, data):
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_emas_accounts(asan_login_name):
|
def get_amas_accounts(asan_login_name):
|
||||||
"""
|
"""
|
||||||
Get list of organizations/accounts user has access to in EMAS.
|
Get list of organizations/accounts user has access to in EMAS.
|
||||||
Fetches from /request/accounts endpoint.
|
Fetches from /request/accounts endpoint.
|
||||||
|
|
@ -583,8 +583,8 @@ def get_emas_accounts(asan_login_name):
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
|
|
||||||
# Build request headers with fresh CSRF token
|
# Build request headers with fresh CSRF token
|
||||||
headers = EMAS_HEADERS.copy()
|
headers = AMAS_HEADERS.copy()
|
||||||
csrf_token = csrf_token or doc.emas_csrf_token or session_data.get("xsrf_token", "")
|
csrf_token = csrf_token or doc.amas_csrf_token or session_data.get("xsrf_token", "")
|
||||||
headers["X-CSRF-TOKEN"] = csrf_token
|
headers["X-CSRF-TOKEN"] = csrf_token
|
||||||
headers["MAGUS-REQUEST-NUMBER"] = generate_request_number()
|
headers["MAGUS-REQUEST-NUMBER"] = generate_request_number()
|
||||||
|
|
||||||
|
|
@ -604,7 +604,7 @@ def get_emas_accounts(asan_login_name):
|
||||||
|
|
||||||
# Make request to /request/accounts
|
# Make request to /request/accounts
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{EMAS_BASE_URL}{EMAS_GET_ACCOUNTS}",
|
f"{AMAS_BASE_URL}{AMAS_GET_ACCOUNTS}",
|
||||||
data=data,
|
data=data,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
|
|
@ -620,10 +620,10 @@ def get_emas_accounts(asan_login_name):
|
||||||
# Update CSRF token if changed
|
# Update CSRF token if changed
|
||||||
if "XSRF-TOKEN" in new_cookies:
|
if "XSRF-TOKEN" in new_cookies:
|
||||||
decoded_token = unquote(new_cookies["XSRF-TOKEN"])
|
decoded_token = unquote(new_cookies["XSRF-TOKEN"])
|
||||||
doc.emas_csrf_token = decoded_token
|
doc.amas_csrf_token = decoded_token
|
||||||
session_data["xsrf_token"] = decoded_token
|
session_data["xsrf_token"] = decoded_token
|
||||||
|
|
||||||
doc.emas_session = json.dumps(session_data)
|
doc.amas_session = json.dumps(session_data)
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
@ -649,7 +649,7 @@ def get_emas_accounts(asan_login_name):
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def change_emas_account(asan_login_name, account_oid, account_name, account_number, role_name="chairman"):
|
def change_amas_account(asan_login_name, account_oid, account_name, account_number, role_name="chairman"):
|
||||||
"""
|
"""
|
||||||
Select/switch to a specific organization account in EMAS.
|
Select/switch to a specific organization account in EMAS.
|
||||||
"""
|
"""
|
||||||
|
|
@ -664,9 +664,9 @@ def change_emas_account(asan_login_name, account_oid, account_name, account_numb
|
||||||
"domain": "emas"
|
"domain": "emas"
|
||||||
}
|
}
|
||||||
|
|
||||||
result = make_emas_request(
|
result = make_amas_request(
|
||||||
asan_login_name,
|
asan_login_name,
|
||||||
EMAS_CHANGE_ACCOUNT,
|
AMAS_CHANGE_ACCOUNT,
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -685,19 +685,19 @@ def change_emas_account(asan_login_name, account_oid, account_name, account_numb
|
||||||
|
|
||||||
# Store selected account info
|
# Store selected account info
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
doc.emas_account_oid = account_oid
|
doc.amas_account_oid = account_oid
|
||||||
doc.emas_account_name = account_name
|
doc.amas_account_name = account_name
|
||||||
doc.emas_account_number = account_number
|
doc.amas_account_number = account_number
|
||||||
doc.emas_auth_status = "Connected"
|
doc.amas_auth_status = "Connected"
|
||||||
doc.emas_last_activity = frappe.utils.now_datetime()
|
doc.amas_last_activity = frappe.utils.now_datetime()
|
||||||
|
|
||||||
# Update session with token from response
|
# Update session with token from response
|
||||||
token = response_data.get("token")
|
token = response_data.get("token")
|
||||||
if token:
|
if token:
|
||||||
session_data = get_emas_session_data(asan_login_name)
|
session_data = get_amas_session_data(asan_login_name)
|
||||||
if session_data:
|
if session_data:
|
||||||
session_data["token"] = token
|
session_data["token"] = token
|
||||||
doc.emas_session = json.dumps(session_data)
|
doc.amas_session = json.dumps(session_data)
|
||||||
|
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
@ -724,7 +724,7 @@ def get_employees_report(asan_login_name, offset=0, limit=100):
|
||||||
try:
|
try:
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
|
|
||||||
if not doc.emas_account_oid:
|
if not doc.amas_account_oid:
|
||||||
return {
|
return {
|
||||||
"success": False,
|
"success": False,
|
||||||
"message": "No ƏMAS account selected. Please select an organization first."
|
"message": "No ƏMAS account selected. Please select an organization first."
|
||||||
|
|
@ -737,7 +737,7 @@ def get_employees_report(asan_login_name, offset=0, limit=100):
|
||||||
"attributes[newExcel]": "true"
|
"attributes[newExcel]": "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
result = make_emas_request(asan_login_name, EMAS_EXECUTE_REPORT, data)
|
result = make_amas_request(asan_login_name, AMAS_EXECUTE_REPORT, data)
|
||||||
|
|
||||||
if not result.get("success"):
|
if not result.get("success"):
|
||||||
return result
|
return result
|
||||||
|
|
@ -780,7 +780,7 @@ def get_contract_stats(asan_login_name):
|
||||||
try:
|
try:
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
|
|
||||||
if not doc.emas_account_oid:
|
if not doc.amas_account_oid:
|
||||||
return {
|
return {
|
||||||
"success": False,
|
"success": False,
|
||||||
"message": "No ƏMAS account selected. Please select an organization first."
|
"message": "No ƏMAS account selected. Please select an organization first."
|
||||||
|
|
@ -792,7 +792,7 @@ def get_contract_stats(asan_login_name):
|
||||||
"pagination[limit]": "100"
|
"pagination[limit]": "100"
|
||||||
}
|
}
|
||||||
|
|
||||||
result = make_emas_request(asan_login_name, EMAS_EXECUTE_REPORT, data)
|
result = make_amas_request(asan_login_name, AMAS_EXECUTE_REPORT, data)
|
||||||
|
|
||||||
if not result.get("success"):
|
if not result.get("success"):
|
||||||
return result
|
return result
|
||||||
|
|
@ -822,7 +822,7 @@ def get_contract_stats(asan_login_name):
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def check_emas_connection(asan_login_name):
|
def check_amas_connection(asan_login_name):
|
||||||
"""
|
"""
|
||||||
Check if EMAS connection is active.
|
Check if EMAS connection is active.
|
||||||
"""
|
"""
|
||||||
|
|
@ -831,11 +831,11 @@ def check_emas_connection(asan_login_name):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"success": True,
|
"success": True,
|
||||||
"emas_auth_status": doc.emas_auth_status or "Not Connected",
|
"amas_auth_status": doc.amas_auth_status or "Not Connected",
|
||||||
"emas_account_name": doc.emas_account_name,
|
"amas_account_name": doc.amas_account_name,
|
||||||
"emas_account_number": doc.emas_account_number,
|
"amas_account_number": doc.amas_account_number,
|
||||||
"emas_last_activity": str(doc.emas_last_activity) if doc.emas_last_activity else None,
|
"amas_last_activity": str(doc.amas_last_activity) if doc.amas_last_activity else None,
|
||||||
"has_session": bool(doc.emas_session),
|
"has_session": bool(doc.amas_session),
|
||||||
"has_mygovid_token": bool(doc.mygovid_token)
|
"has_mygovid_token": bool(doc.mygovid_token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -848,14 +848,14 @@ def check_emas_connection(asan_login_name):
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def refresh_emas_session(asan_login_name):
|
def refresh_amas_session(asan_login_name):
|
||||||
"""
|
"""
|
||||||
Refresh EMAS session by making a GET request to get fresh CSRF token.
|
Refresh EMAS session by making a GET request to get fresh CSRF token.
|
||||||
Use this when you get CSRF_TOKEN_MISMATCH errors.
|
Use this when you get CSRF_TOKEN_MISMATCH errors.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
session_data = get_emas_session_data(asan_login_name)
|
session_data = get_amas_session_data(asan_login_name)
|
||||||
|
|
||||||
if not session_data:
|
if not session_data:
|
||||||
return {
|
return {
|
||||||
|
|
@ -867,7 +867,7 @@ def refresh_emas_session(asan_login_name):
|
||||||
|
|
||||||
# Make GET request to EMAS dashboard to get fresh CSRF token
|
# Make GET request to EMAS dashboard to get fresh CSRF token
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
f"{EMAS_BASE_URL}/core.dashboard",
|
f"{AMAS_BASE_URL}/core.dashboard",
|
||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
timeout=30
|
timeout=30
|
||||||
)
|
)
|
||||||
|
|
@ -889,7 +889,7 @@ def refresh_emas_session(asan_login_name):
|
||||||
match = re.search(r'name="csrf-token" content="([^"]+)"', response.text)
|
match = re.search(r'name="csrf-token" content="([^"]+)"', response.text)
|
||||||
if match:
|
if match:
|
||||||
new_csrf_token = match.group(1)
|
new_csrf_token = match.group(1)
|
||||||
doc.emas_csrf_token = new_csrf_token
|
doc.amas_csrf_token = new_csrf_token
|
||||||
session_data["xsrf_token"] = new_csrf_token
|
session_data["xsrf_token"] = new_csrf_token
|
||||||
|
|
||||||
# Also update from cookie if available
|
# Also update from cookie if available
|
||||||
|
|
@ -897,7 +897,7 @@ def refresh_emas_session(asan_login_name):
|
||||||
decoded_token = unquote(cookies["XSRF-TOKEN"])
|
decoded_token = unquote(cookies["XSRF-TOKEN"])
|
||||||
# Prefer meta tag token, but update session data
|
# Prefer meta tag token, but update session data
|
||||||
if not match:
|
if not match:
|
||||||
doc.emas_csrf_token = decoded_token
|
doc.amas_csrf_token = decoded_token
|
||||||
session_data["xsrf_token"] = decoded_token
|
session_data["xsrf_token"] = decoded_token
|
||||||
|
|
||||||
# Parse config for updated token
|
# Parse config for updated token
|
||||||
|
|
@ -905,8 +905,8 @@ def refresh_emas_session(asan_login_name):
|
||||||
if html_config.get("token"):
|
if html_config.get("token"):
|
||||||
session_data["token"] = html_config.get("token")
|
session_data["token"] = html_config.get("token")
|
||||||
|
|
||||||
doc.emas_session = json.dumps(session_data)
|
doc.amas_session = json.dumps(session_data)
|
||||||
doc.emas_last_activity = frappe.utils.now_datetime()
|
doc.amas_last_activity = frappe.utils.now_datetime()
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
@ -924,20 +924,20 @@ def refresh_emas_session(asan_login_name):
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def disconnect_emas(asan_login_name):
|
def disconnect_amas(asan_login_name):
|
||||||
"""
|
"""
|
||||||
Disconnect from EMAS by clearing session data.
|
Disconnect from EMAS by clearing session data.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
|
|
||||||
doc.emas_session = None
|
doc.amas_session = None
|
||||||
doc.emas_csrf_token = None
|
doc.amas_csrf_token = None
|
||||||
doc.emas_account_oid = None
|
doc.amas_account_oid = None
|
||||||
doc.emas_account_name = None
|
doc.amas_account_name = None
|
||||||
doc.emas_account_number = None
|
doc.amas_account_number = None
|
||||||
doc.emas_auth_status = "Not Connected"
|
doc.amas_auth_status = "Not Connected"
|
||||||
doc.emas_last_activity = None
|
doc.amas_last_activity = None
|
||||||
|
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
@ -965,18 +965,18 @@ def get_connected_asan_logins():
|
||||||
asan_logins = frappe.get_all(
|
asan_logins = frappe.get_all(
|
||||||
"Asan Login",
|
"Asan Login",
|
||||||
filters={
|
filters={
|
||||||
"emas_auth_status": "Connected",
|
"amas_auth_status": "Connected",
|
||||||
"emas_account_oid": ["is", "set"]
|
"amas_account_oid": ["is", "set"]
|
||||||
},
|
},
|
||||||
fields=["name", "emas_account_name", "emas_account_number", "emas_account_oid"]
|
fields=["name", "amas_account_name", "amas_account_number", "amas_account_oid"]
|
||||||
)
|
)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for al in asan_logins:
|
for al in asan_logins:
|
||||||
result.append({
|
result.append({
|
||||||
"name": al.name,
|
"name": al.name,
|
||||||
"organization_name": al.emas_account_name or "Unknown",
|
"organization_name": al.amas_account_name or "Unknown",
|
||||||
"organization_voen": al.emas_account_number or ""
|
"organization_voen": al.amas_account_number or ""
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -993,7 +993,7 @@ def get_connected_asan_logins():
|
||||||
|
|
||||||
|
|
||||||
# Exact list of API fields that map 1:1 to Əmas Employees DocType fields
|
# Exact list of API fields that map 1:1 to Əmas Employees DocType fields
|
||||||
EMAS_EMPLOYEE_FIELDS = [
|
AMAS_EMPLOYEE_FIELDS = [
|
||||||
"full_name",
|
"full_name",
|
||||||
"identification_number",
|
"identification_number",
|
||||||
"ssn",
|
"ssn",
|
||||||
|
|
@ -1039,8 +1039,8 @@ def import_employees(asan_login_name, employees):
|
||||||
employees = json.loads(employees)
|
employees = json.loads(employees)
|
||||||
|
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
organization_name = doc.emas_account_name
|
organization_name = doc.amas_account_name
|
||||||
organization_voen = doc.emas_account_number
|
organization_voen = doc.amas_account_number
|
||||||
|
|
||||||
imported_count = 0
|
imported_count = 0
|
||||||
updated_count = 0
|
updated_count = 0
|
||||||
|
|
@ -1080,17 +1080,17 @@ def import_employees(asan_login_name, employees):
|
||||||
|
|
||||||
fin = str(fin).strip()
|
fin = str(fin).strip()
|
||||||
existing = frappe.db.exists(
|
existing = frappe.db.exists(
|
||||||
"Emas Employees",
|
"Amas Employees",
|
||||||
{"identification_number": fin, "organization_voen": organization_voen}
|
{"identification_number": fin, "organization_voen": organization_voen}
|
||||||
)
|
)
|
||||||
|
|
||||||
if existing:
|
if existing:
|
||||||
employee_doc = frappe.get_doc("Emas Employees", existing)
|
employee_doc = frappe.get_doc("Amas Employees", existing)
|
||||||
update_employee_from_data(employee_doc, emp_data)
|
update_employee_from_data(employee_doc, emp_data)
|
||||||
employee_doc.save(ignore_permissions=True)
|
employee_doc.save(ignore_permissions=True)
|
||||||
updated_count += 1
|
updated_count += 1
|
||||||
else:
|
else:
|
||||||
employee_doc = frappe.new_doc("Emas Employees")
|
employee_doc = frappe.new_doc("Amas Employees")
|
||||||
employee_doc.asan_login = asan_login_name
|
employee_doc.asan_login = asan_login_name
|
||||||
employee_doc.organization_name = organization_name
|
employee_doc.organization_name = organization_name
|
||||||
employee_doc.organization_voen = organization_voen
|
employee_doc.organization_voen = organization_voen
|
||||||
|
|
@ -1116,7 +1116,7 @@ def import_employees(asan_login_name, employees):
|
||||||
|
|
||||||
# Check if exists
|
# Check if exists
|
||||||
existing = frappe.db.exists(
|
existing = frappe.db.exists(
|
||||||
"Emas Employees",
|
"Amas Employees",
|
||||||
{
|
{
|
||||||
"identification_number": fin,
|
"identification_number": fin,
|
||||||
"organization_voen": organization_voen
|
"organization_voen": organization_voen
|
||||||
|
|
@ -1124,7 +1124,7 @@ def import_employees(asan_login_name, employees):
|
||||||
)
|
)
|
||||||
|
|
||||||
if existing:
|
if existing:
|
||||||
employee_doc = frappe.get_doc("Emas Employees", existing)
|
employee_doc = frappe.get_doc("Amas Employees", existing)
|
||||||
# First populate basic fields from list data
|
# First populate basic fields from list data
|
||||||
update_employee_from_data(employee_doc, emp_data)
|
update_employee_from_data(employee_doc, emp_data)
|
||||||
# Then overlay with detailed data
|
# Then overlay with detailed data
|
||||||
|
|
@ -1135,7 +1135,7 @@ def import_employees(asan_login_name, employees):
|
||||||
employee_doc.save(ignore_permissions=True)
|
employee_doc.save(ignore_permissions=True)
|
||||||
updated_count += 1
|
updated_count += 1
|
||||||
else:
|
else:
|
||||||
employee_doc = frappe.new_doc("Emas Employees")
|
employee_doc = frappe.new_doc("Amas Employees")
|
||||||
employee_doc.asan_login = asan_login_name
|
employee_doc.asan_login = asan_login_name
|
||||||
employee_doc.organization_name = organization_name
|
employee_doc.organization_name = organization_name
|
||||||
employee_doc.organization_voen = organization_voen
|
employee_doc.organization_voen = organization_voen
|
||||||
|
|
@ -1186,7 +1186,7 @@ def update_employee_from_data(employee_doc, emp_data):
|
||||||
Hard 1:1 mapping - API field names match DocType field names exactly.
|
Hard 1:1 mapping - API field names match DocType field names exactly.
|
||||||
"""
|
"""
|
||||||
# Map all API fields directly to DocType fields
|
# Map all API fields directly to DocType fields
|
||||||
for field in EMAS_EMPLOYEE_FIELDS:
|
for field in AMAS_EMPLOYEE_FIELDS:
|
||||||
value = emp_data.get(field)
|
value = emp_data.get(field)
|
||||||
if value is not None:
|
if value is not None:
|
||||||
setattr(employee_doc, field, str(value))
|
setattr(employee_doc, field, str(value))
|
||||||
|
|
@ -1200,7 +1200,7 @@ def update_employee_from_data(employee_doc, emp_data):
|
||||||
employee_doc.import_date = frappe.utils.now_datetime()
|
employee_doc.import_date = frappe.utils.now_datetime()
|
||||||
|
|
||||||
|
|
||||||
def parse_emas_date(date_str):
|
def parse_amas_date(date_str):
|
||||||
"""
|
"""
|
||||||
Parse date string from ƏMAS into YYYY-MM-DD format for Frappe Date fields.
|
Parse date string from ƏMAS into YYYY-MM-DD format for Frappe Date fields.
|
||||||
ƏMAS dates can be in various formats.
|
ƏMAS dates can be in various formats.
|
||||||
|
|
@ -1256,7 +1256,7 @@ def resolve_designation(position_text, create_if_missing):
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_employees_from_emas(asan_login_name, employees, company, create_designation=0):
|
def create_employees_from_amas(asan_login_name, employees, company, create_designation=0):
|
||||||
"""
|
"""
|
||||||
Create Employee records directly from ƏMAS API data.
|
Create Employee records directly from ƏMAS API data.
|
||||||
|
|
||||||
|
|
@ -1283,8 +1283,8 @@ def create_employees_from_emas(asan_login_name, employees, company, create_desig
|
||||||
return {"success": False, "message": "Company is required"}
|
return {"success": False, "message": "Company is required"}
|
||||||
|
|
||||||
doc = frappe.get_doc("Asan Login", asan_login_name)
|
doc = frappe.get_doc("Asan Login", asan_login_name)
|
||||||
organization_name = doc.emas_account_name
|
organization_name = doc.amas_account_name
|
||||||
organization_voen = doc.emas_account_number
|
organization_voen = doc.amas_account_number
|
||||||
|
|
||||||
created_count = 0
|
created_count = 0
|
||||||
updated_count = 0
|
updated_count = 0
|
||||||
|
|
@ -1340,42 +1340,42 @@ def create_employees_from_emas(asan_login_name, employees, company, create_desig
|
||||||
fin = str(fin).strip()
|
fin = str(fin).strip()
|
||||||
|
|
||||||
# 1. Save/update Emas Employees record
|
# 1. Save/update Emas Employees record
|
||||||
emas_existing = None
|
amas_existing = None
|
||||||
if doc_oid:
|
if doc_oid:
|
||||||
emas_existing = frappe.db.exists("Emas Employees", {"doc_oid": str(doc_oid)})
|
amas_existing = frappe.db.exists("Amas Employees", {"doc_oid": str(doc_oid)})
|
||||||
if not emas_existing:
|
if not amas_existing:
|
||||||
emas_existing = frappe.db.exists(
|
amas_existing = frappe.db.exists(
|
||||||
"Emas Employees",
|
"Amas Employees",
|
||||||
{"identification_number": fin, "organization_voen": organization_voen}
|
{"identification_number": fin, "organization_voen": organization_voen}
|
||||||
)
|
)
|
||||||
|
|
||||||
if emas_existing:
|
if amas_existing:
|
||||||
emas_doc = frappe.get_doc("Emas Employees", emas_existing)
|
amas_doc = frappe.get_doc("Amas Employees", amas_existing)
|
||||||
# Always populate basic fields from list data first
|
# Always populate basic fields from list data first
|
||||||
update_employee_from_data(emas_doc, emp_data)
|
update_employee_from_data(amas_doc, emp_data)
|
||||||
# Then overlay with detail data if available
|
# Then overlay with detail data if available
|
||||||
if detail_data:
|
if detail_data:
|
||||||
update_employee_from_detail_data(emas_doc, detail_data)
|
update_employee_from_detail_data(amas_doc, detail_data)
|
||||||
# Ensure FIN is set (required field)
|
# Ensure FIN is set (required field)
|
||||||
if not emas_doc.identification_number:
|
if not amas_doc.identification_number:
|
||||||
emas_doc.identification_number = fin
|
amas_doc.identification_number = fin
|
||||||
emas_doc.save(ignore_permissions=True)
|
amas_doc.save(ignore_permissions=True)
|
||||||
else:
|
else:
|
||||||
emas_doc = frappe.new_doc("Emas Employees")
|
amas_doc = frappe.new_doc("Amas Employees")
|
||||||
emas_doc.asan_login = asan_login_name
|
amas_doc.asan_login = asan_login_name
|
||||||
emas_doc.organization_name = organization_name
|
amas_doc.organization_name = organization_name
|
||||||
emas_doc.organization_voen = organization_voen
|
amas_doc.organization_voen = organization_voen
|
||||||
# Set FIN first (required field)
|
# Set FIN first (required field)
|
||||||
emas_doc.identification_number = fin
|
amas_doc.identification_number = fin
|
||||||
# Always populate basic fields from list data first
|
# Always populate basic fields from list data first
|
||||||
update_employee_from_data(emas_doc, emp_data)
|
update_employee_from_data(amas_doc, emp_data)
|
||||||
# Then overlay with detail data if available
|
# Then overlay with detail data if available
|
||||||
if detail_data:
|
if detail_data:
|
||||||
update_employee_from_detail_data(emas_doc, detail_data)
|
update_employee_from_detail_data(amas_doc, detail_data)
|
||||||
# Ensure FIN is still set after mapping
|
# Ensure FIN is still set after mapping
|
||||||
if not emas_doc.identification_number:
|
if not amas_doc.identification_number:
|
||||||
emas_doc.identification_number = fin
|
amas_doc.identification_number = fin
|
||||||
emas_doc.insert(ignore_permissions=True)
|
amas_doc.insert(ignore_permissions=True)
|
||||||
|
|
||||||
# 2. Create/update Employee record
|
# 2. Create/update Employee record
|
||||||
existing_employee = frappe.db.exists("Employee", {"passport_number": fin})
|
existing_employee = frappe.db.exists("Employee", {"passport_number": fin})
|
||||||
|
|
@ -1393,16 +1393,16 @@ def create_employees_from_emas(asan_login_name, employees, company, create_desig
|
||||||
if detail_data:
|
if detail_data:
|
||||||
# Get from detail data
|
# Get from detail data
|
||||||
if 'iamasBean' in detail_data and detail_data.get('iamasBean'):
|
if 'iamasBean' in detail_data and detail_data.get('iamasBean'):
|
||||||
dob = parse_emas_date(detail_data['iamasBean'].get('birthDate'))
|
dob = parse_amas_date(detail_data['iamasBean'].get('birthDate'))
|
||||||
if 'EmasContractDetailsEnt' in detail_data and isinstance(detail_data.get('EmasContractDetailsEnt'), list) and len(detail_data['EmasContractDetailsEnt']) > 0:
|
if 'EmasContractDetailsEnt' in detail_data and isinstance(detail_data.get('EmasContractDetailsEnt'), list) and len(detail_data['EmasContractDetailsEnt']) > 0:
|
||||||
details = detail_data['EmasContractDetailsEnt'][0]
|
details = detail_data['EmasContractDetailsEnt'][0]
|
||||||
doj = parse_emas_date(details.get('beginDate'))
|
doj = parse_amas_date(details.get('beginDate'))
|
||||||
contract_end = parse_emas_date(details.get('endDate'))
|
contract_end = parse_amas_date(details.get('endDate'))
|
||||||
else:
|
else:
|
||||||
# Fallback to list data
|
# Fallback to list data
|
||||||
dob = parse_emas_date(emp_data.get("birthday"))
|
dob = parse_amas_date(emp_data.get("birthday"))
|
||||||
doj = parse_emas_date(emp_data.get("begin_date"))
|
doj = parse_amas_date(emp_data.get("begin_date"))
|
||||||
contract_end = parse_emas_date(emp_data.get("end_date"))
|
contract_end = parse_amas_date(emp_data.get("end_date"))
|
||||||
|
|
||||||
# Map status
|
# Map status
|
||||||
raw_status = ""
|
raw_status = ""
|
||||||
|
|
@ -1471,8 +1471,8 @@ def create_employees_from_emas(asan_login_name, employees, company, create_desig
|
||||||
created_count += 1
|
created_count += 1
|
||||||
|
|
||||||
# Link Emas Employees → Employee
|
# Link Emas Employees → Employee
|
||||||
emas_doc.employee = emp.name
|
amas_doc.employee = emp.name
|
||||||
emas_doc.save(ignore_permissions=True)
|
amas_doc.save(ignore_permissions=True)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
fin_val = emp_data.get("identification_number", "?")
|
fin_val = emp_data.get("identification_number", "?")
|
||||||
|
|
@ -1516,25 +1516,25 @@ def get_edit_form_data(asan_login_name, doc_oid, doc_no, doc_type):
|
||||||
"docNo": doc_no,
|
"docNo": doc_no,
|
||||||
"docType": doc_type
|
"docType": doc_type
|
||||||
}
|
}
|
||||||
return make_emas_request(asan_login_name, "/service/eroom.getEditForm", data)
|
return make_amas_request(asan_login_name, "/service/eroom.getEditForm", data)
|
||||||
|
|
||||||
|
|
||||||
def get_staff_data(asan_login_name, staff_oid):
|
def get_staff_data(asan_login_name, staff_oid):
|
||||||
"""Call embas.getStaffData for position info"""
|
"""Call embas.getStaffData for position info"""
|
||||||
data = {"staffOid": staff_oid}
|
data = {"staffOid": staff_oid}
|
||||||
return make_emas_request(asan_login_name, "/service/embas.getStaffData", data)
|
return make_amas_request(asan_login_name, "/service/embas.getStaffData", data)
|
||||||
|
|
||||||
|
|
||||||
def get_person_data(asan_login_name, entity_oid):
|
def get_person_data(asan_login_name, entity_oid):
|
||||||
"""Call refdata.getPersonDataByEntOid for personal data"""
|
"""Call refdata.getPersonDataByEntOid for personal data"""
|
||||||
data = {"entityOid": entity_oid} # Fixed: was "entOid", should be "entityOid"
|
data = {"entityOid": entity_oid} # Fixed: was "entOid", should be "entityOid"
|
||||||
return make_emas_request(asan_login_name, "/service/refdata.getPersonDataByEntOid", data)
|
return make_amas_request(asan_login_name, "/service/refdata.getPersonDataByEntOid", data)
|
||||||
|
|
||||||
|
|
||||||
def get_address_data(asan_login_name, address_oid):
|
def get_address_data(asan_login_name, address_oid):
|
||||||
"""Call refdata.getAddressData for work address"""
|
"""Call refdata.getAddressData for work address"""
|
||||||
data = {"addressOid": address_oid}
|
data = {"addressOid": address_oid}
|
||||||
return make_emas_request(asan_login_name, "/service/refdata.getAddressData", data)
|
return make_amas_request(asan_login_name, "/service/refdata.getAddressData", data)
|
||||||
|
|
||||||
|
|
||||||
def get_doc_main_data(asan_login_name, doc_oid, doc_no, doc_type):
|
def get_doc_main_data(asan_login_name, doc_oid, doc_no, doc_type):
|
||||||
|
|
@ -1544,7 +1544,7 @@ def get_doc_main_data(asan_login_name, doc_oid, doc_no, doc_type):
|
||||||
"docNo": doc_no,
|
"docNo": doc_no,
|
||||||
"docType": doc_type
|
"docType": doc_type
|
||||||
}
|
}
|
||||||
return make_emas_request(asan_login_name, "/service/eroom.getDocMainData", data)
|
return make_amas_request(asan_login_name, "/service/eroom.getDocMainData", data)
|
||||||
|
|
||||||
|
|
||||||
def get_contract_attachments(asan_login_name, doc_oid, attach_type="attachType_5"):
|
def get_contract_attachments(asan_login_name, doc_oid, attach_type="attachType_5"):
|
||||||
|
|
@ -1556,7 +1556,7 @@ def get_contract_attachments(asan_login_name, doc_oid, attach_type="attachType_5
|
||||||
"docOid[]": doc_oid,
|
"docOid[]": doc_oid,
|
||||||
"attachType": attach_type
|
"attachType": attach_type
|
||||||
}
|
}
|
||||||
return make_emas_request(asan_login_name, "/service/eroom.getAttachListByType", data)
|
return make_amas_request(asan_login_name, "/service/eroom.getAttachListByType", data)
|
||||||
|
|
||||||
|
|
||||||
def download_contract_file(asan_login_name, file_id):
|
def download_contract_file(asan_login_name, file_id):
|
||||||
|
|
@ -1565,7 +1565,7 @@ def download_contract_file(asan_login_name, file_id):
|
||||||
Returns HTML content of the employment contract.
|
Returns HTML content of the employment contract.
|
||||||
"""
|
"""
|
||||||
data = {"fileId": file_id}
|
data = {"fileId": file_id}
|
||||||
return make_emas_request(asan_login_name, "/request/readFromStorage", data)
|
return make_amas_request(asan_login_name, "/request/readFromStorage", data)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|
@ -1750,8 +1750,8 @@ def update_employee_from_detail_data(employee_doc, detail_data):
|
||||||
|
|
||||||
# Dates
|
# Dates
|
||||||
employee_doc.main_contract_begin_date = str(details.get('mainContractBeginDate') or '')
|
employee_doc.main_contract_begin_date = str(details.get('mainContractBeginDate') or '')
|
||||||
employee_doc.contract_begin_date = parse_emas_date(details.get('beginDate'))
|
employee_doc.contract_begin_date = parse_amas_date(details.get('beginDate'))
|
||||||
employee_doc.contract_end_date = parse_emas_date(details.get('endDate'))
|
employee_doc.contract_end_date = parse_amas_date(details.get('endDate'))
|
||||||
employee_doc.emp_job_start_date = str(details.get('empJobStartDate') or '')
|
employee_doc.emp_job_start_date = str(details.get('empJobStartDate') or '')
|
||||||
employee_doc.begin_date = str(details.get('beginDate') or '')
|
employee_doc.begin_date = str(details.get('beginDate') or '')
|
||||||
employee_doc.end_date = str(details.get('endDate') or '')
|
employee_doc.end_date = str(details.get('endDate') or '')
|
||||||
|
|
@ -1800,8 +1800,8 @@ def update_employee_from_detail_data(employee_doc, detail_data):
|
||||||
employee_doc.marital_status = person.get('maritalStatus')
|
employee_doc.marital_status = person.get('maritalStatus')
|
||||||
employee_doc.military_status = person.get('militaryStatus')
|
employee_doc.military_status = person.get('militaryStatus')
|
||||||
employee_doc.document_number = person.get('documentNumber')
|
employee_doc.document_number = person.get('documentNumber')
|
||||||
employee_doc.document_issue_date = parse_emas_date(person.get('issueDate'))
|
employee_doc.document_issue_date = parse_amas_date(person.get('issueDate'))
|
||||||
employee_doc.document_expiry_date = parse_emas_date(person.get('expireDate'))
|
employee_doc.document_expiry_date = parse_amas_date(person.get('expireDate'))
|
||||||
employee_doc.document_issued_by = person.get('issuedBy')
|
employee_doc.document_issued_by = person.get('issuedBy')
|
||||||
employee_doc.personal_address = person.get('address')
|
employee_doc.personal_address = person.get('address')
|
||||||
employee_doc.personal_city = person.get('city')
|
employee_doc.personal_city = person.get('city')
|
||||||
|
|
@ -1855,10 +1855,10 @@ def on_delete_employee(doc, method):
|
||||||
"""
|
"""
|
||||||
When an Employee is deleted, also delete linked Emas Employees records.
|
When an Employee is deleted, also delete linked Emas Employees records.
|
||||||
"""
|
"""
|
||||||
emas_records = frappe.get_all(
|
amas_records = frappe.get_all(
|
||||||
"Emas Employees",
|
"Amas Employees",
|
||||||
filters={"employee": doc.name},
|
filters={"employee": doc.name},
|
||||||
fields=["name"]
|
fields=["name"]
|
||||||
)
|
)
|
||||||
for rec in emas_records:
|
for rec in amas_records:
|
||||||
frappe.delete_doc("Emas Employees", rec.name, ignore_permissions=True)
|
frappe.delete_doc("Amas Employees", rec.name, ignore_permissions=True)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
frappe.ui.form.on('Emas Employees', {
|
frappe.ui.form.on('Amas Employees', {
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
// Add "View Contract" button if contract HTML exists
|
// Add "View Contract" button if contract HTML exists
|
||||||
if (frm.doc.contract_html && frm.doc.contract_html.trim().length > 0) {
|
if (frm.doc.contract_html && frm.doc.contract_html.trim().length > 0) {
|
||||||
|
|
@ -8,26 +8,26 @@ if (frappe.listview_settings['Employee']) {
|
||||||
const orig_onload = frappe.listview_settings['Employee'].onload;
|
const orig_onload = frappe.listview_settings['Employee'].onload;
|
||||||
frappe.listview_settings['Employee'].onload = function(listview) {
|
frappe.listview_settings['Employee'].onload = function(listview) {
|
||||||
if (orig_onload) orig_onload(listview);
|
if (orig_onload) orig_onload(listview);
|
||||||
add_emas_load_button(listview);
|
add_amas_load_button(listview);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
frappe.listview_settings['Employee'] = {
|
frappe.listview_settings['Employee'] = {
|
||||||
onload: function(listview) {
|
onload: function(listview) {
|
||||||
add_emas_load_button(listview);
|
add_amas_load_button(listview);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_emas_load_button(listview) {
|
function add_amas_load_button(listview) {
|
||||||
listview.page.add_inner_button(__('Load from ƏMAS'), function() {
|
listview.page.add_inner_button(__('Load from ƏMAS'), function() {
|
||||||
start_emas_employee_import(listview);
|
start_amas_employee_import(listview);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 1: Get default connected Asan Login → fetch employees from ƏMAS API
|
// Step 1: Get default connected Asan Login → fetch employees from ƏMAS API
|
||||||
function start_emas_employee_import(listview) {
|
function start_amas_employee_import(listview) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.get_connected_asan_logins',
|
method: 'invoice_az.amas_api.get_connected_asan_logins',
|
||||||
freeze: true,
|
freeze: true,
|
||||||
freeze_message: __('Checking ƏMAS connection...'),
|
freeze_message: __('Checking ƏMAS connection...'),
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
|
@ -52,20 +52,20 @@ function start_emas_employee_import(listview) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the first (default) connected login
|
// Use the first (default) connected login
|
||||||
fetch_employees_from_emas(listview, asan_logins[0].name, asan_logins[0].organization_name);
|
fetch_employees_from_amas(listview, asan_logins[0].name, asan_logins[0].organization_name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Fetch employees from ƏMAS API
|
// Step 2: Fetch employees from ƏMAS API
|
||||||
function fetch_employees_from_emas(listview, asan_login_name, organization_name) {
|
function fetch_employees_from_amas(listview, asan_login_name, organization_name) {
|
||||||
frappe.show_alert({
|
frappe.show_alert({
|
||||||
message: __('Fetching employees from ƏMAS...'),
|
message: __('Fetching employees from ƏMAS...'),
|
||||||
indicator: 'blue'
|
indicator: 'blue'
|
||||||
}, 3);
|
}, 3);
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.get_employees_report',
|
method: 'invoice_az.amas_api.get_employees_report',
|
||||||
args: {
|
args: {
|
||||||
asan_login_name: asan_login_name,
|
asan_login_name: asan_login_name,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
|
|
@ -140,7 +140,7 @@ function show_employee_selection(listview, asan_login_name, organization_name, e
|
||||||
|
|
||||||
// Build table (e-taxes style)
|
// Build table (e-taxes style)
|
||||||
let invoiceTable = '<div style="max-height: 500px; overflow-y: auto;">' +
|
let invoiceTable = '<div style="max-height: 500px; overflow-y: auto;">' +
|
||||||
'<table class="table table-bordered emas-employees-table" style="width: 100%; table-layout: fixed;">' +
|
'<table class="table table-bordered amas-employees-table" style="width: 100%; table-layout: fixed;">' +
|
||||||
'<thead><tr>' +
|
'<thead><tr>' +
|
||||||
'<th style="width: 4%;"><input type="checkbox" class="select-all-employees"></th>' +
|
'<th style="width: 4%;"><input type="checkbox" class="select-all-employees"></th>' +
|
||||||
'<th style="width: 20%;">' + __('Full Name') + '</th>' +
|
'<th style="width: 20%;">' + __('Full Name') + '</th>' +
|
||||||
|
|
@ -274,7 +274,7 @@ function create_employees(listview, asan_login_name, selected_employees, company
|
||||||
);
|
);
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.create_employees_from_emas',
|
method: 'invoice_az.amas_api.create_employees_from_amas',
|
||||||
args: {
|
args: {
|
||||||
asan_login_name: asan_login_name,
|
asan_login_name: asan_login_name,
|
||||||
employees: selected_employees,
|
employees: selected_employees,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ doctype_js = {
|
||||||
"Sales Invoice": "client/sales_invoice.js",
|
"Sales Invoice": "client/sales_invoice.js",
|
||||||
"Journal Entry": "client/journal_entry.js",
|
"Journal Entry": "client/journal_entry.js",
|
||||||
"Supplier": "client/supplier.js",
|
"Supplier": "client/supplier.js",
|
||||||
"Emas Employees": "client/emas_employees.js"
|
"Amas Employees": "client/amas_employees.js"
|
||||||
}
|
}
|
||||||
|
|
||||||
doctype_list_js = {
|
doctype_list_js = {
|
||||||
|
|
@ -55,7 +55,7 @@ doc_events = {
|
||||||
"on_update": "invoice_az.api.update_mapped_statuses"
|
"on_update": "invoice_az.api.update_mapped_statuses"
|
||||||
},
|
},
|
||||||
"Employee": {
|
"Employee": {
|
||||||
"on_trash": "invoice_az.emas_api.on_delete_employee"
|
"on_trash": "invoice_az.amas_api.on_delete_employee"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) 2026, Your Company and contributors
|
// Copyright (c) 2026, Your Company and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.ui.form.on('Emas Employees', {
|
frappe.ui.form.on('Amas Employees', {
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
// Form view - show employee details
|
// Form view - show employee details
|
||||||
if (!frm.is_new()) {
|
if (!frm.is_new()) {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "format:EMAS-EMP-{####}",
|
"autoname": "format:AMAS-EMP-{####}",
|
||||||
"creation": "2026-02-06 10:00:00",
|
"creation": "2026-02-06 10:00:00",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
|
|
@ -934,7 +934,7 @@
|
||||||
"modified": "2026-02-10 10:00:00",
|
"modified": "2026-02-10 10:00:00",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Invoice Az",
|
"module": "Invoice Az",
|
||||||
"name": "Emas Employees",
|
"name": "Amas Employees",
|
||||||
"naming_rule": "Expression",
|
"naming_rule": "Expression",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
|
|
@ -955,4 +955,4 @@
|
||||||
"states": [],
|
"states": [],
|
||||||
"title_field": "full_name",
|
"title_field": "full_name",
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
||||||
|
|
@ -4,5 +4,5 @@
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
|
||||||
class EmasEmployees(Document):
|
class AmasEmployees(Document):
|
||||||
pass
|
pass
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) 2026, Your Company and contributors
|
// Copyright (c) 2026, Your Company and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.listview_settings['Emas Employees'] = {
|
frappe.listview_settings['Amas Employees'] = {
|
||||||
onload: function(listview) {
|
onload: function(listview) {
|
||||||
listview.page.add_inner_button(__('Import from ƏMAS'), function() {
|
listview.page.add_inner_button(__('Import from ƏMAS'), function() {
|
||||||
show_import_employees_dialog();
|
show_import_employees_dialog();
|
||||||
|
|
@ -11,7 +11,7 @@ frappe.listview_settings['Emas Employees'] = {
|
||||||
|
|
||||||
function show_import_employees_dialog() {
|
function show_import_employees_dialog() {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.get_connected_asan_logins',
|
method: 'invoice_az.amas_api.get_connected_asan_logins',
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if (r.message && r.message.success) {
|
if (r.message && r.message.success) {
|
||||||
const asan_logins = r.message.asan_logins || [];
|
const asan_logins = r.message.asan_logins || [];
|
||||||
|
|
@ -83,7 +83,7 @@ function load_employees_for_import(asan_login_name, organization_name) {
|
||||||
loading_dialog.show();
|
loading_dialog.show();
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.get_employees_report',
|
method: 'invoice_az.amas_api.get_employees_report',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': asan_login_name,
|
'asan_login_name': asan_login_name,
|
||||||
'offset': 0,
|
'offset': 0,
|
||||||
|
|
@ -239,7 +239,7 @@ function import_selected_employees(asan_login_name, employees, selected_indices)
|
||||||
progress_dialog.show();
|
progress_dialog.show();
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.import_employees',
|
method: 'invoice_az.amas_api.import_employees',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': asan_login_name,
|
'asan_login_name': asan_login_name,
|
||||||
'employees': selected_employees
|
'employees': selected_employees
|
||||||
|
|
@ -7,7 +7,7 @@ frappe.ui.form.on('Asan Login', {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add EMAS buttons
|
// Add EMAS buttons
|
||||||
add_emas_buttons(frm);
|
add_amas_buttons(frm);
|
||||||
|
|
||||||
// Кнопка для MyGovID Login
|
// Кнопка для MyGovID Login
|
||||||
frm.add_custom_button(__('MyGovID Login'), function() {
|
frm.add_custom_button(__('MyGovID Login'), function() {
|
||||||
|
|
@ -967,7 +967,7 @@ function startMyGovIDLogin(frm) {
|
||||||
// ƏMAS (e-social.gov.az) Integration Functions
|
// ƏMAS (e-social.gov.az) Integration Functions
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
function add_emas_buttons(frm) {
|
function add_amas_buttons(frm) {
|
||||||
// Only show ƏMAS buttons if user is authenticated with e-taxes or MyGovID
|
// Only show ƏMAS buttons if user is authenticated with e-taxes or MyGovID
|
||||||
const is_authenticated = frm.doc.auth_status === 'Authenticated' ||
|
const is_authenticated = frm.doc.auth_status === 'Authenticated' ||
|
||||||
frm.doc.auth_status === 'Fully Authenticated' ||
|
frm.doc.auth_status === 'Fully Authenticated' ||
|
||||||
|
|
@ -978,9 +978,9 @@ function add_emas_buttons(frm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check current ƏMAS status
|
// Check current ƏMAS status
|
||||||
const emas_status = frm.doc.emas_auth_status || 'Not Connected';
|
const amas_status = frm.doc.amas_auth_status || 'Not Connected';
|
||||||
|
|
||||||
if (emas_status === 'Connected' && frm.doc.emas_account_oid) {
|
if (amas_status === 'Connected' && frm.doc.amas_account_oid) {
|
||||||
// ƏMAS is connected - show employee buttons
|
// ƏMAS is connected - show employee buttons
|
||||||
frm.add_custom_button(__('Get Employees'), function() {
|
frm.add_custom_button(__('Get Employees'), function() {
|
||||||
show_employees_dialog(frm);
|
show_employees_dialog(frm);
|
||||||
|
|
@ -991,36 +991,36 @@ function add_emas_buttons(frm) {
|
||||||
}, __('ƏMAS'));
|
}, __('ƏMAS'));
|
||||||
|
|
||||||
frm.add_custom_button(__('Refresh Session'), function() {
|
frm.add_custom_button(__('Refresh Session'), function() {
|
||||||
refresh_emas_session(frm);
|
refresh_amas_session(frm);
|
||||||
}, __('ƏMAS'));
|
}, __('ƏMAS'));
|
||||||
|
|
||||||
frm.add_custom_button(__('Disconnect'), function() {
|
frm.add_custom_button(__('Disconnect'), function() {
|
||||||
disconnect_emas(frm);
|
disconnect_amas(frm);
|
||||||
}, __('ƏMAS'));
|
}, __('ƏMAS'));
|
||||||
|
|
||||||
} else if (emas_status === 'Connected' && !frm.doc.emas_account_oid) {
|
} else if (amas_status === 'Connected' && !frm.doc.amas_account_oid) {
|
||||||
// Connected but no account selected
|
// Connected but no account selected
|
||||||
frm.add_custom_button(__('Select Organization'), function() {
|
frm.add_custom_button(__('Select Organization'), function() {
|
||||||
show_accounts_dialog(frm);
|
show_accounts_dialog(frm);
|
||||||
}, __('ƏMAS'));
|
}, __('ƏMAS'));
|
||||||
|
|
||||||
frm.add_custom_button(__('Refresh Session'), function() {
|
frm.add_custom_button(__('Refresh Session'), function() {
|
||||||
refresh_emas_session(frm);
|
refresh_amas_session(frm);
|
||||||
}, __('ƏMAS'));
|
}, __('ƏMAS'));
|
||||||
|
|
||||||
frm.add_custom_button(__('Disconnect'), function() {
|
frm.add_custom_button(__('Disconnect'), function() {
|
||||||
disconnect_emas(frm);
|
disconnect_amas(frm);
|
||||||
}, __('ƏMAS'));
|
}, __('ƏMAS'));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Not connected - show connect button
|
// Not connected - show connect button
|
||||||
frm.add_custom_button(__('Connect ƏMAS'), function() {
|
frm.add_custom_button(__('Connect ƏMAS'), function() {
|
||||||
start_emas_connection(frm);
|
start_amas_connection(frm);
|
||||||
}, __('ƏMAS'));
|
}, __('ƏMAS'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_emas_connection(frm) {
|
function start_amas_connection(frm) {
|
||||||
// Show loading indicator
|
// Show loading indicator
|
||||||
frappe.show_alert({
|
frappe.show_alert({
|
||||||
message: __('Connecting to ƏMAS...'),
|
message: __('Connecting to ƏMAS...'),
|
||||||
|
|
@ -1028,7 +1028,7 @@ function start_emas_connection(frm) {
|
||||||
}, 3);
|
}, 3);
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.connect_emas',
|
method: 'invoice_az.amas_api.connect_amas',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name
|
'asan_login_name': frm.doc.name
|
||||||
},
|
},
|
||||||
|
|
@ -1060,7 +1060,7 @@ function start_emas_connection(frm) {
|
||||||
__('MyGovID authentication required. Do you want to login with MyGovID now?'),
|
__('MyGovID authentication required. Do you want to login with MyGovID now?'),
|
||||||
function() {
|
function() {
|
||||||
// Start MyGovID login, then connect to ƏMAS
|
// Start MyGovID login, then connect to ƏMAS
|
||||||
start_mygovid_then_emas(frm);
|
start_mygovid_then_amas(frm);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1074,7 +1074,7 @@ function start_emas_connection(frm) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_mygovid_then_emas(frm) {
|
function start_mygovid_then_amas(frm) {
|
||||||
// Show MyGovID login dialog with ƏMAS callback
|
// Show MyGovID login dialog with ƏMAS callback
|
||||||
frappe.show_alert({
|
frappe.show_alert({
|
||||||
message: __('Starting MyGovID authentication...'),
|
message: __('Starting MyGovID authentication...'),
|
||||||
|
|
@ -1090,22 +1090,22 @@ function start_mygovid_then_emas(frm) {
|
||||||
fieldtype: 'HTML',
|
fieldtype: 'HTML',
|
||||||
options: `
|
options: `
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<div class="mygovid-emas-spinner" style="display: inline-block; width: 64px; height: 64px;">
|
<div class="mygovid-amas-spinner" style="display: inline-block; width: 64px; height: 64px;">
|
||||||
<div style="width: 64px; height: 64px; border: 6px solid #4e73df; border-radius: 50%; border-color: #4e73df transparent #4e73df transparent; animation: mygovid-emas-spin 1.2s linear infinite;"></div>
|
<div style="width: 64px; height: 64px; border: 6px solid #4e73df; border-radius: 50%; border-color: #4e73df transparent #4e73df transparent; animation: mygovid-amas-spin 1.2s linear infinite;"></div>
|
||||||
</div>
|
</div>
|
||||||
<style>
|
<style>
|
||||||
@keyframes mygovid-emas-spin {
|
@keyframes mygovid-amas-spin {
|
||||||
0% { transform: rotate(0deg); }
|
0% { transform: rotate(0deg); }
|
||||||
100% { transform: rotate(360deg); }
|
100% { transform: rotate(360deg); }
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="mt-3" id="mygovid_emas_status_message">
|
<div class="mt-3" id="mygovid_amas_status_message">
|
||||||
<h4>Waiting for confirmation on your phone</h4>
|
<h4>Waiting for confirmation on your phone</h4>
|
||||||
<p>Please check your phone and confirm the authentication request in ASAN Sign app.</p>
|
<p>Please check your phone and confirm the authentication request in ASAN Sign app.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="mygovid_emas_code_container" style="display:none; margin-top: 15px;">
|
<div id="mygovid_amas_code_container" style="display:none; margin-top: 15px;">
|
||||||
<div style="background: #f8f9fa; padding: 10px; display: inline-block; border-radius: 5px; font-size: 24px; font-weight: bold; letter-spacing: 2px; color: #333; border: 1px solid #ddd;">
|
<div style="background: #f8f9fa; padding: 10px; display: inline-block; border-radius: 5px; font-size: 24px; font-weight: bold; letter-spacing: 2px; color: #333; border: 1px solid #ddd;">
|
||||||
<span id="mygovid_emas_code">----</span>
|
<span id="mygovid_amas_code">----</span>
|
||||||
</div>
|
</div>
|
||||||
<p style="margin-top: 5px; font-size: 12px; color: #666;">Verification Code</p>
|
<p style="margin-top: 5px; font-size: 12px; color: #666;">Verification Code</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1136,25 +1136,25 @@ function start_mygovid_then_emas(frm) {
|
||||||
|
|
||||||
if (r.message && r.message.success) {
|
if (r.message && r.message.success) {
|
||||||
// MyGovID login successful, now connect to ƏMAS
|
// MyGovID login successful, now connect to ƏMAS
|
||||||
$('#mygovid_emas_status_message').html(`
|
$('#mygovid_amas_status_message').html(`
|
||||||
<h4 style="color: blue;">Connecting to ƏMAS...</h4>
|
<h4 style="color: blue;">Connecting to ƏMAS...</h4>
|
||||||
<p>MyGovID authentication successful. Now connecting to ƏMAS...</p>
|
<p>MyGovID authentication successful. Now connecting to ƏMAS...</p>
|
||||||
`);
|
`);
|
||||||
$('#mygovid_emas_code_container').hide();
|
$('#mygovid_amas_code_container').hide();
|
||||||
|
|
||||||
// Now connect to ƏMAS
|
// Now connect to ƏMAS
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.connect_emas',
|
method: 'invoice_az.amas_api.connect_amas',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name
|
'asan_login_name': frm.doc.name
|
||||||
},
|
},
|
||||||
callback: function(r2) {
|
callback: function(r2) {
|
||||||
if (r2.message && r2.message.success) {
|
if (r2.message && r2.message.success) {
|
||||||
$('#mygovid_emas_status_message').html(`
|
$('#mygovid_amas_status_message').html(`
|
||||||
<h4 style="color: green;">ƏMAS Connected!</h4>
|
<h4 style="color: green;">ƏMAS Connected!</h4>
|
||||||
<p>Successfully connected to ƏMAS.</p>
|
<p>Successfully connected to ƏMAS.</p>
|
||||||
`);
|
`);
|
||||||
$('.mygovid-emas-spinner').html(`
|
$('.mygovid-amas-spinner').html(`
|
||||||
<div style="width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;">
|
<div style="width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;">
|
||||||
<i class="fa fa-check" style="font-size: 48px; color: #5cb85c;"></i>
|
<i class="fa fa-check" style="font-size: 48px; color: #5cb85c;"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1181,11 +1181,11 @@ function start_mygovid_then_emas(frm) {
|
||||||
});
|
});
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} else {
|
} else {
|
||||||
$('#mygovid_emas_status_message').html(`
|
$('#mygovid_amas_status_message').html(`
|
||||||
<h4 style="color: red;">ƏMAS Connection Failed</h4>
|
<h4 style="color: red;">ƏMAS Connection Failed</h4>
|
||||||
<p>${r2.message ? r2.message.message : 'Unknown error'}</p>
|
<p>${r2.message ? r2.message.message : 'Unknown error'}</p>
|
||||||
`);
|
`);
|
||||||
$('.mygovid-emas-spinner').css('display', 'none');
|
$('.mygovid-amas-spinner').css('display', 'none');
|
||||||
|
|
||||||
status_dialog.set_primary_action(__('Close'), function() {
|
status_dialog.set_primary_action(__('Close'), function() {
|
||||||
status_dialog.hide();
|
status_dialog.hide();
|
||||||
|
|
@ -1196,12 +1196,12 @@ function start_mygovid_then_emas(frm) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// MyGovID login failed
|
// MyGovID login failed
|
||||||
$('#mygovid_emas_status_message').html(`
|
$('#mygovid_amas_status_message').html(`
|
||||||
<h4 style="color: red;">Authentication Failed</h4>
|
<h4 style="color: red;">Authentication Failed</h4>
|
||||||
<p>${r.message ? r.message.message : 'Unknown error'}</p>
|
<p>${r.message ? r.message.message : 'Unknown error'}</p>
|
||||||
`);
|
`);
|
||||||
$('.mygovid-emas-spinner').css('display', 'none');
|
$('.mygovid-amas-spinner').css('display', 'none');
|
||||||
$('#mygovid_emas_code_container').hide();
|
$('#mygovid_amas_code_container').hide();
|
||||||
|
|
||||||
status_dialog.set_primary_action(__('Close'), function() {
|
status_dialog.set_primary_action(__('Close'), function() {
|
||||||
status_dialog.hide();
|
status_dialog.hide();
|
||||||
|
|
@ -1212,12 +1212,12 @@ function start_mygovid_then_emas(frm) {
|
||||||
error: function() {
|
error: function() {
|
||||||
if (window.mygovidEmasStop) return;
|
if (window.mygovidEmasStop) return;
|
||||||
|
|
||||||
$('#mygovid_emas_status_message').html(`
|
$('#mygovid_amas_status_message').html(`
|
||||||
<h4 style="color: red;">Authentication Timeout</h4>
|
<h4 style="color: red;">Authentication Timeout</h4>
|
||||||
<p>The request timed out. Please try again.</p>
|
<p>The request timed out. Please try again.</p>
|
||||||
`);
|
`);
|
||||||
$('.mygovid-emas-spinner').css('display', 'none');
|
$('.mygovid-amas-spinner').css('display', 'none');
|
||||||
$('#mygovid_emas_code_container').hide();
|
$('#mygovid_amas_code_container').hide();
|
||||||
|
|
||||||
status_dialog.set_primary_action(__('Close'), function() {
|
status_dialog.set_primary_action(__('Close'), function() {
|
||||||
status_dialog.hide();
|
status_dialog.hide();
|
||||||
|
|
@ -1233,8 +1233,8 @@ function start_mygovid_then_emas(frm) {
|
||||||
args: { 'asan_login_name': frm.doc.name },
|
args: { 'asan_login_name': frm.doc.name },
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if (r.message && r.message.success) {
|
if (r.message && r.message.success) {
|
||||||
$('#mygovid_emas_code').text(r.message.code);
|
$('#mygovid_amas_code').text(r.message.code);
|
||||||
$('#mygovid_emas_code_container').show();
|
$('#mygovid_amas_code_container').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1267,7 +1267,7 @@ function show_accounts_dialog_with_data(frm, accounts) {
|
||||||
<td>${frappe.utils.escape_html(voen)}</td>
|
<td>${frappe.utils.escape_html(voen)}</td>
|
||||||
<td>${frappe.utils.escape_html(role)}</td>
|
<td>${frappe.utils.escape_html(role)}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-xs btn-primary select-emas-account"
|
<button class="btn btn-xs btn-primary select-amas-account"
|
||||||
data-oid="${frappe.utils.escape_html(oid)}"
|
data-oid="${frappe.utils.escape_html(oid)}"
|
||||||
data-name="${frappe.utils.escape_html(name)}"
|
data-name="${frappe.utils.escape_html(name)}"
|
||||||
data-number="${frappe.utils.escape_html(voen)}"
|
data-number="${frappe.utils.escape_html(voen)}"
|
||||||
|
|
@ -1296,19 +1296,19 @@ function show_accounts_dialog_with_data(frm, accounts) {
|
||||||
d.show();
|
d.show();
|
||||||
|
|
||||||
// Add click handler for account selection
|
// Add click handler for account selection
|
||||||
d.$wrapper.find('.select-emas-account').on('click', function() {
|
d.$wrapper.find('.select-amas-account').on('click', function() {
|
||||||
const oid = $(this).data('oid');
|
const oid = $(this).data('oid');
|
||||||
const name = $(this).data('name');
|
const name = $(this).data('name');
|
||||||
const number = $(this).data('number');
|
const number = $(this).data('number');
|
||||||
const role = $(this).data('role');
|
const role = $(this).data('role');
|
||||||
|
|
||||||
select_emas_account(frm, d, oid, name, number, role);
|
select_amas_account(frm, d, oid, name, number, role);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_accounts_dialog(frm) {
|
function show_accounts_dialog(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.get_emas_accounts',
|
method: 'invoice_az.amas_api.get_amas_accounts',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name
|
'asan_login_name': frm.doc.name
|
||||||
},
|
},
|
||||||
|
|
@ -1338,7 +1338,7 @@ function show_accounts_dialog(frm) {
|
||||||
<td>${frappe.utils.escape_html(voen)}</td>
|
<td>${frappe.utils.escape_html(voen)}</td>
|
||||||
<td>${frappe.utils.escape_html(role)}</td>
|
<td>${frappe.utils.escape_html(role)}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-xs btn-primary select-emas-account"
|
<button class="btn btn-xs btn-primary select-amas-account"
|
||||||
data-oid="${frappe.utils.escape_html(oid)}"
|
data-oid="${frappe.utils.escape_html(oid)}"
|
||||||
data-name="${frappe.utils.escape_html(name)}"
|
data-name="${frappe.utils.escape_html(name)}"
|
||||||
data-number="${frappe.utils.escape_html(voen)}"
|
data-number="${frappe.utils.escape_html(voen)}"
|
||||||
|
|
@ -1367,13 +1367,13 @@ function show_accounts_dialog(frm) {
|
||||||
d.show();
|
d.show();
|
||||||
|
|
||||||
// Add click handler for account selection
|
// Add click handler for account selection
|
||||||
d.$wrapper.find('.select-emas-account').on('click', function() {
|
d.$wrapper.find('.select-amas-account').on('click', function() {
|
||||||
const oid = $(this).data('oid');
|
const oid = $(this).data('oid');
|
||||||
const name = $(this).data('name');
|
const name = $(this).data('name');
|
||||||
const number = $(this).data('number');
|
const number = $(this).data('number');
|
||||||
const role = $(this).data('role');
|
const role = $(this).data('role');
|
||||||
|
|
||||||
select_emas_account(frm, d, oid, name, number, role);
|
select_amas_account(frm, d, oid, name, number, role);
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1387,9 +1387,9 @@ function show_accounts_dialog(frm) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function select_emas_account(frm, dialog, oid, name, number, role) {
|
function select_amas_account(frm, dialog, oid, name, number, role) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.change_emas_account',
|
method: 'invoice_az.amas_api.change_amas_account',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name,
|
'asan_login_name': frm.doc.name,
|
||||||
'account_oid': oid,
|
'account_oid': oid,
|
||||||
|
|
@ -1429,17 +1429,17 @@ function show_employees_dialog(frm) {
|
||||||
fieldname: 'loading_html',
|
fieldname: 'loading_html',
|
||||||
fieldtype: 'HTML',
|
fieldtype: 'HTML',
|
||||||
options: `
|
options: `
|
||||||
<div class="text-center" id="emas_loading">
|
<div class="text-center" id="amas_loading">
|
||||||
<i class="fa fa-spinner fa-spin fa-3x"></i>
|
<i class="fa fa-spinner fa-spin fa-3x"></i>
|
||||||
<p class="mt-3">Loading employees...</p>
|
<p class="mt-3">Loading employees...</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="emas_employees_container" style="display: none;">
|
<div id="amas_employees_container" style="display: none;">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<strong>Organization:</strong> ${frm.doc.emas_account_name || ''}
|
<strong>Organization:</strong> ${frm.doc.amas_account_name || ''}
|
||||||
(VOEN: ${frm.doc.emas_account_number || ''})
|
(VOEN: ${frm.doc.amas_account_number || ''})
|
||||||
</div>
|
</div>
|
||||||
<div id="emas_employees_table"></div>
|
<div id="amas_employees_table"></div>
|
||||||
<div id="emas_pagination" class="mt-3"></div>
|
<div id="amas_pagination" class="mt-3"></div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
@ -1458,21 +1458,21 @@ function show_employees_dialog(frm) {
|
||||||
|
|
||||||
function load_employees(frm, dialog, offset, limit) {
|
function load_employees(frm, dialog, offset, limit) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.get_employees_report',
|
method: 'invoice_az.amas_api.get_employees_report',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name,
|
'asan_login_name': frm.doc.name,
|
||||||
'offset': offset,
|
'offset': offset,
|
||||||
'limit': limit
|
'limit': limit
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
dialog.$wrapper.find('#emas_loading').hide();
|
dialog.$wrapper.find('#amas_loading').hide();
|
||||||
dialog.$wrapper.find('#emas_employees_container').show();
|
dialog.$wrapper.find('#amas_employees_container').show();
|
||||||
|
|
||||||
if (r.message && r.message.success) {
|
if (r.message && r.message.success) {
|
||||||
const employees = r.message.employees || [];
|
const employees = r.message.employees || [];
|
||||||
render_employees_table(dialog, employees, offset, limit, r.message.has_more);
|
render_employees_table(dialog, employees, offset, limit, r.message.has_more);
|
||||||
} else {
|
} else {
|
||||||
dialog.$wrapper.find('#emas_employees_table').html(`
|
dialog.$wrapper.find('#amas_employees_table').html(`
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
${r.message ? r.message.message : __('Failed to load employees')}
|
${r.message ? r.message.message : __('Failed to load employees')}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1484,7 +1484,7 @@ function load_employees(frm, dialog, offset, limit) {
|
||||||
|
|
||||||
function render_employees_table(dialog, employees, offset, limit, has_more) {
|
function render_employees_table(dialog, employees, offset, limit, has_more) {
|
||||||
if (employees.length === 0) {
|
if (employees.length === 0) {
|
||||||
dialog.$wrapper.find('#emas_employees_table').html(`
|
dialog.$wrapper.find('#amas_employees_table').html(`
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
${__('No employees found')}
|
${__('No employees found')}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1533,7 +1533,7 @@ function render_employees_table(dialog, employees, offset, limit, has_more) {
|
||||||
|
|
||||||
table_html += '</tbody></table></div>';
|
table_html += '</tbody></table></div>';
|
||||||
|
|
||||||
dialog.$wrapper.find('#emas_employees_table').html(table_html);
|
dialog.$wrapper.find('#amas_employees_table').html(table_html);
|
||||||
|
|
||||||
// Pagination info
|
// Pagination info
|
||||||
const showing_from = offset + 1;
|
const showing_from = offset + 1;
|
||||||
|
|
@ -1545,12 +1545,12 @@ function render_employees_table(dialog, employees, offset, limit, has_more) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pagination_html += '</p>';
|
pagination_html += '</p>';
|
||||||
dialog.$wrapper.find('#emas_pagination').html(pagination_html);
|
dialog.$wrapper.find('#amas_pagination').html(pagination_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_contract_stats(frm) {
|
function show_contract_stats(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.get_contract_stats',
|
method: 'invoice_az.amas_api.get_contract_stats',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name
|
'asan_login_name': frm.doc.name
|
||||||
},
|
},
|
||||||
|
|
@ -1565,8 +1565,8 @@ function show_contract_stats(frm) {
|
||||||
fieldtype: 'HTML',
|
fieldtype: 'HTML',
|
||||||
options: `
|
options: `
|
||||||
<div style="padding: 20px;">
|
<div style="padding: 20px;">
|
||||||
<h4>${frm.doc.emas_account_name || 'Organization'}</h4>
|
<h4>${frm.doc.amas_account_name || 'Organization'}</h4>
|
||||||
<p class="text-muted">VOEN: ${frm.doc.emas_account_number || ''}</p>
|
<p class="text-muted">VOEN: ${frm.doc.amas_account_number || ''}</p>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-center">
|
<div class="col-md-4 text-center">
|
||||||
|
|
@ -1613,9 +1613,9 @@ function show_contract_stats(frm) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh_emas_session(frm) {
|
function refresh_amas_session(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.refresh_emas_session',
|
method: 'invoice_az.amas_api.refresh_amas_session',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name
|
'asan_login_name': frm.doc.name
|
||||||
},
|
},
|
||||||
|
|
@ -1639,12 +1639,12 @@ function refresh_emas_session(frm) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function disconnect_emas(frm) {
|
function disconnect_amas(frm) {
|
||||||
frappe.confirm(
|
frappe.confirm(
|
||||||
__('Are you sure you want to disconnect from ƏMAS?'),
|
__('Are you sure you want to disconnect from ƏMAS?'),
|
||||||
function() {
|
function() {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: 'invoice_az.emas_api.disconnect_emas',
|
method: 'invoice_az.amas_api.disconnect_amas',
|
||||||
args: {
|
args: {
|
||||||
'asan_login_name': frm.doc.name
|
'asan_login_name': frm.doc.name
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,15 @@
|
||||||
"choose_taxpayer_response",
|
"choose_taxpayer_response",
|
||||||
"mygovid_section",
|
"mygovid_section",
|
||||||
"mygovid_token",
|
"mygovid_token",
|
||||||
"emas_section",
|
"amas_section",
|
||||||
"emas_auth_status",
|
"amas_auth_status",
|
||||||
"emas_account_name",
|
"amas_account_name",
|
||||||
"emas_account_number",
|
"amas_account_number",
|
||||||
"column_break_emas",
|
"column_break_amas",
|
||||||
"emas_account_oid",
|
"amas_account_oid",
|
||||||
"emas_last_activity",
|
"amas_last_activity",
|
||||||
"emas_session",
|
"amas_session",
|
||||||
"emas_csrf_token"
|
"amas_csrf_token"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
|
@ -155,13 +155,13 @@
|
||||||
"label": "Last Activity Time"
|
"label": "Last Activity Time"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "emas_section",
|
"fieldname": "amas_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "ƏMAS (e-social.gov.az)"
|
"label": "ƏMAS (e-social.gov.az)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "Not Connected",
|
"default": "Not Connected",
|
||||||
"fieldname": "emas_auth_status",
|
"fieldname": "amas_auth_status",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "ƏMAS Status",
|
"label": "ƏMAS Status",
|
||||||
|
|
@ -169,41 +169,41 @@
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "emas_account_name",
|
"fieldname": "amas_account_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "ƏMAS Account Name",
|
"label": "ƏMAS Account Name",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "emas_account_number",
|
"fieldname": "amas_account_number",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "ƏMAS Account VOEN",
|
"label": "ƏMAS Account VOEN",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_emas",
|
"fieldname": "column_break_amas",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "emas_account_oid",
|
"fieldname": "amas_account_oid",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"label": "EMAS Account OID"
|
"label": "AMAS Account OID"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "emas_last_activity",
|
"fieldname": "amas_last_activity",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"label": "ƏMAS Last Activity",
|
"label": "ƏMAS Last Activity",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "emas_session",
|
"fieldname": "amas_session",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"label": "ƏMAS Session"
|
"label": "ƏMAS Session"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "emas_csrf_token",
|
"fieldname": "amas_csrf_token",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"label": "ƏMAS CSRF Token"
|
"label": "ƏMAS CSRF Token"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue