diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php deleted file mode 100644 index 20fe0c1aef4..00000000000 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ /dev/null @@ -1,135 +0,0 @@ - - * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2015 Jean-François Ferry - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * \file htdocs/accountancy/bookkeeping/balancebymonth.php - * \ingroup Accountancy (Double entries) - * \brief Balance by month - */ -require '../../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("bills", "compta", "accountancy", "other")); - -// Filter -$year = GETPOST("year", 'int'); -if ($year == 0) { - $year_current = strftime("%Y", time()); - $year_start = $year_current; -} else { - $year_current = $year; - $year_start = $year; -} - - -/* - * View - */ - -llxHeader('', $langs->trans("Bookkeeping")); - -$textprevyear = ''.img_previous().''; -$textnextyear = ' '.img_next().''; - -print load_fiche_titre($langs->trans("AccountBalanceByMonth").' '.$textprevyear.' '.$langs->trans("Year").' '.$year_start.' '.$textnextyear); - -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd"; -$sql .= " , ".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE fd.fk_code_ventilation = 0"; -$sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;"; - -dol_syslog('accountancy/bookkeeping/balancebymonth.php:: $sql='.$sql); -$result = $db->query($sql); -if ($result) { - $row = $db->fetch_row($result); - $nbfac = $row[0]; - - $db->free($result); -} - -$y = $year_current; - -print ''; -print ''; -print ''; -for ($i = 1; $i <= 12; $i++) { - print ''; -} -print ''; -print ''; - -$sql = "SELECT bk.numero_compte AS 'compte',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=1,bk.montant,0)),2) AS 'Janvier',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=2,bk.montant,0)),2) AS 'Fevrier',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=3,bk.montant,0)),2) AS 'Mars',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=4,bk.montant,0)),2) AS 'Avril',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=5,bk.montant,0)),2) AS 'Mai',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=6,bk.montant,0)),2) AS 'Juin',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=7,bk.montant,0)),2) AS 'Juillet',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=8,bk.montant,0)),2) AS 'Aout',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=9,bk.montant,0)),2) AS 'Septembre',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=10,bk.montant,0)),2) AS 'Octobre',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=11,bk.montant,0)),2) AS 'Novembre',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=12,bk.montant,0)),2) AS 'Decembre',"; -$sql .= " ROUND(SUM(bk.montant),2) as 'Total'"; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; -$sql .= " WHERE bk.doc_date >= '".$db->idate(dol_get_first_day($y, 1, false))."'"; -$sql .= " AND bk.doc_date <= '".$db->idate(dol_get_last_day($y, 12, false))."'"; -$sql .= " GROUP BY bk.numero_compte"; - -$resql = $db->query($sql); -if ($resql) { - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) { - $row = $db->fetch_row($resql); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i++; - } - $db->free($resql); -} else { - print $db->lasterror(); -} -print "
'.$langs->trans("Label").''.$langs->trans("MonthShort".sprintf("%02s", $i)).''.$langs->trans("Total").'
'.length_accountg($row[0]).''.price($row[1]).''.price($row[2]).''.price($row[3]).''.price($row[4]).''.price($row[5]).''.price($row[6]).''.price($row[7]).''.price($row[8]).''.price($row[9]).''.price($row[10]).''.price($row[11]).''.price($row[12]).''.price($row[13]).'
\n"; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index bc103edbf1b..a2192d5ea60 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -145,7 +145,7 @@ print dol_get_fiche_end(); $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code "; +$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; $sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )"; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 3da345add6a..f8167846aff 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -144,7 +144,7 @@ print dol_get_fiche_end(); $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated "; +$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated "; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; $sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )"; if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 35e32bf2004..1065836cac3 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -359,7 +359,7 @@ class AccountancyExport print length_accountg($line->numero_compte).$separator; print length_accounta($line->subledger_account).$separator; print $line->sens.$separator; - print price2fec(abs($line->montant)).$separator; + print price2fec(abs($line->debit - $line->credit)).$separator; print dol_string_unaccent($line->label_operation).$separator; print dol_string_unaccent($line->doc_ref); print $end_line; @@ -387,11 +387,11 @@ class AccountancyExport print $line->label_operation.$separator; print $date.$separator; if ($line->sens == 'D') { - print price($line->montant).$separator; + print price($line->debit).$separator; print ''.$separator; } elseif ($line->sens == 'C') { print ''.$separator; - print price($line->montant).$separator; + print price($line->credit).$separator; } print $line->doc_ref.$separator; print $line->label_operation.$separator; @@ -493,7 +493,7 @@ class AccountancyExport $Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12); $Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11); $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25); - $Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT); + $Tab['montant'] = str_pad(abs($data->debit - $data->credit), 13, ' ', STR_PAD_LEFT); $Tab['type_montant'] = str_pad($data->sens, 1); $Tab['vide'] = str_repeat(' ', 18); $Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34); @@ -541,20 +541,23 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20); // Credit invoice - invert sens - if ($data->montant < 0) { - if ($data->sens == 'C') { - $Tab['sens'] = 'D'; - } else { - $Tab['sens'] = 'C'; - } - $Tab['signe_montant'] = '-'; - } else { - $Tab['sens'] = $data->sens; // C or D - $Tab['signe_montant'] = '+'; - } + /* + if ($data->montant < 0) { + if ($data->sens == 'C') { + $Tab['sens'] = 'D'; + } else { + $Tab['sens'] = 'C'; + } + $Tab['signe_montant'] = '-'; + } else { + $Tab['sens'] = $data->sens; // C or D + $Tab['signe_montant'] = '+'; + }*/ + $Tab['sens'] = $data->sens; // C or D + $Tab['signe_montant'] = '+'; // The amount must be in centimes without decimal points. - $Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT); + $Tab['montant'] = str_pad(abs(($data->debit - $abs->credit) * 100), 12, '0', STR_PAD_LEFT); $Tab['contrepartie'] = str_repeat(' ', 8); // Force date format : %d%m%y @@ -640,13 +643,13 @@ class AccountancyExport $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); if ($data->sens == 'D') { - $Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); + $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } else { $Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); - $Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); + $Tab['montant_crebit'] = str_pad(number_format($data->credit), 2, ',', ''), 13, ' ', STR_PAD_LEFT); } $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); @@ -707,7 +710,7 @@ class AccountancyExport //print substr(length_accountg($line->numero_compte), 0, 2) . $separator; print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"'.$separator; print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator; - print price2num(abs($line->montant)).$separator; + print price2num(abs($line->debit - $line->credit)).$separator; print $line->sens.$separator; print $date.$separator; //print 'EUR'; @@ -747,7 +750,7 @@ class AccountancyExport print self::toAnsi($line->doc_ref).$separator; print price($line->debit).$separator; print price($line->credit).$separator; - print price($line->montant).$separator; + print price(abs($line->debit - $line->credit)).$separator; print $line->sens.$separator; print $line->lettering_code.$separator; print $line->code_journal; @@ -810,7 +813,7 @@ class AccountancyExport $tab[] = length_accounta($line->subledger_account); $tab[] = price2num($line->debit); $tab[] = price2num($line->credit); - $tab[] = price2num($line->montant); + $tab[] = price2num($line->debit - $line->credit); $tab[] = $line->code_journal; print implode($separator, $tab).$this->end_line; @@ -853,8 +856,8 @@ class AccountancyExport foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); - } else { + //unset($array[$line]); + } else { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d'); $date_lettering = dol_print_date($line->date_lettering, '%Y%m%d'); @@ -959,7 +962,7 @@ class AccountancyExport foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); + //unset($array[$line]); } else { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d'); @@ -1110,11 +1113,7 @@ class AccountancyExport // Code print '""'.$this->separator; // Netto - if ($line->montant >= 0) { - print $line->montant.$this->separator; - } else { - print ($line->montant * -1).$this->separator; - } + print abs($line->debit - $line->credit).$this->separator; // Steuer print "0.00".$this->separator; // FW-Betrag @@ -1190,13 +1189,13 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) > 0) { $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) < 0) { $nature_piece = 'AC'; } else { $nature_piece = 'FC'; @@ -1220,7 +1219,7 @@ class AccountancyExport print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead // MONT - print price(abs($line->montant), 0, '', 1, 2, 2).$separator; + print price(abs($line->debit - $line->credit), 0, '', 1, 2, 2).$separator; // CODC print $line->sens.$separator; // CPTG @@ -1451,13 +1450,13 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) > 0) { $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) < 0) { $nature_piece = 'AC'; } else { $nature_piece = 'FC'; @@ -1481,7 +1480,7 @@ class AccountancyExport print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead // MONT - print price(abs($line->montant), 0, '', 1, 2).$separator; + print price(abs($line->debit - $line->credit), 0, '', 1, 2).$separator; // CODC print $line->sens.$separator; // CPTG @@ -1602,7 +1601,7 @@ class AccountancyExport print self::trunc($line->label_compte, 60).$separator; //Account label print self::trunc($line->doc_ref, 20).$separator; //Piece print self::trunc($line->label_operation, 60).$separator; //Operation label - print price(abs($line->montant)).$separator; //Amount + print price(abs($line->debit - $line->credit)).$separator; //Amount print $line->sens.$separator; //Direction print $separator; //Analytic print $separator; //Analytic @@ -1631,7 +1630,7 @@ class AccountancyExport $supplier_invoices_infos = array(); foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); + //unset($array[$line]); } else { $date = dol_print_date($line->doc_date, '%d/%m/%Y'); @@ -1699,8 +1698,8 @@ class AccountancyExport print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator; //Devise print 'EUR' . $this->separator; - //Montant - print price2num(abs($line->montant)) . $this->separator; + //Amount + print price2num(abs($line->debit - $line->credit)) . $this->separator; //Sens print $line->sens . $this->separator; //Code lettrage @@ -1726,14 +1725,14 @@ class AccountancyExport foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); + //unset($array[$line]); } else { $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->id . $this->separator; print $date . $this->separator; print substr($line->code_journal, 0, 4) . $this->separator; - if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { + if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { // TODO No hard code value print length_accountg($line->subledger_account) . $this->separator; } else { print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; @@ -1742,7 +1741,7 @@ class AccountancyExport //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; print '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"' . $this->separator; print '"' . dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . '"' . $this->separator; - print price2num($line->montant) . $this->separator; + print price2num(abs($line->debit - $line->credit)) . $this->separator; print $line->sens . $this->separator; print $date . $this->separator; print $this->separator; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 8ef8979fad4..27a84270e95 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -135,6 +135,7 @@ class BookKeeping extends CommonObject /** * @var float FEC:Amount (Not necessary) + * @deprecated No more used */ public $amount; @@ -239,6 +240,9 @@ class BookKeeping extends CommonObject if (isset($this->montant)) { $this->montant = (float) $this->montant; } + if (isset($this->amount)) { + $this->amount = (float) $this->amount; + } if (isset($this->sens)) { $this->sens = trim($this->sens); } @@ -563,6 +567,9 @@ class BookKeeping extends CommonObject if (isset($this->montant)) { $this->montant = trim($this->montant); } + if (isset($this->amount)) { + $this->amount = trim($this->amount); + } if (isset($this->sens)) { $this->sens = trim($this->sens); } @@ -708,7 +715,7 @@ class BookKeeping extends CommonObject $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; - $sql .= " t.montant,"; + $sql .= " t.montant as amount,"; $sql .= " t.sens,"; $sql .= " t.fk_user_author,"; $sql .= " t.import_key,"; @@ -747,7 +754,8 @@ class BookKeeping extends CommonObject $this->label_operation = $obj->label_operation; $this->debit = $obj->debit; $this->credit = $obj->credit; - $this->montant = $obj->montant; + $this->montant = $obj->amount; + $this->amount = $obj->amount; $this->sens = $obj->sens; $this->fk_user_author = $obj->fk_user_author; $this->import_key = $obj->import_key; @@ -1207,8 +1215,8 @@ class BookKeeping extends CommonObject if (isset($this->credit)) { $this->credit = trim($this->credit); } - if (isset($this->montant)) { - $this->montant = trim($this->montant); + if (isset($this->amount)) { + $this->amount = trim($this->amount); } if (isset($this->sens)) { $this->sens = trim($this->sens); @@ -1655,7 +1663,7 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; - $sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation"; + $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; @@ -1681,7 +1689,8 @@ class BookKeeping extends CommonObject $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; - $line->montant = $obj->montant; + $line->montant = $obj->amount; + $line->amount = $obj->amount; $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->journal_label = $obj->journal_label; @@ -1714,7 +1723,7 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; - $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; + $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE entity IN (".getEntity('accountancy').")"; @@ -1744,7 +1753,8 @@ class BookKeeping extends CommonObject $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; - $line->montant = $obj->montant; + $line->montant = $obj->amount; + $line->amount = $obj->amount; $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 83646ab4f5e..a56084d0f32 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -547,6 +547,7 @@ function hideMessage(fieldId,message) { * @param string token Token */ function setConstant(url, code, input, entity, strict, forcereload, userid, token) { + var saved_url = url; /* avoid undefined url */ $.post( url, { action: "set", name: code, @@ -591,7 +592,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke $.each(data, function(key, value) { $("#set_" + key).hide(); $("#del_" + key).show(); - $.post( url, { + $.post( saved_url, { action: "set", name: key, value: value, @@ -621,6 +622,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke * @param string token Token */ function delConstant(url, code, input, entity, strict, forcereload, userid, token) { + var saved_url = url; /* avoid undefined url */ $.post( url, { action: "del", name: code, @@ -662,7 +664,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke $.each(data, function(key, value) { $("#del_" + value).hide(); $("#set_" + value).show(); - $.post( url, { + $.post( saved_url, { action: "del", name: value, entity: entity, diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 4ba6c61c5e3..f048f070366 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -292,7 +292,8 @@ class modAccounting extends DolibarrModules 'b.subledger_label'=>'SubledgerAccountLabel', 'b.label_operation'=>'LabelOperation', 'b.debit'=>"Debit", - 'b.credit'=>"Credit" + 'b.credit'=>"Credit", + 'b.sens'=>'Direction' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit ); $this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); @@ -309,7 +310,8 @@ class modAccounting extends DolibarrModules 'b.subledger_label'=>'', 'b.label_operation'=>"Sale of ABC", 'b.debit'=>"0", - 'b.credit'=>"100" + 'b.credit'=>"100", + 'b.sens'=>'C' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit ); // Chart of accounts diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index c297d14eb4a..f6f0a2a3ff9 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -583,3 +583,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4); + +-- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL; +-- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL; + + diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index dae9eb79c42..cd147979790 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -35,7 +35,7 @@ CREATE TABLE llx_accounting_bookkeeping label_operation varchar(255), -- FEC:EcritureLib | label of the operation debit double(24,8) NOT NULL, -- FEC:Debit credit double(24,8) NOT NULL, -- FEC:Credit - montant double(24,8) NOT NULL, -- FEC:Montant (Not necessary) + montant double(24,8) NULL, -- FEC:Montant (Not necessary) sens varchar(1) DEFAULT NULL, -- FEC:Sens (Not necessary) multicurrency_amount double(24,8), -- FEC:Montantdevise multicurrency_code varchar(255), -- FEC:Idevise