Page 1 of 1

Adding of list_desc on add_list func on non_agent API

PostPosted: Mon Sep 16, 2019 8:46 am
by paolo
Hi,

We noticed that adding a list_description on the non_agent api is not available on the add_list function so we added a piece of code and edited some original codes to accommodate adding a list_description on the add_list function.

----getters
if (isset($_GET["list_description"])) {$list_description=$_GET["list_description"];}
elseif (isset($_POST["list_description"])) {$list_description=$_POST["list_description"];}

---preg replace
$list_description=preg_replace('/[^- \+\.\:\/\@\?\&\_0-9a-zA-Z]/','',$list_description);

----for error checking
if ( (strlen($list_id)<2) or (strlen($list_id)>14) or (strlen($campaign_id)<1) or (strlen($campaign_id)>8) or (strlen($list_description)<1) or (strlen($list_description)>255) or (strlen($list_name)<6) or (strlen($list_name)>30) )

----to capture data

if (strlen($list_description) > 0)
{
if (preg_match("/%3A%2F%2F/",$list_description))
{
$list_description = urldecode($list_description);
$list_description = preg_replace("/ /",'+',$list_description);
}
if ($list_description == '--BLANK--')
{$listdescriptionSQL = " ,list_description=''";}
else
{$listdescriptionSQL = " ,list_description='$list_description'";}
}

----to insert data

$stmt="INSERT INTO vicidial_lists SET list_id='$list_id', list_name='$list_name', list_description='$list_description', campaign_id='$campaign_id', active='$active', campaign_cid_override='$outbound_cid', agent_script_override='$script', am_message_exten_override='$am_message', drop_inbound_group_override='$drop_inbound_group', reset_time='$reset_time', expiration_date='$expiration_date' $webformSQL $webformtwoSQL $webformthreeSQL;";

Re: Adding of list_desc on add_list func on non_agent API

PostPosted: Mon Sep 16, 2019 4:51 pm
by mflorell
Please post code contributions to the Issue Tracker and post a link here.

Re: Adding of list_desc on add_list func on non_agent API

PostPosted: Mon Sep 16, 2019 5:03 pm
by paolo
Hi Matt,

I added it already on the issue tracker

http://www.vicidial.org/VICIDIALmantis/view.php?id=1183