灵当CRM

 找回密码
 立即注册
查看: 2588|回复: 0

(手机端)拜访签到如何增加选择其他模块?

[复制链接]

1660

主题

1709

帖子

5万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
59077
 楼主| 发表于 2020-7-6 13:15:37 | 显示全部楼层 |阅读模式
(手机端)拜访签到如何增加选择其他模块?
-- 存储过程
DROP PROCEDURE IF EXISTS `ldcrm_add_selectbill_bymodule`;
delimiter ||
CREATE PROCEDURE `ldcrm_add_selectbill_bymodule`(
        tmp_curmodule VARCHAR(100),
        tmp_selmodule VARCHAR(100)
)
BEGIN
        
        SET @cur_tabid=(SELECT tabid FROM ld_tab WHERE `name`=tmp_curmodule LIMIT 1);
        SET @sel_tabid=(SELECT tabid FROM ld_tab WHERE `name`=tmp_selmodule LIMIT 1);
        SET @maxseq=(SELECT MAX(sequence) FROM ld_option_module WHERE tabid=@cur_tabid);
        SET @table_sequence=(SELECT tabsequence FROM ld_tab WHERE `name`=tmp_curmodule LIMIT 1);


        IF EXISTS (SELECT 1 FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='ld_option_module' AND COLUMN_NAME='maxrowsshow') THEN
                SET @insert_sql=CONCAT("INSERT INTO ld_option_module(tabid,option_tabid,presence,`default`,approve_demand,sequence,table_sequence,datarang,maxrowsshow)
                SELECT ",@cur_tabid,",",@sel_tabid,",",0,",",0,",",0,",",@maxseq+1,",",@table_sequence,",'all',5  
                FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM ld_option_module WHERE tabid=",@cur_tabid," AND option_tabid=",@sel_tabid,")");
        ELSE
                SET @insert_sql=CONCAT("INSERT INTO ld_option_module(tabid,option_tabid,presence,`default`,approve_demand,sequence,table_sequence)
                SELECT ",@cur_tabid,",",@sel_tabid,",",0,",",0,",",0,",",@maxseq+1,",",@table_sequence,"
                FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM ld_option_module WHERE tabid=",@cur_tabid," AND option_tabid=",@sel_tabid,")");
        END IF;


                PREPARE mystmt FROM @insert_sql;
                EXECUTE mystmt;
                DEALLOCATE PREPARE mystmt;


end ||
delimiter;




-- 存储过程调用方法:
-- 第1个参数“当前模块”,第2个参数“要增加的可选模块”(脚本执行后需要清除缓存),例如:
CALL ldcrm_add_selectbill_bymodule('Singin','CustomForm01');




-- 选择单据后带出的“拜访地址”内容,请修改 ld_related_field 表的传值方法 fromvalue_info
SELECT * FROM ld_related_field WHERE effect_fieldid=(SELECT fieldid FROM ld_field WHERE columnname='address' AND tablename='ld_singin');


根据添加的模块,找到对应的表名称,然后更改【ld_customform02】,执行下面脚本。


-- 签到源单模块添加字段
DROP PROCEDURE IF EXISTS `ldcrm_add_signin_fields`;
delimiter ||
CREATE PROCEDURE `ldcrm_add_signin_fields`(
    tmp_tablename VARCHAR(100)
)
BEGIN
    call AddColumn(tmp_tablename,'sign_longtitude','varchar',200,NULL);
    call AddColumn(tmp_tablename,'sign_latitude','varchar',200,NULL);
    call AddColumn(tmp_tablename,'sign_location_address','varchar',200,NULL);
END||
delimiter;

CALL    ldcrm_add_signin_fields('ld_customform02');
DROP PROCEDURE  ldcrm_add_signin_fields;


-- 签到地址字段在pc端新区块展示出去
select tabid into @tabid from ld_tab where `name` = 'Leads';
select max(blockid)+1 into @max_blockid from ld_blocks;
insert into ld_blocks(blockid,tabid,blocklabel,sequence,show_title,visible,create_view,edit_view,detail_view,display_status,iscustom)
select @max_blockid,@tabid,'LBL_ADDRESS_SINGIN',10000,0,0,0,0,0,1,0 from DUAL
where not exists(select 1 from ld_blocks where tabid = @tabid and blocklabel = 'LBL_ADDRESS_SINGIN');
set @i=0;
update ld_blocks set sequence=(@i:=@i+1) where tabid = @tabid order by sequence;
select blockid into @blockid from ld_blocks where tabid = @tabid and blocklabel = 'LBL_ADDRESS_SINGIN';

insert into ld_tranlabel(languagetype,trantable,tabid,relateid,fieldlabel)
select 'zh','ld_blocks',@tabid,@blockid,'签到地址信息' from dual
where not exists(select 1 from ld_tranlabel where languagetype = 'zh' and trantable = 'ld_blocks' and tabid = @tabid and relateid = @blockid);
insert into ld_tranlabel(languagetype,trantable,tabid,relateid,fieldlabel)
select 'en','ld_blocks',@tabid,@blockid,'Sing Address Information' from dual
where not exists(select 1 from ld_tranlabel where languagetype = 'en' and trantable = 'ld_blocks' and tabid = @tabid and relateid = @blockid);
update ld_blocks_seq set id = (select max(blockid) from ld_blocks);
delimiter;

select tabid into @tabid from ld_tab where `name` = 'Leads';
select blockid into @blockid from ld_blocks where tabid = @tabid and blocklabel = 'LBL_ADDRESS_SINGIN';
select max(fieldid)+1 into @fieldid from ld_field;
insert into ld_field(tabid,fieldid,columnname,allowhide,tablename,generatedtype,uitype,fieldname,fieldlabel,readonly,presence,defaultvalue,maximumlength,
sequence,block,displaytype,typeofdata,quickcreate,quickcreatesequence,info_type,masseditable,helpinfo,fieldonly,issmownerid,searchfieldtype,associatedfields,
associatedsequence,callchecked,duplicatefield,relate_search_parent_columnname,approve_demand,is_checkimportfield)
select @tabid,@fieldid,'sign_location_address','no','ld_leads',1,1,'sign_location_address','签到地址',1,2,NULL,NULL,1,@blockid,2,'V~O',1,NULL,NULL,1,NULL,0,0,0,0,0,0,NULL,NULL,0,0
from DUAL where not exists(select 1 from ld_field where tabid = @tabid and columnname = 'sign_location_address');
select fieldid into @relateid from ld_field where tabid = @tabid and columnname = 'sign_location_address';

insert into ld_tranlabel(languagetype,trantable,tabid,relateid,fieldlabel)
select 'zh','ld_field',@tabid,@relateid,'签到地址' from DUAL
where not exists(select 1 from ld_tranlabel where tabid = @tabid and relateid = @relateid and languagetype = 'zh' and trantable = 'ld_field');

insert into ld_tranlabel(languagetype,trantable,tabid,relateid,fieldlabel)
select 'en','ld_field',@tabid,@relateid,'Sing address' from DUAL
where not exists(select 1 from ld_tranlabel where tabid = @tabid and relateid = @relateid and languagetype = 'en' and trantable = 'ld_field');

-- end


注:如果希望增加的模块,在移动端模块新增界面也能使用定位功能,那么将问题反馈到灵当开发部。

拜访签到增加选择其他模块.sql (2.01 KB, 下载次数: 362)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

灵当CRM

GMT+8, 2024-3-29 16:01 , Processed in 0.055970 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2008-2022, Tencent Cloud.

沪ICP备08110973号-2

快速回复 返回顶部 返回列表