noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
acc_operation_note.class.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20// Copyright Author Dany De Bontridder danydb@noalyss.eu
21
22/*!
23 * \file
24 * \brief Manage the note attached to an operation
25 */
26
27/*!
28 * \class Acc_Operation_Note
29 * \brief Manage the note attached to an operation
30 */
31
33{
34 private $note;
35 private $id;
36 private $operation_id; //!< jrn.jr_id
38
39 function __construct(Jrn_Note_SQL $p_Jrn_Note_SQL)
40 {
41 $this->jrn_note_sql = $p_Jrn_Note_SQL;
42 $this->id=$p_Jrn_Note_SQL->n_id;
43 $this->note=$p_Jrn_Note_SQL->n_text;
44 $this->operation_id=$p_Jrn_Note_SQL->jr_id;
45 }
46
47 /**
48 * @return Jrn_Note_SQL
49 */
50 public function getJrnNoteSql(): Jrn_Note_SQL
51 {
53 }
54
55 /**
56 * @param Jrn_Note_SQL $jrn_note_sql
57 */
59 {
60 $this->jrn_note_sql = $jrn_note_sql;
61 return $this;
62 }
63
64 /**
65 * @param $p_jr_id
66 * @return void
67 */
68 static function build_jrn_id($p_jr_id) {
69 $cn=Dossier::connect();
70 $n_id=$cn->get_value("select n_id from jrn_note where jr_id=$1",[$p_jr_id]);
71 if ( $cn->count() == 0) {
72 $n_id=-1;
73 }
74
75 return new Acc_Operation_Note(new Jrn_Note_SQL($cn,$n_id));
76
77 }
79 {
80 $cn=Dossier::connect();
81 $this->jrn_note_sql->setp("jr_id",$this->operation_id);
82 $this->jrn_note_sql->setp("n_text", strip_tags($this->note));
83
84 if ( empty($this->jrn_note_sql->n_text) && $this->id > -1 ) {
85 $this->jrn_note_sql->delete();
86 return $this;
87 }
88 // forbid the tag script, iframe and A
89 $n=str_ireplace('<script','<.script',$this->note);
90 $n=str_ireplace('<iframe','<.iframe',$n);
91 $n=str_ireplace('<a ','<.a',$n);
92
93 $this->jrn_note_sql->setp("n_html", $n);
94 $this->jrn_note_sql->save();
95 $this->id=$this->jrn_note_sql->n_id;
96 return $this;
97 }
98 function setNote($p_note) {
99 $this->note=$p_note;
100
101 return $this;
102 }
103 function setOperation_id($p_jrid) {
104 $this->operation_id=$p_jrid;
105 return $this;
106 }
107 function getNote() {
108 return $this->note;
109 }
110 function getOperation_id() {
111 return $this->operation_id;
112 }
113 function load():void
114 {
115 $this->jrn_note_sql->load();
116 $this->operation_id=$this->jrn_note_sql->jr_id;
117 $this->note=$this->jrn_note_sql->n_text;
118 $this->id=$this->jrn_note_sql->n_id;
119 }
120 static function input($p_current)
121 {
122 require NOALYSS_TEMPLATE.'/acc_operation_note-input.php';
123 }
124 function fromPost()
125 {
126
127 }
128 function print()
129 {
130 echo '<div id="print_note">'.h($this->note).'</div>';
131 }
132 /**
133 * @brief create a TEXTAREA to show HTML Note
134 * @param type $div_id
135 * @returns ITextarea
136 */
137 static function build_textarea($div_id)
138 {
139 $inote = new ITextarea('jrn_note');
140 $inote->id="{$div_id}_jrn_note";
141 $inote->set_enrichText("no-toolbar");
142 $inote->heigh=500;
143 return $inote;
144 }
145}
Manage the note attached to an operation.
setJrnNoteSql(Jrn_Note_SQL $jrn_note_sql)
static build_textarea($div_id)
create a TEXTAREA to show HTML Note
__construct(Jrn_Note_SQL $p_Jrn_Note_SQL)
Manage the TEXTAREA html element.
$n
Definition compute.php:54