51 public $errors = array();
71 public function cleanAmount(&$arrayrecord, $listfields, $record_key)
73 $value_trim = trim($arrayrecord[$record_key][
'val']);
85 public function cleanValue(&$arrayrecord, $listfields, $record_key)
87 return trim($arrayrecord[$record_key][
'val']);
101 if (isset($listfields[
'b.debit']) && isset($listfields[
'b.credit'])) {
102 $debit_index = $listfields[
'b.debit'];
104 $debitFloat = (float)
price2num($arrayrecord[$debit_index][
'val']);
105 if (!empty($debitFloat)) {
106 $amount = $debitFloat;
108 $credit_index = $listfields[
'b.credit'];
109 $amount = (float)
price2num($arrayrecord[$credit_index][
'val']);
112 return "'" . $this->db->escape((
string) abs($amount)) .
"'";
129 if (isset($listfields[
'b.debit'])) {
130 $debit_index = $listfields[
'b.debit'];
132 $debitFloat = (float)
price2num($arrayrecord[$debit_index][
'val']);
133 if (!empty($debitFloat)) {
157 $pieceNum = trim($arrayrecord[$record_key][
'val']);
160 if ($pieceNum ==
'') {
161 if (isset($listfields[
'b.code_journal']) && isset($listfields[
'b.doc_date'])) {
163 if (!isset(
$conf->cache[
'accounting'])) {
164 $conf->cache[
'accounting'] = array(
165 'lastRecordCompareValues' => array(),
169 $codeJournalIndex = $listfields[
'b.code_journal'];
170 $docDateIndex = $listfields[
'b.doc_date'];
171 $atLeastOneLastRecordChanged =
false;
172 if (empty(
$conf->cache[
'accounting'][
'lastRecordCompareValues'])) {
173 $atLeastOneLastRecordChanged =
true;
175 if ($arrayrecord[$codeJournalIndex][
'val'] !=
$conf->cache[
'accounting'][
'lastRecordCompareValues'][
'b.code_journal']
176 || $arrayrecord[$docDateIndex][
'val'] !=
$conf->cache[
'accounting'][
'lastRecordCompareValues'][
'b.doc_date']
178 $atLeastOneLastRecordChanged =
true;
183 if ($atLeastOneLastRecordChanged) {
185 if (empty(
$conf->cache[
'accounting'][
'nextPieceNum'])) {
187 $sql =
"SELECT MAX(piece_num) as last_piece_num";
188 $sql .=
" FROM ".$this->db->prefix().
"accounting_bookkeeping";
189 $sql .=
" WHERE entity IN (".getEntity(
'accountingbookkeeping').
")";
190 $res = $this->db->query($sql);
192 $this->errors[] = $this->db->lasterror();
195 if ($obj = $this->db->fetch_object($res)) {
196 $lastPieceNum = (int) $obj->last_piece_num;
198 $this->db->free($res);
201 if (empty(
$conf->cache[
'accounting'][
'nextPieceNum'])) {
202 $conf->cache[
'accounting'][
'nextPieceNum'] = $lastPieceNum;
204 $conf->cache[
'accounting'][
'nextPieceNum']++;
207 $conf->cache[
'accounting'][
'lastRecordCompareValues'] = array(
208 'b.code_journal' => $arrayrecord[$codeJournalIndex][
'val'],
209 'b.doc_date' => $arrayrecord[$docDateIndex][
'val'],
212 $pieceNum = (
string)
$conf->cache[
'accounting'][
'nextPieceNum'];
Manage the different format accountancy import.
computeAmount(&$arrayrecord, $listfields, $record_key)
Compute amount.
cleanAmount(&$arrayrecord, $listfields, $record_key)
Clean amount.
cleanValue(&$arrayrecord, $listfields, $record_key)
Clean value with trim.
computeDirection(&$arrayrecord, $listfields, $record_key)
Compute direction.
computePieceNum(&$arrayrecord, $listfields, $record_key)
Compute piece number.
__construct(DoliDB $db)
Constructor.
Class to manage Dolibarr database access.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php