'.
'Erreur dans l\'enregistrement '.
diff --git a/include/bank.inc.php b/include/bank.inc.php
index c275c7f4c..d3493421b 100644
--- a/include/bank.inc.php
+++ b/include/bank.inc.php
@@ -354,7 +354,8 @@ if ( $p_jrn != -1 )
echo $hid->IOValue("p_jrn",$p_jrn);
echo $hid->IOValue("jrn_type","FIN");
- echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
+ if ($op->count() != 0 )
+ echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '';
diff --git a/include/class_pre_operation.php b/include/class_pre_operation.php
index b4a43b17e..e5245d863 100644
--- a/include/class_pre_operation.php
+++ b/include/class_pre_operation.php
@@ -61,7 +61,8 @@ class Pre_operation
*/
function save() {
if ( CountSql($this->db,"select * from op_predef ".
- "where upper(od_name)=upper('".pg_escape_string($this->name)."')")
+ "where upper(od_name)=upper('".pg_escape_string($this->name)."')".
+ "and jrn_def_id=".$this->p_jrn)
!= 0 )
{
echo "Cette opération a déjà été sauvée";
diff --git a/include/constant.php b/include/constant.php
index 94984c00e..f2ece6170 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -29,11 +29,11 @@ $_ENV['TMP']="/tmp";
define ("phpcompta_password","dany");
define ("phpcompta_psql_port","5432");
define ("phpcompta_user","phpcompta");
-define ("domaine","rel240_");
+define ("domaine","");
define ("MAX_COMPTE",4);
-define ("DEBUG","true");
+define ("DEBUG","false");
// securite correspond a la table
// action
diff --git a/include/depense.inc.php b/include/depense.inc.php
index e0836377e..cd5f78145 100644
--- a/include/depense.inc.php
+++ b/include/depense.inc.php
@@ -261,7 +261,8 @@ if ( isset($_POST['save']))
else
{
$submit='';
- $submit.='';
+ if ( $own->MY_ANALYTIC != "nu" )
+ $submit.='';
$submit.='';
$form=FormAchView($cn,$p_jrn,$User->GetPeriode(),$_POST,$submit,$nb_number,true);
echo '';
@@ -334,7 +335,8 @@ if ( $p_jrn != -1 )
echo $hid->IOValue("jrn_type","ACH");
echo $hid->IOValue("sa","use_opd");
- echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
+ if ($op->count() != 0 )
+ echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '';
diff --git a/include/facture.inc.php b/include/facture.inc.php
index 932e08512..e0a3e27f6 100644
--- a/include/facture.inc.php
+++ b/include/facture.inc.php
@@ -321,7 +321,8 @@ if ( $p_jrn != -1 )
echo $hid->IOValue("jrn_type","VEN");
echo $hid->IOValue("sa","use_opd");
- echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
+ if ($op->count() != 0 )
+ echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '';
diff --git a/include/user_action_ach.php b/include/user_action_ach.php
index 59a9318f9..887e4cbf9 100644
--- a/include/user_action_ach.php
+++ b/include/user_action_ach.php
@@ -27,6 +27,10 @@ require_once ("preference.php");
require_once ("user_common.php");
require_once("class_widget.php");
require_once("class_jrn.php");
+require_once ('class_own.php');
+
+$own=new own($cn);
+
$cn=DbConnect($gDossier);
$msg_tva='Si le montant de TVA est égal à 0, il sera automatiquement calculé';
@@ -88,7 +92,8 @@ if ( $action == 'new' ) {
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","ACH");
- echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
+ if ($op->count() != 0 )
+ echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '';
@@ -143,7 +148,8 @@ if ( $action == 'new' ) {
! isset ($_POST['save'])) {
$nb_number=$_POST["nb_item"];
$submit='';
- $submit.='';
+ if ( $own->MY_ANALYTIC != "nu" )
+ $submit.='';
$submit.='';
if ( form_verify_input ($cn,$_GET['p_jrn'],$User->GetPeriode(),$_POST,$nb_number) == true ) {
// Should use a read only view instead of FormAch
@@ -179,7 +185,8 @@ if ( $action == 'new' ) {
echo "
";
}else {
$submit='';
- $submit.='';
+ if ( $own->MY_ANALYTIC != "nu" )
+ $submit.='';
$submit.='';
diff --git a/include/user_action_fin.php b/include/user_action_fin.php
index 73f57205f..fc31282c2 100644
--- a/include/user_action_fin.php
+++ b/include/user_action_fin.php
@@ -92,7 +92,8 @@ if ( $action == 'new' ) {
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","FIN");
- echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
+ if ($op->count() != 0 )
+ echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '';
diff --git a/include/user_action_ods.php b/include/user_action_ods.php
index 5d503d998..e30d6d5c1 100644
--- a/include/user_action_ods.php
+++ b/include/user_action_ods.php
@@ -28,11 +28,12 @@ include_once("class_widget.php");
require_once('class_dossier.php');
require_once ('class_pre_operation.php');
require_once ('class_pre_op_ods.php');
+require_once ('class_own.php');
$gDossier=dossier::id();
$cn=DbConnect($gDossier);
-
+$own=new own($cn);
if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) {
exit;
@@ -93,7 +94,8 @@ if ( $action == 'new' ) {
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","ODS");
- echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
+ if ($op->count() != 0 )
+ echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '';
@@ -143,7 +145,8 @@ if ( $action == 'new' ) {
if ( isset ($_POST['view_invoice']) ) {
$nb_number=$_POST["nb_item"];
$submit='';
- $submit.='';
+ if ( $own->MY_ANALYTIC != "nu" )
+ $submit.='';
$submit.='';
$r=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,true,$nb_number);
@@ -179,7 +182,8 @@ if ( $action == 'new' ) {
}else {
// CA incorrecte
$submit='';
- $submit.='';
+ if ( $own->MY_ANALYTIC != "nu" )
+ $submit.='';
$submit.='';
$r=FormODS($cn,$_POST['p_jrn'],$User->GetPeriode(),$submit,$_POST,true,$nb_number);
diff --git a/include/user_action_ven.php b/include/user_action_ven.php
index 02ddd3c3b..fa1aabf43 100644
--- a/include/user_action_ven.php
+++ b/include/user_action_ven.php
@@ -109,7 +109,8 @@ if ( $action == 'insert_vente' ) {
echo $hid->IOValue("p_jrn",$_GET['p_jrn']);
echo $hid->IOValue("jrn_type","VEN");
- echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
+ if ($op->count() != 0 )
+ echo widget::submit_button('use_opd','Utilisez une op.prédéfinie');
echo $op->show_button();
echo '';
diff --git a/include/user_form_fin.php b/include/user_form_fin.php
index 8e3a06e74..0f1fedd8f 100644
--- a/include/user_form_fin.php
+++ b/include/user_form_fin.php
@@ -310,6 +310,9 @@ $r.="";
$r.="Sauvez l'opération ?";
$r.=$chk->IOValue('opd_save');
+ $name=new widget('text');
+ $r.='nom de l\' opération ?'.$name->IOValue('predef');
+
}
// Set correctly the REQUEST param for jrn_type
$h=new widget('hidden');
@@ -452,6 +455,8 @@ function RecordFin($p_cn,$p_array,$p_user,$p_jrn) {
echo_debug(__FILE__.':'.__LINE__.'- ','save opd');
$opd=new Pre_op_fin($p_cn);
$opd->get_post();
+ $opd->operation->name=$_POST['predef'];
+
$opd->save();
echo_debug(__FILE__.':'.__LINE__.'- ',"opd = ",$opd);
}
diff --git a/include/user_form_ven.php b/include/user_form_ven.php
index f4332a54b..6b588c99e 100644
--- a/include/user_form_ven.php
+++ b/include/user_form_ven.php
@@ -30,6 +30,8 @@ require_once ("class_own.php");
require_once ("class_plananalytic.php");
require_once ('class_operation.php');
require_once ('class_pre_op_ven.php');
+require_once ('class_own.php');
+
/*! FormVenInput
* \brief Display the form for a sell
* Used to show detail, encode a new invoice
@@ -315,7 +317,7 @@ function form_verify_input($p_cn,$p_jrn,$p_periode,$p_array,$p_number)
}
// encode the pa Check only for mandatory CA
- if ( $own->MY_ANALYTIC!="un") // use of AA
+ if ( $own->MY_ANALYTIC!="nu") // use of AA
{
if ( isset (${"amount_t".$o})){
@@ -436,6 +438,7 @@ function form_verify_input($p_cn,$p_jrn,$p_periode,$p_array,$p_number)
function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form',$p_comment='')
{
+ $own=new own($p_cn);
$r="";
$data="";
@@ -633,7 +636,8 @@ function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form'
$r.=$data;
if ( $sum_with_vat != 0 ) {
$r.='';
- $r.='';
+ if ( $own->MY_ANALYTIC != "nu" )
+ $r.='';
}
$r.='';
diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh
index 05025b559..81b413e72 100755
--- a/scripts/cleanup.sh
+++ b/scripts/cleanup.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# clean all phpcompta related DB.
-DOMAIN="testing"
+DOMAIN="beta3_"
export PGPASSWORD="dany"
export PGUSER="phpcompta"
export PGHOST=localhost