note.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
  54. if ($reshook < 0) {
  55. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  56. }
  57. if (empty($reshook)) {
  58. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
  59. }
  60. /*
  61. * View
  62. */
  63. $form = new Form($db);
  64. $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notes");
  65. if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
  66. $title = $object->name.' - '.$langs->trans("Notes");
  67. }
  68. $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
  69. llxHeader('', $title, $help_url);
  70. if ($object->id > 0) {
  71. /*
  72. * Affichage onglets
  73. */
  74. if (isModEnabled('notification')) {
  75. $langs->load("mails");
  76. }
  77. $head = societe_prepare_head($object);
  78. print dol_get_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company');
  79. $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  80. dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
  81. $cssclass = 'titlefield';
  82. //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
  83. //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
  84. print '<div class="fichecenter">';
  85. print '<div class="underbanner clearboth"></div>';
  86. print '<table class="border centpercent tableforfield">';
  87. // Type Prospect/Customer/Supplier
  88. print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
  89. print $object->getTypeUrl(1);
  90. print '</td></tr>';
  91. if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
  92. print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
  93. }
  94. if ($object->client) {
  95. print '<tr><td class="'.$cssclass.'">';
  96. print $langs->trans('CustomerCode').'</td><td colspan="3">';
  97. print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
  98. $tmpcheck = $object->check_codeclient();
  99. if ($tmpcheck != 0 && $tmpcheck != -5) {
  100. print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
  101. }
  102. print '</td></tr>';
  103. }
  104. if ($object->fournisseur) {
  105. print '<tr><td class="'.$cssclass.'">';
  106. print $langs->trans('SupplierCode').'</td><td colspan="3">';
  107. print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
  108. $tmpcheck = $object->check_codefournisseur();
  109. if ($tmpcheck != 0 && $tmpcheck != -5) {
  110. print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
  111. }
  112. print '</td></tr>';
  113. }
  114. print "</table>";
  115. print '</div>';
  116. //print '<br>';
  117. //print '<div class="underbanner clearboth"></div>';
  118. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  119. print dol_get_fiche_end();
  120. } else {
  121. $langs->load("errors");
  122. print $langs->trans("ErrorRecordNotFound");
  123. }
  124. // End of page
  125. llxFooter();
  126. $db->close();