noalyss Version-9
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
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) {
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 {
81 $this->jrn_note_sql->setp("jr_id",$this->operation_id);
82 $this->jrn_note_sql->setp("n_text",$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 $this->jrn_note_sql->save();
89 $this->id=$this->jrn_note_sql->n_id;
90 return $this;
91 }
92 function setNote($p_note) {
93 $this->note=$p_note;
94
95 return $this;
96 }
97 function setOperation_id($p_jrid) {
98 $this->operation_id=$p_jrid;
99 return $this;
100 }
101 function getNote() {
102 return $this->note;
103 }
104 function getOperation_id() {
105 return $this->operation_id;
106 }
107 function load():void
108 {
109 $this->jrn_note_sql->load();
110 $this->operation_id=$this->jrn_note_sql->jr_id;
111 $this->note=$this->jrn_note_sql->n_text;
112 $this->id=$this->jrn_note_sql->n_id;
113 }
114 static function input($p_current)
115 {
116 require NOALYSS_TEMPLATE.'/acc_operation_note-input.php';
117 }
118 function fromPost()
119 {
120
121 }
122 function print()
123 {
124 echo '<pre id="print_note">'.h($this->note).'</pre>';
125 }
126}
setJrnNoteSql(Jrn_Note_SQL $jrn_note_sql)
__construct(Jrn_Note_SQL $p_Jrn_Note_SQL)
static connect()