30$addlink =
GETPOST(
'addlink',
'alpha');
32$addlinkref =
GETPOST(
'reftolinkto',
'alpha');
33$cancellink =
GETPOST(
'cancel',
'alpha');
36if ($action ==
'addlink' && !empty($permissiondellink) && !$cancellink && $id > 0 && $addlinkid > 0) {
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);
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);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
getElementProperties($elementType)
Get an array with properties of an element.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.