Plugins  LAST
 All Data Structures Files Functions Variables Pages
index.php
Go to the documentation of this file.
1 <?php
2 /*
3  * This file is part of NOALYSS.
4  *
5  * NOALYSS is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * NOALYSS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with NOALYSS; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 /* $Revision$ */
20 
21 // Copyright (c) 2002 Author Dany De Bontridder dany@alchimerys.be
22 
23 /*!\file
24  * \brief main file for importing card
25  */
26 
27 /*
28  * load javascript
29  */
30 require_once 'include/class_import_card.php';
31 require_once NOALYSS_INCLUDE.'/class/class_acc_ledger.php';
32 require_once NOALYSS_INCLUDE.'/class/class_acc_ledger_purchase.php';
33 require_once NOALYSS_INCLUDE.'/class/class_acc_ledger_sold.php';
34 require_once NOALYSS_INCLUDE.'/class/class_acc_operation.php';
35 global $cn;
36 echo '<div style="float:right"><a class="mtitle" style="font-size:140%" href="http://wiki.noalyss.eu/doku.php?id=importation_dolibarr" target="_blank">Aide</a>'.
37 '<span style="font-size:0.8em;color:red;display:inline">vers:SVNINFO</span>'.
38 '</div>';
39 $cn=Dossier::connect();
41 $version_plugin=SVNINFO;
42 
43 Extension::check_version(6910);
44 
45 // Javascript
46  ob_start();
47  require_once('impdol.js');
48 $j=ob_get_contents();
49 ob_end_clean();
50 echo create_script($j);
51 
52 
53 
54 $url='?'.dossier::get().'&plugin_code='.$_REQUEST['plugin_code']."&ac=".$_REQUEST['ac'];
55 
56 $array=array (
57  array($url.'&sa=fiche',_('Fiches'),_('Importation de nouvelles fiches'),1),
58  array($url.'&sa=opr',_('Opérations Ventes/Achats'),_('Importation d\'opérations de vente ou d\'achat'),2),
59  array($url.'&sa=parm',_('Paramètrage'),_('Paramètrage'),5)
60  );
61 
62 $sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:1;
63 switch($sa)
64  {
65  case 'fiche':
66  $default=1;
67  break;
68  case 'opr':
69  $default=2;
70  break;
71  case 'parm':
72  $default=5;
73  break;
74  default:
75  $default=0;
76  }
77 
78  if ($cn->exist_schema('impdol') == false)
79  {
80  require_once('include/class_install_impdol.php');
81 
82  $iplugn=new Install_Impdol();
83  $iplugn->install($cn);
84 
85  }
86 echo ShowItem($array,'H','mtitle','mtitle',$default,' style="width:80%;margin-left:10%"');
87 echo '<div class="content" style="padding:10">';
88 if ($default==1)
89 {
90  if ( ! isset($_REQUEST['sb']))
91  {
93  exit();
94  }
95 
96  if ( $_REQUEST['sb']=='test')
97  {
98  if (Import_Card::test_import() == 0 ) exit();
100  exit();
101 
102  }
103 
104  if($_REQUEST['sb'] == 'record')
105  {
106  if (Import_Card::record_import() ==0 ) exit();
108  }
109 }
110 if ($default == 5)
111 {
112  require_once('include/imd_parameter.inc.php');
113  exit();
114 
115 }
116 if ( $default== 2 )
117 {
118  require_once 'include/imd_operation.inc.php';
119  exit();
120 }
global $version_plugin
Definition: index.php:22
$_REQUEST['sa']
Definition: index.php:68
$cn
Definition: index.php:42
$sa
Definition: index.php:67
test_import()
Test the CSV file, show the choosed delimiter, the CSV parsed, and replace column header by attribute...
$j
Definition: index.php:36
new_import()
show the first screen,
$array
Definition: index.php:42
record_import()
record all rows
$url
Definition: index.php:40