From 24fd4a551fc594e29502bdb0c3db32b63774affa Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 27 Nov 2011 02:20:11 +0000 Subject: [PATCH] fix small cosmetic bugs --- html/admin/sql/patch/upgrade97.sql | 40 ++++++++++++++++-------------- html/ajax_misc.php | 17 ++++++------- html/do.php | 11 -------- html/style.css | 3 ++- include/ac_common.php | 12 ++++----- include/class_acc_ledger.php | 2 +- include/class_database.php | 18 +++++++++++--- include/class_extension.php | 2 +- include/class_pre_op_ach.php | 4 ++- include/class_pre_op_advanced.php | 3 ++- include/class_pre_op_ven.php | 3 ++- include/class_pre_operation.php | 9 +++---- include/menu.inc.php | 3 ++- include/search.inc.php | 2 +- include/template/param_jrn.php | 6 ++--- 15 files changed, 69 insertions(+), 66 deletions(-) diff --git a/html/admin/sql/patch/upgrade97.sql b/html/admin/sql/patch/upgrade97.sql index 0189119dc..6b5dc5ac5 100644 --- a/html/admin/sql/patch/upgrade97.sql +++ b/html/admin/sql/patch/upgrade97.sql @@ -69,7 +69,7 @@ begin end; $BODY$ LANGUAGE plpgsql; - + DROP FUNCTION comptaproc.account_insert(integer, text); CREATE OR REPLACE FUNCTION comptaproc.account_insert(p_f_id integer, p_account text) @@ -170,7 +170,7 @@ declare begin if length(trim(p_account)) != 0 then - -- 2 accounts in card separated by comma + -- 2 accounts in card separated by comma if position (',' in p_account) = 0 then select count(*) into nCount from tmp_pcmn where pcm_val=p_account; if nCount = 0 then @@ -193,13 +193,13 @@ begin raise exception 'Too many comas, invalid account'; end if; -- check that both account are in PCMN - + end if; else -- account is null update fiche_detail set ad_value=null where f_id=p_f_id and ad_id=5 ; end if; - + update fiche_detail set ad_value=p_account where f_id=p_f_id and ad_id=5 ; return 0; @@ -230,7 +230,7 @@ return upper(sResult); end; $BODY$ LANGUAGE plpgsql; - + COMMENT ON FUNCTION comptaproc.format_account(account_type) IS 'format the accounting : - upper case - remove space and special char. @@ -256,7 +256,7 @@ declare r_record tmp_pcmn%ROWTYPE; begin r_record := NEW; -if length(trim(r_record.pcm_type))=0 or r_record.pcm_type is NULL then +if length(trim(r_record.pcm_type))=0 or r_record.pcm_type is NULL then r_record.pcm_type:=find_pcm_type(NEW.pcm_val); return r_record; end if; @@ -729,8 +729,6 @@ ALTER TABLE ONLY profile_menu ADD CONSTRAINT profile_menu_me_code_fkey FOREIG ALTER TABLE ONLY profile_menu ADD CONSTRAINT profile_menu_p_id_fkey FOREIGN KEY (p_id) REFERENCES profile(p_id) ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE ONLY profile_menu ADD CONSTRAINT profile_menu_type_fkey FOREIGN KEY (p_type_display) REFERENCES profile_menu_type(pm_type); ALTER TABLE ONLY profile_user ADD CONSTRAINT profile_user_p_id_fkey FOREIGN KEY (p_id) REFERENCES profile(p_id) ON UPDATE CASCADE ON DELETE CASCADE; -insert into menu_ref(me_code,me_menu,me_file,me_description,me_type,me_parameter) select ex_code,ex_name,ex_file,ex_desC,'PL','plugin_code='||ex_code from extension; -insert into profile_menu (me_code,me_code_dep,p_id,p_type_display) select me_code,'EXTENSION',1,'S' from menu_ref where me_type='PL'; create type menu_tree as (code text,description text); create or replace function comptaproc.get_profile_menu(login text) @@ -741,16 +739,16 @@ declare a menu_tree; e menu_tree; begin -for a in select me_code,me_description from v_all_menu where user_name=login +for a in select me_code,me_description from v_all_menu where user_name=login and me_code_dep is null and me_type <> 'PR' and me_type <>'SP' loop return next a; - + for e in select * from get_menu_tree(a.code,login) - loop + loop return next e; end loop; - + end loop; return; end; @@ -769,7 +767,7 @@ declare x v_all_menu%ROWTYPE; begin for x in select * from v_all_menu where me_code_dep=p_code::text and user_name=login::text - loop + loop if x.me_code_dep is not null then i.code := x.me_code_dep||'/'||x.me_code; else @@ -777,9 +775,9 @@ begin end if; i.description := x.me_description; - + return next i; - + for e in select * from get_menu_tree(x.me_code,login) loop e.code:=x.me_code_dep||'/'||e.code; @@ -791,7 +789,7 @@ begin end; $BODY$ LANGUAGE plpgsql; - + alter table mod_payment add jrn_def_id bigint; update mod_payment set jrn_def_id=2 where mp_type='VEN'; update mod_payment set jrn_def_id=3 where mp_type='ACH'; @@ -934,7 +932,7 @@ begin p_tva_sided); return; end; - $function$ + $function$ LANGUAGE plpgsql; DROP FUNCTION comptaproc.insert_quant_sold(text, numeric, character varying, numeric, numeric, numeric, integer, character varying); @@ -956,8 +954,14 @@ begin (p_internal,p_jid,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client,'Y',p_tva_sided); return; end; - $function$ + $function$ LANGUAGE plpgsql; + +insert into menu_ref(me_code,me_menu,me_file,me_description,me_type,me_parameter) select ex_code,ex_name,ex_file,ex_desC,'PL','plugin_code='||ex_code from extension; + +insert into profile_menu (me_code,me_code_dep,p_id,p_type_display) select me_code,'EXT',1,'S' from menu_ref where me_type='PL'; +update jrn set jr_internal=substring(jr_internal,1,1)||lpad(upper(to_hex(jr_id+1)),6,'0'); + update version set val=98; commit; \ No newline at end of file diff --git a/html/ajax_misc.php b/html/ajax_misc.php index efee8c4f3..3bc0792f5 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -526,13 +526,12 @@ EOF; break; case 'up_pay_method': require_once 'ajax_update_payment.php'; - break; - case 'openancsearch': - case 'resultancsearch': - require_once('ajax_anc_search.php'); - break; - case 'autoanc': - require_once('ajax_auto_anc_card.php'); - break; - + break; + case 'openancsearch': + case 'resultancsearch': + require_once('ajax_anc_search.php'); + break; + case 'autoanc': + require_once('ajax_auto_anc_card.php'); + break; } \ No newline at end of file diff --git a/html/do.php b/html/do.php index 908b217bd..e94710ac0 100644 --- a/html/do.php +++ b/html/do.php @@ -137,17 +137,6 @@ if (isset($_REQUEST['ac'])) show_menu($all, $i); } } -/*elseif (isset($_REQUEST['plugin_code'])) -{ - $default = find_default_module(); - $_GET['ac']=$default; - $_POST['ac']=$default; - $_REQUEST['ac']=$default; - show_module('EXTENSION'); - $all[0] = $default; - show_menu($all, 0); - require_once 'extension_choice.inc.php'; -}*/ else { $default = find_default_module(); diff --git a/html/style.css b/html/style.css index 8113cf83b..93cc46489 100644 --- a/html/style.css +++ b/html/style.css @@ -125,6 +125,7 @@ div.u_tmenu div.u_tool { div.u_tool { float:left; width: 100%; + padding-bottom: 25px; } div.u_tool div.name { float:left; @@ -838,7 +839,7 @@ a#anchorbutton:hover, .button:hover,a.button:hover,div.content a.button:hover { div.topmenu { float:left; width:100%; - + margin-top:2px; } h2.dossier { diff --git a/include/ac_common.php b/include/ac_common.php index ca01652d6..db99d8a42 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -65,7 +65,10 @@ function h2($p_string, $p_class) { return '

' . htmlspecialchars($p_string) . '

'; } - +function h1($p_string, $p_class) +{ + return '

' . htmlspecialchars($p_string) . '

'; +} /* !\brief surround the string with td * \param $p_string string to surround by TD * \param $p_extra extra info (class, style, javascript...) @@ -762,7 +765,7 @@ function show_module($selected) } if ($file[0]['me_file'] != '') { - if ($file[0]['me_parameter'] !== "") + if ($file[0]['me_parameter'] != "") { // if there are paramter put them in superglobal $array=compute_variable($file[0]['me_parameter']); @@ -775,17 +778,12 @@ function show_module($selected) require_once $file[0]['me_file']; else require 'extension_get.inc.php'; - exit(); } if ( $file[0]['me_javascript'] != '') { create_script($file[0]['me_javascript']); } } - else - { - - } } /** * Find the default module or the first one diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index b3f889e15..c5ff1da0b 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -2912,7 +2912,7 @@ class Acc_Ledger extends jrn_def_sql $op->od_direct='t'; if ($op->count() != 0 ) { - echo HtmlInput::submit('use_opd','Utilisez une op.prédéfinie'); + echo HtmlInput::submit('use_opd','Utilisez une opération prédéfinie'); echo $op->show_button(); } echo ''; diff --git a/include/class_database.php b/include/class_database.php index c25400cfa..66cd6c4fe 100644 --- a/include/class_database.php +++ b/include/class_database.php @@ -364,9 +364,19 @@ class Database $add=($from_setup==0)?'admin/':''; for ( $i = 4;$i <= $MaxVersion;$i++) { - $to=$i+1; - if ( $this->get_version() <= $i ) - { + $to = $i + 1; + + if ($this->get_version() <= $i) + { + if ($this->get_version() == 97) + { + if ($this->exist_schema("amortissement")) + { + $this->exec_sql('ALTER TABLE amortissement.amortissement_histo + ADD CONSTRAINT internal_fk FOREIGN KEY (jr_internal) REFERENCES jrn (jr_internal) + ON UPDATE CASCADE ON DELETE SET NULL'); + } + } echo "
  • Patching ".$p_name. " from the version ".$this->get_version()." to $to "; @@ -452,7 +462,7 @@ class Database $country=$this->get_value ("select pr_value from parameter where pr_id='MY_COUNTRY'"); $this->execute_script($add."sql/patch/upgrade61.".$country.".sql"); } - + if ( ! DEBUG ) ob_end_clean(); } } diff --git a/include/class_extension.php b/include/class_extension.php index 8d36bd42d..3db12adea 100644 --- a/include/class_extension.php +++ b/include/class_extension.php @@ -113,7 +113,7 @@ class Extension extends Menu_Ref_sql * insert into default profile */ $this->cn->exec_sql("insert into profile_menu(me_code,me_code_dep,p_type_display,p_id) - values ($1,$2,$3,$4)",array($this->me_code,'EXTENSION','S',1)); + values ($1,$2,$3,$4)",array($this->me_code,'EXT','S',1)); $this->cn->commit(); } catch (Exception $exc) diff --git a/include/class_pre_op_ach.php b/include/class_pre_op_ach.php index 0f4de6002..9b4a6372b 100644 --- a/include/class_pre_op_ach.php +++ b/include/class_pre_op_ach.php @@ -99,6 +99,7 @@ class Pre_op_ach extends Pre_operation_detail $this->db->commit(); } /*!\brief compute an array accordingly with the FormVenView function + * @return an array for filling the form */ function compute_array() { @@ -106,6 +107,7 @@ class Pre_op_ach extends Pre_operation_detail $a_op=$this->operation->load(); $array=$this->operation->compute_array($a_op); $p_array=$this->load(); + if ( empty ($p_array)) return array(); foreach ($p_array as $row) { if ( $row['opd_debit']=='f') @@ -126,7 +128,7 @@ class Pre_op_ach extends Pre_operation_detail return $array; } /*!\brief load the data from the database and return an array - * \return an array + * \return an array */ function load() { diff --git a/include/class_pre_op_advanced.php b/include/class_pre_op_advanced.php index 94272d685..0f4260e5b 100644 --- a/include/class_pre_op_advanced.php +++ b/include/class_pre_op_advanced.php @@ -101,6 +101,7 @@ class Pre_Op_Advanced extends Pre_operation_detail $array=$this->operation->compute_array($a_op); $array['desc']=$array['e_comm']; $p_array=$this->load(); + if (empty($p_array)) return array(); foreach ($p_array as $row) { $tmp_array=array("qc_".$count=>'', @@ -126,7 +127,7 @@ class Pre_Op_Advanced extends Pre_operation_detail return $array; } /*!\brief load the data from the database and return an array - * \return an array + * \return an array */ function load() { diff --git a/include/class_pre_op_ven.php b/include/class_pre_op_ven.php index 97c470dab..2b7e9f4f2 100644 --- a/include/class_pre_op_ven.php +++ b/include/class_pre_op_ven.php @@ -105,6 +105,7 @@ class Pre_op_ven extends Pre_operation_detail $a_op=$this->operation->load(); $array=$this->operation->compute_array($a_op); $p_array=$this->load(); + if (empty($p_array)) return array(); foreach ($p_array as $row) { if ( $row['opd_debit']=='t') @@ -124,7 +125,7 @@ class Pre_op_ven extends Pre_operation_detail return $array; } /*!\brief load the data from the database and return an array - * \return an array + * \return an array */ function load() { diff --git a/include/class_pre_operation.php b/include/class_pre_operation.php index ab0c69725..8e20665d9 100644 --- a/include/class_pre_operation.php +++ b/include/class_pre_operation.php @@ -196,11 +196,8 @@ class Pre_operation_detail $hid=new IHidden(); $r=$hid->input("action","use_opd"); $r.=$hid->input("jrn_type",$this->get("ledger_type")); - if ($this->count() != 0 ) - { - $r.= HtmlInput::submit('use_opd','Utilisez une op.prédéfinie'); - $r.= $this->show_button(); - } + $r.= HtmlInput::submit('use_opd','Utilisez une opération prédéfinie'); + $r.= $this->show_button(); return $r; } @@ -230,7 +227,7 @@ class Pre_operation_detail $value=$this->db->make_array("select od_id,od_name from op_predef ". " where jrn_def_id=".sql_string($this->jrn_def_id). " and od_direct ='".sql_string($this->od_direct)."'". - " order by od_name"); + " order by od_name",1); return $value; } function set($p_param,$value) diff --git a/include/menu.inc.php b/include/menu.inc.php index d9a84d40e..af0672ccd 100644 --- a/include/menu.inc.php +++ b/include/menu.inc.php @@ -155,7 +155,8 @@ for ($i=0;$i'; + $class= ( $i%2 == 0)?$class=' class="odd"':$class=' class="even"'; + echo ""; echo td($js); echo td($row->me_menu); echo td($row->me_description); diff --git a/include/search.inc.php b/include/search.inc.php index 4c6c6eb08..c22ff19ba 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -117,7 +117,7 @@ if ( isset ($_GET['viewsearch']) ) } else { - if ($step<$max_line ) echo 'Nombre d\'enregistrements trouvés =' .$max_line.' limite = '.$step.''; + if ($step<$max_line ) echo '

    Liste limitée à '.$step.' enregistrements. Le nombre d\'enregistrements trouvés est de ' .$max_line.'

    '; } echo '
    '; echo HtmlInput::submit("upd_rec","Mettre à jour"); diff --git a/include/template/param_jrn.php b/include/template/param_jrn.php index af72faa96..473692c3f 100644 --- a/include/template/param_jrn.php +++ b/include/template/param_jrn.php @@ -119,8 +119,8 @@ echo $card->input(); - - + + @@ -139,7 +139,7 @@ for ($i=0;$i<$num;$i++) { break; } } - echo ''; + echo ''; printf (' %s', $res['fd_id'],$CHECKED,$res['fd_label']); $CHECKED=" unchecked";