dolibarr  7.0.0-beta
row.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@capnetworks.com>
3  * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
25 if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disable token renewal
26 if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
27 if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
28 if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
29 if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
30 if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
31 if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks
32 
33 require '../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
35 
36 
37 /*
38  * View
39  */
40 
41 top_httphead();
42 
43 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
44 
45 // Registering the location of boxes
46 if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST['table_element_line']) && ! empty($_POST['table_element_line']))
47  && (isset($_POST['fk_element']) && ! empty($_POST['fk_element'])) && (isset($_POST['element_id']) && ! empty($_POST['element_id'])) )
48 {
49  $roworder=GETPOST('roworder','alpha',2);
50  $table_element_line=GETPOST('table_element_line','alpha',2);
51  $fk_element=GETPOST('fk_element','alpha',2);
52  $element_id=GETPOST('element_id','int',2);
53 
54  dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
55 
56  $rowordertab = explode(',',$roworder);
57  foreach($rowordertab as $value)
58  {
59  if (! empty($value)) $newrowordertab[] = $value;
60  }
61 
62  $row=new GenericObject($db);
63  $row->table_element_line = $table_element_line;
64  $row->fk_element = $fk_element;
65  $row->id = $element_id;
66  $row->line_ajaxorder($newrowordertab); // This update field rank or position in table table_element_line
67 
68  // Reorder line to have position of children lines sharing same counter than parent lines
69  // This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
70  if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
71  {
72  $result=$row->line_order(true);
73  }
74 }
75 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
print
Draft customers invoices.
Definition: index.php:91
Class of a generic business object.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html')
Show HTTP header.
Definition: main.inc.php:1052