Merged revisions 2905-2938 via svnmerge from
svn+ssh://danydb@svn/svn/phpcompta/branches/rel500
........
r2906 | danydb | 2010-01-27 15:16:08 +0100 (Wed, 27 Jan 2010) | 2 lines
Cosmetic for html popup
........
r2907 | danydb | 2010-01-27 15:28:03 +0100 (Wed, 27 Jan 2010) | 5 lines
Fix typo translation
Fix Bug : cannot save extension in IE, probably because the same scripts are included several times
........
r2908 | danydb | 2010-01-28 13:56:37 +0100 (Thu, 28 Jan 2010) | 5 lines
Fix Bug In getNodeText when retrieving data for Internet Explorer,
it fails if the xmlNode.firstChild.nodeValue does not contains data.
It is directly set to undefined
........
r2909 | danydb | 2010-01-29 12:20:24 +0100 (Fri, 29 Jan 2010) | 2 lines
Generate invoice : update the comment of the entry only if there were no comment
........
r2910 | danydb | 2010-01-29 19:39:11 +0100 (Fri, 29 Jan 2010) | 6 lines
Improve User
============
Status only plugin means that the user can use only the plugin and can't access to
anything else.
........
r2911 | danydb | 2010-01-29 19:42:38 +0100 (Fri, 29 Jan 2010) | 1 line
Bug import Dexia
........
r2912 | danydb | 2010-01-31 16:24:22 +0100 (Sun, 31 Jan 2010) | 3 lines
For insert_jrnx, the desc is now in the function, we don't need anymore to update after inserting
........
r2913 | danydb | 2010-01-31 16:33:55 +0100 (Sun, 31 Jan 2010) | 4 lines
Fix bug : cannot see operation in quick_writing
cause : the p_action must be set to ALL, it wasn't for quick_writing
........
r2914 | danydb | 2010-02-02 14:52:37 +0100 (Tue, 02 Feb 2010) | 4 lines
Code cleaning
Bug : in ledger of sale, we have twice the possibility to add~ or generate document, and only for invoice (type 4)
Solution : fix the function Acc_Ledger_Purchase::extra_info (type of document = 10), remove extra code
........
r2915 | danydb | 2010-02-05 01:01:11 +0100 (Fri, 05 Feb 2010) | 4 lines
Improve : search_card you can also find a card thanks is tva_num
Documentation doxygen improved
........
r2916 | danydb | 2010-02-05 11:18:36 +0100 (Fri, 05 Feb 2010) | 2 lines
when inserting into ledger_sold the test to check the attach was wrong
........
r2917 | danydb | 2010-02-05 14:45:33 +0100 (Fri, 05 Feb 2010) | 2 lines
Extension : add the possibility to use ajax
........
r2918 | danydb | 2010-02-06 14:25:22 +0100 (Sat, 06 Feb 2010) | 1 line
rewrite the function encodeJSON, hide and show for doxygen
........
r2919 | danydb | 2010-02-06 14:26:07 +0100 (Sat, 06 Feb 2010) | 1 line
remove error where _SESSION is expired
........
r2920 | danydb | 2010-02-06 14:26:49 +0100 (Sat, 06 Feb 2010) | 1 line
In ITva_Select add the display
........
r2921 | danydb | 2010-02-06 14:27:47 +0100 (Sat, 06 Feb 2010) | 1 line
Cosmetic
........
r2922 | danydb | 2010-02-06 14:27:49 +0100 (Sat, 06 Feb 2010) | 1 line
IPopup add a new property drag to make the ipopup dragguable or not
........
r2923 | danydb | 2010-02-06 14:35:28 +0100 (Sat, 06 Feb 2010) | 5 lines
Middle of payment
=================
Feature : add or remove middle of payment
........
r2924 | danydb | 2010-02-06 18:17:15 +0100 (Sat, 06 Feb 2010) | 7 lines
Card
----
A same card can now have 2 different sides (debit or credit)
usefull to have only one card for a customer and a supplier
........
r2925 | danydb | 2010-02-06 18:23:03 +0100 (Sat, 06 Feb 2010) | 1 line
Add the sql script for the double accounting
........
r2926 | danydb | 2010-02-06 19:29:29 +0100 (Sat, 06 Feb 2010) | 2 lines
Update documentation
........
r2927 | danydb | 2010-02-06 20:37:12 +0100 (Sat, 06 Feb 2010) | 4 lines
Fiche_def
========
Permit to have 2 accouting as class_base
........
r2928 | danydb | 2010-02-06 20:56:00 +0100 (Sat, 06 Feb 2010) | 1 line
Bug : FK from stock prevent the removal of a card
........
r2929 | danydb | 2010-02-06 21:14:10 +0100 (Sat, 06 Feb 2010) | 1 line
removeless useless test
........
r2930 | danydb | 2010-02-07 00:55:03 +0100 (Sun, 07 Feb 2010) | 1 line
Improve appearance extension
........
r2931 | danydb | 2010-02-07 00:56:28 +0100 (Sun, 07 Feb 2010) | 2 lines
remove debug
........
r2932 | danydb | 2010-02-07 01:16:51 +0100 (Sun, 07 Feb 2010) | 1 line
Improve appearance extension
........
r2933 | danydb | 2010-02-07 01:19:08 +0100 (Sun, 07 Feb 2010) | 1 line
Improve appearance extension
........
r2934 | danydb | 2010-02-07 01:30:31 +0100 (Sun, 07 Feb 2010) | 1 line
Improve appearance extension
........
r2935 | danydb | 2010-02-07 02:36:25 +0100 (Sun, 07 Feb 2010) | 1 line
Version PHP5.3 : split is obsolete and replace by explode
........
r2936 | danydb | 2010-02-07 04:56:17 +0100 (Sun, 07 Feb 2010) | 1 line
remove owner
........
r2937 | danydb | 2010-02-08 22:34:07 +0100 (Mon, 08 Feb 2010) | 1 line
typo
........
r2938 | danydb | 2010-02-08 22:34:28 +0100 (Mon, 08 Feb 2010) | 1 line
Start translation for Dutch
........
This commit is contained in:
parent
6017727263
commit
b43f4c87b4
67 changed files with 4220 additions and 898 deletions
62
html/admin/sql/patch/upgrade63.sql
Normal file
62
html/admin/sql/patch/upgrade63.sql
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
begin;
|
||||
|
||||
DROP FUNCTION insert_jrnx(character varying, numeric, poste_comptable, integer, integer, boolean, text, integer, text);
|
||||
|
||||
CREATE OR REPLACE FUNCTION insert_jrnx(p_date character varying, p_montant numeric, p_poste poste_comptable, p_grpt integer, p_jrn_def integer, p_debit boolean, p_tech_user text, p_tech_per integer, p_qcode text,p_comment text)
|
||||
RETURNS void AS
|
||||
$BODY$
|
||||
declare
|
||||
sCode varchar;
|
||||
nCount_qcode integer;
|
||||
begin
|
||||
sCode=trim(p_qcode);
|
||||
|
||||
-- if p_qcode is empty try to find one
|
||||
if length(sCode) = 0 or p_qcode is null then
|
||||
select count(*) into nCount_qcode
|
||||
from vw_poste_qcode where j_poste=p_poste::text;
|
||||
-- if we find only one q_code for a accountancy account
|
||||
-- then retrieve it
|
||||
if nCount_qcode = 1 then
|
||||
select j_qcode::text into sCode
|
||||
from vw_poste_qcode where j_poste=p_poste::text;
|
||||
else
|
||||
sCode=NULL;
|
||||
end if;
|
||||
|
||||
end if;
|
||||
|
||||
insert into jrnx
|
||||
(
|
||||
j_date,
|
||||
j_montant,
|
||||
j_poste,
|
||||
j_grpt,
|
||||
j_jrn_def,
|
||||
j_debit,
|
||||
j_text,
|
||||
j_tech_user,
|
||||
j_tech_per,
|
||||
j_qcode
|
||||
) values
|
||||
(
|
||||
to_date(p_date,'DD.MM.YYYY'),
|
||||
p_montant,
|
||||
p_poste,
|
||||
p_grpt,
|
||||
p_jrn_def,
|
||||
p_debit,
|
||||
p_comment,
|
||||
p_tech_user,
|
||||
p_tech_per,
|
||||
sCode
|
||||
);
|
||||
|
||||
return;
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
update version set val=64;
|
||||
|
||||
commit;
|
||||
67
html/admin/sql/patch/upgrade64.sql
Normal file
67
html/admin/sql/patch/upgrade64.sql
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
begin;
|
||||
|
||||
DROP VIEW vw_fiche_attr;
|
||||
|
||||
CREATE OR REPLACE VIEW vw_fiche_attr AS
|
||||
SELECT a.f_id, a.fd_id, a.av_text AS vw_name, b.av_text AS vw_sell, c.av_text AS vw_buy, d.av_text AS tva_code, tva_rate.tva_id, tva_rate.tva_rate, tva_rate.tva_label, e.av_text AS vw_addr, f.av_text AS vw_cp, j.av_text AS quick_code, h.av_text AS vw_description, i.av_text AS tva_num, fiche_def.frd_id
|
||||
FROM ( SELECT fiche.f_id, fiche.fd_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 1) a
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 6) b ON a.f_id = b.f_id
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 7) c ON a.f_id = c.f_id
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 2) d ON a.f_id = d.f_id
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 14) e ON a.f_id = e.f_id
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 15) f ON a.f_id = f.f_id
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 23) j ON a.f_id = j.f_id
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 9) h ON a.f_id = h.f_id
|
||||
LEFT JOIN ( SELECT fiche.f_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
JOIN attr_def USING (ad_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 13) i ON a.f_id = i.f_id
|
||||
LEFT JOIN tva_rate ON d.av_text = tva_rate.tva_id::text
|
||||
JOIN fiche_def USING (fd_id);
|
||||
|
||||
update version set val=65;
|
||||
|
||||
commit;
|
||||
|
||||
4
html/admin/sql/patch/upgrade65.sql
Normal file
4
html/admin/sql/patch/upgrade65.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
begin;
|
||||
SELECT setval('public.mod_payment_mp_id_seq', 10, true);
|
||||
update version set val=66;
|
||||
commit;
|
||||
134
html/admin/sql/patch/upgrade66.sql
Normal file
134
html/admin/sql/patch/upgrade66.sql
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
begin;
|
||||
|
||||
drop function account_insert(p_f_id integer, p_account poste_comptable);
|
||||
|
||||
CREATE OR REPLACE FUNCTION account_insert(p_f_id integer, p_account text)
|
||||
RETURNS integer AS
|
||||
$BODY$
|
||||
declare
|
||||
nParent tmp_pcmn.pcm_val_parent%type;
|
||||
sName varchar;
|
||||
nNew tmp_pcmn.pcm_val%type;
|
||||
bAuto bool;
|
||||
nFd_id integer;
|
||||
nCount integer;
|
||||
first text;
|
||||
second text;
|
||||
begin
|
||||
|
||||
if length(trim(p_account)) != 0 then
|
||||
-- if there is coma in p_account, treat normally
|
||||
if position (',' in p_account) = 0 then
|
||||
raise info 'p_account is not empty';
|
||||
select count(*) into nCount from tmp_pcmn where pcm_val=p_account;
|
||||
raise notice 'found in tmp_pcm %',nCount;
|
||||
if nCount !=0 then
|
||||
raise info 'this account exists in tmp_pcmn ';
|
||||
perform attribut_insert(p_f_id,5,p_account);
|
||||
else
|
||||
-- account doesn't exist, create it
|
||||
select av_text into sName from
|
||||
attr_value join jnt_fic_att_value using (jft_id)
|
||||
where
|
||||
ad_id=1 and f_id=p_f_id;
|
||||
|
||||
nParent:=account_parent(p_account::poste_comptable);
|
||||
insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account::poste_comptable,sName,nParent);
|
||||
perform attribut_insert(p_f_id,5,p_account);
|
||||
|
||||
end if;
|
||||
else
|
||||
raise info 'presence of a comma';
|
||||
-- there is 2 accounts separated by a comma
|
||||
first := split_part(p_account,',',1);
|
||||
second := split_part(p_account,',',2);
|
||||
-- check there is no other coma
|
||||
raise info 'first value % second value %', first, second;
|
||||
|
||||
if position (',' in first) != 0 or position (',' in second) != 0 then
|
||||
raise exception 'Too many comas, invalid account';
|
||||
end if;
|
||||
perform attribut_insert(p_f_id,5,p_account);
|
||||
end if;
|
||||
else
|
||||
raise info 'p_account is empty';
|
||||
select fd_id into nFd_id from fiche where f_id=p_f_id;
|
||||
bAuto:= account_auto(nFd_id);
|
||||
if bAuto = true then
|
||||
raise notice 'account generated automatically';
|
||||
nNew:=account_compute(p_f_id);
|
||||
raise notice 'nNew %', nNew;
|
||||
select av_text into sName from
|
||||
attr_value join jnt_fic_att_value using (jft_id)
|
||||
where
|
||||
ad_id=1 and f_id=p_f_id;
|
||||
nParent:=account_parent(nNew);
|
||||
perform account_add (nNew,sName);
|
||||
perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
|
||||
|
||||
else
|
||||
-- if there is an account_base then it is the default
|
||||
select fd_class_base::text into nNew from fiche_def join fiche using (fd_id) where f_id=p_f_id;
|
||||
if nNew is null or length(trim(nNew)) = 0 then
|
||||
raise notice 'count is null';
|
||||
perform attribut_insert(p_f_id,5,null);
|
||||
else
|
||||
perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
return 0;
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE 'plpgsql';
|
||||
|
||||
drop function account_update(p_f_id integer, p_account poste_comptable);
|
||||
|
||||
CREATE OR REPLACE FUNCTION account_update(p_f_id integer, p_account text)
|
||||
RETURNS integer AS
|
||||
$BODY$
|
||||
declare
|
||||
nMax fiche.f_id%type;
|
||||
nCount integer;
|
||||
nParent tmp_pcmn.pcm_val_parent%type;
|
||||
sName varchar;
|
||||
nJft_id attr_value.jft_id%type;
|
||||
first text;
|
||||
second text;
|
||||
begin
|
||||
|
||||
if length(trim(p_account)) != 0 then
|
||||
if position (',' in p_account) = 0 then
|
||||
select count(*) into nCount from tmp_pcmn where pcm_val=p_account;
|
||||
if nCount = 0 then
|
||||
select av_text into sName from
|
||||
attr_value join jnt_fic_att_value using (jft_id)
|
||||
where
|
||||
ad_id=1 and f_id=p_f_id;
|
||||
nParent:=account_parent(p_account::poste_comptable);
|
||||
insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account::poste_comptable,sName,nParent);
|
||||
end if;
|
||||
else
|
||||
raise info 'presence of a comma';
|
||||
-- there is 2 accounts separated by a comma
|
||||
first := split_part(p_account,',',1);
|
||||
second := split_part(p_account,',',2);
|
||||
-- check there is no other coma
|
||||
raise info 'first value % second value %', first, second;
|
||||
|
||||
if position (',' in first) != 0 or position (',' in second) != 0 then
|
||||
raise exception 'Too many comas, invalid account';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
select jft_id into njft_id from jnt_fic_att_value where f_id=p_f_id and ad_id=5;
|
||||
update attr_value set av_text=p_account where jft_id=njft_id;
|
||||
|
||||
return njft_id;
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE 'plpgsql';
|
||||
|
||||
update version set val=67;
|
||||
commit;
|
||||
177
html/admin/sql/patch/upgrade67.sql
Normal file
177
html/admin/sql/patch/upgrade67.sql
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
begin;
|
||||
|
||||
DROP VIEW vw_fiche_def;
|
||||
DROP VIEW vw_supplier;
|
||||
DROP VIEW vw_client;
|
||||
|
||||
alter table fiche_def alter fd_class_base type text;
|
||||
CREATE OR REPLACE VIEW vw_fiche_def AS
|
||||
SELECT jnt_fic_attr.fd_id, jnt_fic_attr.ad_id, attr_def.ad_text, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def.frd_id
|
||||
FROM fiche_def
|
||||
JOIN jnt_fic_attr USING (fd_id)
|
||||
JOIN attr_def ON attr_def.ad_id = jnt_fic_attr.ad_id;
|
||||
|
||||
COMMENT ON VIEW vw_fiche_def IS 'all the attributs for card family';
|
||||
|
||||
CREATE OR REPLACE VIEW vw_supplier AS
|
||||
SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email
|
||||
FROM ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 1) a
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 13) b USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 23) a1 USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 5) c USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 14) d USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 15) e USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 16) f USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 17) g USING (f_id)
|
||||
LEFT JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 18) h USING (f_id)
|
||||
WHERE a.frd_id = 8;
|
||||
CREATE OR REPLACE VIEW vw_client AS
|
||||
SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email
|
||||
FROM ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 1) a
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 13) b USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 23) a1 USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 5) c USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 14) d USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 15) e USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 16) f USING (f_id)
|
||||
JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 17) g USING (f_id)
|
||||
LEFT JOIN ( SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text
|
||||
FROM fiche
|
||||
JOIN fiche_def USING (fd_id)
|
||||
JOIN fiche_def_ref USING (frd_id)
|
||||
JOIN jnt_fic_att_value USING (f_id)
|
||||
JOIN attr_value USING (jft_id)
|
||||
WHERE jnt_fic_att_value.ad_id = 18) h USING (f_id)
|
||||
WHERE a.frd_id = 9;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION fiche_def_ins_upd()
|
||||
RETURNS "trigger" AS
|
||||
$BODY$
|
||||
begin
|
||||
|
||||
if position (',' in NEW.fd_class_base) != 0 then
|
||||
NEW.fd_create_account='f';
|
||||
|
||||
end if;
|
||||
return NEW;
|
||||
end;$BODY$
|
||||
LANGUAGE 'plpgsql';
|
||||
|
||||
CREATE TRIGGER fiche_def_ins_upd
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON fiche_def
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE fiche_def_ins_upd();
|
||||
|
||||
ALTER TABLE stock_goods DROP CONSTRAINT fk_stock_good_f_id;
|
||||
|
||||
ALTER TABLE stock_goods
|
||||
ADD CONSTRAINT fk_stock_good_f_id FOREIGN KEY (f_id)
|
||||
REFERENCES fiche (f_id) MATCH SIMPLE
|
||||
ON UPDATE cascade ON DELETE cascade;
|
||||
|
||||
update version set val=68;
|
||||
commit;
|
||||
Loading…
Add table
Add a link
Reference in a new issue