From 0a57ed13d4b44bd0be07faf4da2bd660f5473c7b Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 2 Apr 2004 00:26:36 +0000 Subject: [PATCH] Many little Bugs fixed --- doc/manuel-fr.sgml | 126 +++++++++++++++++++- html/admin_repo.php | 5 + html/annulation.php | 7 +- html/fiche_new.php | 2 +- html/fiche_search.php | 2 +- html/jrn_search.php | 14 ++- html/login.php | 4 +- html/print_balance.php | 21 +++- html/stock.php | 39 +++++- html/user_login.php | 2 +- include/constant.php | 1 + include/form_input.php | 105 ++++++++-------- include/jrn.php | 6 +- include/postgres.php | 5 +- include/user_common.php | 70 +++++++---- include/user_menu.php | 5 + sql/account_repository.sql | 2 +- sql/demo.sql | 237 +++++++++++++++++++++++++------------ sql/mod-be.sql | 123 +++++++++---------- style-light.css | 2 + 20 files changed, 539 insertions(+), 239 deletions(-) diff --git a/doc/manuel-fr.sgml b/doc/manuel-fr.sgml index d9054891e..5239cb2f1 100644 --- a/doc/manuel-fr.sgml +++ b/doc/manuel-fr.sgml @@ -338,6 +338,7 @@ Op Sécurité + Remarques

PhpCompta a sa propre sécurité, cependant si vous voulez vraiment sécuriser votre comptabilité, vous devez prendre en compte qu'il ne @@ -349,8 +350,63 @@ trop facile mesures qui déterminera la sécurité de vos données, il suffit d'une seule faiblesse pour que la sécurité soit insuffisante. Le sujet est très vaste, il englobe trop de choses. C'est pourquoi nous ne -traiterons que de PhpCompta uniquement. +traiterons que de PhpCompta uniquement et un tout petit peu de PostgreSql. + + Base de données +

+En tout premier lieu, si vous avez réussi à tout installer, vous +devez ajouter une sécurité à l'accès de vos database. Donc n'essayez +pas d'utiliser install.sh quand la sécurité par mot de passe est +activée !!! Ou alors mettez le mot de passe dans ~/.pgpass de +l'utilisateur phpcompta +Dans include/constant.php changer le mot de passe (ligne +phpcompta_password), il contient dany par défaut par votre mot de +passe + +En tant +qu'utilisateur postgres, ajoutez un mot de passe à votre utilisateur +phpcompta avec la commande // +psql -c "alter user phpcompta password 'votre_mot_de_passe'" +Ce mot de passe est évidemment celui dont on a parlé au paragraphe +précédent. + + +Ensuite changez le pg_hba.conf, et mettez les lignes suivantes + +host all all 172.16.31.0 255.255.255.0 md5 +local all all md5 +host all all 127.0.0.1 255.255.255.255 md5 + +La première ligne corresponde à mon réseau privé. + +Relancez postgres, voilà maintenant un mot de passe sera toujours +requis, n'oubliez pas de mettre un mot de passe à vos +superutilisateurs PostgreSql avant de changer, sinon vous ne pourrez +plus vous connecter. + +Ensuite, changer les droits sur le répertoire où sont vos fichiers +avec chmod 700, attention : le propriétaire des fichiers doit être le +même que du propriétaire du process httpd, pour vérifier faite ps -ef|grep +httpd, le propriétaire du processus ttpd se trouve dans la première +colonne. +Exemple chez moi, le propriétaire est apache + +root@july data]# ps -ef|grep httpd +root 24540 1 0 22:47 ? 00:00:00 /opt/http2//bin/httpd -k start +apache 24541 24540 0 22:47 ? 00:00:00 [httpd] +apache 24542 24540 0 22:47 ? 00:00:00 [httpd] +apache 24543 24540 0 22:47 ? 00:00:00 [httpd] +apache 24544 24540 0 22:47 ? 00:00:00 [httpd] +apache 24545 24540 0 22:47 ? 00:00:00 [httpd] +root 24555 23968 0 22:56 pts/0 00:00:00 grep httpd + + + + + + PhpCompta +

Dans PhpCompta, le module de sécurité permet d'établir quel utilisateur peut accéder à quel dossier, ce qu'il peut y faire, les journaux qu'il peut accéder. Chaque fois qu'une page est chargée, @@ -379,12 +435,78 @@ permis. Si son droit par d pourra écrire partout sauf là ou est explicitement il ne peut qu'écrire. Le sens d'écrire dans ce contexte-ci doit se comprendre comme la capacité à pouvoir ajouter ou modifier des informations - + Gestion de stock +

Pour toutes les marchandises dont vous voulez gérer le stock, il +faut ajouter l'attribut gestion de stock, vous devez y mettre un code, +et exactement le même code dans sa contrepartie. Les mêmes +marchandises ont toujours deux fiches : l'une pour la vente et l'autre +pour l'achat, la seule façon de lier ces fiches est de leur donner le +même code de stock. + +Bien faire attention à ce code, il doit être le même pour les fiches +achats et ventes de la même marchandise, si vous utilisez ce code +stock pour deux différentes marchandise, vous ne serez plus en mesure +de faire la différence entre ces 2 marchandises dans le stock. + +Dans le mode utilisateur, les achats et les ventes vont +automatiquement mettre le stock à jour. Dans le mode comptable ce +n'est pas le cas ! + + Gestion de stock +

Dans le menu avancé vous verrez l'item stock, dans le mode +comptable, il n'est pas possible de gérer le stock. Il faut rechanger +son mode par défaut à User. + + Rapprochement Centralisation + + Exemple +Ouverture de compte +

+En débit d'année, il faut réouvrir les comptes ou les ouvrir en +commençant une activité. + +1 janvier +Pierre lance une société dont le capital est de 18200 euros, dont +seulement 6100 euro sont libérés et mis sur un compte en banque + +Opération diverse -> +débit banque 6100 euros +débit capital non appelé 12100 +à crédit capital souscrit 18200 + + Quelques factures +

5 janvier +Pierre paie le loyer (400 euro) à son propriétaire par banque, prendre +le journal achat + +7 janvier +Pierre paie l'eau et le gaz (250 euros + 21%tva), cliquez sur le +bouton new pour créer les fiches manquantes + +15 janvier +Extrait de compte banquaire: on voit le paiement du loyer du 5 janvier + +17 janvier +Banque : on voit les paiements du 7 janvier +encoder dans le journal financier, ne pas oublier le rapprochement + +21 janvier +Vente : vend 15 pièces de l'article A, paiement par banque + +26 janvier +Banque : on voit les paiements du 15 janvier +encoder dans le journal financier, ne pas oublier le rapprochement + +31 janvier +Banque : le client nous a payé pour la facture du 21 +encoder dans le journal financier, ne pas oublier le rapprochement + + diff --git a/html/admin_repo.php b/html/admin_repo.php index d7158c4ce..4f8823174 100644 --- a/html/admin_repo.php +++ b/html/admin_repo.php @@ -169,6 +169,7 @@ if ( $count == 0 ) { + @@ -205,14 +206,18 @@ if ( $count == 0 ) { $Res=ExecSql($cn,"truncate table jrn"); $Res=ExecSql($cn,"truncate table jrnx"); $Res=ExecSql($cn,"truncate table centralized"); + $Res=ExecSql($cn,"truncate table stock_goods"); + // Reset Sequence $Res=ExecSql($cn,"drop sequence s_jrn"); $Res=ExecSql($cn,"drop sequence s_jrn_op"); $Res=ExecSql($cn,"drop sequence s_centralized"); + $Res=ExecSql($cn,"drop sequence s_stock_goods"); $Res=ExecSql($cn,"create sequence s_jrn"); $Res=ExecSql($cn,"create sequence s_jrn_op"); $Res=ExecSql($cn,"create sequence s_centralized"); + $Res=ExecSql($cn,"create sequence s_stock_goods"); } // Show all available templates diff --git a/html/annulation.php b/html/annulation.php index 05ca0d88e..7180fd515 100644 --- a/html/annulation.php +++ b/html/annulation.php @@ -72,19 +72,20 @@ if ( isset ($annul) ) { j_text,j_internal,'$g_user',$period from jrnx where j_grpt=".$_POST['p_id']; $Res=ExecSql($cn,$sql); - // Get the internal code - $internalcode=SetInternalCode($cn,$seq,$g_jrn); + // build the sql stmt for jrn $sql= "insert into jrn ( jr_def_id,jr_montant,jr_comment, jr_date,jr_grpt_id,jr_internal ,jr_tech_per ) select - jr_def_id,jr_montant,'Annulation '||jr_comment,jr_date,$seq ,'$internalcode', $period + jr_def_id,jr_montant,'Annulation '||jr_comment,jr_date,$seq ,'ANNUL', $period from jrn where jr_grpt_id=".$_POST['p_id']; $Res=ExecSql($cn,$sql); + // Get the internal code + $internalcode=SetInternalCode($cn,$seq,$g_jrn); // also in the stock table $sql="insert into stock_goods ( j_id,f_id,sg_quantity,sg_type diff --git a/html/fiche_new.php b/html/fiche_new.php index 1bbd0c010..2a25ee4bc 100644 --- a/html/fiche_new.php +++ b/html/fiche_new.php @@ -48,7 +48,7 @@ $cn=DbConnect($l_Db); foreach ($HTTP_GET_VARS as $key=>$element) { // The value are e_name e_type e_PHPSESSID ${"e_$key"}=$element; - echo("e_$key =$element
"); + echo_debug("e_$key =$element
"); } diff --git a/html/fiche_search.php b/html/fiche_search.php index 8253f3ff7..269ecc5c2 100644 --- a/html/fiche_search.php +++ b/html/fiche_search.php @@ -81,7 +81,7 @@ $r=""; foreach ($HTTP_GET_VARS as $key=>$element) { // The value are e_name e_type e_PHPSESSID ${"e_$key"}=$element; - echo("e_$key =$element
"); + echo_debug("e_$key =$element
"); } $e_fic_search=(isset ($_POST['fic_search']))?$_POST['fic_search']:""; diff --git a/html/jrn_search.php b/html/jrn_search.php index ff947417e..d7739fe3a 100644 --- a/html/jrn_search.php +++ b/html/jrn_search.php @@ -85,8 +85,9 @@ if ( $g_UserProperty['use_admin'] != 1 ) { } else { $condition.=" uj_login='$g_user' "; } - - +?> +
+'; echo '
Name
Description
'; echo ''; @@ -117,7 +118,7 @@ if ( isset ($_POST["search"]) ) { j_montant,j_poste,j_debit,j_tech_per,jr_id,jr_comment,j_grpt,pcm_lib,jr_internal from jrnx inner join jrn on jr_grpt_id=j_grpt inner join tmp_pcmn on j_poste=pcm_val ". " inner join user_sec_jrn on uj_jrn_id=j_jrn_def". - $condition." order by j_id"); + $condition." order by jr_id,j_debit desc"); $MaxLine=pg_NumRows($Res); if ( $MaxLine==0) { @@ -152,10 +153,10 @@ if ( isset ($_POST["search"]) ) { echo ''; } if ( $l_line['j_debit'] == 't' ) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } echo $col_vide; if ( $l_line['j_debit']=='f') @@ -185,5 +186,8 @@ if ( isset ($_POST["search"]) ) { echo '
'.$l_line['jr_comment'].'
'; }// if $_POST [search] +?> + + diff --git a/html/login.php b/html/login.php index ade7a2801..2f41c51d3 100644 --- a/html/login.php +++ b/html/login.php @@ -30,8 +30,8 @@ if ( isset ($_POST["p_user"] ) ) { $g_pass=$_POST["p_pass"]; session_register("g_user"); session_register("g_pass"); - $cn=pg_connect("dbname=account_repository user='phpcompta' "); - + //$cn=pg_connect("dbname=account_repository user='phpcompta' "); + $cn=DbConnect("account_repository"); // Verif if User and Pass match DB // if no, then redirect to the login page CheckUser(); diff --git a/html/print_balance.php b/html/print_balance.php index 0d6b9676f..b9887df29 100644 --- a/html/print_balance.php +++ b/html/print_balance.php @@ -67,6 +67,11 @@ if ( ( $M=pg_NumRows($Res)) == 0 ) { exit(); } +$tot_cred= 0.0; +$tot_deb= 0.0; +$tot_deb_saldo=0.0; +$tot_cred_saldo=0.0; + // Load the array for ($i=0; $i <$M;$i++) { $r=pg_fetch_array($Res,$i); @@ -77,9 +82,23 @@ for ($i=0; $i <$M;$i++) { $a['solde_deb']=( $a['sum_deb'] >= $a['sum_cred'] )? $a['sum_deb']- $a['sum_cred']:0; $a['solde_cred']=( $a['sum_deb'] <= $a['sum_cred'] )?$a['sum_cred']-$a['sum_deb']:0; $array[$i]=$a; - + $tot_cred+= $r['sum_cred']; + $tot_deb+= $r['sum_deb']; + $tot_deb_saldo+= $a['solde_deb']; + $tot_cred_saldo+= $a['solde_cred']; + }//for i +// Add the saldo +$i+=1; +$a['poste']=""; +$a['label']=" Totaux "; +$a['sum_deb']=$tot_deb; +$a['sum_cred']=$tot_cred; +$a['solde_deb']=$tot_deb_saldo; +$a['solde_cred']=$tot_cred_saldo; +$array[$i]=$a; + $pdf=& new Cezpdf('a4'); $pdf->selectFont('./addon/fonts/Helvetica.afm'); $pdf->ezSetCmMargins(2,2,2,2); diff --git a/html/stock.php b/html/stock.php index c232c19fe..825dbe80a 100644 --- a/html/stock.php +++ b/html/stock.php @@ -18,9 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Auteur Dany De Bontridder ddebontridder@yahoo.fr -include_once ("ac_common.php"); /* $Revision$ */ include_once("preference.php"); +include_once ("ac_common.php"); +include_once("postgres.php"); +include_once("stock_inc.php"); html_page_start($g_UserProperty['use_theme']); @@ -62,13 +64,42 @@ $left_menu=ShowMenuAdvanced(); echo '

'; +include_once("stock_inc.php"); + + +// if year is not set then use the year of the user's periode +if ( ! isset ($_GET['p_year']) ) { + // get defaut periode + $a=GetUserPeriode($cn,$g_user); + // get exercice of periode + $p_year=GetExercice($cn,$a); + } else + { + $p_year=$_GET['p_year']; + } + +// Show the possible years +$sql="select distinct (p_exercice) as exercice from parm_periode "; +$Res=ExecSql($cn,$sql); +$r=""; +for ( $i = 0; $i < pg_NumRows($Res);$i++) { + $l=pg_fetch_array($Res,$i); + $r.=sprintf('%d - ', + $l['exercice'], + $l['exercice']); + +} + // Show the current stock echo '
'; +echo $r; echo '
'; - - -echo ''; +$a=ViewStock($cn,$p_year); +if ( $a != null ) { + echo ''; + echo $a; +} echo '
'; ?> \ No newline at end of file diff --git a/html/user_login.php b/html/user_login.php index 268e5198f..1dd01f658 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -29,7 +29,7 @@ u_ShowMenu($g_UserProperty['use_admin']); $priv=($g_UserProperty['use_admin']==1)?"Administrator":"User"; echo '

Welcome '.$g_UserProperty['use_first_name'].' '. - $g_UserProperty['use_name'].', your are an '. $priv.' Please Select your folder

'; + $g_UserProperty['use_name'].'
, your are an '. $priv.' Please Select your folder'; // Show default menu (preference,...) // If admin show everything otherwise only the available dossier diff --git a/include/constant.php b/include/constant.php index 1147e53f3..02f127f98 100644 --- a/include/constant.php +++ b/include/constant.php @@ -21,6 +21,7 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr // $Revision$ +define ("phpcompta_password","dany"); // securite correspond a la table // action diff --git a/include/form_input.php b/include/form_input.php index 9fd0adb24..987c73947 100644 --- a/include/form_input.php +++ b/include/form_input.php @@ -539,7 +539,7 @@ if (strlen($e_ech) != 0 and isNumber($e_ech) == 0 and isDate ($e_ech) == null // end table $r.=' '; - $r.='
'; + $r.='
'; $r.="Total HTVA = $sum_march
"; $r.="Total = $sum_with_vat"; $r.="
"; @@ -611,11 +611,13 @@ function RecordInvoice($p_cn,$p_array,$p_user,$p_jrn) // store quantity & goods in array $a_good[$i]=${"e_march$i"}; $a_quant[$i]=${"e_quant$i"}; - + $a_price[$i]=0; // check wether the price is set or no if ( isNumber(${"e_march$i"."_sell"}) == 0 ) { - // If the price is not set we have to find it from the database - $a_price[$i]=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_PRIX_VENTE); + if ( isNumber($a_good[$i]) == 1 ) { + // If the price is not set we have to find it from the database + $a_price[$i]=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_PRIX_VENTE); + } } else { // The price is valid $a_price[$i]=${"e_march$i"."_sell"}; @@ -633,45 +635,46 @@ function RecordInvoice($p_cn,$p_array,$p_user,$p_jrn) } // First we add in jrnx - // Compute the j_grpt - $seq=GetNextId($p_cn,'j_grpt')+1; + // Compute the j_grpt + $seq=GetNextId($p_cn,'j_grpt')+1; + + // Debit = client + $poste=GetFicheAttribut($p_cn,$e_client,ATTR_DEF_ACCOUNT); - // Debit = client - $poste=GetFicheAttribut($p_cn,$e_client,ATTR_DEF_ACCOUNT); + InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,$amount+$sum_vat,$seq,$periode); - InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,$amount+$sum_vat,$seq,$periode); - - // Credit = goods - for ( $i = 0; $i < $nb_item;$i++) { - $poste=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_ACCOUNT); + // Credit = goods + for ( $i = 0; $i < $nb_item;$i++) { + if ( isNumber($a_good[$i]) == 0 ) continue; + $poste=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_ACCOUNT); + + // don't record operation of 0 + if ( $a_price[$i]*$a_quant[$i] == 0 ) continue; + + // record into jrnx + $j_id=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,$a_price[$i]*$a_quant[$i],$seq,$periode); + + // always save quantity but in withStock we can find what card need a stock management + InsertStockGoods($p_cn,$j_id,$a_good[$i],$a_quant[$i],'c'); + } + // Insert Vat + if (sizeof($a_vat) != 0 ) // no vat + { + foreach ($a_vat as $tva_id => $tva_amount ) { + $poste=GetTvaPoste($p_cn,$tva_id,'c'); + if ($tva_amount == 0 ) continue; + InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,$tva_amount,$seq,$periode); + } + } + echo_debug("echeance = $e_ech"); + InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,"Invoice",$amount+$sum_vat,$seq,$periode); + // Set Internal code and Comment + $comment=SetInternalCode($p_cn,$seq,$p_jrn)." client : ".GetFicheName($p_cn,$e_client); - // don't record operation of 0 - if ( $a_price[$i]*$a_quant[$i] == 0 ) continue; - - // record into jrnx - $j_id=InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,$a_price[$i]*$a_quant[$i],$seq,$periode); - - // always save quantity but in withStock we can find what card need a stock management - InsertStockGoods($p_cn,$j_id,$a_good[$i],$a_quant[$i],'c'); - } - // Insert Vat - if (sizeof($a_vat) != 0 ) // no vat - { - foreach ($a_vat as $tva_id => $tva_amount ) { - $poste=GetTvaPoste($p_cn,$tva_id,'c'); - if ($tva_amount == 0 ) continue; - InsertJrnx($p_cn,'c',$p_user,$p_jrn,$poste,$e_date,$tva_amount,$seq,$periode); - } - } -echo_debug("echeance = $e_ech"); - InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,"Invoice",$amount+$sum_vat,$seq,$periode); - // Set Internal code and Comment - $comment=SetInternalCode($p_cn,$seq,$p_jrn)." client : ".GetFicheName($p_cn,$e_client); - - // Update and set the invoice's comment - $Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq); - return $comment; + // Update and set the invoice's comment + $Res=ExecSql($p_cn,"update jrn set jr_comment='".$comment."' where jr_grpt_id=".$seq); + return $comment; } /* function FormAch($p_cn,$p_jrn,$p_user,$p_array=null,$view_only=true,$p_article=1) * Purpose : Display the form for buying @@ -878,6 +881,7 @@ function RecordAchat($p_cn,$p_array,$p_user,$p_jrn) // Computing total customer for ($i=0;$i<$nb_item;$i++) { // store quantity & goods in array + if ( isNumber(${"e_march$i"}) == 0 ) continue; $a_good[$i]=${"e_march$i"}; $a_quant[$i]=${"e_quant$i"}; @@ -913,6 +917,7 @@ function RecordAchat($p_cn,$p_array,$p_user,$p_jrn) // Credit = goods for ( $i = 0; $i < $nb_item;$i++) { + $poste=GetFicheAttribut($p_cn,$a_good[$i],ATTR_DEF_ACCOUNT); if ( $a_price[$i] * $a_quant[$i] == 0 ) continue; $j_id=InsertJrnx($p_cn,'d',$p_user,$p_jrn,$poste,$e_date,$a_price[$i]*$a_quant[$i],$seq,$periode); @@ -1263,12 +1268,12 @@ function FormODS($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p // If $account has a value if ( isNumber($account) == 1 ) { if ( CountSql($p_cn,"select * from tmp_pcmn where pcm_val=$account") == 0 ) { - $msg="Poste comptable inexistant !!! "; - echo_error($msg); echo_error($msg); - echo ""; - $account=""; + $msg="Poste comptable inexistant !!! "; + echo_error($msg); echo_error($msg); + echo ""; + $account=""; } else { - // retrieve the tva label and name + // retrieve the tva label and name $lib=GetPosteLibelle($p_cn, $account,1); } } @@ -1295,8 +1300,13 @@ function FormODS($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p $c_check=( ${"e_account$i"."_type"} == 'c')?"CHECKED":""; $d_check=( ${"e_account$i"."_type"} == 'd' )?"CHECKED":""; $r.=''; - $r.=' Débit ou '; - $r.=' Crédit '; + if ( $view_only == false ) { + $r.=' Débit ou '; + $r.=' Crédit '; + }else { + $r.=(${"e_account$i"."_type"} == 'c' )?"Crédit":"Débit"; + $r.=''; + } $r.=''; $r.=''; $sum_deb+=(${"e_account$i"."_type"}=='d')?${"e_account$i"."_amount"}:0; @@ -1319,7 +1329,7 @@ function FormODS($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p } -/* function RecordAchat +/* function RecordODS ************************************************** * Purpose : Record an buy in the table jrn & * jrnx @@ -1358,6 +1368,7 @@ function RecordODS($p_cn,$p_array,$p_user,$p_jrn) // store into the database for ( $i = 0; $i < $nb_item;$i++) { + if ( isNumber(${"e_account$i"}) == 0 ) continue; $sum_deb+=(${"e_account$i"."_type"}=='d')?${"e_account$i"."_amount"}:0; $sum_cred+=(${"e_account$i"."_type"}=='c')?${"e_account$i"."_amount"}:0; diff --git a/include/jrn.php b/include/jrn.php index 9ec14072b..b7f1471b0 100644 --- a/include/jrn.php +++ b/include/jrn.php @@ -287,11 +287,7 @@ if ( $p_update == 0 ) echo " ', - $row['jr_id'],$l_sessid); + $r.=sprintf('', + $row['jr_id'],$l_sessid,$row['jr_internal']); $r.=""; @@ -360,14 +365,29 @@ return $r; function InsertStockGoods($p_cn,$p_j_id,$p_good,$p_quant,$p_type) { - - $Res=ExecSql($p_cn,"insert into stock_goods ( + // Retrieve the good account for stock + $code_marchandise="select av_text from + jnt_fic_att_value + natural join attr_value + where + ad_id=".ATTR_DEF_STOCK." + and f_id=$p_good"; + $Res=ExecSql($p_cn,$code_marchandise); + if ( pg_NumRows($Res) == 0 ) { + $l_code='null'; + }else { + $r=pg_fetch_array($Res,0); + $l_code=$r['av_text']; + } + $Res=ExecSql($p_cn,"insert into stock_goods ( j_id, f_id, + sg_code, sg_quantity, sg_type ) values ( $p_j_id, $p_good, + '$l_code', $p_quant, '$p_type') "); } diff --git a/include/user_menu.php b/include/user_menu.php index a8b882693..e737c31b0 100644 --- a/include/user_menu.php +++ b/include/user_menu.php @@ -340,6 +340,8 @@ function u_ShowMenuRecherche($p_cn,$p_jrn,$p_sessid,$p_array=null) if ( ! isset ($p_mont_sel))$p_mont_sel=""; if ( ! isset ($p_s_comment))$p_s_comment=""; if ( ! isset ($p_s_montant)) $p_s_montant=""; + if ( ! isset ($p_s_internal)) $p_s_internal=""; + if ( $p_mont_sel != "" ) $opt.='