dolibarr  9.0.0
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 <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 
32 require '../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
34 
35 
36 /*
37  * View
38  */
39 
40 top_httphead();
41 
42 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
43 
44 // Registering the location of boxes
45 if ((! empty($_POST['roworder'])) && (! empty($_POST['table_element_line']))
46  && (! empty($_POST['fk_element'])) && (! empty($_POST['element_id'])))
47 {
48  $roworder=GETPOST('roworder','alpha',2);
49  $table_element_line=GETPOST('table_element_line','alpha',2);
50  $fk_element=GETPOST('fk_element','alpha',2);
51  $element_id=GETPOST('element_id','int',2);
52 
53  dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
54 
55  $rowordertab = explode(',',$roworder);
56  $newrowordertab = array();
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 
67  $row->line_ajaxorder($newrowordertab); // This update field rank or position in table row->table_element_line
68 
69  // Reorder line to have position of children lines sharing same counter than parent lines
70  // This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
71  if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
72  {
73  $result=$row->line_order(true);
74  }
75 }
76 
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
if(! defined('NOREQUIREMENU')) if(! function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1107
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...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
Class of a generic business object.