diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 7e18877cac7..b5abc1b7fd2 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1367,16 +1367,10 @@ if ($id > 0 || ! empty($ref))
/*
* Lines
*/
- // We disable with 1 == 2 because until dev is finished.
- if (1 == 2 && $conf->use_javascript_ajax && $propal->statut == 0 && $_GET['action'] != 'editline')
+ // We disable with $conf->global->MAIN_FEATURES_LEVEL because until dev is finished.
+ if ($conf->global->MAIN_FEATURES_LEVEL == 2 && $conf->use_javascript_ajax && $propal->statut == 0 && $_GET['action'] != 'editline')
{
- print '';
+ include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php');
}
print '
';
diff --git a/htdocs/core/ajaxrow.php b/htdocs/core/ajaxrow.php
new file mode 100644
index 00000000000..284ba49d935
--- /dev/null
+++ b/htdocs/core/ajaxrow.php
@@ -0,0 +1,71 @@
+
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * \file htdocs/core/ajaxrow.php
+ * \brief File to return Ajax response on Row move
+ * \version $Id$
+ */
+
+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/commonobject.class.php");
+
+
+/*
+ * View
+ */
+
+// Ajout directives pour resoudre bug IE
+//header('Cache-Control: Public, must-revalidate');
+//header('Pragma: public');
+
+//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
+top_httphead();
+
+print ''."\n";
+
+// Registering the location of boxes
+if((isset($_GET['roworder']) && !empty($_GET['roworder'])) && (isset($_GET['element']) && !empty($_GET['element'])))
+{
+ $roworder = explode(',',$_GET['roworder']);
+
+ foreach($roworder as $value)
+ {
+ if (!empty($value))
+ {
+ $newroworder[] = $value;
+ }
+ }
+
+ $roworder = implode(',',$newroworder);
+
+ dol_syslog("AjaxRow roworder=".$_GET['roworder']." neworder=".$roworder." element=".$_GET['element'], LOG_DEBUG);
+
+ $row=new CommonObject($db);
+ $row->table_element_line = $_GET['element'];
+ $result=$row->line_ajaxorder($roworder);
+}
+
+?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 75dbd2184a8..07115c0dc4b 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -717,12 +717,7 @@ class CommonObject
}
for ($i = 0 ; $i < sizeof($li) ; $i++)
{
- $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.($i+1);
- $sql.= ' WHERE rowid = '.$li[$i];
- if (!$this->db->query($sql) )
- {
- dol_syslog($this->db->error());
- }
+ $this->updateRangOfLine($li[$i], ($i+1));
}
}
}
@@ -767,11 +762,30 @@ class CommonObject
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang;
$sql.= ' WHERE rowid = '.$rowid;
+
+ dol_syslog("CommonObject::updateRangOfLine sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql) )
{
dol_print_error($this->db);
}
}
+
+ /**
+ * Update position of line with ajax (rang)
+ */
+ function line_ajaxorder($roworder)
+ {
+ $rows = explode(',',$roworder);
+ $num = sizeof($rows);
+
+ dol_syslog("CommonObject::line_ajaxorder roworder=".$roworder." num=".$num, LOG_DEBUG);
+
+ for ($i = 0 ; $i < $num ; $i++)
+ {
+ dol_syslog("CommonObject::line_ajaxorder row=".$rows[$i]." rang=".($i+1), LOG_DEBUG);
+ $this->updateRangOfLine($rows[$i], ($i+1));
+ }
+ }
/**
* Update position of line up (rang)
diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php
new file mode 100644
index 00000000000..cb1d72bf193
--- /dev/null
+++ b/htdocs/core/tpl/ajaxrow.tpl.php
@@ -0,0 +1,38 @@
+
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/core/tpl/freeproductline_view.tpl.php b/htdocs/core/tpl/freeproductline_view.tpl.php
index 3b58689b845..3be16527611 100644
--- a/htdocs/core/tpl/freeproductline_view.tpl.php
+++ b/htdocs/core/tpl/freeproductline_view.tpl.php
@@ -21,7 +21,7 @@
->
+
id.' '.$bc[$var]; ?>>
info_bits & 2) == 2) { ?>
diff --git a/htdocs/core/tpl/predefinedproductline_view.tpl.php b/htdocs/core/tpl/predefinedproductline_view.tpl.php
index 768526fc544..4f194630551 100644
--- a/htdocs/core/tpl/predefinedproductline_view.tpl.php
+++ b/htdocs/core/tpl/predefinedproductline_view.tpl.php
@@ -21,7 +21,7 @@
->
+ id.' '.$bc[$var]; ?>>
|
| |