diff --git a/html/js/scripts.js b/html/js/scripts.js index 81b05633c..daa1397d7 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -2946,7 +2946,7 @@ function init_scroll() "style":"padding:5px;left:auto;width:auto;height: auto;display:none;position:fixed;bottom:30%;right:50px;text-align:center;font-size:20px", id:"go_up" }); - up.innerHTML=' '; + up.innerHTML=' '; document.body.appendChild(up); window.onscroll=function () { if ( document.viewport.getScrollOffsets().top> 0) { diff --git a/include/ajax/ajax_anc_key_compute.php b/include/ajax/ajax_anc_key_compute.php index c04d643f5..63c48c76d 100644 --- a/include/ajax/ajax_anc_key_compute.php +++ b/include/ajax/ajax_anc_key_compute.php @@ -48,7 +48,7 @@ catch (Exception $exc) error_log($exc->getTraceAsString()); return; } - +ob_start(); $compute_key=new Anc_Key($key); $pos=strrpos($target,"t"); $row=substr($target,$pos+1); diff --git a/include/ajax/ajax_template_cat_category.php b/include/ajax/ajax_template_cat_category.php index 241b98954..529dcbda2 100644 --- a/include/ajax/ajax_template_cat_category.php +++ b/include/ajax/ajax_template_cat_category.php @@ -70,8 +70,7 @@ switch ($action) Dossier::id(), $frd_id, $objname, $ad_id); $answer['content']=$cn->get_value("select ad_text from attr_def where ad_id=$1", [$ad_id]). - HtmlInput::anchor(SMALLX, "javascript:void(0)", $js, - ' class="smallbutton" style="padding:0px;display:inline" '); + Icon_Action::trash(uniqid(), $js); } catch (Exception $exc) { diff --git a/include/anc_pa.inc.php b/include/anc_pa.inc.php index a795c35fd..f3fc67433 100644 --- a/include/anc_pa.inc.php +++ b/include/anc_pa.inc.php @@ -171,7 +171,7 @@ if ($sa=='anc_menu') echo '
'; echo ''; echo ''; echo '
'; - echo ''._("Ajout d'un plan comptable").''; + echo ''._("Ajout d'un plan analytique").''; echo '
'; @@ -191,7 +191,7 @@ if ($sa=='anc_menu') if ($obj->isAppend()==true) { echo ''; - echo ''._("Ajout d'un plan comptable").''; + echo ''._("Ajout d'un plan analytique").''; echo ''; } foreach ($list as $line) diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 165f79279..ad72cfcb3 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -714,7 +714,7 @@ class Acc_Ledger extends jrn_def_sql // CA if ($g_parameter->MY_ANALYTIC!='nu') // use of AA { - if (preg_match("/^[6,7]+/", $strPoste)==1) + if ($g_parameter->match_analytic( $strPoste)==TRUE) { // show form $op=new Anc_Operation($this->db); @@ -1293,7 +1293,7 @@ class Acc_Ledger extends jrn_def_sql $tot_cred+=($acc_op->type=='c')?$acc_op->amount:0; if ($g_parameter->MY_ANALYTIC!="nu") { - if (preg_match("/^[6,7]+/", $poste)==1) + if ($g_parameter->match_analytic( $poste)==TRUE) { // for each item, insert into operation_analytique */ @@ -2357,10 +2357,12 @@ class Acc_Ledger extends jrn_def_sql { throw new Exception(_('Choix du type de journal est obligatoire')); } - if ($negative_amount == 1 && trim($negative_warning)=="") { + + if (isset( $negative_warning) && $negative_amount == 1 && trim($negative_warning)=="") { + throw new Exception(_("Avertissement ne peut être vide")); } - if ( $negative_amount <> 0 && $negative_amount <> 1 ){ + if ( isset( $negative_amount) && $negative_amount <> 0 && $negative_amount <> 1 ){ throw new Exception(_("Valeur invalide")); } } @@ -2391,8 +2393,8 @@ class Acc_Ledger extends jrn_def_sql $this->jrn_deb_max_line=($min_row<1)?1:$min_row; $this->jrn_def_description=$p_description; $this->jrn_enable=$jrn_enable; - $this->jrn_def_negative_amount=$negative_amount; - $this->jrn_def_negative_warning=$negative_warning; + $this->jrn_def_negative_amount=(isset($negative_amount))?$negative_amount:'0'; + $this->jrn_def_negative_warning=(isset ($negative_warning))?$negative_warning:_("Attention, ce journal doit utiliser des montants négatifs"); switch ($this->jrn_def_type) { diff --git a/include/class/acc_ledger_fin.class.php b/include/class/acc_ledger_fin.class.php index b9023ac70..c27c16c75 100644 --- a/include/class/acc_ledger_fin.class.php +++ b/include/class/acc_ledger_fin.class.php @@ -612,7 +612,7 @@ class Acc_Ledger_Fin extends Acc_Ledger } $r.=''; // encode the pa - if ($g_parameter->MY_ANALYTIC != 'nu' && preg_match("/^[6,7]/", $fTiers->strAttribut(ATTR_DEF_ACCOUNT)) == 1) // use of AA + if ($g_parameter->MY_ANALYTIC != 'nu' && $g_parameter->match_analytic($fTiers->strAttribut(ATTR_DEF_ACCOUNT)) == 1) // use of AA { // show form $anc_op = new Anc_Operation($this->db); diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index f47974928..2ac7becc3 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -656,7 +656,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger Stock_Goods::insert_goods($this->db,array('j_id'=>$j_id,'goods'=>${'e_march'.$i},'quant'=>$nNeg*${'e_quant'.$i},'dir'=>$dir,'repo'=>$repo)) ; } - if ( $g_parameter->MY_ANALYTIC != "nu" ) + if ( $g_parameter->MY_ANALYTIC != "nu" && $g_parameter->match_analytic($poste_val)) { // for each item, insert into operation_analytique */ $op=new Anc_Operation($this->db); diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php index 40e0ca6a3..9506dddeb 100644 --- a/include/class/acc_ledger_search.class.php +++ b/include/class/acc_ledger_search.class.php @@ -282,7 +282,13 @@ class Acc_Ledger_Search */ public function build_search_sql($p_array, $p_order="", $p_where="") { - $sql="select jr_id , + $sql="with cas as ( + select distinct jr_id + from jrn + join jrnx on (jr_grpt_id=j_grpt) + where + exists(select 1 from operation_analytique where j_id=jrnx.j_id) ) + select jr_id , jr_montant, substr(jr_comment,1,60) as jr_comment, to_char(jr_ech,'DD.MM.YY') as str_jr_ech, @@ -336,11 +342,15 @@ class Acc_Ledger_Search else null end as total_invoice, jr_date_paid, - to_char(jr_date_paid,'DD.MM.YY') as str_jr_date_paid + to_char(jr_date_paid,'DD.MM.YY') as str_jr_date_paid, + cas.jr_id as analytic_op from - jrn as X left join jrn_note using(jr_id) + jrn as X + left join jrn_note using(jr_id) + left join cas using( jr_id) join jrn_def on jrn_def_id=jr_def_id - join parm_periode on p_id=jr_tech_per"; + join parm_periode on p_id=jr_tech_per + "; if (!empty($p_array)) extract($p_array, EXTR_SKIP); @@ -771,6 +781,8 @@ class Acc_Ledger_Search $r.=""; $tmp_jr_comment=h($row['jr_comment']); $r.=$tmp_jr_comment; + if ( $row['analytic_op'] != "") + $r.=sprintf(''); $r.=""; $r.=td(h($row['n_text']), ' style="font-size:0.87em%"'); // Amount diff --git a/include/class/acc_ledger_sold.class.php b/include/class/acc_ledger_sold.class.php index ae4535a38..8a6ff3e7b 100644 --- a/include/class/acc_ledger_sold.class.php +++ b/include/class/acc_ledger_sold.class.php @@ -364,7 +364,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { } - if ($g_parameter->MY_ANALYTIC != "nu") { + if ($g_parameter->MY_ANALYTIC != "nu" && $g_parameter->match_analytic($poste_val)) { // for each item, insert into operation_analytique */ $op = new Anc_Operation($this->db); $op->oa_group = $group; @@ -819,7 +819,8 @@ class Acc_Ledger_Sold extends Acc_Ledger { $r.=''; } // encode the pa - if ($g_parameter->MY_ANALYTIC != 'nu') { // use of AA + if ($g_parameter->MY_ANALYTIC != 'nu' + && $g_parameter->match_analytic($fiche->strAttribut(ATTR_DEF_ACCOUNT))==TRUE) { // use of AA // show form $anc_op = new Anc_Operation($this->db); $null = ($g_parameter->MY_ANALYTIC == 'op') ? 1 : 0; diff --git a/include/class/anc_key.class.php b/include/class/anc_key.class.php index f553a53f2..ed06eb074 100644 --- a/include/class/anc_key.class.php +++ b/include/class/anc_key.class.php @@ -324,6 +324,7 @@ class Anc_Key { $val[$number][$i]=bcmul($p_amount,$a_amount[$i]['ke_percent']); $val[$number][$i]=bcdiv($val[$number][$i],100); + $val[$number][$i]=abs($val[$number][$i]); } $array['val']=$val; diff --git a/include/class/anc_plan.class.php b/include/class/anc_plan.class.php index 93bb90608..fb5b69f21 100644 --- a/include/class/anc_plan.class.php +++ b/include/class/anc_plan.class.php @@ -59,6 +59,7 @@ class Anc_Plan "pa_description as description from plan_analytique $p_order"; $ret=$this->db->exec_sql($sql); $array=Database::fetch_all($ret); + if ($array == FALSE ) return array(); return $array; } diff --git a/include/class/noalyss_parameter_folder.class.php b/include/class/noalyss_parameter_folder.class.php index 8f784429e..a9db097bb 100644 --- a/include/class/noalyss_parameter_folder.class.php +++ b/include/class/noalyss_parameter_folder.class.php @@ -45,6 +45,7 @@ class Noalyss_Parameter_Folder var $MY_ALPHANUM; var $MY_UPDLAB; var $MY_STOCK; + var $MY_ANC_FILTER; // constructor function __construct($p_cn) @@ -61,14 +62,51 @@ class Noalyss_Parameter_Folder } } - function check(&$p_value) + function check_anc_filter($p_value) { - if ($p_value == 'MY_STRICT' - && $this->MY_STRICT != 'Y' - && $this->MY_STRICT != 'N') - $p_value='N'; - $p_value=htmlspecialchars($p_value); + $tmp_value=$p_value; + $tmp_value=preg_replace("/[0-9]|,/", '', $p_value); + if ( $tmp_value != "") { + throw new Exception (sprintf(_("Valeur invalide %s"),$tmp_value),1000); + } + if (trim($p_value) == "") { + throw new Exception (sprintf(_("Erreur Filtre analytique %s"),$tmp_value),1001); + + } + } + function check($p_attr, $p_value) + { + $ret_value=$p_value; + switch ($p_attr) + { + case 'MY_STRICT': + + if (empty(trim($p_value)) ||($p_value!='Y'&&$p_value!='N')) + { + $ret_value='N'; + } + + break; + case 'MY_ANC_FILTER': + try + { + $p_value=str_replace(" ", "", $p_value); + $this->check_anc_filter($p_value); + $ret_value=$p_value; + } + catch (Exception $exc) + { + throw $exc; + } + + break; + default : + $ret_value=htmlspecialchars($p_value); + } + return $ret_value; + } + /*! ************************************************** * \brief save the parameter into the database by inserting or updating @@ -79,20 +117,24 @@ class Noalyss_Parameter_Folder */ function save($p_attr) { - $this->check($p_attr); - $value=$this->$p_attr; - // check if the parameter does exist - if ( $this->db->get_value('select count(*) from parameter where pr_id=$1',array($p_attr)) != 0 ) - { - $Res=$this->db->exec_sql("update parameter set pr_value=$1 where pr_id=$2", - array($value,$p_attr)); - } - else - { + try { + $value=$this->check($p_attr,$this->$p_attr); - $Res=$this->db->exec_sql("insert into parameter (pr_id,pr_value) values( $1,$2)", - array($p_attr,$value)); + // check if the parameter does exist + if ( $this->db->get_value('select count(*) from parameter where pr_id=$1',array($p_attr)) != 0 ) + { + $Res=$this->db->exec_sql("update parameter set pr_value=$1 where pr_id=$2", + array($value,$p_attr)); + } + else + { + $Res=$this->db->exec_sql("insert into parameter (pr_id,pr_value) values( $1,$2)", + array($p_attr,$value)); + + } + } catch (Exception $e) { + throw $e; } } @@ -124,8 +166,19 @@ class Noalyss_Parameter_Folder $this->save('MY_ALPHANUM'); $this->save('MY_UPDLAB'); $this->save('MY_STOCK'); + $this->save("MY_ANC_FILTER"); - + } + /** + * Check if an accounting match the anc_filter + * @param string $p_accounting + * @return boolean FALSE does not match , TRUE matches + */ + function match_analytic($p_accounting) + { + $string="/^[".$this->MY_ANC_FILTER."]+/"; + if ( preg_match($string,$p_accounting) == 0 ) return FALSE; + return TRUE; } } diff --git a/include/class/payment_method_mtable.class.php b/include/class/payment_method_mtable.class.php index f67b60218..ab655a7d7 100644 --- a/include/class/payment_method_mtable.class.php +++ b/include/class/payment_method_mtable.class.php @@ -26,6 +26,7 @@ * @see ajax_payment_method.php */ require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php"; +require_once NOALYSS_INCLUDE."/database/jrn_def_sql.class.php"; class Payment_Method_MTable extends Manage_Table_SQL { @@ -92,11 +93,15 @@ class Payment_Method_MTable extends Manage_Table_SQL $this->set_error("mp_lib", _("Un libellé est obligatoire")); $has_error++; } - if (trim ($table->mp_qcode) != "" && $a_row['jrn_def_type'] != 'FIN') { - $fiche=new Fiche($cn); - if ( $fiche->get_by_qcode($table->mp_qcode,FALSE) == 1) { - $this->set_error("mp_qcode",_("Fiche inexistante")); - $has_error++; + + if (trim ($table->mp_qcode) != "") { + $ledger=new Jrn_def_SQL($cn , $table->jrn_def_id); + if ( $ledger->get('jrn_def_type') == 'FIN'){ + $fiche=new Fiche($cn); + if ( $fiche->get_by_qcode($table->mp_qcode,FALSE) == 1) { + $this->set_error("mp_qcode",_("Fiche inexistante")); + $has_error++; + } } } // get the type of the ledger diff --git a/include/class/template_card_category.class.php b/include/class/template_card_category.class.php index b5b7e439b..ee2e743c8 100644 --- a/include/class/template_card_category.class.php +++ b/include/class/template_card_category.class.php @@ -134,10 +134,9 @@ class Template_Card_Category extends Manage_Table_SQL if (!in_array($a_attribut[$i]['ad_id'], [ATTR_DEF_NAME, ATTR_DEF_QUICKCODE])&&$used==0) { // allow to remove attribute - $js=sprintf("onclick=\"category_card.remove_attribut('%s','%s','%s',%d)\"", + $js=sprintf("category_card.remove_attribut('%s','%s','%s',%d)", Dossier::id(), $this->table->frd_id, $objname, $a_attribut[$i]['ad_id']); - echo HtmlInput::anchor(SMALLX, "", $js, - ' class="smallbutton" style="padding:0px;display:inline" '); + echo Icon_Action::trash(uniqid(), $js); } echo ''; } @@ -159,9 +158,7 @@ class Template_Card_Category extends Manage_Table_SQL echo $sel_attribut->input(); $js_script=sprintf("category_card.add_attribut('%s','%s','%s')", $dossier_id, $this->table->frd_id, $objname); - echo HtmlInput::button_image($js_script, uniqid(), - 'class="smallbutton image_search"', - "image/bouton-plus.png"); + echo Icon_Action::icon_add(uniqid(), $js_script); } } } diff --git a/include/company.inc.php b/include/company.inc.php index c7dcc540e..2bd6ae279 100644 --- a/include/company.inc.php +++ b/include/company.inc.php @@ -48,8 +48,12 @@ if (isset($_POST['record_company'])) $m->MY_ALPHANUM = $http->post("p_alphanum"); $m->MY_UPDLAB = $http->post("p_updlab"); $m->MY_STOCK =$http->post("p_stock"); - - $m->Update(); + $m->MY_ANC_FILTER=$http->post("p_anc_filter"); + try { + $m->Update(); + } catch (Exception $e) { + alert($e->getMessage()); + } } $my = new Noalyss_Parameter_Folder($cn); @@ -111,6 +115,10 @@ $stock->value = array( $stock->selected = $my->MY_STOCK; $stock->table = 1; +$anc_filter=new IText("p_anc_filter", $my->MY_ANC_FILTER); +$anc_filter->placeholder='6,7'; +$anc_filter->title=_("Uniquement des chiffres séparés par des virgules"); + // other parameters $all = new IText(); $all->table = 1; @@ -135,6 +143,12 @@ echo "" . td(_("Pays"), 'style="text-align:right"') . $all->input("p_pays", $all->value = ''; echo "" . td(_("Numéro de Tva"), 'style="text-align:right"') . $all->input("p_tva", $my->MY_TVA) . ""; echo "" . td(_("Utilisation de la compta. analytique"), 'style="text-align:right"') . $compta->input("p_compta", $array) . ""; +echo ''. td(_("Opération analytique uniquement pour les postes comptables commençant par")). + ''. + $anc_filter->input(). + Icon_Action::tips($anc_filter->title); + ''. + ''; echo "" . td(_("Utilisation des stocks"), 'style="text-align:right"') . $stock->input() . ""; echo "" . td(_("Utilisation du mode strict "), 'style="text-align:right"') . $strict->input("p_strict", $strict_array) . ""; diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index 578451b3c..65f3d3fa5 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -68,7 +68,6 @@ if (isset($_POST['view_invoice'])) echo '
'; echo '
'; echo h1(_("Confirmation")); - echo h1(_("Confirmation")); echo span(_("Vous devez encore confirmer"),' class="notice"'); echo '
'; @@ -312,4 +311,4 @@ echo '
'; return; // end record invoice -?> \ No newline at end of file +?> diff --git a/include/constant.php b/include/constant.php index d157706d8..cb856c36b 100644 --- a/include/constant.php +++ b/include/constant.php @@ -108,7 +108,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) { if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",137); +define ("DBVERSION",138); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",18); define ('NOTFOUND','--not found--'); diff --git a/include/history_operation.inc.php b/include/history_operation.inc.php index 3a0ceb77d..50f0e1104 100644 --- a/include/history_operation.inc.php +++ b/include/history_operation.inc.php @@ -110,6 +110,11 @@ $max_line = $cn->count_sql($sql); $step = $_SESSION['g_pagesize']; $page = (isset($_GET['offset'])) ? $_GET['page'] : 1; $offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0; + +// check if number +$page=(isNumber($page)==0)?1:$page; +$offset=(isNumber($offset)==0)?0:$offset; + $bar = navigation_bar($offset, $max_line, $step, $page); echo $msg; @@ -142,13 +147,16 @@ $r = HtmlInput::get_to_hidden(array('search_opnb_jrn', 'search_opr_jrn')); if (isset($_GET['r_jrn'])) { - foreach ($_GET['r_jrn'] as $k => $v) - $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); + $a_rjn=$http->get('r_jrn','array'); + foreach ($a_rjn as $k => $v) { + if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); + } } if (isset($_GET['search_opr_jrn'])) { - foreach ($_GET['search_opr_jrn'] as $k => $v) - $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); + $a_search_opr_jrn=$http->get('search_opr_jrn','array'); + foreach ($a_search_opr_jrn as $k => $v) + if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); } echo $r; @@ -164,13 +172,13 @@ $r = HtmlInput::get_to_hidden(array('l', 'date_paid_start','date_paid_end', 'accounting', 'unpaid', 'gDossier', 'ledger_type', 'p_action')); if (isset($_GET['search_opr_jrn'])) { - foreach ($_GET['search_opr_jrn'] as $k => $v) - $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); + foreach ($a_search_opr_jrn as $k => $v) + if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); } if (isset($_GET['r_jrn'])) { - foreach ($_GET['r_jrn'] as $k => $v) - $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); + foreach ($a_rjn as $k => $v) + if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v); } echo '
'; echo $r; diff --git a/include/lib/data_sql.class.php b/include/lib/data_sql.class.php index 5b45aa482..e3bdb1656 100644 --- a/include/lib/data_sql.class.php +++ b/include/lib/data_sql.class.php @@ -42,12 +42,41 @@ * After you call the parent constructor * @note the view or the table must include an unique key, otherwise the load * doesn't work. + * + * @pnote + * Name is an array the key is the logical name and the value is the name of the column + @code + $this->name=array( + "id"=>"o_id", + "program"=>"o_prog", + "date"=>"o_date", + "qcode"=>"o_qcode", + "fiche"=>"f_id", + ); +@endcode * + the type is an array , key = column name , value = type + + * @code + $this->type = array( + "o_id"=>"numeric", + "o_prog"=>"numeric", + "o_date"=>"date", + "o_qcode"=>"text", + "f_id"=>"numeric", + ); +@endcode + * */ abstract class Data_SQL { - - function __construct($p_cn, $p_id=-1) + private $cn; //! Database connection + var $name; //! Array of logical and real name + var $primary_key; //! Column name of the primary key + var $type; //! Type of the data + var $date_format; //! defaullt date format + + function __construct(DatabaseCore $p_cn, $p_id=-1) { $this->cn=$p_cn; $pk=$this->primary_key; @@ -64,6 +93,7 @@ abstract class Data_SQL $this->$pk=$p_id; /* load it */ if ($p_id != -1 )$this->load(); + if ( empty($this->date_format) ) $this->date_format="DD.MM.YYYY"; } /** * Insert or update : if the row already exists, update otherwise insert @@ -263,6 +293,63 @@ abstract class Data_SQL * @return integer 0 doesn't exist , 1 exists */ abstract function exist() ; + public function get_cn() + { + return $this->cn; + } + + public function get_name() + { + return $this->name; + } + + public function get_primary_key() + { + return $this->primary_key; + } + + public function get_type() + { + return $this->type; + } + + public function set_cn($cn) + { + $this->cn=$cn; + return $this; + } + /** + * + * @param string $name + * @return $this + */ + public function set_name($name) + { + $this->name=$name; + return $this; + } + /** + * + * @param string $primary_key + * @return $this + */ + public function set_primary_key($primary_key) + { + $this->primary_key=$primary_key; + return $this; + } + /** + * + * @param array $type + * @return $this + */ + public function set_type($type) + { + $this->type=$type; + return $this; + } + + } ?> diff --git a/include/lib/database_core.class.php b/include/lib/database_core.class.php index c4fb518ac..8a8d3d24c 100644 --- a/include/lib/database_core.class.php +++ b/include/lib/database_core.class.php @@ -946,6 +946,14 @@ class DatabaseCore $csv->write(); } } + /** + * Returns the number of columns in a ret + * @param handler $p_ret handler to a query + */ + static function nb_column($p_ret) { + return pg_num_fields($p_ret); + } + } /* test::test_me(); */ diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php index 485e4802f..90cca74b5 100644 --- a/include/lib/icon_action.class.php +++ b/include/lib/icon_action.class.php @@ -96,13 +96,31 @@ class Icon_Action */ static function tips($p_comment) { - $p_comment=htmlentities($p_comment); + $p_comment=str_replace("'",' ',$p_comment); $r=''; $r.=""; $r.=''; return $r; } + /** + * Display a info in a bubble, text is given as parameter + * @param string $p_comment + * + * @return html string + */ + static function comment($p_comment) + { + $p_comment=str_replace("'",' ',$p_comment); + $js=sprintf("displayBulle('%s')",$p_comment); + + $r=sprintf('', + $js,$js); + $r.=""; + $r.=''; + + return $r; + } /** * Display a icon ON * @param string $p_div id of element @@ -177,7 +195,7 @@ class Icon_Action */ static function warnbulle($p_comment) { - $r=sprintf('', + $r=sprintf('', $p_comment, $p_comment); return $r; @@ -307,4 +325,21 @@ class Icon_Action $lock_cur); return $r; } + /** + * Display the icon of a slider + * @param string $p_id DOMid + * @param string $p_javascript + * @return htmlString + */ + static function slider($p_id,$p_javascript) + { + + $lock_cur=""; + + $r=sprintf( '%s', + $p_id, + $p_javascript, + $lock_cur); + return $r; + } } diff --git a/include/lib/noalyss_sql.class.php b/include/lib/noalyss_sql.class.php index 0e23ca832..aa40129f1 100644 --- a/include/lib/noalyss_sql.class.php +++ b/include/lib/noalyss_sql.class.php @@ -87,6 +87,7 @@ require NOALYSS_INCLUDE."/lib/data_sql.class.php"; abstract class Noalyss_SQL extends Data_SQL { + var $default; function __construct(&$p_cn, $p_id=-1) { $this->cn=$p_cn; @@ -104,6 +105,7 @@ abstract class Noalyss_SQL extends Data_SQL $this->$pk=$p_id; /* load it */ if ($p_id != -1 )$this->load(); + } /** * Insert or update : if the row already exists, update otherwise insert @@ -255,23 +257,8 @@ abstract class Noalyss_SQL extends Data_SQL public function load() { - $sql=" select "; - $sep=""; - foreach ($this->name as $key) { - switch ($this->type[$key]) - { - case "date": - $sql .= $sep.'to_char('.$key.",'".$this->date_format."') as ".$key; - break; - default: - $sql.=$sep.$key; - } - $sep=","; - } + $sql=$this->build_query(); $pk=$this->primary_key; - $sql.=" from ".$this->table; - - $sql.=" where ".$this->primary_key." = $1"; $result=$this->cn->get_array($sql,array ($this->$pk)); if ($this->cn->count()==0) @@ -412,6 +399,33 @@ abstract class Noalyss_SQL extends Data_SQL $count=$this->cn->get_value("select count(*) from ".$this->table." where ".$this->primary_key."=$1",array($this->$pk)); return $count; } + + /** + * Build the SQL select statement for querying the object and returns it + * @return string Query of the object + */ + public function build_query() + { + $sql=" select "; + $sep=""; + foreach ($this->name as $key) { + switch ($this->type[$key]) + { + case "date": + $sql .= $sep.'to_char('.$key.",'".$this->date_format."') as ".$key; + break; + default: + $sql.=$sep.$key; + } + $sep=","; + } + $pk=$this->primary_key; + $sql.=" from ".$this->table; + + $sql.=" where ".$this->primary_key." = $1"; + + return $sql; + } } ?> diff --git a/include/lib/pdf_core.class.php b/include/lib/pdf_core.class.php index 91c76723b..abfbb9290 100644 --- a/include/lib/pdf_core.class.php +++ b/include/lib/pdf_core.class.php @@ -58,7 +58,7 @@ class PDF_Core extends TFPDF public function __construct ( $orientation = 'P', $unit = 'mm', $format = 'A4') { - $this->bigger=0; + $this->bigger=0; parent::__construct($orientation, $unit, $format); $this->AddFont('DejaVu','','DejaVuSans.ttf',true); @@ -68,12 +68,39 @@ class PDF_Core extends TFPDF $this->AddFont('DejaVuCond','B','DejaVuSansCondensed-Bold.ttf',true); $this->AddFont('DejaVuCond','I','DejaVuSansCondensed-Oblique.ttf',true); - + $this->cells=array(); } - - + function get_margin_left() + { + return $this->lMargin; + } + function get_margin_bottom() + { + return $this->bMargin; + + } + function get_margin_top() + { + return $this->tMargin; + } + function get_margin_right() + { + return $this->rMargin; + } + function get_orientation() + { + return $this->DefOrientation; + } + function get_unit() + { + return $this->k; + } + function get_page_size() + { + return $this->DefPageSize; + } /** * Count the number of rows a p_text will take for a multicell * @param $p_text String diff --git a/include/sql/patch/upgrade137.sql b/include/sql/patch/upgrade137.sql new file mode 100644 index 000000000..2d83eb303 --- /dev/null +++ b/include/sql/patch/upgrade137.sql @@ -0,0 +1,6 @@ +begin; +insert into "parameter" (pr_id,pr_value) values ('MY_ANC_FILTER','6,7'); + + +insert into version (val,v_description) values (138,'Analytic improve'); +commit ; \ No newline at end of file diff --git a/include/template/fiche_def_input.php b/include/template/fiche_def_input.php index b7291e778..ceefb0c98 100644 --- a/include/template/fiche_def_input.php +++ b/include/template/fiche_def_input.php @@ -23,15 +23,15 @@ -

Modèles de catégorie

+