diff --git a/include/ajax/ajax_ledger.php b/include/ajax/ajax_ledger.php index 001ef0ac0..f866c664d 100644 --- a/include/ajax/ajax_ledger.php +++ b/include/ajax/ajax_ledger.php @@ -132,7 +132,7 @@ switch ($action) { // remove op /////////////////////////////////////////////////////////////////////////// case 'rmop': - if ($access == 'W' && $g_user->check_action(RMOPER) == 1) { + if ($access == 'W' && $g_user->check_action(RMOPER) == 1 && $g_parameter->MY_STRICT=='N') { ob_start(); /* get the ledger */ try { @@ -345,7 +345,7 @@ switch ($action) { $http = new HttpInput(); try { $cn->start(); - if ($access == "W") { + if ($access == "W" ) { if (isset($_POST['p_ech'])) { $ech = $http->post('p_ech'); if (trim($ech) != '' && isDate($ech) != null) { @@ -372,15 +372,20 @@ switch ($action) { } } $oLedger=new Acc_Ledger($cn,$ledger); - $npj=$http->post('npj'); + $npj=$http->post('npj'); // protect receipt number if ( ($g_parameter->MY_PJ_SUGGEST == 'A'||$g_user->check_action(UPDRECEIPT)==0) && $oLedger->get_type() !='FIN') { $npj=$cn->get_value("select jr_pj_number from jrn where jr_id=$1",[$jr_id]); } + // protect date in strict mode + $date=$http->post("p_date"); + if ( $g_parameter->MY_STRICT=='Y' && $g_user->check_action(UPDDATE)==0) { + $date=$cn->get_value("select to_char(jr_date,'DD.MM.YYYY') from jrn where jr_id=$1",[$jr_id]); + } $cn->exec_sql("update jrn set jr_comment=$1,jr_pj_number=$2,jr_date=to_date($4,'DD.MM.YYYY'),jr_optype=$5 where jr_id=$3", - array($http->post('lib'), $npj, $jr_id, $http->post('p_date'), $http->post('jr_optype'))); + array($http->post('lib'), $npj, $jr_id,$date, $http->post('jr_optype'))); $cn->exec_sql("update jrnx set j_date=to_date($1,'DD.MM.YYYY') where j_grpt in (select jr_grpt_id from jrn where jr_id=$2)", - array($http->post('p_date'), $jr_id)); + array($date, $jr_id)); $cn->exec_sql('update operation_analytique set oa_date=j_date from jrnx where operation_analytique.j_id=jrnx.j_id and diff --git a/include/constant.security.php b/include/constant.security.php index b8a307e01..a6de1d91c 100644 --- a/include/constant.security.php +++ b/include/constant.security.php @@ -28,6 +28,7 @@ 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 define ('UPDRECEIPT',1130); // change un numéro de pièce +define ('UPDDATE',1140); // change date operation define ('SHARENOTE',1210); // Can share a note define ('SHARENOTEPUBLIC',1220); // Can create public note define ('SHARENOTEREMOVE',1230); // Can drop drop of other diff --git a/include/template/ledger_detail_ach.php b/include/template/ledger_detail_ach.php index f10c09a3c..aadb8e91d 100644 --- a/include/template/ledger_detail_ach.php +++ b/include/template/ledger_detail_ach.php @@ -21,6 +21,9 @@ global $div,$g_parameter,$cn,$access,$jr_id,$obj; value = format_date($obj->det->jr_date); + if ( $g_parameter->MY_STRICT=='Y' && $g_user->check_action(UPDDATE)==0) { + $date->setReadOnly(true); + } echo td(_('Date')) . td($date->input()); ?>