dolibarr  13.0.2
row.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@inodbox.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 <https://www.gnu.org/licenses/>.
17  */
18 
30 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal
31 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
32 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
33 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
34 if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
35 if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
36 
37 require '../../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
39 
40 
41 /*
42  * View
43  */
44 
45 top_httphead();
46 
47 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
48 
49 // Registering the location of boxes
50 if (GETPOST('roworder', 'alpha') && GETPOST('table_element_line', 'alpha', 2)
51  && GETPOST('fk_element', 'alpha', 2) && GETPOST('element_id', 'int', 2))
52 {
53  $roworder = GETPOST('roworder', 'alpha', 2);
54  $table_element_line = GETPOST('table_element_line', 'alpha', 2);
55  $fk_element = GETPOST('fk_element', 'alpha', 2);
56  $element_id = GETPOST('element_id', 'int', 2);
57 
58  dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
59 
60  $rowordertab = explode(',', $roworder);
61  $newrowordertab = array();
62  foreach ($rowordertab as $value)
63  {
64  if (!empty($value)) $newrowordertab[] = $value;
65  }
66 
67  $row = new GenericObject($db);
68  $row->table_element_line = $table_element_line;
69  $row->fk_element = $fk_element;
70  $row->id = $element_id;
71 
72  $row->line_ajaxorder($newrowordertab); // This update field rank or position in table row->table_element_line
73 
74  // Reorder line to have position of children lines sharing same counter than parent lines
75  // This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
76  if (in_array($fk_element, array('fk_facture', 'fk_propal', 'fk_commande')))
77  {
78  $result = $row->line_order(true);
79  }
80 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1214
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
Definition: index.php:89
Class of a generic business object.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...