42@phan-var-force CommonObject $object
43@phan-var-force string $action
44@phan-var-force int $permissiondellink
45@phan-var-force int $id
49$addlink =
GETPOST(
'addlink',
'alpha');
50$addlinkids =
GETPOST(
'idtolinkto',
'array:int');
51$addlinkref =
GETPOST(
'reftolinkto',
'alpha');
52$cancellink =
GETPOST(
'cancel',
'alpha');
55if ($action ==
'addlink' && !empty($permissiondellink) && !$cancellink &&
$id > 0 && !empty($addlinkids)) {
58 foreach ($addlinkids as $addlinkid) {
59 $result =
$object->add_object_linked($addlink, $addlinkid);
61 $object->clearObjectLinkedCache();
65if ($action ==
'addlinkbyref' && !empty($permissiondellink) && !$cancellink &&
$id > 0 && !empty($addlinkref) && !
getDolGlobalString(
'MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
66 $element_prop = getElementProperties($addlink);
67 if (is_array($element_prop)) {
68 dol_include_once(
'/' . $element_prop[
'classpath'] .
'/' . $element_prop[
'classfile'] .
'.class.php');
70 $objecttmp =
new $element_prop[
'classname'](
$db);
71 '@phan-var-force CommonObject $objecttmp';
73 $ret = $objecttmp->fetch(0, $addlinkref);
77 $result =
$object->add_object_linked($addlink, $objecttmp->id);
78 if (isset($_POST[
'reftolinkto'])) {
79 unset($_POST[
'reftolinkto']);
81 $object->clearObjectLinkedCache();
85 $langs->load(
'errors');
92if ($action ==
'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) {
93 $result =
$object->deleteObjectLinked(0,
'', 0,
'', $dellinkid);
94 $object->clearObjectLinkedCache();
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.