';
print '';
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index a70bb710937..ebc91ae54c7 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -1243,7 +1243,7 @@ while ($i < min($num, $limit)) {
// Action column
print '| ';
- if (empty($line->date_export) || empty($line->date_validation)) {
+ if (empty($line->date_export) && empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->creer) {
print '' . img_edit() . '';
}
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 98c3f14191b..63ecc2d420b 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -852,12 +852,14 @@ while ($i < min($num, $limit)) {
// Action column
print ' | ';
- if (empty($line->date_export)) {
+ if (empty($line->date_export) && empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->creer) {
- print ''.img_edit().'';
+ print '' . img_edit() . '';
}
+ }
+ if (empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->supprimer) {
- print ' '.img_delete().'';
+ print ''.img_delete().'';
}
}
print ' | ';
diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php
index 20899c693c6..434867112f9 100644
--- a/htdocs/accountancy/bookkeeping/listbysubaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php
@@ -866,12 +866,14 @@ while ($i < min($num, $limit)) {
// Action column
print '';
- if (empty($line->date_export)) {
+ if (empty($line->date_export) && empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->creer) {
- print ''.img_edit().'';
+ print '' . img_edit() . '';
}
+ }
+ if (empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->supprimer) {
- print ' '.img_delete().'';
+ print ''.img_delete().'';
}
}
print ' | ';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 6bd39f4e227..aeaa42154d8 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1506,6 +1506,7 @@ class BookKeeping extends CommonObject
$sql = "DELETE";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE piece_num = ".(int) $piecenum;
+ $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
$sql .= " AND entity IN (".getEntity('accountancy').")";
$resql = $this->db->query($sql);