';
$x='';
- if ($access=='W' && $g_user->check_action (RMDOC) == 1)
- $x=sprintf('
'._('enlever').'',
+ if ($access=='W' && $g_user->check_action (RMRECEIPT) == 1)
+ $x=sprintf('
ⵝ',
$gDossier,$div,$jr_id);
- echo $x;
+
$filename= $obj->det->jr_pj_name;
if ( strlen($obj->det->jr_pj_name) > 20 )
{
@@ -313,6 +303,7 @@ case 'file':
$h=sprintf('
%s',
$gDossier,$ledger,$obj->det->jr_grpt_id,h( $filename));
echo $h;
+ echo $x;
echo '
';
echo '';
exit();
@@ -342,8 +333,8 @@ case 'loadfile':
echo '
';
// check if the user can remove a document
- if ($g_user->check_action (RMDOC) == 1) {
- $x=sprintf('
'._('enlever').'',
+ if ($g_user->check_action (RMRECEIPT) == 1) {
+ $x=sprintf('
'."ⵝ".'',
$gDossier,$div,$jr_id);
echo $x;
}
@@ -359,7 +350,7 @@ case 'loadfile':
// remove a file
/////////////////////////////////////////////////////////////////////////////
case 'rmf':
- if ( $access == 'W' && $g_user->check_action (RMDOC) == 1)
+ if ( $access == 'W' && $g_user->check_action (RMRECEIPT) == 1)
{
echo "";
$repo=new Database();
diff --git a/include/constant.security.php b/include/constant.security.php
index bcd579797..15426d89c 100644
--- a/include/constant.security.php
+++ b/include/constant.security.php
@@ -24,5 +24,7 @@ define ("FICCAT",910); //création, modification et effacement de catégorie de
define ('RMDOC',1020); // Effacement de document pour follow up & comptabilité
define ('VIEWDOC',1010); // Voir document pour follow up
define ('PARCATDOC',1050); // modifier type document pour follow up
+define ('RMRECEIPT',1110); // Effacer un document d'une pièce comptable
+define ('RMOPER',1120); // Effacer une opération comptable
global $audit; $audit=false;
?>
diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php
index bfaeafe41..8fe7c781d 100644
--- a/include/template/ledger_detail_bottom.php
+++ b/include/template/ledger_detail_bottom.php
@@ -285,7 +285,8 @@ if ( $div != 'popup' ) {
}
$per=new Periode($cn,$obj->det->jr_tech_per);
- if ( $per->is_closed() == 0 && $owner->MY_STRICT=='N'){
+ if ( $per->is_closed() == 0 && $owner->MY_STRICT=='N' && $g_user->check_action(RMOPER)==1)
+ {
$remove=new IButton('Effacer');
$remove->label=_('Effacer');
$remove->javascript="if ( confirm('Vous confirmez effacement ?')) {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')}";
diff --git a/include/template/security_list_action.php b/include/template/security_list_action.php
index 19512b47a..1c1c54d1a 100644
--- a/include/template/security_list_action.php
+++ b/include/template/security_list_action.php
@@ -49,9 +49,19 @@
}// end function
?>
- get_array("select ac_id, ac_description from action where ac_id >=$1 and ac_id <=$2 order by ac_id ",
- array(800,1000));
- display_security_fieldset(_('Fiche'),$array,$sec_User); ?>
- get_array("select ac_id, ac_description from action where ac_id >=$1 and ac_id <=$2 order by ac_id ",
- array(1001,1100));
- display_security_fieldset(_('Suivi & Comptabilité'),$array,$sec_User); ?>
+get_array("select ac_id, ac_description from action where ac_id >=$1 and ac_id <=$2 order by ac_id ",
+ array(800,1000));
+ display_security_fieldset(_('Fiche'),$array,$sec_User); ?>
+get_array("select ac_id, ac_description from action where ac_id >=$1 and ac_id <=$2 order by ac_id ",
+ array(1001,1100));
+ display_security_fieldset(_('Suivi'),$array,$sec_User); ?>
+
+get_array("select ac_id, ac_description from action where ac_id >=$1 and ac_id <=$2 order by ac_id ",
+ array(1101,1200));
+ display_security_fieldset(_('Comptabilité'),$array,$sec_User); ?>
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 0203ef86f..e438d64dc 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -1,4 +1,9 @@
-update action set ac_description = 'Effacer un document de la comptabilité ou du suivi' where ac_id=1020;
+INSERT INTO action(
+ ac_id, ac_description, ac_module, ac_code)
+ VALUES (1110, 'Enlever une pièce justificative', 'compta', 'RMRECEIPT');
+INSERT INTO action(
+ ac_id, ac_description, ac_module, ac_code)
+ VALUES (1120, 'Effacer une opération ', 'compta', 'RMOPER');
CREATE TABLE todo_list_shared (id serial primary key, todo_list_id int4 NOT NULL, use_login int4 NOT NULL, CONSTRAINT unique_todo_list_id_login
@@ -11,3 +16,22 @@ comment on column todo_list_shared.todo_list_id is 'fk to todo_list';
comment on column todo_list_shared.use_login is 'user login';
+/**
+Arbre dépendance
+ with recursive t (ag_id,ag_ref_ag_id,ag_title,depth) as (
+ select
+ ag_id , ag_ref_ag_id, ag_title , 1
+ from
+ action_gestion
+ where ag_id=55
+ union all
+ select
+ p2.ag_id,p2.ag_ref_ag_id,p2.ag_title,depth + 1
+ from
+ t as p1, action_gestion as p2
+ where
+ p1.ag_ref_ag_id is not null and
+ p1.ag_id = p2.ag_ref_ag_id
+) select * from t;
+
+*/
\ No newline at end of file