31$addlink =
GETPOST(
'addlink',
'alpha');
32$addlinkids =
GETPOST(
'idtolinkto',
'array:int');
33$addlinkref =
GETPOST(
'reftolinkto',
'alpha');
34$cancellink =
GETPOST(
'cancel',
'alpha');
37if ($action ==
'addlink' && !empty($permissiondellink) && !$cancellink &&
$id > 0 && !empty($addlinkids)) {
40 foreach ($addlinkids as $addlinkid) {
41 $result =
$object->add_object_linked($addlink, $addlinkid);
46if ($action ==
'addlinkbyref' && !empty($permissiondellink) && !$cancellink &&
$id > 0 && !empty($addlinkref) && !
getDolGlobalString(
'MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
48 if (is_array($element_prop)) {
49 dol_include_once(
'/' . $element_prop[
'classpath'] .
'/' . $element_prop[
'classfile'] .
'.class.php');
51 $objecttmp =
new $element_prop[
'classname']($db);
52 '@phan-var-force CommonObject $objecttmp';
53 $ret = $objecttmp->fetch(0, $addlinkref);
57 $result =
$object->add_object_linked($addlink, $objecttmp->id);
58 if (isset($_POST[
'reftolinkto'])) {
59 unset($_POST[
'reftolinkto']);
64 $langs->load(
'errors');
71if ($action ==
'dellink' && !empty($permissiondellink) && !$cancellink && $dellinkid > 0) {
72 $result =
$object->deleteObjectLinked(0,
'', 0,
'', $dellinkid);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.