forked from unimatrix/web
Clarify credit confirmation and move Support decisions beside reply
This commit is contained in:
parent
c633c30826
commit
dfddf4f69c
1 changed files with 28 additions and 13 deletions
|
|
@ -7,11 +7,20 @@ import sys
|
|||
|
||||
def ticket_review_hook(source):
|
||||
hook = "require_once(dirname(__DIR__).'/bank-credit-review.php');"
|
||||
if hook in source:
|
||||
return source
|
||||
source = source.replace(hook + '\n', '')
|
||||
anchor = "require_once(STAFFINC_DIR.$inc);"
|
||||
if source.count(anchor) != 1:
|
||||
raise RuntimeError('Native staff ticket view changed; no files installed')
|
||||
return source
|
||||
|
||||
|
||||
def reply_review_hook(source):
|
||||
hook = "<?php require(dirname(__DIR__, 2).'/bank-credit-review.php'); ?>"
|
||||
if hook in source:
|
||||
return source
|
||||
anchor = " <input class=\"save pending\" type=\"submit\" value=\"<?php echo __('Post Reply');?>\">"
|
||||
if source.count(anchor) != 1:
|
||||
raise RuntimeError('Native reply controls changed; no files installed')
|
||||
return source.replace(anchor, hook + '\n' + anchor)
|
||||
|
||||
|
||||
|
|
@ -22,6 +31,8 @@ def install(apply=False):
|
|||
for name in ['bank-credit-ticket.php', 'bank-credit-review.php']}
|
||||
ticket_view = target / 'scp/tickets.php'
|
||||
files[ticket_view] = ticket_review_hook(ticket_view.read_text()).encode()
|
||||
reply_view = target / 'include/staff/ticket-view.inc.php'
|
||||
files[reply_view] = reply_review_hook(reply_view.read_text()).encode()
|
||||
for name in ['bank-credit-ticket.php', 'bank-credit-review.php']:
|
||||
subprocess.run(['php', '-l', str(source / name)], check=True)
|
||||
if not apply:
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff