notes.tpl.php 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. // Protection to avoid direct call of template
  20. if (empty($object) || ! is_object($object))
  21. {
  22. print "Error, template page can't be called as URL";
  23. exit;
  24. }
  25. // $cssclass must be defined by caller. For example cssclass='fieldtitle"
  26. $module = $object->element;
  27. $note_public = 'note_public';
  28. $note_private = 'note_private';
  29. $colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));
  30. $permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page
  31. $moreparam=(isset($moreparam)?$moreparam:'');
  32. $value_public=$object->note_public;
  33. $value_private=$object->note_private;
  34. if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES))
  35. {
  36. $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
  37. if (GETPOST('action','aZ09') == 'edit'.$note_public)
  38. {
  39. $value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd);
  40. if (dol_textishtml($value_public)) $value_public.="<br>\n";
  41. else $value_public.="\n";
  42. }
  43. }
  44. if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
  45. {
  46. $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
  47. if (GETPOST('action','aZ09') == 'edit'.$note_private)
  48. {
  49. $value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd);
  50. if (dol_textishtml($value_private)) $value_private.="<br>\n";
  51. else $value_private.="\n";
  52. }
  53. }
  54. // Special cases
  55. if ($module == 'propal') { $permission=$user->rights->propale->creer;}
  56. elseif ($module == 'supplier_proposal') { $permission=$user->rights->supplier_proposal->creer;}
  57. elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;}
  58. elseif ($module == 'project') { $permission=$user->rights->projet->creer;}
  59. elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;}
  60. elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;}
  61. elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;}
  62. elseif ($module == 'societe') { $permission=$user->rights->societe->creer;}
  63. elseif ($module == 'contact') { $permission=$user->rights->societe->creer;}
  64. elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;}
  65. elseif ($module == 'product') { $permission=$user->rights->produit->creer;}
  66. //else dol_print_error('','Bad value '.$module.' for param module');
  67. if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
  68. else $typeofdata='textarea:12:95%';
  69. ?>
  70. <!-- BEGIN PHP TEMPLATE NOTES -->
  71. <div class="tagtable border table-border centpercent">
  72. <?php if ($module != 'product') { // No public note yet on products ?>
  73. <div class="tagtr table-border-row">
  74. <div class="tagtd tdtop 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, '', 0); ?></div>
  75. <div class="tagtd table-val-border-col"><?php echo $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?></div>
  76. </div>
  77. <?php } ?>
  78. <?php if (empty($user->societe_id)) { ?>
  79. <div class="tagtr table-border-row">
  80. <div class="tagtd tdtop 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, '', 0); ?></div>
  81. <div class="tagtd table-val-border-col"><?php echo $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?></div>
  82. </div>
  83. <?php } ?>
  84. </div>
  85. <!-- END PHP TEMPLATE NOTES-->