Skip to content

Commit

Permalink
Debug v15
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 10, 2022
1 parent c81f468 commit cfec02a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
21 changes: 17 additions & 4 deletions htdocs/compta/facture/class/facture-rec.class.php
Expand Up @@ -470,11 +470,23 @@ public function update(User $user, $notrigger = 0)
$error = 0;

$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
$sql .= " fk_soc = ".((int) $this->fk_soc);
$sql .= " entity = ".((int) $this->entity).",";
$sql .= " titre = '".$this->db->escape($this->title)."',";
$sql .= " suspended = ".((int) $this->suspended).",";
$sql .= " fk_soc = ".((int) $this->socid).",";
$sql .= " total_tva = ".((float) $this->total_tva).",";
$sql .= " localtax1 = ".((float) $this->localtax1).",";
$sql .= " localtax2 = ".((float) $this->localtax2).",";
$sql .= " total_ht = ".((float) $this->total_ht).",";
$sql .= " total_ttc = ".((float) $this->total_ttc).",";
$sql .= " remise_percent = ".((float) $this->remise_percent);
// TODO Add missing fields
$sql .= " WHERE rowid = ".((int) $this->id);

$this->db->begin();

dol_syslog(get_class($this)."::update", LOG_DEBUG);

$resql = $this->db->query($sql);
if ($resql) {
if (!$error) {
Expand All @@ -498,7 +510,7 @@ public function update(User $user, $notrigger = 0)
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -2;
return -1;
}
}

Expand Down Expand Up @@ -531,9 +543,9 @@ public function fetch($rowid, $ref = '', $ref_ext = '')
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')';
if ($rowid) {
$sql .= ' AND f.rowid='.((int) $rowid);
$sql .= ' AND f.rowid = '.((int) $rowid);
} elseif ($ref) {
$sql .= " AND f.titre='".$this->db->escape($ref)."'";
$sql .= " AND f.titre = '".$this->db->escape($ref)."'";
} else {
$sql .= ' AND f.rowid = 0';
}
Expand Down Expand Up @@ -2130,6 +2142,7 @@ public function update(User $user, $notrigger = 0)
$this->db->begin();

dol_syslog(get_class($this)."::updateline", LOG_DEBUG);

$resql = $this->db->query($sql);
if ($resql) {
if (!$error) {
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -6109,6 +6109,7 @@ public function insertExtraFields($trigger = '', $userused = null)
}

$sql .= ")";

$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/mysql/tables/llx_facture_rec.sql
Expand Up @@ -35,7 +35,7 @@ create table llx_facture_rec
remise_percent real DEFAULT 0,
remise_absolue real DEFAULT 0,

vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
vat_src_code varchar(10) DEFAULT '', -- TODO Remove this. Field is inside the table of lines
total_tva double(24,8) DEFAULT 0,
localtax1 double(24,8) DEFAULT 0, -- amount localtax1
localtax2 double(24,8) DEFAULT 0, -- amount localtax2
Expand Down

0 comments on commit cfec02a

Please sign in to comment.