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
bac1f95e
Commit
bac1f95e
authored
8 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix consistency on permission. Missing the getLibStatut function.
parent
214dc2cb
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/accountancy/admin/card.php
+11
-11
11 additions, 11 deletions
htdocs/accountancy/admin/card.php
htdocs/accountancy/class/accountingaccount.class.php
+60
-1
60 additions, 1 deletion
htdocs/accountancy/class/accountingaccount.class.php
with
71 additions
and
12 deletions
htdocs/accountancy/admin/card.php
+
11
−
11
View file @
bac1f95e
...
...
@@ -43,13 +43,13 @@ $rowid = GETPOST('rowid', 'int');
$cancel
=
GETPOST
(
'cancel'
);
// Security check
if
(
!
$user
->
admin
)
accessforbidden
();
$object
=
new
AccountingAccount
(
$db
);
// Action
if
(
$action
==
'add'
)
{
if
(
$action
==
'add'
&&
$user
->
rights
->
accounting
->
chartofaccount
)
{
if
(
!
$cancel
)
{
$sql
=
'SELECT pcg_version FROM '
.
MAIN_DB_PREFIX
.
'accounting_system WHERE rowid='
.
$conf
->
global
->
CHARTOFACCOUNTS
;
...
...
@@ -97,7 +97,7 @@ if ($action == 'add') {
}
header
(
"Location: account.php"
);
exit
;
}
else
if
(
$action
==
'edit'
)
{
}
else
if
(
$action
==
'edit'
&&
$user
->
rights
->
accounting
->
chartofaccount
)
{
if
(
!
$cancel
)
{
$result
=
$object
->
fetch
(
$id
);
...
...
@@ -145,7 +145,7 @@ if ($action == 'add') {
header
(
"Location: "
.
$_SERVER
[
"PHP_SELF"
]
.
"?id="
.
$id
);
exit
();
}
}
else
if
(
$action
==
'delete'
)
{
}
else
if
(
$action
==
'delete'
&&
$user
->
rights
->
accounting
->
chartofaccount
)
{
$result
=
$object
->
fetch
(
$id
);
if
(
!
empty
(
$object
->
id
))
{
...
...
@@ -329,14 +329,14 @@ if ($action == 'create') {
print
'<td colspan="2">'
.
$object
->
pcg_subtype
.
'</td></tr>'
;
// Active
print
'<tr><td>'
.
$langs
->
trans
(
"
Activated
"
)
.
'</td>'
;
print
'<tr><td>'
.
$langs
->
trans
(
"
Status
"
)
.
'</td>'
;
print
'<td colspan="2">'
;
if
(
empty
(
$object
->
active
))
{
print
$object
->
getLibStatut
(
4
);
/*
if (empty($object->active)) {
print img_picto($langs->trans("Disabled"), 'switch_off');
} else {
print img_picto($langs->trans("Activated"), 'switch_on');
}
}
*/
print
'</td></tr>'
;
...
...
@@ -350,13 +350,13 @@ if ($action == 'create') {
print
'<div class="tabsAction">'
;
if
(
$user
->
admin
)
{
if
(
!
empty
(
$user
->
rights
->
accounting
->
chartofaccount
)
)
{
print
'<a class="butAction" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=update&id='
.
$id
.
'">'
.
$langs
->
trans
(
'Modify'
)
.
'</a>'
;
}
else
{
print
'<a class="butActionRefused" href="#" title="'
.
dol_escape_htmltag
(
$langs
->
trans
(
"NotAllowed"
))
.
'">'
.
$langs
->
trans
(
'Modify'
)
.
'</a>'
;
}
if
(
$user
->
admin
)
{
if
(
!
empty
(
$user
->
rights
->
accounting
->
chartofaccount
)
)
{
print
'<a class="butActionDelete" href="'
.
$_SERVER
[
"PHP_SELF"
]
.
'?action=delete&id='
.
$id
.
'">'
.
$langs
->
trans
(
'Delete'
)
.
'</a>'
;
}
else
{
print
'<a class="butActionRefused" href="#" title="'
.
dol_escape_htmltag
(
$langs
->
trans
(
"NotAllowed"
))
.
'">'
.
$langs
->
trans
(
'Delete'
)
.
'</a>'
;
...
...
This diff is collapsed.
Click to expand it.
htdocs/accountancy/class/accountingaccount.class.php
+
60
−
1
View file @
bac1f95e
...
...
@@ -45,7 +45,8 @@ class AccountingAccount extends CommonObject
var
$label
;
var
$fk_user_author
;
var
$fk_user_modif
;
var
$active
;
var
$active
;
// duplicate with status
var
$status
;
/**
* Constructor
...
...
@@ -103,6 +104,7 @@ class AccountingAccount extends CommonObject
$this
->
fk_user_author
=
$obj
->
fk_user_author
;
$this
->
fk_user_modif
=
$obj
->
fk_user_modif
;
$this
->
active
=
$obj
->
active
;
$this
->
status
=
$obj
->
active
;
return
$this
->
id
;
}
else
{
...
...
@@ -465,4 +467,61 @@ class AccountingAccount extends CommonObject
return
-
1
;
}
}
/**
* Retourne le libelle du statut d'un user (actif, inactif)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function
getLibStatut
(
$mode
=
0
)
{
return
$this
->
LibStatut
(
$this
->
status
,
$mode
);
}
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function
LibStatut
(
$statut
,
$mode
=
0
)
{
global
$langs
;
$langs
->
load
(
'users'
);
if
(
$mode
==
0
)
{
$prefix
=
''
;
if
(
$statut
==
1
)
return
$langs
->
trans
(
'Enabled'
);
if
(
$statut
==
0
)
return
$langs
->
trans
(
'Disabled'
);
}
if
(
$mode
==
1
)
{
if
(
$statut
==
1
)
return
$langs
->
trans
(
'Enabled'
);
if
(
$statut
==
0
)
return
$langs
->
trans
(
'Disabled'
);
}
if
(
$mode
==
2
)
{
if
(
$statut
==
1
)
return
img_picto
(
$langs
->
trans
(
'Enabled'
),
'statut4'
)
.
' '
.
$langs
->
trans
(
'Enabled'
);
if
(
$statut
==
0
)
return
img_picto
(
$langs
->
trans
(
'Disabled'
),
'statut5'
)
.
' '
.
$langs
->
trans
(
'Disabled'
);
}
if
(
$mode
==
3
)
{
if
(
$statut
==
1
)
return
img_picto
(
$langs
->
trans
(
'Enabled'
),
'statut4'
);
if
(
$statut
==
0
)
return
img_picto
(
$langs
->
trans
(
'Disabled'
),
'statut5'
);
}
if
(
$mode
==
4
)
{
if
(
$statut
==
1
)
return
img_picto
(
$langs
->
trans
(
'Enabled'
),
'statut4'
)
.
' '
.
$langs
->
trans
(
'Enabled'
);
if
(
$statut
==
0
)
return
img_picto
(
$langs
->
trans
(
'Disabled'
),
'statut5'
)
.
' '
.
$langs
->
trans
(
'Disabled'
);
}
if
(
$mode
==
5
)
{
if
(
$statut
==
1
)
return
$langs
->
trans
(
'Enabled'
)
.
' '
.
img_picto
(
$langs
->
trans
(
'Enabled'
),
'statut4'
);
if
(
$statut
==
0
)
return
$langs
->
trans
(
'Disabled'
)
.
' '
.
img_picto
(
$langs
->
trans
(
'Disabled'
),
'statut5'
);
}
}
}
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