noalyss Version-9
Public Member Functions | Static Public Member Functions
Document_Type Class Reference

class for the table document_type , a document_type is a kind of action in the follow up More...

+ Collaboration diagram for Document_Type:

Public Member Functions

 __construct ($p_cn, $p_id=-1)
 document_type More...
 
 get ()
 Get all the data for this dt_id. More...
 
 set_number ($p_int)
 Restart the increment of the document. More...
 

Static Public Member Functions

static get_list ($p_cn)
 get a list More...
 

Detailed Description

class for the table document_type , a document_type is a kind of action in the follow up

< dt_id pk document_type < dt_value value

Definition at line 34 of file document_type.class.php.

Constructor & Destructor Documentation

◆ __construct()

Document_Type::__construct (   $p_cn,
  $p_id = -1 
)

document_type

constructor

Parameters
$p_cndatabase connx

Definition at line 41 of file document_type.class.php.

42 {
43 $this->db = $p_cn;
44 $this->dt_id = $p_id;
45 }
$SecUser db

References $p_id, and db.

Member Function Documentation

◆ get()

Document_Type::get ( )

Get all the data for this dt_id.

Definition at line 51 of file document_type.class.php.

52 {
53 $sql = "select * from document_type where dt_id=$1";
54 $R = $this->db->exec_sql($sql, array($this->dt_id));
55 if ($this->db->count($R) == 0) return 1;
57 $this->dt_id = $r['dt_id'];
58 $this->dt_value = $r['dt_value'];
59 $this->dt_prefix = $r['dt_prefix'];
60 return 0;
61 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array

References $r, $sql, db, and DatabaseCore\fetch_array().

+ Here is the call graph for this function:

◆ get_list()

static Document_Type::get_list (   $p_cn)
static

get a list

Parameters
$p_cndatabase connection
Returns
array of data from document_type

Definition at line 68 of file document_type.class.php.

69 {
70 $sql = "select * from document_type order by dt_value";
71 $r = $p_cn->get_array($sql);
72 $array = array();
73 for ($i = 0; $i < count($r); $i++)
74 {
75 $tmp['dt_value'] = $r[$i]['dt_value'];
76 $tmp['dt_prefix'] = $r[$i]['dt_prefix'];
77
78 $bt = new IButton('M' . $r[$i]['dt_id']);
79 $bt->label = _('Modifier');
80 $bt->javascript = "cat_doc_change('" . $r[$i]['dt_id'] . "','" . Dossier::id() . "');";
81
82 $tmp['js_mod'] = $bt->input();
83 $tmp['dt_id'] = $r[$i]['dt_id'];
84
85 $bt = new IButton('X' . $r[$i]['dt_id']);
86 $bt->label = _('Effacer');
87 $bt->javascript = "confirm_box('X{$r[$i]['dt_id']}','" . _('Vous confirmez') . "',";
88 $bt->javascript.="function () { cat_doc_remove('{$r[$i]['dt_id']}','" . Dossier::id() . "');})";
89
90 $tmp['js_remove'] = $bt->input();
91
92
93 $array[$i] = $tmp;
94 }
95 return $array;
96 }
static id()
return the 'gDossier' value after a check
Html Input.

References $array, $i, $r, $sql, $tmp, and Dossier\id().

+ Here is the call graph for this function:

◆ set_number()

Document_Type::set_number (   $p_int)

Restart the increment of the document.

Parameters
type$p_int

Definition at line 102 of file document_type.class.php.

103 {
104 try
105 {
106 $this->db->exec_sql("alter sequence seq_doc_type_" . $this->dt_id . " restart " . $p_int);
107 }
108 catch (Exception $e)
109 {
110 record_log($e);
111 alert("Erreur " . $e->getMessage());
112 }
113 }
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1342
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738

References $e, alert(), db, and record_log().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: