Rename field

This commit is contained in:
Laurent Destailleur 2019-03-22 17:43:53 +01:00
parent 7d54c7a480
commit 8ca5b2e45f
5 changed files with 29 additions and 22 deletions

View File

@ -1090,9 +1090,13 @@ if (empty($reshook))
$error = 0; $error = 0;
// First save uploaded file // First save uploaded file
$fk_ecm_files = 0;
if (! empty($_FILES)) 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. // 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'); setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings');
} }
// S'il y'a eu au moins une erreur
if (! $error) 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 $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 // 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) if ($result > 0)
{ {
$ret = $object->fetch($object->id); // Reload to get new records $ret = $object->fetch($object->id); // Reload to get new records
@ -1709,7 +1712,7 @@ else
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
// Author // Author
print '<tr>'; print '<tr>';
@ -1853,7 +1856,7 @@ else
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
// Amount // Amount
print '<tr>'; print '<tr>';

View File

@ -1696,11 +1696,12 @@ class ExpenseReport extends CommonObject
* @param int $fk_project Project id * @param int $fk_project Project id
* @param int $fk_c_exp_tax_cat Car category id * @param int $fk_c_exp_tax_cat Car category id
* @param int $type Type line * @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 * @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); 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->comments = $comments;
$this->line->fk_projet = $fk_project; $this->line->fk_projet = $fk_project;
$this->line->fk_ecm_files = $fk_ecm_files;
$this->applyOffset(); $this->applyOffset();
$this->checkRules($type, $seller); $this->checkRules($type, $seller);
@ -2585,7 +2588,7 @@ class ExpenseReportLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det'; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,'; $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.= " VALUES (".$this->db->escape($this->fk_expensereport).",";
$sql.= " ".$this->db->escape($this->fk_c_type_fees).","; $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')).","; $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->escape($this->total_ttc).",";
$sql.= "'".$this->db->idate($this->date)."',"; $sql.= "'".$this->db->idate($this->date)."',";
$sql.= " '".$this->db->escape($this->rule_warning_message)."',"; $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.= ")"; $sql.= ")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -1105,7 +1105,7 @@ else
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border tableforfield centpercent">';
print '<tbody>'; print '<tbody>';
// User // User
@ -1213,7 +1213,7 @@ else
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
// Info workflow // Info workflow
print '<table class="border centpercent">'."\n"; print '<table class="border tableforfield centpercent">'."\n";
print '<tbody>'; print '<tbody>';
if (! empty($object->fk_user_create)) if (! empty($object->fk_user_create))

View File

@ -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_adherent ADD COLUMN linkedin varchar(255) after whatsapp;
ALTER TABLE llx_user 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( CREATE TABLE llx_bom_bom(

View File

@ -51,7 +51,7 @@ CREATE TABLE llx_expensereport_det
multicurrency_total_tva double(24,8) DEFAULT 0, multicurrency_total_tva double(24,8) DEFAULT 0,
multicurrency_total_ttc 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_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, fk_code_ventilation integer DEFAULT 0,
rang integer DEFAULT 0, -- position of line rang integer DEFAULT 0, -- position of line
import_key varchar(14), import_key varchar(14),