Big debug of accountancy module
This commit is contained in:
parent
48f226a825
commit
a9d3e90b70
@ -193,13 +193,18 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$this->piece_num = 0;
|
$this->piece_num = 0;
|
||||||
|
|
||||||
// First check if line not yet already in bookkeeping
|
// First check if line not yet already in bookkeeping.
|
||||||
|
// Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines
|
||||||
|
// with same doc_type, fk_odc, numero_compte for 1 invoice line when using localtaxes with same account)
|
||||||
|
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
|
||||||
|
// The page to make journalization make the test on couple doc_type - fk_doc only.
|
||||||
$sql = "SELECT count(*) as nb";
|
$sql = "SELECT count(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= " AND fk_doc = " . $this->fk_doc;
|
$sql .= " AND fk_doc = " . $this->fk_doc;
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
|
//$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
|
||||||
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
||||||
|
$sql .= " AND label_operation = '" . $this->db->escape($this->label_operation) . "'";
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -99,6 +99,8 @@ $accounting = new AccountingAccount($db);
|
|||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -140,6 +142,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
$msg='';
|
$msg='';
|
||||||
|
|
||||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
if (! empty($mesCasesCochees)) {
|
if (! empty($mesCasesCochees)) {
|
||||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||||
@ -167,7 +170,7 @@ if ($massaction == 'ventil') {
|
|||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '');
|
$accountventilated->fetch($monCompte, '');
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||||
$ok++;
|
$ok++;
|
||||||
@ -197,23 +200,30 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("Ventilation"));
|
llxHeader('', $langs->trans("Ventilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Customer Invoice lines
|
// Customer Invoice lines
|
||||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
$sql = "SELECT f.rowid as facid, f.facnumber, f.datef, f.type as ftype,";
|
||||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " AND product_type <= 2";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN
|
$sql.= " AND product_type <= 2";
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -255,7 +265,7 @@ else if ($search_year > 0)
|
|||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||||
}
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
@ -276,7 +286,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php", LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num_lines = $db->num_rows($result);
|
$num_lines = $db->num_rows($result);
|
||||||
@ -466,9 +476,11 @@ if ($result) {
|
|||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Column with checkbox
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,6 +92,8 @@ if (! $user->rights->accounting->bind->write)
|
|||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -182,18 +184,24 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Expense report lines
|
// Expense report lines
|
||||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
$sql.= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
$sql.= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
||||||
$sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_expensereport))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
$sql .= natural_search("er.ref",$search_expensereport);
|
$sql .= natural_search("er.ref",$search_expensereport);
|
||||||
|
|||||||
@ -596,8 +596,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
|
|
||||||
if ($totaldebit != $totalcredit)
|
if ($totaldebit != $totalcredit)
|
||||||
{
|
{
|
||||||
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
setEventMessages('Try to insert a non balanced transaction in book. Canceled. Surely a bug.', null, 'errors');
|
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -642,7 +643,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -341,8 +341,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
if ($totaldebit != $totalcredit)
|
if ($totaldebit != $totalcredit)
|
||||||
{
|
{
|
||||||
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
setEventMessages('Try to insert a non balanced transaction in book. Canceled. Surely a bug.', null, 'errors');
|
setEventMessages('Try to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -361,6 +362,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $taber;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -385,7 +388,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -520,7 +523,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
|
|||||||
@ -156,6 +156,8 @@ if ($result) {
|
|||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_localtax1 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_localtax2 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
|
||||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
@ -388,8 +390,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
if ($totaldebit != $totalcredit)
|
if ($totaldebit != $totalcredit)
|
||||||
{
|
{
|
||||||
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
setEventMessages('Try to insert a non balanced transaction in book. Canceled. Surely a bug.', null, 'errors');
|
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -408,6 +411,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $tabfac;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -432,7 +437,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -551,7 +556,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -712,7 +717,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
print "<td>";
|
||||||
|
print $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
|||||||
@ -193,7 +193,7 @@ if ($result) {
|
|||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
if (empty($line->tva_npr)) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
|
||||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -396,8 +396,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
if ($totaldebit != $totalcredit)
|
if ($totaldebit != $totalcredit)
|
||||||
{
|
{
|
||||||
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
setEventMessages('Try to insert a non balanced transaction in book. Canceled. Surely a bug.', null, 'errors');
|
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -417,6 +418,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $tabfac;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -441,7 +444,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -560,7 +563,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
|
|||||||
@ -368,13 +368,13 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td align="left">';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')) . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')) . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
print '<td align="right">' . $objp->country .'</td>';
|
print '<td>' . $objp->country .'</td>';
|
||||||
print '<td align="center">' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -100,6 +100,8 @@ $accounting = new AccountingAccount($db);
|
|||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -117,39 +119,40 @@ if (empty($reshook))
|
|||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
$search_invoice = '';
|
$search_invoice = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
$search_desc = '';
|
$search_desc = '';
|
||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
$search_day = '';
|
$search_day = '';
|
||||||
$search_month = '';
|
$search_month = '';
|
||||||
$search_year = '';
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='AccountingAccount';
|
$objectclass='AccountingAccount';
|
||||||
$permtoread = $user->rights->accounting->read;
|
$permtoread = $user->rights->accounting->read;
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
$permtodelete = $user->rights->accounting->delete;
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
$uploaddir = $conf->accounting->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
$msg='';
|
$msg='';
|
||||||
|
|
||||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
if (! empty($mesCasesCochees)) {
|
if (! empty($mesCasesCochees)) {
|
||||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||||
$msg.='<div class="detail">';
|
$msg.='<div class="detail">';
|
||||||
$mesCodesVentilChoisis = $codeventil;
|
|
||||||
$cpt = 0;
|
$cpt = 0;
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$ko=0;
|
$ko=0;
|
||||||
|
|
||||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
foreach ($mesCasesCochees as $maLigneCochee) {
|
||||||
$maLigneCourante = explode("_", $maLigneCochee);
|
$maLigneCourante = explode("_", $maLigneCochee);
|
||||||
$monId = $maLigneCourante[0];
|
$monId = $maLigneCourante[0];
|
||||||
$monCompte = GETPOST('codeventil'.$monId);
|
$monCompte = GETPOST('codeventil'.$monId);
|
||||||
@ -198,9 +201,17 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Supplier Invoice Lines
|
// Supplier Invoice Lines
|
||||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||||
$sql.= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
@ -209,12 +220,9 @@ $sql.=$hookmanager->resPrint;
|
|||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND product_type <= 2";
|
$sql.= " AND product_type <= 2";
|
||||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy =''OR p.accountancy_code_buy NOT IN
|
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -253,6 +261,11 @@ else if ($search_year > 0)
|
|||||||
{
|
{
|
||||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
@ -325,9 +338,8 @@ if ($result) {
|
|||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
|
||||||
|
|
||||||
// We add search filter
|
// We add search filter
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -446,7 +458,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($objp->price);
|
print price($objp->total_ht);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Vat rate
|
// Vat rate
|
||||||
@ -471,12 +483,12 @@ if ($result) {
|
|||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Colonne choix ligne a ventiler
|
// Column with checkbox
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>";
|
print '</tr>';
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4400,6 +4400,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$this->date_start = $this->db->jdate($objp->date_start);
|
$this->date_start = $this->db->jdate($objp->date_start);
|
||||||
$this->date_end = $this->db->jdate($objp->date_end);
|
$this->date_end = $this->db->jdate($objp->date_end);
|
||||||
$this->info_bits = $objp->info_bits;
|
$this->info_bits = $objp->info_bits;
|
||||||
|
$this->tva_npr = ($objp->info_bits & 1 == 1) ? 1 : 0;
|
||||||
$this->special_code = $objp->special_code;
|
$this->special_code = $objp->special_code;
|
||||||
$this->total_ht = $objp->total_ht;
|
$this->total_ht = $objp->total_ht;
|
||||||
$this->total_tva = $objp->total_tva;
|
$this->total_tva = $objp->total_tva;
|
||||||
|
|||||||
@ -109,12 +109,17 @@ class DoliDBMysqli extends DoliDB
|
|||||||
$this->database_name = $name;
|
$this->database_name = $name;
|
||||||
$this->ok = true;
|
$this->ok = true;
|
||||||
|
|
||||||
// If client connected with different charset than Dolibarr HTML output
|
// If client is old latin, we force utf8
|
||||||
$clientmustbe='';
|
$clientmustbe=empty($conf->db->dolibarr_main_db_character_set)?'utf8':$conf->db->dolibarr_main_db_character_set;
|
||||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
if (preg_match('/latin1/', $clientmustbe)) $clientmustbe='utf8';
|
||||||
if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1';
|
|
||||||
if ($this->db->character_set_name() != $clientmustbe) {
|
if ($this->db->character_set_name() != $clientmustbe) {
|
||||||
$this->db->set_charset($clientmustbe);
|
$this->db->set_charset($clientmustbe); // This set charset, but with a bad collation
|
||||||
|
|
||||||
|
$collation = $conf->db->dolibarr_main_db_collation;
|
||||||
|
if (preg_match('/latin1/', $collation)) $collation='utf8_unicode_ci';
|
||||||
|
|
||||||
|
if (! preg_match('/general/', $collation)) $this->db->query("SET collation_connection = ".$collation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -133,14 +138,19 @@ class DoliDBMysqli extends DoliDB
|
|||||||
|
|
||||||
if ($this->connected)
|
if ($this->connected)
|
||||||
{
|
{
|
||||||
// If client connected with different charset than Dolibarr HTML output
|
// If client is old latin, we force utf8
|
||||||
$clientmustbe='';
|
$clientmustbe=$conf->db->dolibarr_main_db_character_set;
|
||||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
if (preg_match('/latin1/', $clientmustbe)) $clientmustbe='utf8';
|
||||||
if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1';
|
|
||||||
if ($this->db->character_set_name() != $clientmustbe) {
|
if ($this->db->character_set_name() != $clientmustbe) {
|
||||||
$this->db->set_charset($clientmustbe);
|
$this->db->set_charset($clientmustbe); // This set utf8_general_ci
|
||||||
|
|
||||||
|
$collation = $conf->db->dolibarr_main_db_collation;
|
||||||
|
if (preg_match('/latin1/', $collation)) $collation='utf8_unicode_ci';
|
||||||
|
|
||||||
|
if (! preg_match('/general/', $collation)) $this->db->query("SET collation_connection = ".$collation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2518,6 +2518,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
$this->product_type = $obj->product_type;
|
$this->product_type = $obj->product_type;
|
||||||
$this->product_label = $obj->label;
|
$this->product_label = $obj->label;
|
||||||
$this->info_bits = $obj->info_bits;
|
$this->info_bits = $obj->info_bits;
|
||||||
|
$this->tva_npr = ($objp->info_bits & 1 == 1) ? 1 : 0;
|
||||||
$this->fk_parent_line = $obj->fk_parent_line;
|
$this->fk_parent_line = $obj->fk_parent_line;
|
||||||
$this->special_code = $obj->special_code;
|
$this->special_code = $obj->special_code;
|
||||||
$this->rang = $obj->rang;
|
$this->rang = $obj->rang;
|
||||||
|
|||||||
@ -183,6 +183,16 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
|
|||||||
print '<tr><td>'.$langs->trans("ServerVersion").'</td>';
|
print '<tr><td>'.$langs->trans("ServerVersion").'</td>';
|
||||||
print '<td align="right">'.$version.'</td></tr>';
|
print '<td align="right">'.$version.'</td></tr>';
|
||||||
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ServerVersion") . ": " .$version);
|
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ServerVersion") . ": " .$version);
|
||||||
|
if ($db->type == 'mysqli')
|
||||||
|
{
|
||||||
|
$tmparray = $db->db->get_charset();
|
||||||
|
print '<tr><td>'.$langs->trans("ClientCharset").'</td>';
|
||||||
|
print '<td align="right">'.$tmparray->charset.'</td></tr>';
|
||||||
|
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ClientCharset") . ": " .$tmparray->charset);
|
||||||
|
print '<tr><td>'.$langs->trans("ClientSortingCharset").'</td>';
|
||||||
|
print '<td align="right">'.$tmparray->collation.'</td></tr>';
|
||||||
|
dolibarr_install_syslog("upgrade: " . $langs->transnoentities("ClientCollation") . ": " .$tmparray->collation);
|
||||||
|
}
|
||||||
|
|
||||||
// Test database version requirement
|
// Test database version requirement
|
||||||
$versionmindb=explode('.',$db::VERSIONMIN);
|
$versionmindb=explode('.',$db::VERSIONMIN);
|
||||||
|
|||||||
@ -167,7 +167,7 @@ DeleteMvt=Delete Ledger lines
|
|||||||
DelYear=Year to delete
|
DelYear=Year to delete
|
||||||
DelJournal=Journal to delete
|
DelJournal=Journal to delete
|
||||||
ConfirmDeleteMvt=This will delete all lines of the Ledger for year and/or from a specific journal. At least one criteria is required.
|
ConfirmDeleteMvt=This will delete all lines of the Ledger for year and/or from a specific journal. At least one criteria is required.
|
||||||
ConfirmDeleteMvtPartial=This will delete the selected line(s) of the Ledger
|
ConfirmDeleteMvtPartial=This will delete the transaction from the Ledger (all lines related to same transaction will be deleted)
|
||||||
DelBookKeeping=Delete record of the Ledger
|
DelBookKeeping=Delete record of the Ledger
|
||||||
FinanceJournal=Finance journal
|
FinanceJournal=Finance journal
|
||||||
ExpenseReportsJournal=Expense reports journal
|
ExpenseReportsJournal=Expense reports journal
|
||||||
|
|||||||
@ -40,6 +40,8 @@ WebUserGroup=Web server user/group
|
|||||||
NoSessionFound=Your PHP seems to not allow to list active sessions. Directory used to save sessions (<b>%s</b>) might be protected (For example, by OS permissions or by PHP directive open_basedir).
|
NoSessionFound=Your PHP seems to not allow to list active sessions. Directory used to save sessions (<b>%s</b>) might be protected (For example, by OS permissions or by PHP directive open_basedir).
|
||||||
DBStoringCharset=Database charset to store data
|
DBStoringCharset=Database charset to store data
|
||||||
DBSortingCharset=Database charset to sort data
|
DBSortingCharset=Database charset to sort data
|
||||||
|
ClientCharset=Client charset
|
||||||
|
ClientSortingCharset=Client collation
|
||||||
WarningModuleNotActive=Module <b>%s</b> must be enabled
|
WarningModuleNotActive=Module <b>%s</b> must be enabled
|
||||||
WarningOnlyPermissionOfActivatedModules=Only permissions related to activated modules are shown here. You can activate other modules in the Home->Setup->Modules page.
|
WarningOnlyPermissionOfActivatedModules=Only permissions related to activated modules are shown here. You can activate other modules in the Home->Setup->Modules page.
|
||||||
DolibarrSetup=Dolibarr install or upgrade
|
DolibarrSetup=Dolibarr install or upgrade
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user