noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
All Data Structures Namespaces Files Functions Variables Pages
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 (Database $p_cn, $p_id=-1)
 document_type
 
 get ()
 Get all the data for this dt_id.
 
 set_number ($p_int)
 Restart the increment of the document.
 

Static Public Member Functions

static get_list ($p_cn)
 get a list
 

Data Fields

 $db
 Database conx.
 
 $dt_id
 $dt_id (int) primary key of DOCUMENT_TYPE
 
 $dt_prefix
 $dt_prefix (text) prefix to use for this
 
 $dt_value
 $dt_value (text) description of document type
 

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 ( Database $p_cn,
$p_id = -1 )

document_type

constructor

Parameters
$p_cndatabase connx

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

46 {
47 $this->db = $p_cn;
48 $this->dt_id = $p_id;
49 }
$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 55 of file document_type.class.php.

56 {
57 $sql = "select * from document_type where dt_id=$1";
58 $R = $this->db->exec_sql($sql, array($this->dt_id));
59 if ($this->db->count($R) == 0) return 1;
61 $this->dt_id = $r['dt_id'];
62 $this->dt_value = $r['dt_value'];
63 $this->dt_prefix = $r['dt_prefix'];
64 return 0;
65 }
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 72 of file document_type.class.php.

73 {
74 $sql = "select * from document_type order by dt_value";
75 $r = $p_cn->get_array($sql);
76 $array = array();
77 for ($i = 0; $i < count($r); $i++)
78 {
79 $tmp['dt_value'] = $r[$i]['dt_value'];
80 $tmp['dt_prefix'] = $r[$i]['dt_prefix'];
81
82 $bt = new IButton('M' . $r[$i]['dt_id']);
83 $bt->label = _('Modifier');
84 $bt->javascript = "cat_doc_change('" . $r[$i]['dt_id'] . "','" . Dossier::id() . "');";
85
86 $tmp['js_mod'] = $bt->input();
87 $tmp['dt_id'] = $r[$i]['dt_id'];
88
89 $bt = new IButton('X' . $r[$i]['dt_id']);
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() . "');})";
93
94 $tmp['js_remove'] = $bt->input();
95
96
97 $array[$i] = $tmp;
98 }
99 return $array;
100 }
_("actif, passif,charge,...")
static id()
return the 'gDossier' value after a check

References $array, $i, $r, $sql, $tmp, and _.

◆ set_number()

Document_Type::set_number ( $p_int)

Restart the increment of the document.

Parameters
type$p_int

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

107 {
108 try
109 {
110 $this->db->exec_sql("alter sequence seq_doc_type_" . $this->dt_id . " restart " . $p_int);
111 }
112 catch (Exception $e)
113 {
114 record_log($e);
115 alert("Erreur " . $e->getMessage());
116 }
117 }
record_log($p_message)
Record an error message into the log file of the server or in the log folder of NOALYSS Record also t...
alert($p_msg, $buffer=false)
alert in javascript

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

+ Here is the call graph for this function:

Field Documentation

◆ $db

Document_Type::$db

Database conx.

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

◆ $dt_id

Document_Type::$dt_id

$dt_id (int) primary key of DOCUMENT_TYPE

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

◆ $dt_prefix

Document_Type::$dt_prefix

$dt_prefix (text) prefix to use for this

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

◆ $dt_value

Document_Type::$dt_value

$dt_value (text) description of document type

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


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