diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 9d9eebae245..5ffef81e4c0 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2265,7 +2265,7 @@ if ($action == 'create') {
print $numline;
print '';
- print '
';
+ print ' | ';
print ''.$langs->trans("UploadANewFileNow");
print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly');
print '';
@@ -2493,6 +2493,8 @@ if ($action == 'create') {
print ' | | ';
print ' | ';
print ' | ';
+ print ' | ';
+ print ' | ';
print '';
print '';
@@ -2501,19 +2503,19 @@ if ($action == 'create') {
print ' | ';
// Select date
- print '';
+ print ' | ';
print $form->selectDate($date ? $date : -1, 'date', 0, 0, 0, '', 1, 1);
print ' | ';
// Select project
if (!empty($conf->projet->enabled)) {
- print '';
+ print ' | ';
$formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300');
print ' | ';
}
// Select type
- print '';
+ print ' | ';
print $formexpensereport->selectTypeExpenseReport($fk_c_type_fees, 'fk_c_type_fees', 1);
print ' | ';
@@ -2525,12 +2527,12 @@ if ($action == 'create') {
}
// Add comments
- print '';
+ print ' | ';
// Select VAT
- print '';
+ print ' | ';
$defaultvat = -1;
if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) {
$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
@@ -2539,17 +2541,17 @@ if ($action == 'create') {
print ' | ';
// Unit price net
- print '';
+ print ' | ';
print '';
print ' | ';
// Unit price with tax
- print '';
+ print ' | ';
print '';
print ' | ';
// Quantity
- print '';
+ print ' | ';
print ''; // We must be able to enter decimal qty
print ' | ';
@@ -2561,7 +2563,7 @@ if ($action == 'create') {
print ' | ';
}
- print '';
+ print ' | ';
print $form->buttonsSaveCancel("Add", '', '', 1);
print ' | ';
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index f2f0b7dbf0d..24d56b0c0b7 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -2063,7 +2063,7 @@ class ExpenseReport extends CommonObject
* @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 updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id, $fk_c_exp_tax_cat = 0, $fk_ecm_files = 0)
+ public function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id, $fk_c_exp_tax_cat = 0, $fk_ecm_files = 0, $notrigger = 0)
{
global $user, $mysoc;
@@ -2153,9 +2153,19 @@ class ExpenseReport extends CommonObject
$this->applyOffset();
$this->checkRules();
-
+ $error = 0;
$result = $this->line->update($user);
- if ($result > 0) {
+
+ if ($result > 0 && !$notrigger) {
+ // Call triggers
+ $result = $this->call_trigger('EXPENSE_REPORT_DET_UPDATE', $user);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
+ }
+
+ if ($result > 0 && $error == 0) {
$this->db->commit();
return 1;
} else {
@@ -2174,16 +2184,29 @@ class ExpenseReport extends CommonObject
* @param User $fuser User
* @return int <0 if KO, >0 if OK
*/
- public function deleteline($rowid, $fuser = '')
+ public function deleteline($rowid, $fuser = '', $notrigger = 0)
{
+ $error=0;
+
$this->db->begin();
- $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element_line;
+ if (!$notrigger) {
+ // Call triggers
+ $result = $this->call_trigger('EXPENSE_REPORT_DET_DELETE', $fuser);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
+ }
+
+
+ $sql = ' DELETE FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE rowid = '.((int) $rowid);
dol_syslog(get_class($this)."::deleteline sql=".$sql);
$result = $this->db->query($sql);
- if (!$result) {
+
+ if (!$result || $error > 0 ) {
$this->error = $this->db->error();
dol_syslog(get_class($this)."::deleteline Error ".$this->error, LOG_ERR);
$this->db->rollback();