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 '
';
@@ -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 '
';
$r.='
';
$r.=HtmlInput::submit('x','accepter',
- 'onclick="confirm_box($(\'form_'.$div.'\'),\'Vous confirmez ? \',function () {$(\'form_'.$div.'\').divname=\''.$div.'\';reverseOperation($(\'form_'.$div.'\'))}); return false"');
+ 'onclick="confirm_box($(\'form_'.$div.'\'),content[50],function () {$(\'form_'.$div.'\').divname=\''.$div.'\';reverseOperation($(\'form_'.$div.'\'))}); return false"');
$r.="
";
$r.='';
echo $r;
diff --git a/include/template/ledger_detail_fin.php b/include/template/ledger_detail_fin.php
index a34f4b680..291a125d7 100644
--- a/include/template/ledger_detail_fin.php
+++ b/include/template/ledger_detail_fin.php
@@ -118,7 +118,7 @@ echo td(_('Pièce')).td($itext->input());
if ( $owner->MY_ANALYTIC != "nu" /*&& $div == 'popup'*/)
{
$poste=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
- if ( preg_match('/^(6|7)/',$q[$e]['j_poste']))
+ if ( $g_parameter->match_analytic($q[$e]['j_poste']))
{
$qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE);
$anc_op=new Anc_Operation($cn);
diff --git a/include/template/ledger_detail_misc.php b/include/template/ledger_detail_misc.php
index 27ce89814..eb00e1118 100644
--- a/include/template/ledger_detail_misc.php
+++ b/include/template/ledger_detail_misc.php
@@ -161,7 +161,7 @@ $amount_idx=0;
$row.=($q[$e]['j_debit']=='f')?$montant:td('');
/* Analytic accountancy */
if ( $owner->MY_ANALYTIC != "nu" /*&& $div=='popup'*/){
- if ( preg_match('/^(6|7)/',$q[$e]['j_poste'])) {
+ if ( $g_parameter->match_analytic($q[$e]['j_poste'])) {
echo HtmlInput::hidden("amount_t".$amount_idx,$q[$e]['j_montant']);
$anc_op=new Anc_Operation($cn);
diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php
index fa7c3acaf..f68b51e75 100644
--- a/include/template/ledger_detail_ven.php
+++ b/include/template/ledger_detail_ven.php
@@ -223,7 +223,7 @@ echo $ipaid->input();
if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup' */ )
{
$poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
- if (preg_match('/^(6|7)/', $poste))
+ if ( $g_parameter->match_analytic($poste))
{
$anc_op = new Anc_Operation($cn);
$anc_op->in_div=$div;
diff --git a/include/template/letter_all.php b/include/template/letter_all.php
index 5af29165e..0239ead61 100644
--- a/include/template/letter_all.php
+++ b/include/template/letter_all.php
@@ -50,7 +50,7 @@ $class= ( ($i % 2) == 0 ) ? "odd":"even";
>
|
content[$i]['letter']==-1)?" aucun lettrage ":strtoupper(base_convert($this->content[$i]['letter'],10,36));
+$letter=($this->content[$i]['letter']==-1)?_("aucun lettrage"):strtoupper(base_convert($this->content[$i]['letter'],10,36));
$js="this.gDossier=".dossier::id().
";this.j_id=".$this->content[$i]['j_id'].
";this.obj_type='".$this->object_type."'".
diff --git a/scenario/icon_actionTest.php b/scenario/icon_actionTest.php
index 4682d7e69..35c33a98c 100644
--- a/scenario/icon_actionTest.php
+++ b/scenario/icon_actionTest.php
@@ -77,4 +77,10 @@ include_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
Tips
+
+
+ Slider
+
+
+ Comment
\ No newline at end of file
diff --git a/unit-test/include/class/noalyss_parameter_folderTest.class.php b/unit-test/include/class/noalyss_parameter_folderTest.class.php
new file mode 100644
index 000000000..091830c19
--- /dev/null
+++ b/unit-test/include/class/noalyss_parameter_folderTest.class.php
@@ -0,0 +1,183 @@
+
+
+use PHPUnit\Framework\TestCase;
+function trim_parameter($p_value){
+ return;
+}
+/**
+ * Generated by PHPUnit_SkeletonGenerator on 2017-11-26 at 11:24:04.
+ */
+class Noalyss_Parameter_FolderTest extends TestCase
+{
+
+ protected $object;
+ private $a_param;
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ *
+ */
+ protected function setUp()
+ {
+ global $g_connection, $g_user;
+ $_REQUEST['gDossier']=DOSSIER;
+ $g_connection=new Database(DOSSIER);
+ $g_user=new User($g_connection);
+ $this->object=new Noalyss_Parameter_Folder($g_connection);
+ $this->a_param=explode(",","MY_COUNTRY,".
+ "MY_DEFAULT_ROUND_ERROR_DEB,".
+ "MY_DEFAULT_ROUND_ERROR_CRED,".
+ "MY_ANC_FILTER,".
+ "MY_NAME,".
+ "MY_TVA,".
+ "MY_STREET,".
+ "MY_NUMBER,".
+ "MY_CP,".
+ "MY_TEL,".
+ "MY_PAYS,".
+ "MY_COMMUNE,".
+ "MY_FAX,".
+ "MY_ANALYTIC,".
+ "MY_STRICT,".
+ "MY_TVA_USE,".
+ "MY_PJ_SUGGEST,".
+ "MY_CHECK_PERIODE,".
+ "MY_DATE_SUGGEST,".
+ "MY_ALPHANUM,".
+ "MY_UPDLAB,".
+ "MY_STOCK");
+
+ }
+ public function testNew()
+ {
+ global $g_connection ;
+ $nb_param=count($this->a_param);
+ $cnt=$g_connection->get_value("select count(*) from parameter where pr_id like 'MY_%'");
+ $this->assertEquals($nb_param,$cnt,"Number of parameters");
+
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testcheck()
+ {
+
+ $a=$this->object->check('MY_STRICT', 0);
+ $this->assertEquals($a,"N");
+
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testcheck_anc_filter()
+ {
+
+ try {
+ $this->object->check_anc_filter('6,7');
+ $this->assertTrue(TRUE);
+ } catch (Exception $ex) {
+ $this->assertTrue(FALSE,'6,7 is valid');
+ }
+ try {
+ $this->object->check_anc_filter('6,7,8,2');
+ $this->assertTrue(TRUE);
+ } catch (Exception $ex) {
+ $this->assertTrue(FALSE,'6,7,8,2 is valid');
+ }
+ try {
+ $this->object->check_anc_filter('6,7,8,2,AA');
+ $this->assertTrue(FALSE);
+ } catch (Exception $ex) {
+ $this->assertTrue(TRUE,'6,7,8,2 is not valid');
+ }
+
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testupdate()
+ {
+ $ok=0;
+ try {
+ $this->testsave();
+ } catch (Exception $e)
+ {
+ $ok=1;
+ }
+ $this->assertEquals($ok,0);
+ }
+ /*
+ * @covers Noalyss_Parameter_Folder::checkTest
+ *
+ */
+ public function testsave()
+ {
+ global $g_connection;
+ for ($e =0;$e < count($this->a_param);$e++)
+ {
+
+ $attr=$this->a_param[$e];
+
+ $old=$this->object->$attr;
+ switch ($attr)
+ {
+ case "MY_STRICT":
+ $this->object->$attr='Y';
+ break;
+ case "MY_COUNTRY":
+ $this->object->MY_COUNTRY='XBE';
+ break;
+ case "MY_ANC_FILTER":
+ $this->object->MY_ANC_FILTER='5,4';
+ break;
+ default:
+ $this->object->$attr='000';
+ break;
+ }
+ $this->object->save($this->a_param[$e]);
+ $cur_value=$g_connection->get_value('select pr_value from "parameter" where pr_id=$1',[$attr]);
+ $this->assertTrue(($cur_value==$this->object->$attr),sprintf("failed : %s cur_value %s expected %s",$attr,$cur_value,$this->object->$attr));
+ $this->assertTrue($cur_value != $old,sprintf( "failed : %s cur_value %s old %s",$attr,$cur_value,$old));
+
+ $this->object->$attr=$old;
+ $this->object->save($this->a_param[$e]);
+ $cur_value=$g_connection->get_value('select pr_value from "parameter" where pr_id=$1',[$attr]);
+ $this->assertTrue($cur_value == $old,sprintf( "failed : %s cur_value %s old %s",$attr,$cur_value,$old));
+ }
+
+ }
+ function testMatch_accounting()
+ {
+ $this->assertTrue($this->object->match_analytic("612"));
+ $this->assertTrue($this->object->match_analytic("6"));
+ $this->assertTrue($this->object->match_analytic("66"));
+ $this->assertTrue($this->object->match_analytic("71"));
+ $this->assertTrue($this->object->match_analytic("7"));
+ $this->assertFalse($this->object->match_analytic("5"));
+ }
+}
+
+?>
|