noalyss
Version-6.9.1.8
Main Page
Related Pages
Packages
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
include
class
class_acc_parm_code.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
// Copyright Author Dany De Bontridder danydb@aevalys.eu
20
/*! \file
21
* \brief Manage the table parm_code which contains the custom parameter
22
* for the module accountancy
23
*/
24
/*!
25
* \brief Manage the table parm_code which contains the custom parameter
26
* for the module accountancy
27
*/
28
require_once NOALYSS_INCLUDE.
'/lib/class_itext.php'
;
29
require_once NOALYSS_INCLUDE.
'/class/class_acc_account_ledger.php'
;
30
31
class
Acc_Parm_Code
32
{
33
var
$db
;
/*!< $db database connection */
34
var
$p_code
;
/*!< $p_code parm_code.p_code primary key */
35
var
$p_value
;
/*!< $p_value parm_code.p_value */
36
var
$p_comment
;
/*!< $p_comment parm_code.p_comment */
37
// constructor
38
function
__construct
($p_cn,
$p_id
=-1)
39
{
40
$this->
db
=$p_cn;
41
$this->p_code=
$p_id
;
42
if
(
$p_id
!= -1 )
43
$this->
load
();
44
}
45
/*!
46
**************************************************
47
* \brief
48
* Load all parmCode
49
* return an array of Acc_Parm_Code object
50
*
51
* \return array
52
*/
53
54
function
load_all
()
55
{
56
$sql
=
"select * from parm_code order by p_code"
;
57
$Res
=$this->
db
->exec_sql(
$sql
);
58
$r
=
Database::fetch_all
(
$Res
);
59
$idx
=0;
60
$array
=array();
61
62
if
(
$r
===
false
)
return
null;
63
foreach
(
$r
as
$row
)
64
{
65
$o=
new
Acc_Parm_Code
($this->
db
,$row[
'p_code'
]);
66
$array
[
$idx
]=$o;
67
$idx
++;
68
}
69
70
return
$array
;
71
}
72
/*!
73
**************************************************
74
* \brief update a parm_object into the database
75
* p_code is _not_ updatable
76
* \return
77
* nothing
78
*/
79
function
save
()
80
{
81
// if p_code=="" nothing to save
82
if
( $this->p_code== -1)
return
;
83
// check if the account exists
84
$acc
=
new
Acc_Account_Ledger
($this->
db
,$this->p_value);
85
if
(
$acc
->load() ==
false
)
86
{
87
alert
(_(
"Ce compte n'existe pas"
));
88
}
89
else
90
{
91
$this->p_comment=
sql_string
($this->p_comment);
92
$this->p_value=
sql_string
($this->p_value);
93
$this->p_code=
sql_string
($this->p_code);
94
$sql
=
"update parm_code set "
.
95
"p_comment='"
.$this->p_comment.
"' "
.
96
",p_value='"
.$this->p_value.
"' "
.
97
"where p_code='"
.$this->p_code.
"'"
;
98
$Res
=$this->
db
->exec_sql(
$sql
);
99
}
100
}
101
/*!
102
**************************************************
103
* \brief Display an object, with the <TD> tag
104
*
105
* \return
106
* string
107
*/
108
function
display
()
109
{
110
$r
=
""
;
111
$r
.=
'<TD>'
.$this->p_code.
'</TD>'
;
112
$r
.=
'<TD>'
.h($this->p_comment).
'</TD>'
;
113
$r
.=
'<TD>'
.$this->p_value.
'</TD>'
;
114
115
return
$r
;
116
}
117
/*!
118
**************************************************
119
* \brief Display a form to enter info about
120
* a parm_code object with the <TD> tag
121
*
122
* \return string
123
*/
124
function
form
()
125
{
126
$comment
=
new
IText
();
127
$comment
->name=
'p_comment'
;
128
$comment
->value=
$this->p_comment
;
129
$comment
->size=45;
130
$value
=
new
IPoste
();
131
$value
->name=
'p_value'
;
132
$value
->value=
$this->p_value
;
133
$value
->size=7;
134
$value
->set_attribute(
'ipopup'
,
'ipop_account'
);
135
$value
->set_attribute(
'account'
,
'p_value'
);
136
$poste
=
new
IText
();
137
$poste
->setReadOnly(
true
);
138
$poste
->size=strlen($this->p_code)+1;
139
$poste
->name=
'p_code'
;
140
$poste
->value=
$this->p_code
;
141
$r
=
""
;
142
$r
.=
'<tr>'
;
143
$r
.=
'<td align="right"> Code </td>'
;
144
$r
.=
'<TD>'
.$poste->input().
'</TD>'
;
145
$r
.=
'</tr>'
;
146
$r
.=
'<tr>'
;
147
$r
.=
'<td align="right"> Commentaire </td>'
;
148
$r
.=
'<TD>'
.$comment->input().
'</TD>'
;
149
$r
.=
'</tr>'
;
150
$r
.=
'<tr>'
;
151
$r
.=
'<td align="right"> Poste comptable </td>'
;
152
$r
.=
'<TD>'
.$value->input();
153
$r
.=
'<span id="p_value_label"></span></td>'
;
154
$r
.=
'</tr>'
;
155
$r
.=
Dossier::hidden
();
156
return
$r
;
157
158
}
159
160
/*!
161
**************************************************
162
* \brief
163
* Complete a parm_code object thanks the p_code
164
*
165
* \return array
166
*/
167
168
function
load
()
169
{
170
if
( $this->p_code == -1 )
return
"p_code non initialisé"
;
171
$sql
=
'select * from parm_code where p_code=$1 '
;
172
173
$Res
=$this->
db
->exec_sql(
$sql
,array($this->p_code));
174
175
if
(
Database::num_row
(
$Res
) == 0 )
return
'INCONNU'
;
176
$row
=
Database::fetch_array
(
$Res
,0);
177
$this->p_value=
$row
[
'p_value'
];
178
$this->p_comment=
$row
[
'p_comment'
];
179
180
}
181
182
}
$r
$r
Definition:
ajax_add_concerned_card.php:32
alert
alert($p_msg, $buffer=false)
alert in javascript
Definition:
ac_common.php:666
Database\fetch_all
static fetch_all($ret)
wrapper for the function pg_fetch_all
Definition:
class_database.php:947
$row
$row
Definition:
ajax_anc_key_compute.php:47
Acc_Parm_Code
Manage the table parm_code which contains the custom parameter for the module accountancy.
Definition:
class_acc_parm_code.php:31
sql_string
sql_string($p_string)
Fix the problem with the quote char for the database.
Definition:
ac_common.php:457
Acc_Parm_Code\display
display()
Display an object, with the tag.
Definition:
class_acc_parm_code.php:108
Database\num_row
static num_row($ret)
wrapper for the function pg_NumRows
Definition:
class_database.php:926
Acc_Parm_Code\$p_value
$p_value
Definition:
class_acc_parm_code.php:35
IPoste
show a button, for selecting a account and a input text for manually inserting an account the differe...
Definition:
class_iposte.php:79
Acc_Parm_Code\$db
$db
Definition:
class_acc_parm_code.php:33
$sql
$sql
Definition:
ajax_add_concerned_card.php:51
$Res
$Res
Definition:
export_security_pdf.php:111
Acc_Account_Ledger
Manage the account from the table jrn, jrnx or tmp_pcmn.
Definition:
class_acc_account_ledger.php:30
$acc
if($id== '') $acc
Definition:
ajax_bank_saldo.php:64
$value
$value
Definition:
doc_state.inc.php:65
Acc_Parm_Code\save
save()
update a parm_object into the database p_code is not updatable
Definition:
class_acc_parm_code.php:79
$array
$array
Definition:
ajax_boxcard_search.php:38
$idx
$idx
Definition:
ajax_bookmark.php:79
Database\fetch_array
static fetch_array($ret, $p_indice=0)
wrapper for the function pg_fetch_array
Definition:
class_database.php:937
Acc_Parm_Code\$p_comment
$p_comment
Definition:
class_acc_parm_code.php:36
Dossier\hidden
static hidden()
return a string to set gDossier into a FORM
Definition:
class_dossier.php:192
$p_id
$p_id
Definition:
ajax_display_submenu.php:36
IText
Definition:
class_itext.php:26
Acc_Parm_Code\form
form()
Display a form to enter info about a parm_code object with the tag.
Definition:
class_acc_parm_code.php:124
$comment
$comment
Definition:
operation_detail_fin.php:44
Acc_Parm_Code\load_all
load_all()
Load all parmCode return an array of Acc_Parm_Code object.
Definition:
class_acc_parm_code.php:54
false
return false
Definition:
action_search.php:45
db
$SecUser db
Definition:
export_security_pdf.php:112
Acc_Parm_Code\load
load()
Complete a parm_code object thanks the p_code.
Definition:
class_acc_parm_code.php:168
Acc_Parm_Code\__construct
__construct($p_cn, $p_id=-1)
Definition:
class_acc_parm_code.php:38
$poste
$poste
Definition:
lettering.account.inc.php:36
Acc_Parm_Code\$p_code
$p_code
Definition:
class_acc_parm_code.php:34