actions_fetchobject.inc.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
  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. * or see http://www.gnu.org/
  18. */
  19. /**
  20. * \file htdocs/core/actions_fetchobject.inc.php
  21. * \brief Code for actions on fetching object page
  22. */
  23. // $action must be defined
  24. // $object must be defined (object is loaded in this file with fetch)
  25. // $cancel must be defined
  26. // $id or $ref must be defined (object is loaded in this file with fetch)
  27. if (($id > 0 || (! empty($ref) && ! in_array($action, array('create','createtask')))) && empty($cancel))
  28. {
  29. $ret = $object->fetch($id,$ref);
  30. if ($ret > 0)
  31. {
  32. $object->fetch_thirdparty();
  33. $id = $object->id;
  34. }
  35. else
  36. {
  37. setEventMessages($object->error, $object->errors, 'errors');
  38. $action='';
  39. }
  40. }