mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
2013-02-28 Dario Rodriguez <dario@artica.es>
* include/functions_api.php: Added new API function to create custom field and to get custom field ID by name. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7748 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
03cbebaef2
commit
ef8efa9938
@ -1,3 +1,8 @@
|
|||||||
|
2013-02-28 Dario Rodriguez <dario@artica.es>
|
||||||
|
|
||||||
|
* include/functions_api.php: Added new API function to
|
||||||
|
create custom field and to get custom field ID by name.
|
||||||
|
|
||||||
2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
|
2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* operation/gis_maps/render_view.php: fixed the mysql error
|
* operation/gis_maps/render_view.php: fixed the mysql error
|
||||||
|
@ -762,6 +762,62 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Creates a custom field
|
||||||
|
*
|
||||||
|
* @param string $name Custom field name
|
||||||
|
* @param boolean $display_front Flag to display custom field in agent's operation view
|
||||||
|
*/
|
||||||
|
function api_set_create_custom_field($t1, $t2, $other, $returnType) {
|
||||||
|
|
||||||
|
if ($other['type'] == 'string') {
|
||||||
|
returnError('error_parameter', 'Error in the parameters.');
|
||||||
|
return;
|
||||||
|
} else if ($other['type'] == 'array') {
|
||||||
|
|
||||||
|
$name = "";
|
||||||
|
|
||||||
|
if ($other['data'][0] != '') {
|
||||||
|
$name = $other['data'][0];
|
||||||
|
} else {
|
||||||
|
returnError('error_parameter', 'Custom field name required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$display_front = 0;
|
||||||
|
|
||||||
|
if ($other['data'][1] != '') {
|
||||||
|
$display_front = $other['data'][1];
|
||||||
|
} else {
|
||||||
|
returnError('error_parameter', 'Custom field display flag required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_process_sql_insert('tagent_custom_fields', array('name' => $name, 'display_on_front' => $display_front));
|
||||||
|
|
||||||
|
$data['type'] = "string";
|
||||||
|
$data["data"] = $result;
|
||||||
|
returnData("string", $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Returns ID of custom field zero if not exists
|
||||||
|
*
|
||||||
|
* @param string $name Custom field name
|
||||||
|
*/
|
||||||
|
function api_get_custom_field_id($t1, $t2, $other, $returnType) {
|
||||||
|
|
||||||
|
$name = $other["data"][0];
|
||||||
|
$id = db_get_value ('id_field', 'tagent_custom_fields', 'name', $name);
|
||||||
|
|
||||||
|
$data['type'] = "string";
|
||||||
|
$data["data"] = $id;
|
||||||
|
returnData("string", $data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a agent with the name pass as parameter.
|
* Delete a agent with the name pass as parameter.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user