56 $sql =
"select * from document_type where dt_id=$1";
57 $r = $this->
db->get_row(
$sql, array($this->dt_id));
58 if (
$r ==
null )
return 1;
60 $this->dt_id =
$r[
'dt_id'];
61 $this->dt_value =
$r[
'dt_value'];
62 $this->dt_prefix =
$r[
'dt_prefix'];
73 $sql =
"select * from document_type order by dt_value";
74 $r = $p_cn->get_array(
$sql);
79 $tmp[
'dt_value'] =
$r[
$i][
'dt_value'];
80 $tmp[
'dt_prefix'] =
$r[
$i][
'dt_prefix'];
83 $bt->label =
_(
'Modifier');
84 $bt->javascript =
"cat_doc_change('" .
$r[
$i][
'dt_id'] .
"','" . Dossier::id() .
"');";
86 $tmp[
'js_mod'] = $bt->input();
90 $bt->label =
_(
'Effacer');
91 $bt->javascript =
"confirm_box('X{$r[$i]['dt_id']}','" .
_(
'Vous confirmez') .
"',";
92 $bt->javascript.=
"function () { cat_doc_remove('{$r[$i]['dt_id']}','" . Dossier::id() .
"');})";
94 $tmp[
'js_remove'] = $bt->input();
110 $this->
db->exec_sql(
"alter sequence seq_doc_type_" . $this->dt_id .
" restart " . $p_int);
114 alert(
"Erreur " .
$e->getMessage());
120 return sprintf(
"dt_id : [%d] \n dt_value [%s] \n dt_prefix [%s]\n",$this->dt_id,$this->dt_value,$this->dt_prefix);
130 $cn=Dossier::connect();
131 function prv_echo_error(
$msg,
int $lineno) {
132 print '<p class="p-2 alert-danger">';
133 print "ERROR : $lineno";
141 $old_value[0]=
$cn->get_row(
'select * from document_type where dt_id=$1',[8]);
142 $old_value[1]=
$cn->get_row(
'select * from document_type where dt_id=$1',[6]);
144 $cn->exec_sql(
"update document_type set dt_value='Email' where dt_id=$1",[6]);
145 $cn->exec_sql(
"update document_type set dt_prefix='PML' where dt_id=$1",[8]);
165 if (count (
$list) == 0) {
166 prv_echo_error(
"GET_LIST :EMPTY",__LINE__);
168 foreach ([
'js_mod',
'dt_id',
'dt_value',
'dt_prefix',
'js_remove'] as $key) {
169 if ( ! isset (
$list[0][$key])) {
170 prv_echo_error (
'NOT SET '.$key,__LINE__);
173 var_dump(
$list[0][$key]);
178 }
catch (\Exception
$e) {
180 print_r(
$e->getTraceAsString());
alert($p_msg, $buffer=false)
alert in javascript
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
_("actif, passif,charge,...")
contains the class for connecting to Noalyss
class for the table document_type , a document_type is a kind of action in the follow up
$dt_prefix
prefix for numbering see SQL DOCUMENT_TYPE.DT_PREFIX
__construct(\Database $p_cn, int $dt_id=-1)
constructor document_type
$dt_id
primary key see SQL DOCUMENT_TYPE.DT_ID
$dt_value
description of the document see SQL DOCUMENT_TYPE.DT_VALUE
set_number(int $p_int)
Restart the increment of the document.
static test_me()
unit test for Document_Type
static get_list($p_cn)
get a list