diff --git a/ChangeLog b/ChangeLog
index 0f2ed877a1360fb2df84a3214feec45c2a293433..2f9bbcc45c3389abe3d611c0a9c8a474eb59f61e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,7 +39,7 @@ Dolibarr better:
 - Trigger name SUPPLIER_PROPOSAL_CREATE has been renamed into PROPOSAL_SUPPLIER_CREATE.
 - A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters,
   no more required, were also removed. Use this new one if you were using one of them.
-
+- The trigger that activate or close a contract line is run on a contract line, not on contract.
 
 
 ***** ChangeLog for 4.0.2 compared to 4.0.1 *****
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 032dcf6f3d9db67206d3aa4688f6124b08f87eea..85fccbc543b34596e97b8764ba6feef5746c6a38 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -73,7 +73,7 @@ class BookKeeping extends CommonObject
 	public $id;
 	/**
 	 */
-	public $doc_date = '';
+	public $doc_date;
 	public $doc_type;
 	public $doc_ref;
 	public $fk_doc;
@@ -1163,9 +1163,12 @@ class BookKeeping extends CommonObject
 	 * @return void
 	 */
 	public function initAsSpecimen() {
-		$this->id = 0;
+		global $user;
 		
-		$this->doc_date = '';
+		$now=dol_now();
+		
+		$this->id = 0;
+		$this->doc_date = $now;
 		$this->doc_type = '';
 		$this->doc_ref = '';
 		$this->fk_doc = '';
@@ -1173,11 +1176,11 @@ class BookKeeping extends CommonObject
 		$this->code_tiers = '';
 		$this->numero_compte = '';
 		$this->label_compte = '';
-		$this->debit = '';
+		$this->debit = 99.9;
 		$this->credit = '';
 		$this->montant = '';
 		$this->sens = '';
-		$this->fk_user_author = '';
+		$this->fk_user_author = $user->id;
 		$this->import_key = '';
 		$this->code_journal = '';
 		$this->piece_num = '';
diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php
index 50c40a85dc3dcc28c50e56736cd81448c73b80d5..f36df0773eb8534df82f7aa1d67ac58362e42c19 100644
--- a/htdocs/projet/class/api_projects.class.php
+++ b/htdocs/projet/class/api_projects.class.php
@@ -441,7 +441,6 @@ class Projects extends DolibarrApi
         {
             throw new RestException(500, $this->project->error);
         }
-        return false;
     }
 
     /**
diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php
index 735b830e9d5a796896e9c06793761e80124acb1c..a5bab614a4a4a43073844cec150989630faf8c64 100644
--- a/htdocs/projet/class/api_tasks.class.php
+++ b/htdocs/projet/class/api_tasks.class.php
@@ -445,8 +445,6 @@ class Tasks extends DolibarrApi
         {
             throw new RestException(500, $this->task->error);
         }
-
-        return false;
     }
 
     /**