diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index c39b67a8680..93425a65e68 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1090,9 +1090,13 @@ if (empty($reshook))
$error = 0;
// First save uploaded file
+ $fk_ecm_files = 0;
if (! empty($_FILES))
{
+ // Get ID of ECM file
+ $idofecmfile = 0;
+ $fk_ecm_files = $idofecmfile;
}
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
@@ -1144,13 +1148,12 @@ if (empty($reshook))
setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings');
}
- // S'il y'a eu au moins une erreur
if (! $error)
{
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
// Insert line
- $result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type);
+ $result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type, $fk_ecm_files);
if ($result > 0)
{
$ret = $object->fetch($object->id); // Reload to get new records
@@ -1709,7 +1712,7 @@ else
print '
';
print '
';
- print '
';
+ print '';
// Author
print '';
@@ -1853,7 +1856,7 @@ else
print '';
print '
';
- print '
';
+ print '';
// Amount
print '';
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 0bc5c533f9e..7c8d7eb209e 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1687,20 +1687,21 @@ class ExpenseReport extends CommonObject
/**
* addline
*
- * @param float $qty Qty
- * @param double $up Value init
- * @param int $fk_c_type_fees Type payment
- * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
- * @param string $date Date
- * @param string $comments Description
- * @param int $fk_project Project id
- * @param int $fk_c_exp_tax_cat Car category id
- * @param int $type Type line
- * @return int <0 if KO, >0 if OK
+ * @param float $qty Qty
+ * @param double $up Value init
+ * @param int $fk_c_type_fees Type payment
+ * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
+ * @param string $date Date
+ * @param string $comments Description
+ * @param int $fk_project Project id
+ * @param int $fk_c_exp_tax_cat Car category id
+ * @param int $type Type line
+ * @param int $fk_ecm_files Id of ECM file to link to this expensereport line
+ * @return int <0 if KO, >0 if OK
*/
- public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0)
+ public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0, $fk_ecm_files = 0)
{
- global $conf,$langs,$mysoc;
+ global $conf, $langs, $mysoc;
dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG);
@@ -1752,6 +1753,8 @@ class ExpenseReport extends CommonObject
$this->line->comments = $comments;
$this->line->fk_projet = $fk_project;
+ $this->line->fk_ecm_files = $fk_ecm_files;
+
$this->applyOffset();
$this->checkRules($type, $seller);
@@ -2585,7 +2588,7 @@ class ExpenseReportLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
- $sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat)';
+ $sql.= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
$sql.= " VALUES (".$this->db->escape($this->fk_expensereport).",";
$sql.= " ".$this->db->escape($this->fk_c_type_fees).",";
$sql.= " ".$this->db->escape($this->fk_project>0?$this->fk_project:($this->fk_projet>0?$this->fk_projet:'null')).",";
@@ -2599,7 +2602,8 @@ class ExpenseReportLine
$sql.= " ".$this->db->escape($this->total_ttc).",";
$sql.= "'".$this->db->idate($this->date)."',";
$sql.= " '".$this->db->escape($this->rule_warning_message)."',";
- $sql.= " ".$this->db->escape($this->fk_c_exp_tax_cat);
+ $sql.= " ".$this->db->escape($this->fk_c_exp_tax_cat).",";
+ $sql.= " ".($this->fk_ecm_files > 0 ? $this->fk_ecm_files : 'null');
$sql.= ")";
$resql=$this->db->query($sql);
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 1c92e558c41..fc90f8a3ed5 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -1105,7 +1105,7 @@ else
print '';
print '
';
- print '
';
+ print '';
print '';
// User
@@ -1213,7 +1213,7 @@ else
print '';
// Info workflow
- print ''."\n";
+ print ''."\n";
print '';
if (! empty($object->fk_user_create))
diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
index 52b52a5f342..f75c618612d 100644
--- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
+++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
@@ -189,7 +189,7 @@ ALTER TABLE llx_socpeople ADD COLUMN linkedin varchar(255) after whatsapp;
ALTER TABLE llx_adherent ADD COLUMN linkedin varchar(255) after whatsapp;
ALTER TABLE llx_user ADD COLUMN linkedin varchar(255) after whatsapp;
-ALTER TABLE llx_expensereport_det ADD COLUMN fk_expensereport_line integer DEFAULT NULL;
+ALTER TABLE llx_expensereport_det ADD COLUMN fk_ecm_files integer DEFAULT NULL;
CREATE TABLE llx_bom_bom(
diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql
index c87d26c94a8..75d503ac181 100644
--- a/htdocs/install/mysql/tables/llx_expensereport_det.sql
+++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql
@@ -51,7 +51,7 @@ CREATE TABLE llx_expensereport_det
multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc double(24,8) DEFAULT 0,
fk_facture integer DEFAULT 0, -- ID of customer invoice line if expense is rebilled to a customer
- fk_expensereport_line integer DEFAULT NULL, -- ID of ECM file that is source document of expense report
+ fk_ecm_files integer DEFAULT NULL, -- ID of ECM file that is source document of expense report
fk_code_ventilation integer DEFAULT 0,
rang integer DEFAULT 0, -- position of line
import_key varchar(14),