Plugins  LAST
 All Data Structures Files Functions Variables Pages
class_impacc_operation.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * Copyright (C) 2016 Dany De Bontridder <dany@alchimerys.be>
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 /***
22  * @file
23  * @brief Redirect to CSV or other format
24  *
25  */
26 /// Redirect to CSV or other format
28 {
29  /// call the right filter to import operation
30  function record_file(Impacc_File $p_file)
31  {
32  // in p_file we have the type CSV , XML NOALYSS or XML FEC
33  switch ($p_file->format)
34  {
35  case "CSV":
36  /**
37  * Following the ledger type we have to use impacc_csv_bank,
38  * sale_purchase or mis_operation
39  *
40  */
41  $csv=new Impacc_CSV();
42 
43  $csv->record($p_file);
44  break;
45 
46  default:
47  throw new Exception(_("Non supporté"), 1);
48  }
49  }
50  /// call the check and validate import , depending of the format (CSV...)
51  function check(Impacc_File $p_file)
52  {
53  switch ($p_file->format)
54  {
55  case 'CSV':
56 
57  $csv=new Impacc_CSV();
58  $csv->check($p_file);
59  break;
60 
61  default:
62  break;
63  }
64  }
65  ///Transfer operation from uploaded file to the
66  /// tables of Noalyss
67  //!\param $p_file Impacc_File $p_file
68  function transfer(Impacc_File $p_file)
69  {
70  switch($p_file->format)
71  {
72  case 'CSV':
73  $csv=new Impacc_CSV();
74  $obj=$csv->make_csv_class($p_file->import_file->id);
75  $obj->transfer();
76  break;
77  default:
78  throw new Exception(_("Non supporté"), 1);
79 
80  }
81  }
82 }
record_file(Impacc_File $p_file)
call the right filter to import operation
transfer(Impacc_File $p_file)
Transfer operation from uploaded file to the tables of Noalyss.
Used by all Import CSV Operation , contains the setting (delimiter,thousand ...)
check(Impacc_File $p_file)
call the check and validate import , depending of the format (CSV...)
Redirect to CSV or other format.