notes.tpl.php 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
  3. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
  4. * Copyright (C) 2014 Laurent Destailleur <eldy@destailleur.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. // $cssclass must be defined by caller. For example cssclass='fieldtitle"
  20. $module = $object->element;
  21. $note_public = 'note_public';
  22. $note_private = 'note_private';
  23. $colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));
  24. $permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page
  25. $moreparam=(isset($moreparam)?$moreparam:'');
  26. $value_public=$object->note_public;
  27. $value_private=$object->note_private;
  28. if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES))
  29. {
  30. $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
  31. if (GETPOST('action') == 'edit'.$note_public)
  32. {
  33. $value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd);
  34. if (dol_textishtml($value_public)) $value_public.="<br>\n";
  35. else $value_public.="\n";
  36. }
  37. }
  38. if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
  39. {
  40. $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
  41. if (GETPOST('action') == 'edit'.$note_private)
  42. {
  43. $value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd);
  44. if (dol_textishtml($value_private)) $value_private.="<br>\n";
  45. else $value_private.="\n";
  46. }
  47. }
  48. // Special cases
  49. if ($module == 'propal') { $permission=$user->rights->propale->creer;}
  50. elseif ($module == 'supplier_proposal') { $permission=$user->rights->supplier_proposal->creer;}
  51. elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;}
  52. elseif ($module == 'project') { $permission=$user->rights->projet->creer;}
  53. elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;}
  54. elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;}
  55. elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;}
  56. elseif ($module == 'societe') { $permission=$user->rights->societe->creer;}
  57. elseif ($module == 'contact') { $permission=$user->rights->societe->creer;}
  58. elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;}
  59. //else dol_print_error('','Bad value '.$module.' for param module');
  60. if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:100'; // Rem: This var is for all notes, not only thirdparties note.
  61. else $typeofdata='textarea:12:100';
  62. ?>
  63. <!-- BEGIN PHP TEMPLATE NOTES -->
  64. <div class="border table-border centpercent">
  65. <div class="table-border-row">
  66. <div class="table-key-border-col<?php echo (empty($cssclass)?'':' '.$cssclass); ?>"<?php echo ($colwidth ? ' style="width: '.$colwidth.'%"' : ''); ?>><?php echo $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?></div>
  67. <div class="table-val-border-col"><?php echo $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam); ?></div>
  68. </div>
  69. <?php if (empty($user->societe_id)) { ?>
  70. <div class="table-border-row">
  71. <div class="table-key-border-col<?php echo (empty($cssclass)?'':' '.$cssclass); ?>"<?php echo ($colwidth ? ' style="width: '.$colwidth.'%"' : ''); ?>><?php echo $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?></div>
  72. <div class="table-val-border-col"><?php echo $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam); ?></div>
  73. </div>
  74. <?php } ?>
  75. </div>
  76. <!-- END PHP TEMPLATE NOTES-->