note.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  7. * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file htdocs/societe/note.php
  24. * \brief Tab for notes on third party
  25. * \ingroup societe
  26. */
  27. // Load Dolibarr environment
  28. require '../main.inc.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  30. // Load translation files required by the page
  31. $langs->load("companies");
  32. // Get parameters
  33. $id = GETPOST('id') ? GETPOST('id', 'int') : GETPOST('socid', 'int');
  34. $action = GETPOST('action', 'aZ09');
  35. // Initialize objects
  36. $object = new Societe($db);
  37. if ($id > 0) {
  38. $object->fetch($id);
  39. }
  40. // Permissions
  41. $permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
  42. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  43. $hookmanager->initHooks(array('thirdpartynote', 'globalcard'));
  44. // Security check
  45. if ($user->socid > 0) {
  46. unset($action);
  47. $socid = $user->socid;
  48. }
  49. $result = restrictedArea($user, 'societe', $object->id, '&societe');
  50. /*
  51. * Actions
  52. */
  53. $parameters = array();
  54. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  55. if ($reshook < 0) {
  56. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  57. }
  58. if (empty($reshook)) {
  59. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  60. }
  61. /*
  62. * View
  63. */
  64. $form = new Form($db);
  65. $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notes");
  66. if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
  67. $title = $object->name.' - '.$langs->trans("Notes");
  68. }
  69. $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
  70. llxHeader('', $title, $help_url);
  71. if ($object->id > 0) {
  72. /*
  73. * Affichage onglets
  74. */
  75. if (isModEnabled('notification')) {
  76. $langs->load("mails");
  77. }
  78. $head = societe_prepare_head($object);
  79. print dol_get_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company');
  80. $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  81. dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
  82. $cssclass = 'titlefield';
  83. //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
  84. //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
  85. print '<div class="fichecenter">';
  86. print '<div class="underbanner clearboth"></div>';
  87. print '<table class="border centpercent tableforfield">';
  88. // Type Prospect/Customer/Supplier
  89. print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
  90. print $object->getTypeUrl(1);
  91. print '</td></tr>';
  92. if (getDolGlobalString('SOCIETE_USEPREFIX')) { // Old not used prefix field
  93. print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
  94. }
  95. if ($object->client) {
  96. print '<tr><td class="'.$cssclass.'">';
  97. print $langs->trans('CustomerCode').'</td><td colspan="3">';
  98. print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
  99. $tmpcheck = $object->check_codeclient();
  100. if ($tmpcheck != 0 && $tmpcheck != -5) {
  101. print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
  102. }
  103. print '</td></tr>';
  104. }
  105. if ($object->fournisseur) {
  106. print '<tr><td class="'.$cssclass.'">';
  107. print $langs->trans('SupplierCode').'</td><td colspan="3">';
  108. print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
  109. $tmpcheck = $object->check_codefournisseur();
  110. if ($tmpcheck != 0 && $tmpcheck != -5) {
  111. print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
  112. }
  113. print '</td></tr>';
  114. }
  115. print "</table>";
  116. print '</div>';
  117. //print '<br>';
  118. //print '<div class="underbanner clearboth"></div>';
  119. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  120. print dol_get_fiche_end();
  121. } else {
  122. $langs->load("errors");
  123. print $langs->trans("ErrorRecordNotFound");
  124. }
  125. // End of page
  126. llxFooter();
  127. $db->close();