project.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  6. * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
  7. * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  8. * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. */
  23. /**
  24. * \file htdocs/societe/project.php
  25. * \ingroup societe
  26. * \brief Page of third party projects
  27. */
  28. require '../main.inc.php';
  29. require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  31. $langs->loadLangs(array("companies", "projects"));
  32. // Security check
  33. $socid = GETPOST('socid','int');
  34. if ($user->societe_id) $socid=$user->societe_id;
  35. $result = restrictedArea($user, 'societe', $socid, '&societe');
  36. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  37. $hookmanager->initHooks(array('projectthirdparty'));
  38. /*
  39. * Actions
  40. */
  41. $parameters=array('id'=>$socid);
  42. $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
  43. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  44. /*
  45. * View
  46. */
  47. $contactstatic = new Contact($db);
  48. $form = new Form($db);
  49. if ($socid)
  50. {
  51. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  52. require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
  53. $langs->load("companies");
  54. $object = new Societe($db);
  55. $result = $object->fetch($socid);
  56. $title=$langs->trans("Projects");
  57. if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
  58. llxHeader('',$title);
  59. if (! empty($conf->notification->enabled)) $langs->load("mails");
  60. $head = societe_prepare_head($object);
  61. dol_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company');
  62. $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  63. dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
  64. print '<div class="fichecenter">';
  65. print '<div class="underbanner clearboth"></div>';
  66. print '<table class="border centpercent">';
  67. if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
  68. {
  69. print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
  70. }
  71. if ($object->client)
  72. {
  73. print '<tr><td class="titlefield">';
  74. print $langs->trans('CustomerCode').'</td><td colspan="3">';
  75. print $object->code_client;
  76. if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
  77. print '</td></tr>';
  78. }
  79. if ($object->fournisseur)
  80. {
  81. print '<tr><td class="titlefield">';
  82. print $langs->trans('SupplierCode').'</td><td colspan="3">';
  83. print $object->code_fournisseur;
  84. if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
  85. print '</td></tr>';
  86. }
  87. print '</table>';
  88. print '</div>';
  89. dol_fiche_end();
  90. /*
  91. * Barre d'action
  92. */
  93. /*print '<div class="tabsAction">';
  94. if (! empty($conf->projet->enabled))
  95. {
  96. if (! empty($conf->projet->enabled) && ! empty($user->rights->projet->creer))
  97. {*/
  98. $addbutton = '<a href="'.DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
  99. /* }
  100. else
  101. {
  102. print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddProject").'</a>';
  103. }
  104. }
  105. print '</div>'; */
  106. print '<br>';
  107. // Projects list
  108. $result=show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $addbutton);
  109. }
  110. // End of page
  111. llxFooter();
  112. $db->close();