Fix travis

This commit is contained in:
Laurent Destailleur 2018-07-03 13:49:41 +02:00
parent da7b433cd0
commit f93f5bd6e0
3 changed files with 111 additions and 83 deletions

View File

@ -341,7 +341,8 @@ script:
#cat $TRAVIS_BUILD_DIR/upgrade500600.log #cat $TRAVIS_BUILD_DIR/upgrade500600.log
#cat $TRAVIS_BUILD_DIR/upgrade500600-2.log #cat $TRAVIS_BUILD_DIR/upgrade500600-2.log
#cat $TRAVIS_BUILD_DIR/upgrade500600-3.log #cat $TRAVIS_BUILD_DIR/upgrade500600-3.log
#cat /tmp/dolibarr_install.log #cat $TRAVIS_BUILD_DIR/upgrade600700-2.log
cat /tmp/dolibarr_install.log
- | - |
echo "Unit testing" echo "Unit testing"

View File

@ -124,9 +124,22 @@ class Menubase
else dol_print_error($this->db); else dol_print_error($this->db);
} }
// TODO
// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql // Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
$sql = "SELECT count(*)";
$sql.= " FROM ".MAIN_DB_PREFIX."menu";
$sql.= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
$sql.= " AND fk_menu = ".((int) $this->db->escape($this->fk_menu));
$sql.= " AND position = ".((int) $this->position);
$sql.= " AND url = '".$this->db->escape($this->url)."'";
$sql.= " AND entity = ".$conf->entity;
$result=$this->db->query($sql);
if ($result)
{
$row = $this->db->fetch_row($result);
if ($row[0] == 0) // If not found
{
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
$sql.= "menu_handler,"; $sql.= "menu_handler,";
@ -153,10 +166,10 @@ class Menubase
$sql.= " '".$this->db->escape($this->type)."',"; $sql.= " '".$this->db->escape($this->type)."',";
$sql.= " ".($this->mainmenu?"'".$this->db->escape($this->mainmenu)."'":"''").","; // Can't be null $sql.= " ".($this->mainmenu?"'".$this->db->escape($this->mainmenu)."'":"''").","; // Can't be null
$sql.= " ".($this->leftmenu?"'".$this->db->escape($this->leftmenu)."'":"null").","; $sql.= " ".($this->leftmenu?"'".$this->db->escape($this->leftmenu)."'":"null").",";
$sql.= " '".$this->db->escape($this->fk_menu)."',"; $sql.= " ".((int) $this->fk_menu).",";
$sql.= " ".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").","; $sql.= " ".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
$sql.= " ".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").","; $sql.= " ".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
$sql.= " '".(int) $this->position."',"; $sql.= " ".((int) $this->position).",";
$sql.= " '".$this->db->escape($this->url)."',"; $sql.= " '".$this->db->escape($this->url)."',";
$sql.= " '".$this->db->escape($this->target)."',"; $sql.= " '".$this->db->escape($this->target)."',";
$sql.= " '".$this->db->escape($this->titre)."',"; $sql.= " '".$this->db->escape($this->titre)."',";
@ -181,6 +194,18 @@ class Menubase
return -1; return -1;
} }
} }
else
{
dol_syslog(get_class($this)."::create menu entry already exists", LOG_WARNING);
$this->error = 'Error Menu entry already exists';
return 0;
}
}
else
{
return -1;
}
}
/** /**
* Update menu entry into database. * Update menu entry into database.

View File

@ -953,7 +953,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
$sql.= " AND entity IN (0, ".$entity.")"; $sql.= " AND entity IN (0, ".$entity.")";
dol_syslog(get_class($this)."::_active delect activation constant", LOG_DEBUG); dol_syslog(get_class($this)."::_active delete activation constant", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) $err++; if (! $resql) $err++;
@ -1672,7 +1672,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def";
$sql.= " WHERE id = ".$r_id." AND entity = ".$entity; $sql.= " WHERE id = ".$r_id." AND entity = ".$entity;
$resqlselect=$this->db->query($sql); $resqlselect=$this->db->query($sql);
if ($resqlselect)
{
$obj = $this->db->fetch_object($resqlselect); $obj = $this->db->fetch_object($resqlselect);
if ($obj->nb == 0) if ($obj->nb == 0)
{ {
@ -1719,6 +1720,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
} }
$this->db->free($resqlselect); $this->db->free($resqlselect);
}
// If we want to init permissions on admin users // If we want to init permissions on admin users
if ($reinitadminperms) if ($reinitadminperms)