Merge pull request #20016 from FHenry/14_fix_sql_extrafields
fix: in some case index do not exists and return an error
This commit is contained in:
commit
5bcf2153ac
@ -608,10 +608,14 @@ class ExtraFields
|
|||||||
if ($unique) {
|
if ($unique) {
|
||||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
|
$sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
|
||||||
} else {
|
} else {
|
||||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX uk_".$table."_".$attrname;
|
$sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX IF EXISTS uk_".$table."_".$attrname;
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this).'::update', LOG_DEBUG);
|
dol_syslog(get_class($this).'::update', LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql, 1, 'dml');
|
$resql = $this->db->query($sql, 1, 'dml');
|
||||||
|
/*if ($resql < 0) {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}*/
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
|
|||||||
@ -1066,11 +1066,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
|
|||||||
}
|
}
|
||||||
// Capital
|
// Capital
|
||||||
if (!empty($fromcompany->capital) && $fromcompany->capital) {
|
if (!empty($fromcompany->capital) && $fromcompany->capital) {
|
||||||
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string
|
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string or a float
|
||||||
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
|
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
|
||||||
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
|
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
|
||||||
} else {
|
} elseif (!empty($fromcompany->capital)) {
|
||||||
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs);
|
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", $fromcompany->capital, $outputlangs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Prof Id 1
|
// Prof Id 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user