Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
9c9e4d31
Commit
9c9e4d31
authored
10 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Patches
Plain Diff
FEAT
#1693
add function advanced_reactivate
parent
f8f9ae40
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/trunk/core/class/ObjectControlerAbstract.php
+41
-0
41 additions, 0 deletions
core/trunk/core/class/ObjectControlerAbstract.php
with
41 additions
and
0 deletions
core/trunk/core/class/ObjectControlerAbstract.php
+
41
−
0
View file @
9c9e4d31
...
...
@@ -418,6 +418,47 @@ abstract class ObjectControler
return
$result
;
}
/**
* Reactivate given object from given table, according with
* given table id name.
* Return true if succeeded.
* @param Any $object
* @return boolean
*/
protected
function
advanced_reactivate
(
$object
)
{
if
(
!
isset
(
$object
))
{
return
false
;
}
$table_name
=
get_class
(
$object
);
$table_id
=
$table_name
.
'_id'
;
if
(
isset
(
self
::
$specific_id
)
&&
!
empty
(
self
::
$specific_id
))
{
$table_id
=
self
::
$specific_id
;
}
self
::
$db
=
new
dbquery
();
self
::
$db
->
connect
();
if
(
in_array
(
$table_id
,
self
::
$foolish_ids
)
){
$query
=
"update
$table_name
set status = 'OK' where
$table_id
='"
.
$object
->
$table_id
.
"'"
;
}
else
{
$query
=
"update
$table_name
set status = 'OK' where
$table_id
="
.
$object
->
$table_id
;
}
try
{
if
(
_DEBUG
){
echo
"enable:
$query
// "
;
}
self
::
$db
->
query
(
$query
);
$result
=
true
;
}
catch
(
Exception
$e
)
{
echo
'Impossible to enable object with id='
.
$object
->
$table_id
.
' // '
;
$result
=
false
;
}
self
::
$db
->
disconnect
();
return
$result
;
}
/**
* Disable given object from given table, according with
* given table id name.
...
...
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