WIP Save link to file in expensereport lines

This commit is contained in:
Laurent Destailleur 2019-03-22 18:03:08 +01:00
parent 8ca5b2e45f
commit aab9734f52
2 changed files with 14 additions and 6 deletions

View File

@ -1091,12 +1091,17 @@ if (empty($reshook))
// First save uploaded file
$fk_ecm_files = 0;
if (! empty($_FILES))
if (GETPOSTISSET('attachfile'))
{
// Get ID of ECM file
$idofecmfile = 0;
$fk_ecm_files = $idofecmfile;
$arrayoffiles=GETPOST('attachfile','array');
if (is_array($arrayoffiles) && ! empty($arrayoffiles[0]))
{
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$relativepath='expensereport/'.$object->ref.'/'.$arrayoffiles[0];
$ecmfiles=new EcmFiles($db);
$ecmfiles->fetch(0, '', $relativepath);
$fk_ecm_files = $ecmfiles->id;
}
}
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.

View File

@ -1696,7 +1696,7 @@ class ExpenseReport extends CommonObject
* @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
* @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, $fk_ecm_files = 0)
@ -2500,6 +2500,9 @@ class ExpenseReportLine
public $total_tva;
public $total_ttc;
public $fk_ecm_files;
/**
* Constructor
*