Plugins  LAST
 All Data Structures Files Functions Variables Pages
Static Public Member Functions
Impacc_Verify Class Reference

All the methods to check the column from The table impacc.import_detail are here. More...

Collaboration diagram for Impacc_Verify:
Collaboration graph

Static Public Member Functions

static check_quantity (Impacc_Import_detail_SQL $row, $p_thousand, $p_decimal)
 
static check_amount_vat (Impacc_Import_detail_SQL $row, $p_thousand, $p_decimal)
 
static check_service (Impacc_Import_detail_SQL $row)
 Check that the sale / purchase card exist Update the object $row (id_message) More...
 
static check_tva ($p_tva_code)
 Check that TVA_CODE does exist , return true if exists otherwise false. More...
 
static check_date ($p_date, $p_format_date)
 Check that the date payment has valid format . Return false or. More...
 
static check_card ($p_account)
 Check that a card exist and use a valid accounting. More...
 
static check_belong_card (Fiche $p_account, $p_ledger)
 Check that a card belong to a ledger. More...
 

Detailed Description

All the methods to check the column from The table impacc.import_detail are here.

Definition at line 27 of file class_impacc_verify.php.

Member Function Documentation

static Impacc_Verify::check_amount_vat ( Impacc_Import_detail_SQL  $row,
  $p_thousand,
  $p_decimal 
)
static
Parameters
$rowis an Impacc_Import_detail_SQL object

Definition at line 52 of file class_impacc_verify.php.

References Impacc_Tool\convert_amount().

54  {
55  $row->id_amount_vat_conv=Impacc_Tool::convert_amount($row->id_amount_vat,
56  $p_thousand, $p_decimal);
57  if (isNumber($row->id_amount_vat_conv)==0)
58  {
59  $and=($row->id_message=="")?"":",";
60  $row->id_message.=$and."CK_INVALID_AMOUNT";
61  }
62  }
static convert_amount($p_amount, $p_thousand, $p_decimal)
convert_amount($array[$i]->id_amount_novat,$this->detail->s_thousand,$this->s_decimal); ...
static Impacc_Verify::check_belong_card ( Fiche  $p_account,
  $p_ledger 
)
static

Check that a card belong to a ledger.

Parameters
$p_accountquick_code of a card,
$p_ledgerledger id , to see if not zero check if belong to ledger
Returns
true if correct , else false

Definition at line 164 of file class_impacc_verify.php.

165  {
166 
167  return true;
168  }
static Impacc_Verify::check_card (   $p_account)
static

Check that a card exist and use a valid accounting.

Parameters
$p_accountquick_code of a card,
Returns
a Fiche object if correct , else false

Definition at line 135 of file class_impacc_verify.php.

References $cn.

Referenced by Impacc_CSV\check().

136  {
137  $cn=Dossier::connect();
138  $card=new Fiche($cn);
139  $card->get_by_qcode($p_account, false);
140  if ($card->id==0)
141  {
142 
143  return false;
144  }
145  else
146  {
147  // The accounting must also be checked
148  $poste_str=$card->strAttribut(ATTR_DEF_ACCOUNT);
149 
150  $poste=new Acc_Account_Ledger($cn, $poste_str);
151  if ($poste->do_exist()==0)
152  {
153  return false;
154  }
155  }
156  return $card;
157  }
global $cn
static Impacc_Verify::check_date (   $p_date,
  $p_format_date 
)
static

Check that the date payment has valid format . Return false or.

Parameters
$p_dateis the value to check
$p_format_datecheck for date_limit and date_payment

Definition at line 113 of file class_impacc_verify.php.

References $p_date.

Referenced by Impacc_Csv_Sale_Purchase\check().

114  {
115  if ($p_date=="") return false;
116 
117  $test=DateTime::createFromFormat($p_format_date, $p_date);
118 
119  if ($test==false)
120  {
121  return false;
122  }
123  else
124  {
125  $p_return=$test->format('d.m.Y');
126  return $p_return;
127  }
128  }
static Impacc_Verify::check_quantity ( Impacc_Import_detail_SQL  $row,
  $p_thousand,
  $p_decimal 
)
static
Parameters
$rowis an Impacc_Import_detail_SQL object

Definition at line 35 of file class_impacc_verify.php.

References Impacc_Tool\convert_amount().

37  {
38  $row->id_quant_conv=Impacc_Tool::convert_amount($row->id_quant,
39  $p_thousand, $p_decimal);
40  if (isNumber($row->id_quant_conv)==0)
41  {
42  $and=($row->id_message=="")?"":",";
43  $row->id_message.=$and."CK_INVALID_AMOUNT";
44  }
45  }
static convert_amount($p_amount, $p_thousand, $p_decimal)
convert_amount($array[$i]->id_amount_novat,$this->detail->s_thousand,$this->s_decimal); ...
static Impacc_Verify::check_service ( Impacc_Import_detail_SQL  $row)
static

Check that the sale / purchase card exist Update the object $row (id_message)

Parameters
$rowis an Impacc_Import_detail_SQL object

Definition at line 69 of file class_impacc_verify.php.

References $cn.

70  {
71  $cn=Dossier::connect();
72  $card=new Fiche($cn);
73  $card->get_by_qcode($row->id_acc_second, false);
74  if ($card->id==0)
75  {
76  $and=($row->id_message=="")?"":",";
77  $row->id_message.=$and."CK_INVALID_ACCOUNTING";
78  }
79  }
global $cn
static Impacc_Verify::check_tva (   $p_tva_code)
static

Check that TVA_CODE does exist , return true if exists otherwise false.

Definition at line 84 of file class_impacc_verify.php.

References $cn, and $g_parameter.

Referenced by Impacc_Csv_Sale_Purchase\check().

85  {
86  $cn=Dossier::connect();
87  global $g_parameter;
88  // If we don't use VAT , no need to check it
89  if ($g_parameter->MY_TVA_USE=="N")
90  return true;
91 
92  // VAT Mandatory and empty
93  if ($p_tva_code=="")
94  {
95  return false;
96  }
97 
98  $exist=$cn->get_value("select count(*) from impacc.parameter_tva where tva_code=$1",
99  array($p_tva_code));
100  if ($exist!=1)
101  {
102  return false;
103  }
104  return true;
105  }
global $g_parameter
Definition: ajax.php:27
global $cn

The documentation for this class was generated from the following file: