Merge branch 'master' of ssh://ns3git/srv/git/noalyss

This commit is contained in:
Dany De Bontridder 2018-05-23 15:59:42 +02:00
commit f4ee4a3130
9 changed files with 162 additions and 17 deletions

View file

@ -53,6 +53,7 @@ class Acc_Account
$this->db=$p_cn;
$id=-1;
if ( trim($pcm_val) != "" ) {
$pcm_val=mb_strtoupper($pcm_val);
$pcm_val=$this->db->get_value("select format_account($1)",
array($pcm_val));
$id=$p_cn->get_value("select id from tmp_pcmn where pcm_val=$1",[$pcm_val]);
@ -128,7 +129,7 @@ class Acc_Account
function verify() {
// check for Duplicate key, parent ... see Acc_Plan_MTable
$count=$this->data_sql->count(" where pcm_val =$1 and id <> $2",
[$this->data_sql->pcm_val,$this->data_sql->id]);
[mb_strtoupper($this->data_sql->pcm_val),$this->data_sql->id]);
if ( $count > 0)
throw new Exception (_("Poste en double"),EXC_DUPLICATE);

View file

@ -47,6 +47,7 @@ require_once NOALYSS_INCLUDE.'/class/acc_payment.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger_history.class.php';
//require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/class/pre_op_ods.class.php';
/** \file
* @brief Class for jrn, class acc_ledger for manipulating the ledger

View file

@ -278,7 +278,7 @@ class Acc_Operation
if ( $diff != 0 )
{
printf (_("Erreur : balance incorrecte :diff = %d"),$diff);
printf (_("Erreur : balance incorrecte :diff = %s"),$diff);
return false;
}

View file

@ -805,7 +805,7 @@ class Fiche
// account
if ($id==ATTR_DEF_ACCOUNT)
{
$v=sql_string($value);
$v=mb_strtoupper(sql_string($value));
try
{
@ -973,7 +973,7 @@ class Fiche
// account
if ($id==ATTR_DEF_ACCOUNT)
{
$v=sql_string($value);
$v=mb_strtoupper(sql_string($value));
if (trim($v)!='')
{
if (strpos($v, ',')!=0)

View file

@ -110,7 +110,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
define ("DBVERSION",128);
define ("DBVERSION",129);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",18);
define ('NOTFOUND','--not found--');

View file

@ -270,9 +270,11 @@ function html_page_start($p_theme="", $p_script="", $p_script2="")
if ($p_theme != "")
{
$Res = $cn->exec_sql("select the_filestyle from theme
where the_name='" . $p_theme . "'");
where the_name=$1" ,[$p_theme]);
if (Database::num_row($Res) == 0)
$style = "style-classic.css";
{
$style = "style-classic7.css";
}
else
{
$s = Database::fetch_array($Res, 0);
@ -281,7 +283,7 @@ function html_page_start($p_theme="", $p_script="", $p_script2="")
}
else
{
$style = "style-classic.css";
$style = "style-classic7.css";
} // end if
$title="NOALYSS";

View file

@ -193,4 +193,40 @@ class Icon_Action
$r='<span id="'.$p_id.'" onclick="'.$p_javascript.'" class="icon">&#xe80f;</span>';
return $r;
}
/**
* Display the icon to modify a idem
* @param type $p_id
* @param type $p_javascript
* @return string
*/
static function modify($p_id,$p_javascript)
{
$r='<span id="'.$p_id.'" onclick="'.$p_javascript.'" class="smallicon icon" style="margin-left:5px">&#xe80d;</span>';
return $r;
}
/**
* Display the icon to modify a idem
* @param type $p_id
* @param type $p_javascript
* @return string
*/
static function validate($p_id,$p_javascript)
{
$r='<span id="'.$p_id.'" onclick="'.$p_javascript.'" class="smallicon icon" style="margin-left:5px">&#x2713;</span>';
return $r;
}
/**
* Display the icon to modify a idem
* @param type $p_id
* @param type $p_javascript
* @return string
*/
static function cancel($p_id,$p_javascript)
{
$r='<span id="'.$p_id.'" onclick="'.$p_javascript.'" class="smallicon icon" style="margin-left:5px">&#xe802;</span>';
return $r;
}
}

View file

@ -0,0 +1,59 @@
begin;
CREATE OR REPLACE FUNCTION comptaproc.insert_quant_purchase(p_internal text, p_j_id numeric, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_nd_amount numeric, p_nd_tva numeric, p_nd_tva_recup numeric, p_dep_priv numeric, p_client character varying, p_tva_sided numeric, p_price_unit numeric)
RETURNS void
AS $function$
declare
fid_client integer;
fid_good integer;
account_priv account_type;
fid_good_account account_type;
n_dep_priv numeric;
begin
n_dep_priv := p_dep_priv;
select p_value into account_priv from parm_code where p_code='DEP_PRIV';
select f_id into fid_client from
fiche_detail where ad_id=23 and ad_value=upper(trim(p_client));
select f_id into fid_good from
fiche_detail where ad_id=23 and ad_value=upper(trim(p_fiche));
select ad_value into fid_good_account from fiche_detail where ad_id=5 and f_id=fid_good;
if strpos( fid_good_account , account_priv ) = 1 then
n_dep_priv=p_price;
end if;
insert into quant_purchase
(qp_internal,
j_id,
qp_fiche,
qp_quantite,
qp_price,
qp_vat,
qp_vat_code,
qp_nd_amount,
qp_nd_tva,
qp_nd_tva_recup,
qp_supplier,
qp_dep_priv,
qp_vat_sided,
qp_unit)
values
(p_internal,
p_j_id,
fid_good,
p_quant,
p_price,
p_vat,
p_vat_code,
p_nd_amount,
p_nd_tva,
p_nd_tva_recup,
fid_client,
n_dep_priv,
p_tva_sided,
p_price_unit);
return;
end;
$function$
LANGUAGE plpgsql;
insert into version (val,v_description) values (129,'Fix bug in QUANT_PURCHASE');
commit;

View file

@ -1,9 +1,55 @@
create view v_tva_rate as select
tva_id,
tva_rate,
tva_label,
tva_comment,
split_part(tva_poste,',',1) as tva_purchase,
split_part(tva_poste,',',2) as tva_sale,
tva_both_side
from tva_rate;
CREATE OR REPLACE FUNCTION comptaproc.insert_quant_purchase(p_internal text, p_j_id numeric, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_nd_amount numeric, p_nd_tva numeric, p_nd_tva_recup numeric, p_dep_priv numeric, p_client character varying, p_tva_sided numeric, p_price_unit numeric)
RETURNS void
LANGUAGE plpgsql
AS $function$
declare
fid_client integer;
fid_good integer;
account_priv account_type;
fid_good_account account_type;
n_dep_priv numeric;
begin
n_dep_priv := p_dep_priv;
select p_value into account_priv from parm_code where p_code='DEP_PRIV';
select f_id into fid_client from
fiche_detail where ad_id=23 and ad_value=upper(trim(p_client));
select f_id into fid_good from
fiche_detail where ad_id=23 and ad_value=upper(trim(p_fiche));
select ad_value into fid_good_account from fiche_detail where ad_id=5 and f_id=fid_good;
if strpos( fid_good_account , account_priv ) = 1 then
n_dep_priv=p_price;
end if;
insert into quant_purchase
(qp_internal,
j_id,
qp_fiche,
qp_quantite,
qp_price,
qp_vat,
qp_vat_code,
qp_nd_amount,
qp_nd_tva,
qp_nd_tva_recup,
qp_supplier,
qp_dep_priv,
qp_vat_sided,
qp_unit)
values
(p_internal,
p_j_id,
fid_good,
p_quant,
p_price,
p_vat,
p_vat_code,
p_nd_amount,
p_nd_tva,
p_nd_tva_recup,
fid_client,
n_dep_priv,
p_tva_sided,
p_price_unit);
return;
end;
$function$