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

问题描述 投票:0回答:1

我想添加一个编辑功能,如果用户决定更改字段值,但我似乎无法找到正确的方法来做到这一点。我试过通过谷歌搜索,但它没有给出任何与此问题相关的答案。

代码在这里:

<?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));
        }

    }
}
sugarcrm suitecrm sugarbean
1个回答
0
投票

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

但是如果你正在尝试编辑重复的相关bean,那么params应该是EditView而不是ListView,如下所示:

$params = array(
                    'module' => 'Module',
                    'action' => 'EditView',
                    'record' => $bean->id,
                );
                SugarApplication::redirect('index.php?' . http_build_query($params));
© www.soinside.com 2019 - 2024. All rights reserved.