phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r299 - tag/rel601/modop


From: phpcompta-dev
Subject: [Phpcompta-dev] r299 - tag/rel601/modop
Date: Wed, 8 Feb 2012 22:32:49 +0100 (CET)

Author: danydb
Date: 2012-02-08 22:32:48 +0100 (Wed, 08 Feb 2012)
New Revision: 299

Removed:
   tag/rel601/modop/mod_save.php
Modified:
   tag/rel601/modop/index.php
   tag/rel601/modop/modop_confirm.php
   tag/rel601/modop/modop_display.php
   tag/rel601/modop/modop_save.php
Log:
Fix bug Document are not generated properly


Modified: tag/rel601/modop/index.php
===================================================================
--- tag/rel601/modop/index.php  2012-02-04 20:12:00 UTC (rev 298)
+++ tag/rel601/modop/index.php  2012-02-08 21:32:48 UTC (rev 299)
@@ -45,7 +45,9 @@
 </FORM>
 <hr>
 <?php
-  if ( isset($_GET['seek'])) {
+$action=(isset ($_REQUEST['action']))?$_REQUEST['action']:'end';
+
+  if ( ! isset ($_REQUEST['action']) && isset($_GET['seek'])) {
     /* retrieve and show the accounting */
     if ( trim($_GET['jr_id'])=='') {
       alert('Aucune opération demandé'); exit;}
@@ -53,8 +55,8 @@
     require_once('modop_display.php');
     exit();
   }
-$action=(isset ($_GET['action']))?$_GET['action']:'end';
 
+
 /* we need to confirm it */
 if ( $action=='confirm' ) {
   require_once('modop_confirm.php');

Deleted: tag/rel601/modop/mod_save.php
===================================================================
--- tag/rel601/modop/mod_save.php       2012-02-04 20:12:00 UTC (rev 298)
+++ tag/rel601/modop/mod_save.php       2012-02-08 21:32:48 UTC (rev 299)
@@ -1,26 +0,0 @@
-<?php
-/*
- *   This file is part of PhpCompta.
- *
- *   PhpCompta is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   PhpCompta is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   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 address@hidden
-
-/*!\file
- * \brief
- */
-

Modified: tag/rel601/modop/modop_confirm.php
===================================================================
--- tag/rel601/modop/modop_confirm.php  2012-02-04 20:12:00 UTC (rev 298)
+++ tag/rel601/modop/modop_confirm.php  2012-02-08 21:32:48 UTC (rev 299)
@@ -31,17 +31,17 @@
 $act->suspend_strict();
 //----------------------------------------------------------------------
 // ACH
-if ( $_GET['jrn_type'] == 'ACH') {
-  $jrn=new Acc_Ledger_Purchase($cn,$_GET['p_jrn']);
+if ( $_POST['jrn_type'] == 'ACH') {
+  $jrn=new Acc_Ledger_Purchase($cn,$_POST['p_jrn']);
   try {
-  echo '<FORM METHOD="GET">';
+  echo '<FORM enctype="multipart/form-data" METHOD="POST">';
   echo HtmlInput::hidden('ac',$_REQUEST['ac']);
   echo HtmlInput::extension().dossier::hidden();
   echo HtmlInput::hidden('action','save');
-  echo HtmlInput::hidden('ext_jr_id',$_GET['ext_jr_id']);
+  echo HtmlInput::hidden('ext_jr_id',$_POST['ext_jr_id']);
   echo HtmlInput::hidden('ext_jr_internal',
-                        $_GET['ext_jr_internal']);
-  echo $jrn->confirm($_GET);
+                        $_POST['ext_jr_internal']);
+  echo $jrn->confirm($_POST);
 
   echo HtmlInput::submit('save','Sauver');
   echo '</FORM>';
@@ -51,17 +51,17 @@
 }
 //----------------------------------------------------------------------
 // VEN
-if ( $_GET['jrn_type'] == 'VEN') {
-  $jrn=new Acc_Ledger_Sold($cn,$_GET['p_jrn']);
+if ( $_POST['jrn_type'] == 'VEN') {
+  $jrn=new Acc_Ledger_Sold($cn,$_POST['p_jrn']);
   try {
-  $a=$jrn->confirm($_GET);
-  echo '<FORM METHOD="GET">';
+  $a=$jrn->confirm($_POST);
+  echo '<FORM enctype="multipart/form-data" METHOD="POST">';
   echo HtmlInput::hidden('ac',$_REQUEST['ac']);
   echo HtmlInput::extension().dossier::hidden();
   echo HtmlInput::hidden('action','save');
-  echo HtmlInput::hidden('ext_jr_id',$_GET['ext_jr_id']);
+  echo HtmlInput::hidden('ext_jr_id',$_POST['ext_jr_id']);
   echo HtmlInput::hidden('ext_jr_internal',
-                        $_GET['ext_jr_internal']);
+                        $_POST['ext_jr_internal']);
   echo $a;
 
   echo HtmlInput::submit('save','Sauver');
@@ -73,20 +73,20 @@
 }
 //----------------------------------------------------------------------
 // ODS
-if ( $_GET['jrn_type'] == 'ODS') {
-  $jrn=new Acc_Ledger($cn,$_GET['p_jrn']);
+if ( $_POST['jrn_type'] == 'ODS') {
+  $jrn=new Acc_Ledger($cn,$_POST['p_jrn']);
   $jrn->with_concerned=false;
   try {
-    $jrn->verify($_GET);
-    $a= $jrn->input($_GET,1);
-    echo '<FORM METHOD="GET">';
+    $jrn->verify($_POST);
+    $a= $jrn->input($_POST,1);
+    echo '<FORM enctype="multipart/form-data" METHOD="POST">';
     echo HtmlInput::hidden('ac',$_REQUEST['ac']);
     echo HtmlInput::extension().dossier::hidden();
     echo HtmlInput::hidden('action','save');
-    echo HtmlInput::hidden('ext_jr_id',$_GET['ext_jr_id']);
+    echo HtmlInput::hidden('ext_jr_id',$_POST['ext_jr_id']);
     echo HtmlInput::hidden('ext_jr_internal',
-                        $_GET['ext_jr_internal']);
-    echo $a;    
+                        $_POST['ext_jr_internal']);
+    echo $a;
 
     echo HtmlInput::submit('save','Sauver');
     echo '</FORM>';

Modified: tag/rel601/modop/modop_display.php
===================================================================
--- tag/rel601/modop/modop_display.php  2012-02-04 20:12:00 UTC (rev 298)
+++ tag/rel601/modop/modop_display.php  2012-02-08 21:32:48 UTC (rev 299)
@@ -85,7 +85,7 @@
     $pop_tva->value='';
     echo $pop_tva->input();
 
-    echo '<FORM METHOD="GET" class="print">';
+    echo '<FORM enctype="multipart/form-data"  METHOD="POST" class="print">';
     $op->suspend_receipt();
     echo HtmlInput::hidden('ac',$_REQUEST['ac']);
     echo $jrn->input($op->array);
@@ -119,7 +119,7 @@
     echo $pop_tva->input();
     $op->suspend_receipt();
 
-    echo '<FORM METHOD="GET" class="print">';
+    echo '<FORM enctype="multipart/form-data"  METHOD="POST" class="print">';
     echo $jrn->input($op->array);
     echo HtmlInput::hidden('ac',$_REQUEST['ac']);
     echo HtmlInput::extension().dossier::hidden();
@@ -148,7 +148,7 @@
     echo $search_card->input();
     $op->suspend_receipt();
 
-    echo '<FORM METHOD="GET" class="print">';
+    echo '<FORM enctype="multipart/form-data"  METHOD="POST" class="print">';
     echo $jrn->input($op->array);
     echo HtmlInput::hidden('ac',$_REQUEST['ac']);
     echo HtmlInput::extension().dossier::hidden();
@@ -189,7 +189,7 @@
     $f_add_button->set_attribute('filter',$jrn->get_all_fiche_def ());
     $f_add_button->javascript=" select_card_type(this);";
     $str_add_button=$f_add_button->input();
-    echo '<FORM METHOD="GET" class="print">';
+    echo '<FORM enctype="multipart/form-data"  METHOD="post" class="print">';
     echo HtmlInput::hidden('ac',$_REQUEST['ac']);
     $Date=new IDate("e_date",$op->array['e_date']);
     $f_date=$Date->input();

Modified: tag/rel601/modop/modop_save.php
===================================================================
--- tag/rel601/modop/modop_save.php     2012-02-04 20:12:00 UTC (rev 298)
+++ tag/rel601/modop/modop_save.php     2012-02-08 21:32:48 UTC (rev 299)
@@ -29,115 +29,175 @@
 /* ---------------------------------------------------------------------- */
 // Purchase
 /* ---------------------------------------------------------------------- */
-if ( $_GET['jrn_type'] == 'ACH')
+if ( $_POST['jrn_type'] == 'ACH')
 {
-    $jrn=new Acc_Ledger_Purchase($cn,$_GET['p_jrn']);
+    $jrn=new Acc_Ledger_Purchase($cn,$_POST['p_jrn']);
     try
     {
-        $op=new Modop_Operation($cn,$_GET['ext_jr_internal']);
+        $op=new Modop_Operation($cn,$_POST['ext_jr_internal']);
         $op->suspend_receipt();
         $op->suspend_strict();
-        $pj=$_GET['e_pj'];
-        $_GET['e_pj']=microtime();
-        $new_internal=$jrn->insert($_GET);
+        $pj=$_POST['e_pj'];
+               $oldpj=  microtime();
+               $cn->exec_sql('update jrn set jr_pj_number=$1  where jr_id=$2',
+                      array($oldpj,$_POST['ext_jr_id']));
+        $new_internal=$jrn->insert($_POST);
     }
     catch (Exception $e)
     {
         alert($e->getMessage());
         exit();
     }
+       $cn->commit();
+
     /* we delete the old operation */
     $cn->start();
     /* in stock_goods */
     $cn->exec_sql('delete from stock_goods where j_id in (select j_id from 
jrnx join jrn on (j_grpt=jr_grpt_id) where jr_id=$1)',
-                  array($_GET['ext_jr_id']));
+                  array($_POST['ext_jr_id']));
 
     /* in jrnx */
     $cn->exec_sql('delete from jrnx where j_grpt in (select jr_grpt_id from 
jrn where jr_id=$1)',
-                  array($_GET['ext_jr_id']));
+                  array($_POST['ext_jr_id']));
 
     /* in jrn */
     $attach=$cn->get_array('select jr_pj,jr_pj_name,jr_pj_type from jrn where 
jr_id=$1',
-                           array($_GET['ext_jr_id']));
-    $cn->exec_sql('delete from jrn where jr_id=$1',array($_GET['ext_jr_id']));
+                           array($_POST['ext_jr_id']));
+    $cn->exec_sql('delete from jrn where jr_id=$1',array($_POST['ext_jr_id']));
     $cn->exec_sql('update jrn set jr_id=$1,jr_internal=$2,jr_pj_number=$3 
where jr_internal=$4',
-                  
array($_GET['ext_jr_id'],$_GET['ext_jr_internal'],$pj,$new_internal));
-    if ( $attach[0]['jr_pj_name'] != '')
+                  
array($_POST['ext_jr_id'],$_POST['ext_jr_internal'],$pj,$new_internal));
+    if ($_FILES['pj']['name']=='' && $attach[0]['jr_pj_name'] != '' && ! isset 
($_POST['gen_invoice']))
     {
         $cn->exec_sql('update jrn set jr_pj=$1,jr_pj_type=$2,jr_pj_name=$3 
where jr_id=$4',
-                      
array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_GET['ext_jr_id']));
+                      
array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_POST['ext_jr_id']));
     }
     /* in quant_purchase */
     $cn->exec_sql('update quant_purchase set qp_internal=$1 where 
qp_internal=$2',
-                  array($_GET['ext_jr_internal'],$new_internal));
+                  array($_POST['ext_jr_internal'],$new_internal));
 
     $cn->commit();
+       echo '<h2 class="info"> Enregistrement </h2>';
+               echo "<h2 >" . _('Opération sauvée') .$_POST['ext_jr_internal'] 
;
+               if ($jrn->pj != '')
+                       echo ' Piece : ' . h($jrn->pj);
+               echo "</h2>";
+               if (strcmp($jrn->pj, $_POST['e_pj']) != 0)
+               {
+                       echo '<h3 class="notice"> ' . _('Attention numéro pièce 
existante, elle a du être adaptée') . '</h3>';
+               }
+               if (isset($jrn->doc))
+               {
+                     echo '<span class="invoice">';
+                     echo $jrn->doc;
+                     echo '</span>';
+               }
+               /* Save the additional information into jrn_info */
+               $obj = new Acc_Ledger_Info($cn);
+               $obj->save_extra($jrn->jr_id, $_POST);
+               printf('<a class="line" style="display:inline" 
href="javascript:modifyOperation(%d,%d)">%s</a><hr>', $_POST['ext_jr_id'], 
dossier::id(), $new_internal);
+               // Feedback
+               echo $jrn->confirm($_POST, true);
+               echo '</div>';
 }
 /* ---------------------------------------------------------------------- */
 // SOLD
 /* ---------------------------------------------------------------------- */
-if ( $_GET['jrn_type'] == 'VEN')
+if ( $_POST['jrn_type'] == 'VEN')
 {
-    $jrn=new Acc_Ledger_Sold($cn,$_GET['p_jrn']);
+    $jrn=new Acc_Ledger_Sold($cn,$_POST['p_jrn']);
+       $pj=$_POST['e_pj'];
     try
-    {
-        $op=new Modop_Operation($cn,$_GET['ext_jr_internal']);
+    {  $cn->start();
+        $op=new Modop_Operation($cn,$_POST['ext_jr_internal']);
         $op->suspend_receipt();
         $op->suspend_strict();
-        $pj=$_GET['e_pj'];
-        $_GET['e_pj']=microtime();
-        $new_internal=$jrn->insert($_GET);
+
+               $oldpj=  microtime();
+               $cn->exec_sql('update jrn set jr_pj_number=$1  where jr_id=$2',
+                      array($oldpj,$_POST['ext_jr_id']));
+        $new_internal=$jrn->insert($_POST);
     }
     catch (Exception $e)
     {
         alert($e->getMessage());
         exit();
     }
+       $cn->commit();
     /* we delete the old operation */
     $cn->start();
 
     /* in stock_goods */
     $cn->exec_sql('delete from stock_goods where j_id in (select j_id from 
jrnx join jrn on (j_grpt=jr_grpt_id) where jr_id=$1)',
-                  array($_GET['ext_jr_id']));
+                  array($_POST['ext_jr_id']));
 
     /* in jrnx */
     $cn->exec_sql('delete from jrnx where j_grpt in (select jr_grpt_id from 
jrn where jr_id=$1)',
-                  array($_GET['ext_jr_id']));
+                  array($_POST['ext_jr_id']));
 
     /* in jrn */
     $attach=$cn->get_array('select jr_pj,jr_pj_name,jr_pj_type from jrn where 
jr_id=$1',
-                           array($_GET['ext_jr_id']));
+                           array($_POST['ext_jr_id']));
 
-    $cn->exec_sql('delete from jrn where jr_id=$1',array($_GET['ext_jr_id']));
+    $cn->exec_sql('delete from jrn where jr_id=$1',array($_POST['ext_jr_id']));
     $cn->exec_sql('update jrn set jr_id=$1,jr_internal=$2,jr_pj_number=$3 
where jr_internal=$4',
-                  
array($_GET['ext_jr_id'],$_GET['ext_jr_internal'],$pj,$new_internal));
-    if ( $attach[0]['jr_pj_name'] != '')
+                  
array($_POST['ext_jr_id'],$_POST['ext_jr_internal'],$pj,$new_internal));
+
+       if ( $_FILES['pj']['name']=='' && $attach[0]['jr_pj_name'] != '' && ! 
isset ($_POST['gen_invoice']))
     {
         $cn->exec_sql('update jrn set jr_pj=$1,jr_pj_type=$2,jr_pj_name=$3 
where jr_id=$4',
-                      
array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_GET['ext_jr_id']));
-    }
+                      
array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_POST['ext_jr_id']));
+        }
 
     /* in quant_sold */
     $cn->exec_sql('update quant_sold set qs_internal=$1 where qs_internal=$2',
-                  array($_GET['ext_jr_internal'],$new_internal));
+                  array($_POST['ext_jr_internal'],$new_internal));
 
     $cn->commit();
+ /* Show button  */
+            echo '<h2 class="info"> Enregistrement </h2>';
+            $jr_id=$_POST['ext_jr_id'];
 
+            echo "<h2 >"._('Opération sauvée');
+            if ( $jrn->pj != '') echo ' Piece : '.h($jrn->pj);
+            echo "</h2>";
+            if ( strcmp($jrn->pj,$_POST['e_pj']) != 0 )
+            {
+                echo '<h3 class="notice"> '._('Attention numéro pièce 
existante, elle a du être adaptée').'</h3>';
+            }
+
+            printf ('<a class="line" style="display:inline" 
href="javascript:modifyOperation(%d,%d)">%s</a><hr>',
+                    $jr_id,dossier::id(),$new_internal);
+                       echo $jrn->confirm($_POST,true);
+            /* Show link for Invoice */
+            if (isset ($jrn->doc) )
+            {
+                echo '<span class="invoice">';
+                echo $jrn->doc;
+                echo '</span>';
+            }
+
+
+            /* Save the additional information into jrn_info */
+            $obj=new Acc_Ledger_Info($cn);
+            $obj->save_extra($jr_id,$_POST);
+
+
+            echo '</div>';
 }
 /* ---------------------------------------------------------------------- */
 // ODS
 /* ---------------------------------------------------------------------- */
-if ( $_GET['jrn_type'] == 'ODS')
+if ( $_POST['jrn_type'] == 'ODS')
 {
-    $jrn=new Acc_Ledger($cn,$_GET['p_jrn']);
+    $jrn=new Acc_Ledger($cn,$_POST['p_jrn']);
     try
     {
-        $op=new Modop_Operation($cn,$_GET['ext_jr_internal']);
+        $op=new Modop_Operation($cn,$_POST['ext_jr_internal']);
         $op->suspend_receipt();
         $op->suspend_strict();
-        $pj=$_GET['e_pj'];
-        $_GET['e_pj']=microtime();
-        $jrn->save($_GET);
+        $pj=$_POST['e_pj'];
+        $_POST['e_pj']=microtime();
+        $jrn->save($_POST);
         $new_internal=$jrn->internal;
     }
     catch (Exception $e)
@@ -150,18 +210,18 @@
 
     /* in jrnx */
     $cn->exec_sql('delete from jrnx where j_grpt in (select jr_grpt_id from 
jrn where jr_id=$1)',
-                  array($_GET['ext_jr_id']));
+                  array($_POST['ext_jr_id']));
 
     /* in jrn */
     $attach=$cn->get_array('select jr_pj,jr_pj_name,jr_pj_type from jrn where 
jr_id=$1',
-                           array($_GET['ext_jr_id']));
-    $cn->exec_sql('delete from jrn where jr_id=$1',array($_GET['ext_jr_id']));
+                           array($_POST['ext_jr_id']));
+    $cn->exec_sql('delete from jrn where jr_id=$1',array($_POST['ext_jr_id']));
     $cn->exec_sql('update jrn set jr_id=$1,jr_internal=$2,jr_pj_number=$3 
where jr_internal=$4',
-                  
array($_GET['ext_jr_id'],$_GET['ext_jr_internal'],$pj,$new_internal));
+                  
array($_POST['ext_jr_id'],$_POST['ext_jr_internal'],$pj,$new_internal));
     if ( $attach[0]['jr_pj_name'] != '')
     {
         $cn->exec_sql('update jrn set jr_pj=$1,jr_pj_type=$2,jr_pj_name=$3 
where jr_id=$4',
-                      
array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_GET['ext_jr_id']));
+                      
array($attach[0]['jr_pj'],$attach[0]['jr_pj_type'],$attach[0]['jr_pj_name'],$_POST['ext_jr_id']));
     }
 
     $cn->commit();
@@ -171,9 +231,9 @@
 /* ---------------------------------------------------------------------- */
 // Purchase
 /* ---------------------------------------------------------------------- */
-if ( $_GET['jrn_type'] == 'FIN')
+if ( $_POST['jrn_type'] == 'FIN')
 {
-    extract ($_GET);
+    extract ($_POST);
     $user=new User($cn);
     try
     {



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]