diff --git a/include/class/periode.class.php b/include/class/periode.class.php index 44b4fc6f8..1e18583b9 100644 --- a/include/class/periode.class.php +++ b/include/class/periode.class.php @@ -346,7 +346,7 @@ class Periode $Res=$this->cn->exec_sql($sql, array($p_periode)); if (Database::num_row($Res)==0) return null; - return Database::fetch_array($Res, 0); + return Database::fetch_array($Res, 0,PGSQL_BOTH); } /*!\brief return the first day of periode diff --git a/include/lib/database_core.class.php b/include/lib/database_core.class.php index 19dbbc0cf..11b89ccb0 100644 --- a/include/lib/database_core.class.php +++ b/include/lib/database_core.class.php @@ -381,7 +381,7 @@ class DatabaseCore { if ($this->ret == false) throw new Exception('this->ret is empty'); - return pg_fetch_array($this->ret, $p_indice); + return pg_fetch_array($this->ret, $p_indice,PGSQL_ASSOC); } /** @@ -739,12 +739,13 @@ class DatabaseCore /**\brief wrapper for the function pg_fetch_array * \param $ret is the result of a pg_exec * \param $p_indice is the index + * \param $p_indice is the index * \return $array of column */ - static function fetch_array($ret, $p_indice = 0) + static function fetch_array($ret, $p_indice = 0,$p_mode=PGSQL_ASSOC) { - return pg_fetch_array($ret, $p_indice); + return pg_fetch_array($ret, $p_indice,$p_mode); } /**\brief wrapper for the function pg_fetch_all diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index 2dcb8899e..ccaec8118 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -85,7 +85,7 @@ class Manage_Table_SQL const UPDATABLE=1; const VISIBLE=2; - private $icon_mod; //!< place of right or left the icon update or mod, default right, accepted value=left,right,first column for mod + private $icon_mod; //!< place of right or left the icon update or mod, default right, accepted value=left,right,first,custom column for mod private $icon_del; //!< place of right or left the icon update or mod, default right, accepted value=left,right private $dialogbox_style; //!< style of the dialog box private $button_add_top; //!< place of the button add on the top, by default true @@ -573,13 +573,14 @@ function check() return $this->row_update; } /** - * @brief Set the icon to modify at the right ,the first col or left of the row - * - * @param type $pString - * @throws Exception + * @brief Set the icon to modify at the right ,the first col or left of the row, if the mod if custom , + * you have to override the function display_icon_custom + * @see Manage_Table_SQL::display_icon_custom($p_row) + * @param string $pString default right, accepted value=left,right,first,custom column for mod + * @throws Exception if invalide choice */ function set_icon_mod($pString) { - if ($pString != "right" && $pString != "left" && $pString!="first") + if (! in_array( $pString ,[ 'right','left','custom','first'] ) ) throw new Exception('set_icon_mod invalide '.$pString); $this->icon_mod=$pString; } @@ -987,6 +988,8 @@ function check() $this->display_icon_mod($p_row); if ($this->icon_del=="left") $this->display_icon_del($p_row); + if ( $this->icon_mod == "custom") + $this->display_icon_custom($p_row); $nb_order=count($this->a_order); for ($i=0; $i<$nb_order; $i++) @@ -1501,4 +1504,15 @@ function check() echo ""; } + /** + * @brief usually contain a link and calls another page, it must overriden + * @param array $p_row is the current database row + * @return void + */ + function display_icon_custom($p_row) + { + echo '