';
//-----------------------------------------------------
diff --git a/include/check_priv.php b/include/check_priv.php
index 32b3abd36..690b73b39 100644
--- a/include/check_priv.php
+++ b/include/check_priv.php
@@ -132,7 +132,10 @@ function CheckJrn($p_dossier,$p_user,$p_jrn,$p_detail=False)
}
/*!
- * \brief Check if an user is allowed to do an action
+ * \brief Check if an user is allowed to do an action,
+ * this function is only used by the user_sec.php,
+ * otherwise you have to use cl_user->CheckAction
+ * or $cl_user->AccessRequest
*
* \param p_dossier dossier id
* \param p_login user's login
@@ -153,6 +156,7 @@ function CheckAction ( $p_dossier,$p_login,$p_action_id)
if ( $Count == 1 ) return 1;
echo "
Invalid action !!! $Count select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id
";
}
+
/*!
* \brief Check if an user is an administrator
*
diff --git a/include/class_fiche.php b/include/class_fiche.php
index 613696d7e..6318c049b 100644
--- a/include/class_fiche.php
+++ b/include/class_fiche.php
@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
+
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
include_once("class_attribut.php");
require_once('class_fiche_def.php');
@@ -39,7 +40,7 @@ class fiche {
var $fiche_def; /*! \enum $fiche_def fd_id */
var $attribut; /*! \enum $attribut array of attribut object */
var $fiche_def_ref; /*!\enum $fiche_def_ref Type of the card here always FICHE_TYPE_CONTACT */
-
+ var $row; /*! \enum All the row from the ledgers */
function fiche($p_cn,$p_id=0) {
$this->cn=$p_cn;
$this->id=$p_id;
@@ -455,7 +456,10 @@ class fiche {
{
echo_debug("insert ATTR_DEF_ACCOUNT");
$v=FormatString($value);
- if ( isNumber($v) == 1 )
+ if (
+ isNumber($v) == 1 &&
+ CountSql($this->cn,"select * from tmp_pcmn where pcm_val=$v")
+ )
{
$sql=sprintf("select account_insert(%d,%f)",
$this->id,$v);
@@ -465,8 +469,8 @@ class fiche {
$sql=sprintf("select account_insert(%d,null)",
$this->id);
}
- $Ret=ExecSql($this->cn,$sql);
-
+ ExecSql($this->cn,$sql);
+
continue;
}
// TVA
@@ -711,6 +715,190 @@ class fiche {
return $result[0]['frd_id'];
}
-
+
+ /*!
+ * \brief Get data for poste
+ *
+ * \param $p_from periode from
+ * \param $p_to end periode
+ * \param $p_qcode quick_code of the card
+ * \return double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal)
+ * (tot_deb,tot_credit
+ *
+ */
+ function GetRow($p_from,$p_to)
+ {
+ if ( $this->id == 0 )
+ {
+ echo_error("class_fiche",__LINE__,"id is 0");
+ return;
+ }
+ $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
+ $periode=sql_filter_per($this->cn,$p_from,$p_to,'p_id','jr_tech_per');
+
+ $Res=ExecSql($this->cn,"select to_char(j_date,'DD.MM.YYYY') as j_date,j_qcode,".
+ "case when j_debit='t' then j_montant else 0 end as deb_montant,".
+ "case when j_debit='f' then j_montant else 0 end as cred_montant,".
+ " jr_comment as description,jrn_def_name as jrn_name,".
+ "j_debit, jr_internal ".
+ " from jrnx left join jrn_def on jrn_def_id=j_jrn_def ".
+ " left join jrn on jr_grpt_id=j_grpt".
+ " where j_qcode='".$qcode."' and ".$periode.
+ " order by j_date::date");
+ $array=array();
+ $tot_cred=0.0;
+ $tot_deb=0.0;
+ $Max=pg_NumRows($Res);
+ if ( $Max == 0 ) return null;
+ for ($i=0;$i<$Max;$i++) {
+ $array[]=pg_fetch_array($Res,$i);
+ if ($array[$i]['j_debit']=='t') {
+ $tot_deb+=$array[$i]['deb_montant'] ;
+ } else {
+ $tot_cred+=$array[$i]['cred_montant'] ;
+ }
+ }
+ $this->row=$array;
+ return array($array,$tot_deb,$tot_cred);
+ }
+
+ /*!
+ * \brief HtmlTable, display a HTML of a card for the asked period
+ * \param none
+ *
+ * \return none
+ */
+ function HtmlTable()
+ {
+ $name=$this->getName();
+
+ list($array,$tot_deb,$tot_cred)=$this->GetRow( $_POST['from_periode'],
+ $_POST['to_periode']
+ );
+
+ if ( count($this->row ) == 0 )
+ return;
+
+ $rep="";
+
+ echo '
Attention: les soldes ne tiennent pas compte des journaux OD qui '.
+ 'n\'utilisent pas les quick codes, les soldes des postes sont dans impression->poste
",$solde['credit']);
diff --git a/include/impress_poste.php b/include/impress_poste.php
index 92ebe99e8..f2238234c 100644
--- a/include/impress_poste.php
+++ b/include/impress_poste.php
@@ -42,7 +42,7 @@ if ( isset( $_POST['bt_html'] ) ) {
{
$parent=$_POST['poste_id'];
$a_poste=getarray($cn,"select pcm_val from tmp_pcmn where pcm_val like '$parent%'");
- $go=2;
+ $go=3;
}
// Check if the post is numeric and exists
elseif ( CountSql($cn,'select * from tmp_pcmn where pcm_val='.FormatString($_POST['poste_id'])) != 0 )
@@ -54,35 +54,47 @@ if ( isset( $_POST['bt_html'] ) ) {
{
require_once("class_fiche.php");
// thanks the qcode we found the poste account
- $fiche=new fiche($cn,$_POST['f_id']);
- $fiche->GetByQCode($_POST['f_id']);
+ $fiche=new fiche($cn);
+ $qcode=$fiche->GetByQCode($_POST['f_id']);
$p=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
if ( $p != "- ERROR -") {
- $Poste=new poste($cn,$p);
- $go=1;
+ $go=2;
}
}
- // A account or a quick code is given
+ // A account is given
if ( $go == 1)
{
echo '
";
exit;
diff --git a/include/jrn.php b/include/jrn.php
index 33f2553da..c8a1bcaa0 100644
--- a/include/jrn.php
+++ b/include/jrn.php
@@ -17,7 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
+
/* $Revision$ */
+
/*! \file
* \brief work with the ledger
*/
diff --git a/include/stock.inc.php b/include/stock.inc.php
index efd4b0ad0..79c1666a7 100644
--- a/include/stock.inc.php
+++ b/include/stock.inc.php
@@ -18,7 +18,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
+
/* $Revision$ */
+
/*!\file
* \brief Manage the stock by year
*/
@@ -46,16 +48,6 @@ $User->Check();
// Synchronize rights
SyncRight($_SESSION['g_dossier'],$_SESSION['g_user']);
-// Get The priv on the selected folder
-if ( $User->admin == 0 ) {
-
- $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],STOCK_READ);
- if ($r == 0 ){
- /* Cannot Access */
- NoAccess();
- }
-
-}
$href=basename($_SERVER['PHP_SELF']);
if ($href=='compta.php')
@@ -70,6 +62,9 @@ if ($href=='compta.php')
//echo '
';
echo $left_menu;
}
+// Get The priv on the selected folder
+$User->AccessRequest($cn,STOCK_READ);
+
$action= ( isset ($_GET['action']))? $_GET['action']:"";
include_once("stock_inc.php");
@@ -135,7 +130,7 @@ if ( isset ($_POST['sub_change']))
$action="detail";
}
}
-
+echo JS_VIEW_JRN_MODIFY;
// View the summary
// if year is not set then use the year of the user's periode
diff --git a/include/stock_inc.php b/include/stock_inc.php
index 60378cab7..b99a4418b 100644
--- a/include/stock_inc.php
+++ b/include/stock_inc.php
@@ -28,7 +28,8 @@
* \brief show the listing of all goods
*
*
- *\param - database connection
+ *\param $cn database connection
+ * \param $p_year exercice
* -
* \return string containing the table
*/
@@ -187,7 +188,6 @@ $sql="select sg_code,
$r.="
";
diff --git a/include/supplier.inc.php b/include/supplier.inc.php
index e4a19932b..58ba99641 100644
--- a/include/supplier.inc.php
+++ b/include/supplier.inc.php
@@ -16,7 +16,9 @@
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
/* $Revision$ */
+
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
require_once("class_supplier.php");
$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
diff --git a/include/user_action_gl.php b/include/user_action_gl.php
index 62ea38b77..a4309bab0 100644
--- a/include/user_action_gl.php
+++ b/include/user_action_gl.php
@@ -30,8 +30,6 @@ include_once("class_user.php");
require_once("jrn.php");
$cn=DbConnect($_SESSION['g_dossier']);
-if (CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],0) < 1 )
- {NoAccess();exit -1;}
?>
diff --git a/include/user_action_ven.php b/include/user_action_ven.php
index aadc4342a..19f6a6761 100644
--- a/include/user_action_ven.php
+++ b/include/user_action_ven.php
@@ -17,7 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
+
/* $Revision$ */
+
/*! \file
* \brief Manage the ledger of type VEN
*/
diff --git a/include/user_common.php b/include/user_common.php
index 71f64a319..7c6b34536 100644
--- a/include/user_common.php
+++ b/include/user_common.php
@@ -16,7 +16,9 @@
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
/* $Revision$ */
+
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
include_once("postgres.php");
@@ -995,6 +997,10 @@ function jrn_navigation_bar($p_offset,$p_line,$p_size=0,$p_page=1)
// if max page == 1 then return a empty string
if ( $nb_page == 1) return "";
+ // restore the sort
+ if ( isset($_GET['o']))
+ $url=$url.'&o='.$_GET['o'];
+
$r="";
// previous
if ($p_page !=1) {
diff --git a/include/user_form_ods.php b/include/user_form_ods.php
index ad09f7762..a2a0ae58a 100644
--- a/include/user_form_ods.php
+++ b/include/user_form_ods.php
@@ -16,7 +16,9 @@
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
/* $Revision$ */
+
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
require_once("constant.php");
require_once("class_widget.php");
diff --git a/include/user_menu.php b/include/user_menu.php
index 128c603af..d089d96e7 100644
--- a/include/user_menu.php
+++ b/include/user_menu.php
@@ -25,6 +25,7 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* $Revision$ */
+
/*!
* \brief Show all the available folder for the users
* at the login page
@@ -256,6 +257,10 @@ function ShowMenuJrnUser($p_dossier,$p_type,$p_jrn,$p_extra="")
}
$Max=pg_NumRows($Ret);
+ // If you can't access any ledger, so you don't have access
+ if ( $Max == 0 )
+ NoAccess();
+
include_once("check_priv.php");
for ($i=0;$i<$Max;$i++) {
@@ -424,15 +429,17 @@ function u_ShowMenuRecherche($p_cn,$p_jrn,$p_sessid,$p_array=null)
$r.= '
Date compris entre
';
$r.= "
";
$r.= '
';
- $r.= '
';
+ $r.= '
et
';
$r.= '
';
$r.= "
";
$r.= "
Montant ";
$r.= '
';
$r.= '
';
- $r.= "
";
- $r.="
Internal code
";
- $r.='
';
+ $r.= '
';
+ $r.='
Internal code
';
+ $r.='
';
+ $r.='
vous pouvez spécifier uniquement une partie (VEN, numéro d\'opération...)