PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/core/ajax/row.php

https://bitbucket.org/speedealing/speedealing
PHP | 73 lines | 35 code | 13 blank | 25 comment | 16 complexity | 6bab101c6be489e2558dcaf19dbc1a11 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/core/ajax/row.php
  19. * \brief File to return Ajax response on Row move
  20. */
  21. if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
  22. if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
  23. if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
  24. if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
  25. if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
  26. if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
  27. require '../../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
  29. /*
  30. * View
  31. */
  32. top_httphead();
  33. print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
  34. // Registering the location of boxes
  35. if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST['table_element_line']) && ! empty($_POST['table_element_line']))
  36. && (isset($_POST['fk_element']) && ! empty($_POST['fk_element'])) && (isset($_POST['element_id']) && ! empty($_POST['element_id'])) )
  37. {
  38. $roworder=GETPOST('roworder','alpha',2);
  39. $table_element_line=GETPOST('table_element_line','alpha',2);
  40. $fk_element=GETPOST('fk_element','alpha',2);
  41. $element_id=GETPOST('element_id','int',2);
  42. dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
  43. $rowordertab = explode(',',$roworder);
  44. foreach($rowordertab as $value)
  45. {
  46. if (! empty($value)) $newrowordertab[] = $value;
  47. }
  48. $row=new GenericObject($db);
  49. $row->table_element_line = $table_element_line;
  50. $row->fk_element = $fk_element;
  51. $row->id = $element_id;
  52. $result=$row->line_ajaxorder($newrowordertab);
  53. // Reorder line to have position of chilren lines sharing same counter than parent lines
  54. // This should be useless because there is no need to have children sharing same counter that parent.
  55. if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
  56. {
  57. $result=$row->line_order(true);
  58. }
  59. }
  60. ?>