29$dellinkid =
GETPOST(
'dellinkid',
'int');
30$addlink =
GETPOST(
'addlink',
'alpha');
31$addlinkid =
GETPOST(
'idtolinkto',
'int');
32$addlinkref =
GETPOST(
'reftolinkto',
'alpha');
33$cancellink =
GETPOST(
'cancel',
'alpha');
36if ($action ==
'addlink' && !empty($permissiondellink) && !$cancellink && $id > 0 && $addlinkid > 0) {
38 $object->fetch_thirdparty();
39 $result = $object->add_object_linked($addlink, $addlinkid);
43if ($action ==
'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $id > 0 && !empty($addlinkref) &&
getDolGlobalString(
'MAIN_LINK_BY_REF_IN_LINKTO')) {
45 if (is_array($element_prop)) {
46 dol_include_once(
'/' . $element_prop[
'classpath'] .
'/' . $element_prop[
'classfile'] .
'.class.php');
48 $objecttmp =
new $element_prop[
'classname']($db);
49 $ret = $objecttmp->fetch(0, $addlinkref);
52 $object->fetch_thirdparty();
53 $result = $object->add_object_linked($addlink, $objecttmp->id);
54 if (isset($_POST[
'reftolinkto'])) {
55 unset($_POST[
'reftolinkto']);
60 $langs->load(
'errors');
67if ($action ==
'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) {
68 $result = $object->deleteObjectLinked(0,
'', 0,
'', $dellinkid);
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getElementProperties($element_type)
Get an array with properties of an element.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.