Fix #14352 - JavaScript errors with Designer

Closes: #14352

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2018-11-30 11:27:34 +01:00 committed by Isaac Bennetch
parent c22fefba77
commit 4459dec32f

View File

@ -302,7 +302,7 @@ class Common
*
* @param int $pg pdf page id
*
* @return string table name
* @return string|null table name
*/
public function getPageName($pg)
{
@ -322,7 +322,7 @@ class Common
DatabaseInterface::CONNECT_CONTROL,
DatabaseInterface::QUERY_STORE
);
return count($page_name) ? $page_name[0] : null;
return ( is_array($page_name) && isset($page_name[0]) ) ? $page_name[0] : null;
}
/**
@ -370,7 +370,7 @@ class Common
{
$cfgRelation = $this->relation->getRelationsParam();
if (! $cfgRelation['pdfwork']) {
return null;
return -1;
}
$query = "SELECT `page_nr`"
@ -387,7 +387,7 @@ class Common
DatabaseInterface::QUERY_STORE
);
if (isset($default_page_no) && count($default_page_no)) {
if (is_array($default_page_no) && isset($default_page_no[0])) {
return intval($default_page_no[0]);
}
return -1;
@ -405,7 +405,7 @@ class Common
{
$cfgRelation = $this->relation->getRelationsParam();
if (! $cfgRelation['pdfwork']) {
return null;
return -1;
}
$page_no = -1;
@ -426,7 +426,7 @@ class Common
DatabaseInterface::CONNECT_CONTROL,
DatabaseInterface::QUERY_STORE
);
if (isset($min_page_no[0]) && count($min_page_no[0])) {
if (is_array($min_page_no) && isset($min_page_no[0])) {
$page_no = $min_page_no[0];
}
}