2012-03-16 09:39:32 +01:00
< ? php
2018-10-27 14:43:12 +02:00
/* Copyright ( C ) 2012 Regis Houssin < regis . houssin @ inodbox . com >
2017-07-25 12:44:55 +02:00
* Copyright ( C ) 2013 Florian Henry < florian . henry @ open - concept . pro >
* Copyright ( C ) 2014 - 2017 Laurent Destailleur < eldy @ destailleur . fr >
2012-03-16 09:39:32 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2012-03-16 09:39:32 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http :// www . gnu . org / licenses />.
*/
2017-12-21 13:32:16 +01:00
// Protection to avoid direct call of template
2018-10-27 11:06:45 +02:00
if ( empty ( $object ) || ! is_object ( $object )) {
2017-12-21 13:32:16 +01:00
print " Error, template page can't be called as URL " ;
exit ;
}
2017-09-29 17:43:32 +02:00
// $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create
// $cssclass must be defined by caller. For example $cssclass='fieldtitle"
2017-07-25 12:44:55 +02:00
$module = $object -> element ;
$note_public = 'note_public' ;
2013-04-09 17:18:07 +02:00
$note_private = 'note_private' ;
2012-03-18 02:01:23 +01:00
2015-10-13 13:06:32 +02:00
$colwidth = ( isset ( $colwidth ) ? $colwidth : ( empty ( $cssclass ) ? '25' : '' ));
2017-09-29 17:43:32 +02:00
// Set $permission from the $permissionnote var defined on calling page
$permission = ( isset ( $permissionnote ) ? $permissionnote : ( isset ( $permission ) ? $permission : ( isset ( $user -> rights -> $module -> create ) ? $user -> rights -> $module -> create : ( isset ( $user -> rights -> $module -> creer ) ? $user -> rights -> $module -> creer : 0 ))));
2012-03-18 02:01:23 +01:00
$moreparam = ( isset ( $moreparam ) ? $moreparam : '' );
2014-01-10 01:31:23 +01:00
$value_public = $object -> note_public ;
$value_private = $object -> note_private ;
2014-01-20 00:31:32 +01:00
if ( ! empty ( $conf -> global -> MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES ))
2014-01-10 01:31:23 +01:00
{
$stringtoadd = dol_print_date ( dol_now (), 'dayhour' ) . ' ' . $user -> getFullName ( $langs ) . ' --' ;
2017-05-16 13:27:32 +02:00
if ( GETPOST ( 'action' , 'aZ09' ) == 'edit' . $note_public )
2014-01-10 01:31:23 +01:00
{
$value_public = dol_concatdesc ( $value_public , ( $value_public ? " \n " : " " ) . " -- " . $stringtoadd );
if ( dol_textishtml ( $value_public )) $value_public .= " <br> \n " ;
else $value_public .= " \n " ;
}
2014-01-20 00:31:32 +01:00
}
if ( ! empty ( $conf -> global -> MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES ))
{
$stringtoadd = dol_print_date ( dol_now (), 'dayhour' ) . ' ' . $user -> getFullName ( $langs ) . ' --' ;
2017-05-16 13:27:32 +02:00
if ( GETPOST ( 'action' , 'aZ09' ) == 'edit' . $note_private )
2014-01-10 01:31:23 +01:00
{
$value_private = dol_concatdesc ( $value_private , ( $value_private ? " \n " : " " ) . " -- " . $stringtoadd );
if ( dol_textishtml ( $value_private )) $value_private .= " <br> \n " ;
else $value_private .= " \n " ;
}
}
2012-03-18 00:59:24 +01:00
// Special cases
2016-07-28 13:53:17 +02:00
if ( $module == 'propal' ) { $permission = $user -> rights -> propale -> creer ;}
2015-11-15 18:23:42 +01:00
elseif ( $module == 'supplier_proposal' ) { $permission = $user -> rights -> supplier_proposal -> creer ;}
2016-07-28 13:53:17 +02:00
elseif ( $module == 'fichinter' ) { $permission = $user -> rights -> ficheinter -> creer ;}
elseif ( $module == 'project' ) { $permission = $user -> rights -> projet -> creer ;}
elseif ( $module == 'project_task' ) { $permission = $user -> rights -> projet -> creer ;}
elseif ( $module == 'invoice_supplier' ) { $permission = $user -> rights -> fournisseur -> facture -> creer ;}
elseif ( $module == 'order_supplier' ) { $permission = $user -> rights -> fournisseur -> commande -> creer ;}
elseif ( $module == 'societe' ) { $permission = $user -> rights -> societe -> creer ;}
elseif ( $module == 'contact' ) { $permission = $user -> rights -> societe -> creer ;}
elseif ( $module == 'shipping' ) { $permission = $user -> rights -> expedition -> creer ;}
elseif ( $module == 'product' ) { $permission = $user -> rights -> produit -> creer ;}
2013-05-29 15:41:59 +02:00
//else dol_print_error('','Bad value '.$module.' for param module');
2012-03-16 09:39:32 +01:00
2018-06-29 15:57:34 +02:00
if ( ! empty ( $conf -> fckeditor -> enabled ) && ! 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.
2016-11-10 14:24:29 +01:00
else $typeofdata = 'textarea:12:95%' ;
2014-08-14 17:27:28 +02:00
2017-06-26 23:06:24 +02:00
print '<!-- BEGIN PHP TEMPLATE NOTES -->' . " \n " ;
print '<div class="tagtable border table-border centpercent">' . " \n " ;
if ( $module != 'product' ) {
2017-08-21 12:52:47 +02:00
// No public note yet on products
2018-03-01 11:51:25 +01:00
print '<div class="tagtr pair table-border-row">' . " \n " ;
2018-03-23 19:35:25 +01:00
print '<div class="tagtd tagtdnote tdtop table-key-border-col' . ( empty ( $cssclass ) ? '' : ' ' . $cssclass ) . '"' . ( $colwidth ? ' style="width: ' . $colwidth . '%"' : '' ) . '>' . " \n " ;
2017-06-26 23:06:24 +02:00
print $form -> editfieldkey ( " NotePublic " , $note_public , $value_public , $object , $permission , $typeofdata , $moreparam , '' , 0 );
print '</div>' . " \n " ;
print '<div class="tagtd table-val-border-col">' . " \n " ;
print $form -> editfieldval ( " NotePublic " , $note_public , $value_public , $object , $permission , $typeofdata , '' , null , null , $moreparam , 1 ) . " \n " ;
print '</div>' . " \n " ;
print '</div>' . " \n " ;
}
if ( empty ( $user -> societe_id )) {
2018-03-01 11:51:25 +01:00
print '<div class="tagtr ' . ( $module != 'product' ? 'impair' : 'pair' ) . ' table-border-row">' . " \n " ;
2018-03-23 19:35:25 +01:00
print '<div class="tagtd tagtdnote tdtop table-key-border-col' . ( empty ( $cssclass ) ? '' : ' ' . $cssclass ) . '"' . ( $colwidth ? ' style="width: ' . $colwidth . '%"' : '' ) . '>' . " \n " ;
2017-06-26 23:06:24 +02:00
print $form -> editfieldkey ( " NotePrivate " , $note_private , $value_private , $object , $permission , $typeofdata , $moreparam , '' , 0 );
print '</div>' . " \n " ;
print '<div class="tagtd table-val-border-col">' . " \n " ;
print $form -> editfieldval ( " NotePrivate " , $note_private , $value_private , $object , $permission , $typeofdata , '' , null , null , $moreparam , 1 );
print '</div>' . " \n " ;
print '</div>' . " \n " ;
2017-08-21 12:52:47 +02:00
}
2017-06-26 23:06:24 +02:00
print '</div>' . " \n " ;
2012-03-16 09:39:32 +01:00
?>
2012-03-17 23:32:28 +01:00
<!-- END PHP TEMPLATE NOTES -->