From 3f8aaf5cbc3f0f3532a4737e2bf9b97f9d0c674e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 21:30:55 +0100 Subject: [PATCH] clean code --- .../class/expensereport.class.php | 65 ++++++++++++++----- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 38c39d96b6f..685626ef6ff 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (c) 2018-2021 Frédéric France + * Copyright (c) 2018-2023 Frédéric France * Copyright (C) 2016-2020 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -60,8 +60,16 @@ class ExpenseReport extends CommonObject */ public $picto = 'trip'; + /** + * @var ExpenseReportLine[] array of expensereport lines + */ public $lines = array(); + /** + * @var ExpenseReportLine expensereport lines + */ + public $line; + public $date_debut; public $date_fin; @@ -93,6 +101,15 @@ class ExpenseReport extends CommonObject // Create public $date_create; + + /** + * @var int ID of user creator + */ + public $fk_user_creat; + + /** + * @var int ID of user who reclaim expense report + */ public $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. // Update @@ -107,15 +124,34 @@ class ExpenseReport extends CommonObject // Annulation public $date_cancel; public $detail_cancel; + + /** + * @var int ID of user who cancel expense report + */ public $fk_user_cancel; - public $fk_user_validator; // User that is defined to approve + /** + * @var int User that is defined to approve + */ + public $fk_user_validator; - // Validation - /* @deprecated */ + /** + * Validation date + * @var int + * @deprecated + * @see $date_valid + */ public $datevalid; - public $date_valid; // User making validation + /** + * Validation date + * @var int + */ + public $date_valid; + + /** + * @var int ID of User making validation + */ public $fk_user_valid; public $user_valid_infos; @@ -154,16 +190,15 @@ class ExpenseReport extends CommonObject */ const STATUS_APPROVED = 5; - /** - * Classified refused - */ - const STATUS_REFUSED = 99; - /** * Classified paid. */ const STATUS_CLOSED = 6; + /** + * Classified refused + */ + const STATUS_REFUSED = 99; public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), @@ -434,12 +469,12 @@ class ExpenseReport extends CommonObject $this->fk_statut = 0; // deprecated // Clear fields - $this->fk_user_creat = $user->id; - $this->fk_user_author = $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. - $this->fk_user_valid = ''; + $this->fk_user_creat = $user->id; + $this->fk_user_author = $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. + $this->fk_user_valid = ''; $this->date_create = ''; - $this->date_creation = ''; - $this->date_validation = ''; + $this->date_creation = ''; + $this->date_validation = ''; // Remove link on lines to a joined file if (is_array($this->lines) && count($this->lines) > 0) {