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

\ 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 32 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 39 of file document_type.class.php.

40  {
41  $this->db = $p_cn;
42  $this->dt_id = $p_id;
43  }

References $p_id, and db.

Member Function Documentation

◆ get()

Document_type::get ( )

Get all the data for this dt_id.

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

50  {
51  $sql = "select * from document_type where dt_id=$1";
52  $R = $this->db->exec_sql($sql, array($this->dt_id));
53  if ($this->db->count($R) == 0) return 1;
54  $r = Database::fetch_array($R, 0);
55  $this->dt_id = $r['dt_id'];
56  $this->dt_value = $r['dt_value'];
57  $this->dt_prefix = $r['dt_prefix'];
58  return 0;
59  }

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 66 of file document_type.class.php.

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

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 100 of file document_type.class.php.

101  {
102  try
103  {
104  $this->db->exec_sql("alter sequence seq_doc_type_" . $this->dt_id . " restart " . $p_int);
105  }
106  catch (Exception $e)
107  {
108  record_log($e);
109  alert("Erreur " . $e->getMessage());
110  }
111  }

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:
$e
$e
Definition: result_cat_card_summary.php:26
db
$SecUser db
Definition: export_security_pdf.php:118
DatabaseCore\fetch_array
static fetch_array($ret, $p_indice=0)
wrapper for the function pg_fetch_array
Definition: database_core.class.php:745
$sql
$sql
Definition: ajax_add_concerned_card.php:100
$array
$array
Definition: ajax_add_concerned_card.php:115
$i
$i
Definition: action_document_type_mtable_input.php:83
$r
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
Definition: ajax_add_concerned_card.php:53
Dossier\id
static id()
return the $_REQUEST['gDossier'] after a check
Definition: dossier.class.php:55
IButton
Definition: ibutton.class.php:25
alert
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:729
$tmp
$tmp
Definition: export_document_template.php:40
$p_id
$p_id
Definition: ajax_accounting.php:33
record_log
record_log($p_message)
Record an error message into the log file of the server.
Definition: ac_common.php:1383