diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php
index b0113149146..033ad7ef30e 100644
--- a/htdocs/compta/bank/line.php
+++ b/htdocs/compta/bank/line.php
@@ -125,7 +125,11 @@ if ($user->rights->banque->modifier && $action == "update") {
$error = 0;
$acline = new AccountLine($db);
- $acline->fetch($rowid);
+ $result = $acline->fetch($rowid);
+ if ($result <= 0) {
+ dol_syslog('Failed to read bank line with id '.$rowid, LOG_ERR); // This happens due to old bug that has set fk_account to null.
+ $acline->id = $rowid;
+ }
$acsource = new Account($db);
$acsource->fetch($accountoldid);
@@ -332,7 +336,7 @@ if ($result) {
print '
';
if (!$objp->rappro && !$bankline->getVentilExportCompta()) {
print img_picto('', 'bank_account', 'class="paddingright"');
- print $form->select_comptes($acct->id, 'accountid', 0, '', 0, '', 0, '', 1);
+ print $form->select_comptes($acct->id, 'accountid', 0, '', ($acct->id > 0 ? $acct->id : 1), '', 0, '', 1);
} else {
print $acct->getNomUrl(1, 'transactions', 'reflabel');
}
diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php
index 383f9a0c041..fcc39e1aae1 100644
--- a/htdocs/core/ajax/row.php
+++ b/htdocs/core/ajax/row.php
@@ -48,7 +48,7 @@ if (!defined('NOREQUIRETRAN')) {
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
-
+$hookmanager->initHooks(array('rowinterface'));
// Security check
// This is done later into view.
@@ -120,7 +120,15 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
}
}
-
+ $parameters = array('roworder'=> &$roworder, 'table_element_line' => &$table_element_line, 'fk_element' => &$fk_element, 'element_id' => &$element_id, 'perm' => &$perm);
+ $row = new GenericObject($db);
+ $row->table_element_line = $table_element_line;
+ $row->fk_element = $fk_element;
+ $row->id = $element_id;
+ $reshook = $hookmanager->executeHooks('checkRowPerms', $parameters, $row, $action);
+ if ($reshook > 0) {
+ $perm = $hookmanager->resArray['perm'];
+ }
if (! $perm) {
// We should not be here. If we are not allowed to reorder rows, feature should not be visible on script.
// If we are here, it is a hack attempt, so we report a warning.
@@ -137,10 +145,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
}
}
- $row = new GenericObject($db);
- $row->table_element_line = $table_element_line;
- $row->fk_element = $fk_element;
- $row->id = $element_id;
+
$row->line_ajaxorder($newrowordertab); // This update field rank or position in table row->table_element_line
diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php
index f61bd298c62..e5042807b02 100644
--- a/htdocs/core/lib/website2.lib.php
+++ b/htdocs/core/lib/website2.lib.php
@@ -49,7 +49,7 @@ function dolSaveMasterFile($filemaster)
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
}
- return $result;
+ return $result;
}
/**
@@ -291,11 +291,12 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
* @param string $fileindex Full path of file index.php
* @param string $filetpl File tpl the index.php page redirect to (used only if $fileindex is provided)
* @param string $filewrapper Full path of file wrapper.php
+ * @param Website $object Object website
* @return boolean True if OK
*/
-function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
+function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper, $object = null)
{
- global $conf;
+ global $conf, $db;
$result1 = false;
$result2 = false;
@@ -320,6 +321,44 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
}
+
+ if (is_object($object) && $object->fk_default_home > 0) {
+ $objectpage = new WebsitePage($db);
+ $objectpage->fetch($object->fk_default_home);
+
+ // Create a version for sublanguages
+ if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
+ if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR) && is_object($object) && !empty($object->otherlang)) {
+ $dirname = dirname($fileindex);
+ foreach (explode(',', $object->otherlang) as $sublang) {
+ // Avoid to erase main alias file if $sublang is empty string
+ if (empty(trim($sublang))) continue;
+ $fileindexsub = $dirname.'/'.$sublang.'/index.php';
+
+ // Same indexcontent than previously but with ../ instead of ./ for master and tpl file include/require_once.
+ $relpath = '..';
+ $indexcontent = ''."\n";
+ $result = file_put_contents($fileindexsub, $indexcontent);
+ if ($result === false) {
+ dol_syslog("Failed to write file ".$fileindexsub, LOG_WARNING);
+ }
+ if (!empty($conf->global->MAIN_UMASK)) {
+ @chmod($fileindexsub, octdec($conf->global->MAIN_UMASK));
+ }
+ }
+ }
+ }
+ }
} else {
$result1 = true;
}
@@ -491,7 +530,7 @@ function dolSaveReadme($file, $content)
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
- return $result;
+ return $result;
}
@@ -545,9 +584,9 @@ function showWebsiteTemplates(Website $website)
while (($subdir = readdir($handle)) !== false) {
if (is_file($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
&& substr($subdir, 0, 3) <> 'CVS' && preg_match('/\.zip$/i', $subdir)) {
- $subdirwithoutzip = preg_replace('/\.zip$/i', '', $subdir);
+ $subdirwithoutzip = preg_replace('/\.zip$/i', '', $subdir);
- // Disable not stable themes (dir ends with _exp or _dev)
+ // Disable not stable themes (dir ends with _exp or _dev)
if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) {
continue;
}
@@ -555,38 +594,38 @@ function showWebsiteTemplates(Website $website)
continue;
}
- print '';
+ print ' ';
- $file = $dirtheme."/".$subdirwithoutzip.".jpg";
- $url = DOL_URL_ROOT.'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.".jpg";
+ $file = $dirtheme."/".$subdirwithoutzip.".jpg";
+ $url = DOL_URL_ROOT.'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.".jpg";
if (!file_exists($file)) {
$url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
}
- $originalfile = basename($file);
- $entity = $conf->entity;
- $modulepart = 'doctemplateswebsite';
- $cache = '';
- $title = $file;
+ $originalfile = basename($file);
+ $entity = $conf->entity;
+ $modulepart = 'doctemplateswebsite';
+ $cache = '';
+ $title = $file;
- $ret = '';
- $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 1, '&entity='.$entity);
+ $ret = '';
+ $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 1, '&entity='.$entity);
if (!empty($urladvanced)) {
$ret .= ' ';
} else {
$ret .= '';
}
- print $ret;
- print ' ';
- print '';
+ print $ret;
+ print '  ';
+ print '';
- print ' ';
- print $subdir.' ('.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).')';
- print ' ref.'&templateuserfile='.$subdir.'" class="button">'.$langs->trans("Load").'';
- print ' ';
+ print ' ';
+ print $subdir.' ('.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).')';
+ print ' ref.'&templateuserfile='.$subdir.'" class="button">'.$langs->trans("Load").'';
+ print ' ';
- $i++;
+ $i++;
}
}
}
diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php
index 61428170f50..0be260194c2 100644
--- a/htdocs/core/tpl/ajaxrow.tpl.php
+++ b/htdocs/core/tpl/ajaxrow.tpl.php
@@ -43,7 +43,6 @@ $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1;
$tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd);
$filepath = (empty($filepath) ? '' : $filepath);
-
if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1 && $conf->browser->layout != 'phone') { ?>
|