将用户输入添加到“已编辑”字段中

时间:2019-04-17 08:15:16

标签: sugarcrm suitecrm sugarbean

如果用户决定更改字段值,我想添加一个编辑功能,但是我似乎找不到正确的方法来执行此操作。香港专业教育学院试图通过谷歌搜索,但没有给出与此问题相关的任何答案。

此处的代码:

<?php

class CloseTicket
{
    public function do_CloseTicket($bean, $events, $args)
    {
        //checks if the ticket is already in use
        if(!isset($bean->fetched_row['field_name_id'])){

            if (!empty($bean->field_name)) {

                //if ticket status is closed then it displays an error message
                $module = BeanFactory::getBean("CUSTOM MODULE", $bean->field_name_id);
                if ($module->status == 'Closed') {

                    SugarApplication::appendErrorMessage("Ticket is already used. Please use another Ticket.");
                    $params = array(
                        'module' => 'Module',
                        'action' => 'ListView',
                        'record' => $bean->id,
                    );
                    SugarApplication::redirect('index.php?' . http_build_query($params));

                //else adds the ticket then closed it    
                } else {
                    $module->status = "Closed";
                    $module->save();
                }
            }
        //if ticket is already taken then it display an error message    
        } else {
            SugarApplication::appendErrorMessage("Ticket is already attached.");
            $params = array(
                'module' => 'module',
                'action' => 'ListView',
                'record' => $bean->id,
            );
            SugarApplication::redirect('index.php?' . http_build_query($params));
        }

    }
}

1 个答案:

答案 0 :(得分:0)

我无法完全理解您的问题。

但是,如果您尝试编辑重复的相关bean,则参数应为EditView,而不是ListView,如下所示:

$params = array(
                    'module' => 'Module',
                    'action' => 'EditView',
                    'record' => $bean->id,
                );
                SugarApplication::redirect('index.php?' . http_build_query($params));