diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php
index fe0a2b6382a..791584581c3 100644
--- a/htdocs/compta/deplacement/fiche.php
+++ b/htdocs/compta/deplacement/fiche.php
@@ -344,6 +344,8 @@ else if ($id)
$soc = new Societe($db);
if ($object->socid) $soc->fetch($object->socid);
+
+ if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxeditinplace.tpl.php');
print '
';
@@ -413,7 +415,9 @@ else if ($id)
// Public note
print '| '.$langs->trans("NotePublic").' | ';
print '';
- print ($object->note_public ? nl2br($object->note_public) : " ");
+ print ' ';
+ print ($object->note_public ? dol_nl2br($object->note_public) : " ");
+ print ' ';
print " |
";
// Private note
@@ -421,7 +425,9 @@ else if ($id)
{
print '| '.$langs->trans("NotePrivate").' | ';
print '';
- print ($object->note_private ? nl2br($object->note_private) : " ");
+ print ' ';
+ print ($object->note_private ? dol_nl2br($object->note_private) : " ");
+ print ' ';
print " |
";
}
diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php
new file mode 100644
index 00000000000..214ca46d81c
--- /dev/null
+++ b/htdocs/core/ajax/loadinplace.php
@@ -0,0 +1,49 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/ajax/loadinplace.php
+ * \brief File to load field value
+ */
+
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
+if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
+
+require('../../main.inc.php');
+require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
+
+/*
+ * View
+ */
+
+top_httphead();
+
+//print ''."\n";
+
+// Load original field value
+if((isset($_GET['field']) && ! empty($_GET['field'])) && (isset($_GET['table_element']) && ! empty($_GET['table_element'])) && (isset($_GET['fk_element']) && ! empty($_GET['fk_element'])))
+{
+ $object = new GenericObject($db);
+ $ret=$object->getValueFrom($_GET['table_element'], $_GET['fk_element'], $_GET['field']);
+ echo $ret;
+}
+
+?>
diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php
new file mode 100644
index 00000000000..5e0ff2b6b42
--- /dev/null
+++ b/htdocs/core/ajax/saveinplace.php
@@ -0,0 +1,54 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/ajax/saveinplace.php
+ * \brief File to save field value
+ */
+
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
+if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
+
+require('../../main.inc.php');
+require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
+
+/*
+ * View
+ */
+
+top_httphead();
+
+//print ''."\n";
+//var_dump($_POST);
+
+// Load original field value
+if((isset($_POST['field']) && ! empty($_POST['field'])) && (isset($_POST['table_element']) && ! empty($_POST['table_element'])) && (isset($_POST['fk_element']) && ! empty($_POST['fk_element'])))
+{
+ $object = new GenericObject($db);
+
+ // Clean parameters
+ $value = trim($_POST['value']);
+
+ $ret=$object->setValueFrom($_POST['table_element'], $_POST['fk_element'], $_POST['field'], $value);
+ if ($ret > 0) echo (! empty($value) ? dol_nl2br($value) : ' ');
+}
+
+?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 46a70f250dc..b47b5b07f74 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -589,25 +589,50 @@ abstract class CommonObject
return $result;
}
+
+ /**
+ * Load value from specific field
+ *
+ * @param string $table Table of element or element line
+ * @param int $id Element id
+ * @param string $field Field selected
+ * @return int <0 if KO, >0 if OK
+ */
+ function getValueFrom($table, $id, $field)
+ {
+ $result=false;
+
+ $sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
+ $sql.= " WHERE rowid = ".$id;
+
+ $resql = $this->db->query($sql);
+ if ($resql)
+ {
+ $row = $this->db->fetch_row($resql);
+ $result = $row[0];
+ }
+
+ return $result;
+ }
/**
- * Update a specific field from an object
+ * Update a specific field from an object
*
- * @param table Table element or element line
- * @param id Object id
- * @param field Field to update
- * @param value New value
- * @return int <0 if KO, >0 if OK
+ * @param string $table Table element or element line
+ * @param int $id Object id
+ * @param string $field Field to update
+ * @param mixte $value New value
+ * @return int <0 if KO, >0 if OK
*/
- function updateObjectField($table,$id,$field,$value)
+ function setValueFrom($table, $id, $field, $value)
{
global $conf;
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
- $sql.= $field." = '".$value."'";
+ $sql.= $field." = '".$this->db->escape($value)."'";
$sql.= " WHERE rowid = ".$id;
- dol_syslog(get_class($this)."::updateObjectField sql=".$sql, LOG_DEBUG);
+ dol_syslog(get_class($this)."::setValueFrom sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
diff --git a/htdocs/core/class/genericobject.class.php b/htdocs/core/class/genericobject.class.php
index de4511f8283..06f8067f2b4 100755
--- a/htdocs/core/class/genericobject.class.php
+++ b/htdocs/core/class/genericobject.class.php
@@ -37,7 +37,7 @@ class GenericObject extends CommonObject
*
* @param DoliDB $DB Database handler
*/
- function GenericObject($db)
+ function __construct($db)
{
$this->db=$db;
}
diff --git a/htdocs/core/tpl/ajaxeditinplace.tpl.php b/htdocs/core/tpl/ajaxeditinplace.tpl.php
new file mode 100644
index 00000000000..89c8ff27fe2
--- /dev/null
+++ b/htdocs/core/tpl/ajaxeditinplace.tpl.php
@@ -0,0 +1,45 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+?>
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 0b46afe4689..cd81033134d 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -917,19 +917,24 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print ''."\n";
//print ''."\n";
// jQuery Layout
- if (!empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) || defined('REQUIRE_JQUERY_LAYOUT'))
+ if (! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) || defined('REQUIRE_JQUERY_LAYOUT'))
{
print ''."\n";
}
// jQuery jnotify
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY)) print ''."\n";
- // Flot
- print ''."\n";
- print ''."\n";
- print ''."\n";
- print ''."\n";
+ // jQuery jeditable
+ if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print ''."\n";
+ // Flot
+ if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT))
+ {
+ print ''."\n";
+ print ''."\n";
+ print ''."\n";
+ print ''."\n";
+ }
// CKEditor
- if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_EDITORNAME) && $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor')
+ if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_EDITORNAME) && $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor')
{
print ''."\n";
print ''."\n";