Merge pull request #2393 from aspangaro/develop-patch11
FIXED: Correct field note - Add note_private & use wysiwyg editor
This commit is contained in:
commit
57ecb543ae
@ -24,16 +24,17 @@
|
||||
|
||||
$res=0;
|
||||
require '../main.inc.php';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formmail.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formprojet.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/expensereport.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/price.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/modules/expensereport/modules_expensereport.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php");
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/expensereport.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/expensereport/modules_expensereport.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
|
||||
$langs->load("trips");
|
||||
|
||||
@ -111,7 +112,8 @@ if ($action == 'add' && $user->rights->expensereport->creer)
|
||||
$object->fk_c_expensereport_statuts = 1;
|
||||
$object->fk_c_paiement = GETPOST('fk_c_paiement','int');
|
||||
$object->fk_user_validator = GETPOST('fk_user_validator','int');
|
||||
$object->note = GETPOST('note');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
|
||||
if ($object->periode_existe($user,$object->date_debut,$object->date_fin))
|
||||
{
|
||||
@ -155,7 +157,8 @@ if ($action == 'update' && $user->rights->expensereport->creer)
|
||||
}
|
||||
|
||||
$object->fk_c_paiement = GETPOST('fk_c_paiement','int');
|
||||
$object->note = GETPOST('note');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result > 0)
|
||||
@ -1132,21 +1135,36 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Note").'</td>';
|
||||
print '<td>';
|
||||
print '<textarea name="note" class="flat" rows="'.ROWS_3.'" cols="100">'.GETPOST('note').'</textarea>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->societe_id)) {
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tbody>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<center>';
|
||||
print '<div align="center">';
|
||||
print '<input type="submit" value="'.$langs->trans("AddTrip").'" name="bouton" class="button" />';
|
||||
print ' <input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
|
||||
print '</center>';
|
||||
print ' <input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
@ -1196,8 +1214,6 @@ else
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<table class="border" style="width:100%;">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
@ -1270,19 +1286,34 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
}
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Note").'</td>';
|
||||
print '<td>';
|
||||
print '<textarea name="note" class="flat" rows="'.ROWS_2.'" cols="70">'.$object->note.'</textarea>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->societe_id)) {
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" value="'.$langs->trans("Modify").'" name="bouton" class="button"> ';
|
||||
print '<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
|
||||
print '<input type="submit" value="'.$langs->trans("Modify").'" name="bouton" class="button">';
|
||||
print ' <input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
@ -1369,8 +1400,12 @@ else
|
||||
print '<td>'.$object->getLibStatut(4).'</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Note").'</td>';
|
||||
print '<td>'.$object->note.'</td>';
|
||||
print '<td>'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td>'.$object->note_public.'</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td>'.$object->note_private.'</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountHT").'</td>';
|
||||
|
||||
@ -19,7 +19,8 @@ class ExpenseReport extends CommonObject
|
||||
var $total_ht;
|
||||
var $total_tva;
|
||||
var $total_ttc;
|
||||
var $note;
|
||||
var $note_public;
|
||||
var $note_private;
|
||||
var $date_debut;
|
||||
var $date_fin;
|
||||
|
||||
@ -134,7 +135,8 @@ class ExpenseReport extends CommonObject
|
||||
$sql.= ",fk_user_validator";
|
||||
$sql.= ",fk_c_expensereport_statuts";
|
||||
$sql.= ",fk_c_paiement";
|
||||
$sql.= ",note";
|
||||
$sql.= ",note_public";
|
||||
$sql.= ",note_private";
|
||||
$sql.= ") VALUES(";
|
||||
$sql.= "'(PROV)'";
|
||||
$sql.= ", ".$this->total_ht;
|
||||
@ -147,7 +149,8 @@ class ExpenseReport extends CommonObject
|
||||
$sql.= ", ".($this->fk_user_validator > 0 ? $this->fk_user_validator:"null");
|
||||
$sql.= ", ".($this->fk_c_expensereport_statuts > 1 ? $this->fk_c_expensereport_statuts:0);
|
||||
$sql.= ", ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null");
|
||||
$sql.= ", ".($this->note?"'".$this->db->escape($this->note)."'":"null");
|
||||
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||
@ -230,7 +233,8 @@ class ExpenseReport extends CommonObject
|
||||
$sql.= " , fk_user_paid = ".($this->fk_user_paid > 0 ? $this->fk_user_paid:"null");
|
||||
$sql.= " , fk_c_expensereport_statuts = ".($this->fk_c_expensereport_statuts >= 0 ? $this->fk_c_expensereport_statuts:'0');
|
||||
$sql.= " , fk_c_paiement = ".($this->fk_c_paiement > 0 ? $this->fk_c_paiement:"null");
|
||||
$sql.= " , note = ".(!empty($this->note)?"'".$this->db->escape($this->note)."'":"''");
|
||||
$sql.= " , note_public = ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"''");
|
||||
$sql.= " , note_private = ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"''");
|
||||
$sql.= " , detail_refuse = ".(!empty($this->detail_refuse)?"'".$this->db->escape($this->detail_refuse)."'":"''");
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
@ -258,7 +262,7 @@ class ExpenseReport extends CommonObject
|
||||
{
|
||||
global $conf,$db;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref, d.note,"; // DEFAULT
|
||||
$sql = "SELECT d.rowid, d.ref, d.note_public, d.note_private,"; // DEFAULT
|
||||
$sql.= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
|
||||
$sql.= " d.date_refuse, d.date_cancel,"; // ACTIONS
|
||||
$sql.= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int)
|
||||
@ -283,7 +287,8 @@ class ExpenseReport extends CommonObject
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->note = $obj->note;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->detail_refuse = $obj->detail_refuse;
|
||||
$this->detail_cancel = $obj->detail_cancel;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user