note.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 <http://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. require '../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  29. $action = GETPOST('action','aZ09');
  30. $langs->load("companies");
  31. // Security check
  32. $id = GETPOST('id')?GETPOST('id','int'):GETPOST('socid','int');
  33. if ($user->societe_id) $id=$user->societe_id;
  34. $result = restrictedArea($user, 'societe', $id, '&societe');
  35. $object = new Societe($db);
  36. if ($id > 0) $object->fetch($id);
  37. $permissionnote=$user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
  38. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  39. $hookmanager->initHooks(array('thirdpartynote','globalcard'));
  40. /*
  41. * Actions
  42. */
  43. include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
  44. /*
  45. * View
  46. */
  47. $form = new Form($db);
  48. $title=$langs->trans("ThirdParty").' - '.$langs->trans("Notes");
  49. if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Notes");
  50. $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
  51. llxHeader('',$title,$help_url);
  52. if ($object->id > 0)
  53. {
  54. /*
  55. * Affichage onglets
  56. */
  57. if (! empty($conf->notification->enabled)) $langs->load("mails");
  58. $head = societe_prepare_head($object);
  59. dol_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company');
  60. $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  61. dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
  62. $cssclass='titlefield';
  63. //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
  64. //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
  65. print '<div class="fichecenter">';
  66. print '<div class="underbanner clearboth"></div>';
  67. print '<table class="border centpercent">';
  68. if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
  69. {
  70. print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
  71. }
  72. if ($object->client)
  73. {
  74. print '<tr><td class="'.$cssclass.'">';
  75. print $langs->trans('CustomerCode').'</td><td colspan="3">';
  76. print $object->code_client;
  77. if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
  78. print '</td></tr>';
  79. }
  80. if ($object->fournisseur)
  81. {
  82. print '<tr><td class="'.$cssclass.'">';
  83. print $langs->trans('SupplierCode').'</td><td colspan="3">';
  84. print $object->code_fournisseur;
  85. if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
  86. print '</td></tr>';
  87. }
  88. print "</table>";
  89. print '</div>';
  90. //print '<br>';
  91. //print '<div class="underbanner clearboth"></div>';
  92. include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
  93. dol_fiche_end();
  94. }
  95. else
  96. {
  97. $langs->load("errors");
  98. print $langs->trans("ErrorRecordNotFound");
  99. }
  100. // End of page
  101. llxFooter();
  102. $db->close();