Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
dcf05160
Commit
dcf05160
authored
11 years ago
by
Cédric Salvador
Committed by
Raphaël Doursenaud
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
delete function for links
parent
28bfb10d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/core/tpl/document_actions.tpl.php
+31
-19
31 additions, 19 deletions
htdocs/core/tpl/document_actions.tpl.php
htdocs/link/class/link.class.php
+4
-0
4 additions, 0 deletions
htdocs/link/class/link.class.php
with
35 additions
and
19 deletions
htdocs/core/tpl/document_actions.tpl.php
+
31
−
19
View file @
dcf05160
<?php
// Envoi fichier
if
(
GETPOST
(
'sendit'
)
&&
!
empty
(
$conf
->
global
->
MAIN_UPLOAD_DOC
))
{
if
(
$object
->
id
)
{
dol_add_file_process
(
$upload_dir
,
0
,
1
,
'userfile'
);
// Send file/link
if
(
GETPOST
(
'sendit'
)
&&
!
empty
(
$conf
->
global
->
MAIN_UPLOAD_DOC
))
{
if
(
$object
->
id
)
{
dol_add_file_process
(
$upload_dir
,
0
,
1
,
'userfile'
);
}
}
elseif
(
GETPOST
(
'linkit'
)
&&
!
empty
(
$conf
->
global
->
MAIN_UPLOAD_DOC
))
{
if
(
$object
->
id
)
{
...
...
@@ -12,24 +10,38 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if
(
substr
(
$link
,
0
,
7
)
!=
'http://'
&&
substr
(
$link
,
0
,
8
)
!=
'https://'
)
{
$link
=
'http://'
.
$link
;
}
dol_add_file_process
(
$upload_dir
,
0
,
1
,
'userfile'
,
$link
);
dol_add_file_process
(
$upload_dir
,
0
,
1
,
'userfile'
,
$link
);
}
}
// Delete file
if
(
$action
==
'confirm_deletefile'
&&
$confirm
==
'yes'
)
{
if
(
$object
->
id
)
{
$file
=
$upload_dir
.
"/"
.
GETPOST
(
'urlfile'
);
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret
=
dol_delete_file
(
$file
,
0
,
0
,
0
,
$object
);
if
(
$ret
)
{
setEventMessage
(
$langs
->
trans
(
"FileWasRemoved"
,
GETPOST
(
'urlfile'
)));
}
else
{
setEventMessage
(
$langs
->
trans
(
"ErrorFailToDeleteFile"
,
GETPOST
(
'urlfile'
)),
'errors'
);
// Delete file/link
if
(
$action
==
'confirm_deletefile'
&&
$confirm
==
'yes'
)
{
if
(
$object
->
id
)
{
$urlfile
=
GETPOST
(
'urlfile'
,
'alpha'
);
$linkid
=
GETPOST
(
'linkid'
,
'int'
);
if
(
$urlfile
)
{
$file
=
$upload_dir
.
"/"
.
$urlfile
;
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret
=
dol_delete_file
(
$file
,
0
,
0
,
0
,
$object
);
if
(
$ret
)
{
setEventMessage
(
$langs
->
trans
(
"FileWasRemoved"
,
$urlfile
));
}
else
{
setEventMessage
(
$langs
->
trans
(
"ErrorFailToDeleteFile"
,
$urlfile
),
'errors'
);
}
}
elseif
(
$linkid
)
{
require_once
DOL_DOCUMENT_ROOT
.
'/link/class/link.class.php'
;
$link
=
new
Link
(
$db
);
$link
->
id
=
$linkid
;
$link
->
fetch
();
$res
=
$link
->
delete
(
$user
);
if
(
$res
)
{
setEventMessage
(
$langs
->
trans
(
"LinkWasRemoved"
,
$link
->
label
)
}
else
{
setEventMessage
(
$langs
->
trans
(
"ErrorFailToDeleteLink"
,
$link
->
label
),
'errors'
);
}
}
header
(
'Location: '
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
);
header
(
'Location: '
.
$_SERVER
[
"PHP_SELF"
]
.
'?id='
.
$object
->
id
);
exit
;
}
}
...
...
This diff is collapsed.
Click to expand it.
htdocs/link/class/link.class.php
+
4
−
0
View file @
dcf05160
...
...
@@ -257,6 +257,8 @@ class Link extends CommonObject
$link
->
datea
=
$this
->
db
->
jdate
(
$obj
->
datea
);
$link
->
url
=
$obj
->
url
;
$link
->
label
=
$obj
->
label
;
$link
->
objecttype
=
$obj
->
objecttype
;
$link
->
objectid
=
$obj
->
objectid
;
$links
[]
=
$link
;
}
return
1
;
...
...
@@ -293,6 +295,8 @@ class Link extends CommonObject
$this
->
datea
=
$this
->
db
->
jdate
(
$obj
->
datea
);
$this
->
url
=
$obj
->
url
;
$this
->
label
=
$obj
->
label
;
$this
->
objecttype
=
$obj
->
objecttype
;
$this
->
objectid
=
$obj
->
objectid
;
return
1
;
}
else
{
$this
->
error
=
'Fetch no link found for id = '
.
$rowid
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment