Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

import.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   PhpCompta is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 1.6 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00021 // Author Olivier Dzwoniarkiewicz
00026 include_once("ac_common.php");
00027 include_once("user_menu.php");
00028 include_once ("constant.php");
00029 include_once ("postgres.php");
00030 include_once ("check_priv.php");
00031 include_once ("class_widget.php");
00032 if ( ! isset ( $_SESSION['g_dossier'] ) ) {
00033   echo "You must choose a Dossier ";
00034   exit -2;
00035 }
00036 $cn=DbConnect($_SESSION['g_dossier']);
00037 include ('class_user.php');
00038 $User=new cl_user($cn);
00039 $User->Check();
00040 
00041 html_page_start($User->theme);
00042 
00043 
00044 /* Admin. Dossier */
00045 
00046 include_once("import_inc.php");
00047 
00048 include_once ("user_menu.php");
00049 echo '<div class="u_tmenu">';
00050 echo ShowMenuCompta($_SESSION['g_dossier'],"user_advanced.php");
00051 echo '</div>';
00052 $cn=DbConnect($_SESSION['g_dossier']);
00053 if ( $User->CheckAction($cn,IMP_BQE)==0){
00054   /* Cannot Access */
00055   NoAccess();
00056  }
00057 echo ShowMenuAdvanced("import.php");
00058 
00059 echo '<div class="lmenu">';
00060 ShowMenuImport();
00061 echo '</div>';
00062 if ( isset( $_REQUEST['PHPSESSID'])) {
00063         $sessid = $_REQUEST['PHPSESSID'];
00064 }
00065 
00066 
00067 // if action is set proceed to it
00068 if ( isset ($_GET["action"]) ) {
00069   $action=$_GET["action"];
00070 // menu = import cvs
00071   if ($action == "import" ) {
00072     if(isset($_FILES['fupload'])) {
00073         // load the table with the cvs' content
00074       echo '<DIV class="u_redcontent">';
00075       ImportCSV($cn,$_FILES['fupload']['tmp_name'],$_POST['import_bq'],$_POST['format_csv'],$_POST['import_jrn']);
00076       echo "</DIV>";
00077     } else {
00078       echo '<DIV class="u_redcontent">';
00079       ShowFormTransfert($cn);
00080       echo "</DIV>";
00081     }
00082   }
00083   if ( isset ($_POST['trashit'])) {
00084     DropRecord($cn,$_POST['code']);
00085     echo '<DIV class="u_redcontent">';
00086     VerifImport($cn);
00087     echo "</DIV>";
00088     exit();
00089   }
00090   if ($action == "verif" ) {
00091     if(isset($_POST['count'])) {
00092       UpdateCSV($cn);
00093     }
00094 
00095     echo '<DIV class="u_redcontent">';
00096     VerifImport($cn);
00097     echo "</DIV>";
00098   }
00099   if ($action == "transfer" ) {
00100 
00101     echo '<DIV class="u_redcontent">';
00102     //   TransferCSV($cn, 
00103     ConfirmTransfert($cn,$User->GetPeriode());
00104     echo "</DIV>";
00105   }
00106 } 
00107 /*-----------------------------------------------
00108  * transfert or remove the wrong record 
00109  *
00110  *-----------------------------------------------*/
00111 if ( isset ($_POST['action'])) {
00112   $action=$_POST['action'];
00113   if ($action == "transfer" ) {
00114     echo '<DIV class="u_redcontent">';
00115     TransferCSV($cn, $User->GetPeriode());
00116     echo "</DIV>";
00117   }
00118 
00119   if ($action == "remove" ) {
00120     echo '<DIV class="u_redcontent">';
00121     RemoveCSV($cn);
00122     ConfirmTransfert($cn,$User->GetPeriode());
00123     echo "</DIV>";
00124   }
00125 
00126 }
00127 html_page_stop();
00128 ?>