Fix sql errors

This commit is contained in:
Laurent Destailleur 2023-09-09 21:16:58 +02:00
parent 7d1a456a2b
commit bc71380410
5 changed files with 19 additions and 12 deletions

View File

@ -373,6 +373,7 @@ script:
echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE
echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE
#cat $INSTALL_FORCED_FILE
echo
- |
echo "Upgrading Dolibarr"
@ -441,12 +442,14 @@ script:
php upgrade.php 18.0.0 19.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade18001900.log || cat $TRAVIS_BUILD_DIR/upgrade18001900.log
php upgrade2.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-2.log || cat $TRAVIS_BUILD_DIR/upgrade18001900-2.log
php step5.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-3.log || cat $TRAVIS_BUILD_DIR/upgrade18001900-3.log
set -e
set +e
echo
- |
echo Show some debug info like table content or log
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
cat $TRAVIS_BUILD_DIR/upgrade18001900.log
echo
- |
echo Result of migration scripts
@ -470,6 +473,7 @@ script:
echo
#cat /tmp/dolibarr_install.log
cat $TRAVIS_BUILD_DIR/enablemodule.log
echo
- |
echo "Unit testing"
@ -479,6 +483,7 @@ script:
phpunitresult=$?
echo "Phpunit return code = $phpunitresult"
set +e
echo
after_script:
- |

View File

@ -701,7 +701,7 @@ class Account extends CommonObject
return -1;
}
// Chargement librairie pour acces fonction controle RIB
// Load librairies to check BAN
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
$now = dol_now();
@ -778,13 +778,13 @@ class Account extends CommonObject
$result = $this->update($user, 1);
if ($result > 0) {
$accline = new AccountLine($this->db);
$accline->datec = $this->db->idate($now);
$accline->datec = $now;
$accline->label = '('.$langs->trans("InitialBankBalance").')';
$accline->amount = price2num($this->solde);
$accline->fk_user_author = $user->id;
$accline->fk_account = $this->id;
$accline->datev = $this->db->idate($this->date_solde);
$accline->dateo = $this->db->idate($this->date_solde);
$accline->datev = $this->date_solde;
$accline->dateo = $this->date_solde;
$accline->fk_type = 'SOLD';
if ($accline->insert() < 0) {
@ -2131,6 +2131,7 @@ class AccountLine extends CommonObjectLine
$sql .= ", ".($this->num_releve ? "'".$this->db->escape($this->num_releve)."'" : "null");
$sql .= ")";
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -282,11 +282,9 @@ class CompanyBankAccount extends Account
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec";
$sql .= ", model_pdf";
$sql .= ")";
$sql .= " VALUES (".((int) $this->socid).", '".$this->type."', '".$this->db->idate($this->datec)."'";
$sql .= ",\"".$this->db->escape(getDolGlobalString("BANKADDON_PDF"))."\"";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec, model_pdf)";
$sql .= " VALUES (".((int) $this->socid).", '".$this->type."', '".$this->db->idate($this->datec)."',";
$sql .= " '".$this->db->escape(getDolGlobalString("BANKADDON_PDF"))."'";
$sql .= ")";
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -143,9 +143,9 @@ class BankAccountTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new Account($db);
$localobject = new Account($db);
$localobject->initAsSpecimen();
$localobject->date_solde=dol_now();
$localobject->date_solde = dol_now();
$result=$localobject->create($user);
print __METHOD__." result=".$result."\n";

View File

@ -126,6 +126,9 @@ class SecurityTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
$db->rollback();
// Restore value to a neutral value (it was set to a test value by some tests)
unset($_SERVER["PHP_SELF"]);
print __METHOD__."\n";
}