Merge branch 'develop' of github.com:Dolibarr/dolibarr into dev_EventOrganisation

This commit is contained in:
Florian HENRY 2021-03-29 20:30:31 +02:00
commit 11dcf656c6
46 changed files with 1014 additions and 433 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
@ -98,6 +98,28 @@ if (empty($action)) {
$arrayfields = array();
$accounting_product_modes = array(
'ACCOUNTANCY_SELL',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_BUY',
'ACCOUNTANCY_BUY_INTRA',
'ACCOUNTANCY_BUY_EXPORT'
);
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$accountancy_field_name = "accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
$accountancy_field_name = "accountancy_code_buy_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
$accountancy_field_name = "accountancy_code_buy_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$accountancy_field_name = "accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$accountancy_field_name = "accountancy_code_sell_intra";
} else { // $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT'
$accountancy_field_name = "accountancy_code_sell_export";
}
/*
* Actions
@ -133,15 +155,6 @@ if ($action == 'update') {
if (!empty($btn_changetype)) {
$error = 0;
$accounting_product_modes = array(
'ACCOUNTANCY_SELL',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_BUY',
'ACCOUNTANCY_BUY_INTRA',
'ACCOUNTANCY_BUY_EXPORT'
);
if (in_array($accounting_product_mode, $accounting_product_modes)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
$error++;
@ -153,7 +166,7 @@ if ($action == 'update') {
if (!empty($btn_changeaccount)) {
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
if (!empty($chk_prod)) {
if (!empty($chk_prod) && in_array($accounting_product_mode, $accounting_product_modes)) {
$accounting = new AccountingAccount($db);
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
@ -175,26 +188,15 @@ if ($action == 'update') {
} else {
$db->begin();
$sql = " UPDATE ".MAIN_DB_PREFIX."product";
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= " SET accountancy_code_buy = ".$accounting->account_number;
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $accountancy_field_name . ")";
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", " . $accounting->account_number . ")";
$sql .= " ON DUPLICATE KEY UPDATE " . $accountancy_field_name . " = " . $accounting->account_number;
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."product";
$sql .= " SET " . $accountancy_field_name . " = " . $accounting->account_number;
$sql .= " WHERE rowid = " . ((int) $productid);
}
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
$sql .= " SET accountancy_code_buy_intra = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
$sql .= " SET accountancy_code_buy_export = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " SET accountancy_code_sell = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$sql .= " SET accountancy_code_sell_intra = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$sql .= " SET accountancy_code_sell_export = ".$accounting->account_number;
}
$sql .= " WHERE rowid = ".((int) $productid);
dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG);
if ($db->query($sql)) {
@ -267,50 +269,25 @@ if (empty($pcgvercode)) {
}
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.tva_tx,";
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,";
$sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,";
} else {
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
}
$sql .= " p.tms, p.fk_product_type as product_type,";
$sql .= " aa.rowid as aaid";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
$sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
$sql .= " p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = pa." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
} else {
$sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
}
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy_export", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
}
} else {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search((!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "pa." : "p.") . $accountancy_field_name, $search_current_account);
}
if ($search_current_account_valid == 'withoutvalidaccount') {
$sql .= " AND aa.account_number IS NULL";
@ -459,7 +436,7 @@ if ($result) {
// On sell
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print '<td class="liste_titre center">'.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).'</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
} else {
// On buy
print '<td class="liste_titre center">'.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).'</td>';
}
@ -484,26 +461,12 @@ if ($result) {
}
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "p.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
// On sell / On purchase
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
} else {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy_export";
}
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "pa." : "p.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AssignDedicatedAccountingAccount");
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
@ -607,11 +570,10 @@ if ($result) {
print vatrate($obj->tva_tx);
print '</td>';
// On sell / On purchase
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print '<td class="center">'.$product_static->getLibStatut(3, 0).'</td>';
}
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
} else {
print '<td class="center">'.$product_static->getLibStatut(3, 1).'</td>';
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -100,10 +100,18 @@ $formaccounting = new FormAccounting($db);
if (!empty($id)) {
$sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,";
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,";
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell as code_sell,";
} else {
$sql .= " p.accountancy_code_sell as code_sell,";
}
$sql .= " l.fk_code_ventilation, aa.account_number, aa.label";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = l.fk_facture";
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -125,19 +125,34 @@ if ($action == 'validatehistory') {
$sql = "SELECT f.rowid as facid, f.ref as ref, 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 .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,";
} else {
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
}
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra, s.accountancy_code_sell as company_code_sell";
$sql .= " s.tva_intra,";
if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) {
$sql .= " sa.accountancy_code_sell as company_code_sell";
} else {
$sql .= " s.accountancy_code_sell as company_code_sell";
}
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$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."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$alias_company_accounting = !empty($conf->global->ACCOUNTANCY_COMPANY_SHARED) ? "sa" : "s";
$alias_product_accounting = !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "pa" : "p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_accounting . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_accounting . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_accounting . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_company_accounting . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -182,9 +182,13 @@ print '<script type="text/javascript">
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
$sql .= " aa.rowid as fk_compte, aa.account_number, aa.label, aa.labelshort,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell,";
} else {
$sql .= " p.accountancy_code_sell,";
}
$sql .= " aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,";
$sql .= " fd.situation_percent,";
$sql .= " co.code as country_code, co.label as country,";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
@ -193,6 +197,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";

View File

@ -218,24 +218,43 @@ if (empty($chartaccountcode)) {
$sql = "SELECT f.rowid as facid, f.ref as ref, 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 .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,";
$sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,";
} else {
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
}
$sql .= " p.tosell as status, p.tobuy as status_buy,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur, s.accountancy_code_sell as company_code_sell";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " sa.accountancy_code_sell as company_code_sell";
} else {
$sql .= " s.accountancy_code_sell as company_code_sell";
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_accounting as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$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."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$alias_company_accounting = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "sa";
$alias_product_accounting = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_accounting . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_accounting . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_accounting . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_company_accounting . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
// Define begin binding date

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -108,9 +108,16 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
$sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell";
} else {
$sql .= " p.accountancy_code_sell";
}
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";

View File

@ -223,24 +223,41 @@ if (empty($chartaccountcode)) {
$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, 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.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,";
$sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,";
} else {
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
}
$sql .= " p.tosell as status, p.tobuy as status_buy,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur, s.accountancy_code_buy as company_code_buy";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " sa.accountancy_code_buy as company_code_buy";
} else {
$sql .= " s.accountancy_code_buy as company_code_buy";
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_accounting as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$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."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$alias_company_accounting = !empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "sa" : "s";
$alias_product_accounting = !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "pa" : "p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_accounting . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_accounting . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_accounting . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_company_accounting . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
// Define begin binding date

View File

@ -13,6 +13,7 @@
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
*
* 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

View File

@ -4,6 +4,7 @@
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
*
* 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

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Frédéric France <frederic.france@netlgic.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
*
* 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

View File

@ -75,6 +75,7 @@ function llxFooter()
print "\n".'</html>'."\n";
}
require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -117,10 +118,10 @@ if (!isset($conf->global->ASTERISK_MAX_RETRY)) {
}
$login = GETPOST('login');
$password = GETPOST('password');
$caller = GETPOST('caller');
$called = GETPOST('called');
$login = GETPOST('login', 'alphanohtml');
$password = GETPOST('password', 'none');
$caller = GETPOST('caller', 'alphanohtml');
$called = GETPOST('called', 'alphanohtml');
// IP address of Asterisk server
$strHost = $conf->global->ASTERISK_HOST;
@ -163,7 +164,7 @@ if ($resql) {
if ($obj) {
$found = $obj->name;
} else {
$found = $notfound;
$found = 'Not found';
}
$db->free($resql);
} else {
@ -177,7 +178,7 @@ if (!empty($number)) {
if ($pos === false) {
$errno = 0;
$errstr = 0;
$strCallerId = "Dolibarr call $found <".strtolower($number).">";
$strCallerId = "Dolibarr caller $found <".strtolower($number).">";
$oSocket = @fsockopen($strHost, $port, $errno, $errstr, 10);
if (!$oSocket) {
print '<body>'."\n";
@ -211,7 +212,7 @@ if (!empty($number)) {
}
}
} else {
print 'Bad parameters in URL. Must be '.$_SERVER['PHP_SELF'].'?caller=99999&called=99999&login=xxxxx&password=xxxxx';
print 'Bad parameters in URL. Must be '.dol_escape_htmltag($_SERVER['PHP_SELF']).'?caller=99999&called=99999&login=xxxxx&password=xxxxx';
}
// End of page

View File

@ -1324,9 +1324,9 @@ if (empty($reshook)) {
// Terms of payment
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
$result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent')));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue')));
} elseif ($action == 'setmode' && $usercancreate) {
// Payment choice
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));

View File

@ -24,6 +24,8 @@
* \brief Page to edit absolute discounts for a customer
*/
if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -1778,7 +1778,7 @@ if (empty($reshook)) {
$product->fetch(GETPOST('idprod'.$i, 'int'));
$startday = dol_mktime(12, 0, 0, GETPOST('date_start'.$i.'month'), GETPOST('date_start'.$i.'day'), GETPOST('date_start'.$i.'year'));
$endday = dol_mktime(12, 0, 0, GETPOST('date_end'.$i.'month'), GETPOST('date_end'.$i.'day'), GETPOST('date_end'.$i.'year'));
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
$result = $object->addline($product->description, $product->price, price2num(GETPOST('qty'.$i), 'MS'), $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, GETPOST('idprod'.$i, 'int'), price2num(GETPOST('remise_percent'.$i)), $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type, -1, 0, '', 0, 0, null, 0, '', 0, 100, '', $product->fk_unit);
}
}
}

View File

@ -111,10 +111,18 @@ $idpays = $p[0];
$sql = "SELECT f.rowid, f.ref, f.type, f.datef, f.ref_client,";
$sql .= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2, fd.rowid as id, fd.situation_percent,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
$sql .= " p.rowid as pid, p.ref as pref,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell,";
} else {
$sql .= " p.accountancy_code_sell,";
}
$sql .= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = ".((int) $idpays);

View File

@ -37,6 +37,7 @@ if ($user->socid) {
$result = restrictedArea($user, 'tax', '', '', 'charges');
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -63,6 +64,8 @@ $search_year_lim = GETPOST('search_year_lim', 'int');
$search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_project = GETPOST('search_project', 'alpha');
$search_users = GETPOST('search_users');
$search_type = GETPOST('search_type', 'int');
$search_account = GETPOST('search_account', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -103,13 +106,19 @@ $arrayfields = array(
'cs.rowid' =>array('label'=>"Ref", 'checked'=>1, 'position'=>10),
'cs.libelle' =>array('label'=>"Label", 'checked'=>1, 'position'=>20),
'cs.fk_type' =>array('label'=>"Type", 'checked'=>1, 'position'=>30),
'cs.fk_user' =>array('label'=>"Employee", 'checked'=>1, 'position'=>30),
'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>40, 'enable'=>(!empty($conf->projet->enabled))),
'cs.date_ech' =>array('label'=>"Date", 'checked'=>1, 'position'=>50),
'cs.periode' =>array('label'=>"PeriodEndDate", 'checked'=>1, 'position'=>60),
'cs.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>70),
'cs.paye' =>array('label'=>"Status", 'checked'=>1, 'position'=>80),
'cs.date_ech' =>array('label'=>"Date", 'checked'=>1, 'position'=>40),
'cs.periode' =>array('label'=>"PeriodEndDate", 'checked'=>1, 'position'=>50),
'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>60, 'enable'=>(!empty($conf->projet->enabled))),
'cs.fk_user' =>array('label'=>"Employee", 'checked'=>1, 'position'=>70),
'cs.fk_mode_reglement' =>array('checked'=>1, 'position'=>80, 'label'=>"DefaultPaymentMode"),
'cs.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>100),
'cs.paye' =>array('label'=>"Status", 'checked'=>1, 'position'=>110),
);
if (!empty($conf->banque->enabled)) {
$arrayfields['cs.fk_account'] = array('checked'=>1, 'position'=>90, 'label'=>"DefaultBankAccount");
}
$arrayfields = dol_sort_array($arrayfields, 'position');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -144,6 +153,8 @@ if (empty($reshook)) {
$search_project_ref = '';
$search_project = '';
$search_users = '';
$search_type = '';
$search_account = '';
$search_array_options = array();
}
}
@ -154,6 +165,7 @@ if (empty($reshook)) {
$form = new Form($db);
$formother = new FormOther($db);
$bankstatic = new Account($db);
$formsocialcontrib = new FormSocialContrib($db);
$chargesociale_static = new ChargeSociales($db);
if (!empty($conf->projet->enabled)) {
@ -167,10 +179,13 @@ $sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
if (!empty($conf->projet->enabled)) {
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
}
$sql .= " c.libelle as type_label,";
$sql .= " SUM(pc.amount) as alreadypayed";
$sql .= " c.libelle as type_label, cs.fk_account,";
$sql .= " ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
$sql .= " SUM(pc.amount) as alreadypayed, pay.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (cs.fk_account = ba.rowid)";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
if (!empty($conf->projet->enabled)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet";
}
@ -193,6 +208,12 @@ if (!empty($conf->projet->enabled)) {
if (!empty($search_users)) {
$sql .= ' AND cs.fk_user IN('.implode(', ', $search_users).')';
}
if (!empty($search_type) && $search_type > 0) {
$sql .= ' AND cs.fk_mode_reglement='.$search_type;
}
if (!empty($search_account) && $search_account > 0) {
$sql .= ' AND cs.fk_account='.$search_account;
}
if ($search_amount) {
$sql .= natural_search("cs.amount", $search_amount, 1);
}
@ -212,7 +233,7 @@ if ($year > 0) {
if ($search_typeid) {
$sql .= " AND cs.fk_type=".$db->escape($search_typeid);
}
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle, cs.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos";
if (!empty($conf->projet->enabled)) {
$sql .= ", p.rowid, p.ref, p.title";
}
@ -263,6 +284,12 @@ if ($search_users) {
$param .= '&search_users[]='.urlencode($id_user);
}
}
if ($search_type) {
$param .= '&search_type='.urlencode($search_type);
}
if ($search_account) {
$param .= '&search_account='.$search_account;
}
if ($search_status != '' && $search_status != '-1') {
$param .= '&search_status='.urlencode($search_status);
}
@ -346,19 +373,6 @@ if (!empty($arrayfields['cs.fk_type']['checked'])) {
print '</td>';
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
print '<td class="liste_titre" align="left">';
print $form->select_dolusers($search_users, 'search_users', 1, null, 0, '', '', '0', '0', 0, '', 0, '', '', 0, 0, true);
}
// Filter: Project ref
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'">';
print '</td>';
}
// Filter: Date (placeholder)
if (!empty($arrayfields['cs.date_ech']['checked'])) {
print '<td class="liste_titre">';
@ -376,6 +390,33 @@ if (!empty($arrayfields['cs.periode']['checked'])) {
print '</td>';
}
// Filter: Project ref
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'">';
print '</td>';
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
print '<td class="liste_titre" align="left">';
print $form->select_dolusers($search_users, 'search_users', 1, null, 0, '', '', '0', '0', 0, '', 0, '', '', 0, 0, true);
}
// Filter: Type
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print '<td class="liste_titre left">';
$form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 16);
print '</td>';
}
// Filter: Bank Account
if (!empty($arrayfields['cs.fk_account']['checked'])) {
print '<td class="liste_titre left">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>';
}
// Filter: Amount
if (!empty($arrayfields['cs.amount']['checked'])) {
print '<td class="liste_titre right">';
@ -416,18 +457,24 @@ if (!empty($arrayfields['cs.libelle']['checked'])) {
if (!empty($arrayfields['cs.fk_type']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_type']['label'], $_SERVER["PHP_SELF"], "cs.fk_type", '', $param, 'class="left"', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'class="left"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.ref']['checked'])) {
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.date_ech']['checked'])) {
print_liste_field_titre($arrayfields['cs.date_ech']['label'], $_SERVER["PHP_SELF"], "cs.date_ech", '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.periode']['checked'])) {
print_liste_field_titre($arrayfields['cs.periode']['label'], $_SERVER["PHP_SELF"], "cs.periode", '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.ref']['checked'])) {
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'class="left"', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "cs.fk_mode_reglement", '', $param, 'class="right"', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.fk_account']['checked'])) {
print_liste_field_titre($arrayfields['cs.fk_account']['label'], $_SERVER["PHP_SELF"], "cs.fk_account", '', $param, 'class="right"', $sortfield, $sortorder);
}
if (!empty($arrayfields['cs.amount']['checked'])) {
print_liste_field_titre($arrayfields['cs.amount']['label'], $_SERVER["PHP_SELF"], "cs.amount", '', $param, 'class="right"', $sortfield, $sortorder);
}
@ -492,37 +539,6 @@ while ($i < min($num, $limit)) {
}
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
print "<td>";
if (!empty($obj->fk_user)) {
if (!empty($TLoadedUsers[$obj->fk_user])) {
$ustatic = $TLoadedUsers[$obj->fk_user];
} else {
$ustatic = new User($db);
$ustatic->fetch($obj->fk_user);
$TLoadedUsers[$obj->fk_user] = $ustatic;
}
print $ustatic->getNomUrl(-1);
}
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Project ref
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowrap">';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date
if (!empty($arrayfields['cs.date_ech']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
@ -545,6 +561,70 @@ while ($i < min($num, $limit)) {
}
}
// Project ref
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowrap">';
if ($obj->project_id > 0) {
print $projectstatic->getNomUrl(1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['cs.fk_user']['checked'])) {
// Employee
print "<td>";
if (!empty($obj->fk_user)) {
if (!empty($TLoadedUsers[$obj->fk_user])) {
$ustatic = $TLoadedUsers[$obj->fk_user];
} else {
$ustatic = new User($db);
$ustatic->fetch($obj->fk_user);
$TLoadedUsers[$obj->fk_user] = $ustatic;
}
print $ustatic->getNomUrl(-1);
}
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
print '<td>';
if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account
if (!empty($arrayfields['cs.fk_account']['checked'])) {
print '<td>';
if ($obj->fk_account > 0) {
$bankstatic->id = $obj->fk_account;
$bankstatic->ref = $obj->bref;
$bankstatic->number = $obj->bnumber;
$bankstatic->iban = $obj->iban;
$bankstatic->bic = $obj->bic;
$bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$bankstatic->account_number = $obj->account_number;
$bankstatic->clos = $obj->clos;
//$accountingjournal->fetch($obj->fk_accountancy_journal);
//$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
$bankstatic->label = $obj->blabel;
print $bankstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount
if (!empty($arrayfields['cs.amount']['checked'])) {
print '<td class="nowrap right">'.price($obj->amount).'</td>';

View File

@ -30,6 +30,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
@ -44,7 +45,7 @@ $hookmanager = new HookManager($db);
$hookmanager->initHooks(array('specialexpensesindex'));
// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills'));
$langs->loadLangs(array('compta', 'bills', 'hrm'));
// Security check
if ($user->socid) {
@ -96,8 +97,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$tva_static = new Tva($db);
$socialcontrib = new ChargeSociales($db);
$payment_sc_static = new PaymentSocialContribution($db);
$userstatic = new User($db);
$sal_static = new Salary($db);
$accountstatic = new Account($db);
$accountlinestatic = new AccountLine($db);
$formsocialcontrib = new FormSocialContrib($db);
$title = $langs->trans("SocialContributionsPayments");
@ -140,13 +143,15 @@ $sql = "SELECT c.id, c.libelle as label,";
$sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql .= " u.rowid uid, u.lastname, u.firstname, u.email, u.login, u.admin,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = cs.fk_user";
$sql .= " WHERE cs.fk_type = c.id";
$sql .= " AND cs.entity IN (".getEntity("tax").")";
if ($search_sc_type > 0) {
@ -160,7 +165,11 @@ if ($year > 0) {
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ")";
}
if (preg_match('/^cs\./', $sortfield) || preg_match('/^c\./', $sortfield) || preg_match('/^pc\./', $sortfield) || preg_match('/^pct\./', $sortfield)) {
if (preg_match('/^cs\./', $sortfield)
|| preg_match('/^c\./', $sortfield)
|| preg_match('/^pc\./', $sortfield)
|| preg_match('/^pct\./', $sortfield)
|| preg_match('/^u\./', $sortfield)) {
$sql .= $db->order($sortfield, $sortorder);
}
@ -208,8 +217,11 @@ print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
if (!empty($conf->banque->enabled)) {
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">';
@ -219,16 +231,19 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "c.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "cs.fk_type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pc.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("SocialContribution", $_SERVER["PHP_SELF"], "c.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "cs.fk_type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pc.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "pc.num_paiement", "", $param, '', $sortfield, $sortorder, '', 'ChequeOrTransferNumber');
if (!empty($conf->banque->enabled)) {
print_liste_field_titre("BankTransactionLine", $_SERVER["PHP_SELF"], "pc.fk_bank", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -246,52 +261,80 @@ $totalpaye = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
// Ref payment
$payment_sc_static->id = $obj->pid;
$payment_sc_static->ref = $obj->pid;
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
// Label
print '<td>';
$socialcontrib->id = $obj->rowid;
$socialcontrib->ref = empty($obj->libelle) ? $obj->label : $obj->libelle;
$socialcontrib->label = empty($obj->libelle) ? $obj->label : $obj->libelle;
print $socialcontrib->getNomUrl(1, '20');
print '</td>';
// Type
print '<td title="'.dol_escape_htmltag($obj->label).'" class="tdmaxoverflow300">'.$obj->label.'</td>';
// Date
$date = $obj->periode;
if (empty($date)) {
$date = $obj->date_ech;
}
print '<td>'.dol_print_date($date, 'day').'</td>';
// Label
print '<td>';
$socialcontrib->id = $obj->rowid;
$socialcontrib->ref = $obj->label;
$socialcontrib->label = $obj->label;
print $socialcontrib->getNomUrl(1, '20');
print '</td>';
// Type
print '<td title="'.dol_escape_htmltag($obj->label).'" class="tdmaxoverflow300">'.$obj->label.'</td>';
// Expected to pay
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
// Ref payment
$payment_sc_static->id = $obj->pid;
$payment_sc_static->ref = $obj->pid;
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
// Date payment
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
// Employee
print "<td>";
if (!empty($obj->uid)) {
$userstatic->id = $obj->uid;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->admin = $obj->admin;
$userstatic->login = $obj->login;
$userstatic->email = $obj->email;
$userstatic->socid = $obj->fk_soc;
$userstatic->statut = $obj->status;
print $userstatic->getNomUrl(1);
print "</td>\n";
}
// Type payment
print '<td>';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
}
print $obj->num_payment.'</td>';
print '</td>';
print '<td>'.$obj->num_payment.'</td>';
// Account
if (!empty($conf->banque->enabled)) {
// Bank transaction
print '<td>';
$accountlinestatic->id = $obj->fk_bank;
print $accountlinestatic->getNomUrl(1);
print '</td>';
print '<td>';
if ($obj->fk_bank > 0) {
//$accountstatic->fetch($obj->fk_bank);
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
$accountstatic->accountancy_number = $obj->account_number;
$accountstatic->accountancy_journal = $obj->accountancy_journal;
$accountstatic->label = $obj->blabel;
$accountstatic->iban = $obj->iban;
$accountstatic->bic = $obj->bic;
$accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$accountstatic->clos = $obj->clos;
print $accountstatic->getNomUrl(1);
} else {
print '&nbsp;';
}
print '</td>';
}
// Expected to pay
print '<td class="right">'.price($obj->total).'</td>';
// Paid
print '<td class="right">';
if ($obj->totalpaye) {
@ -315,8 +358,11 @@ print '<td class="liste_total right"></td>'; // A total here has no sense
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
if (!empty($conf->banque->enabled)) {
print '<td></td>';
print '<td></td>';
}
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print '<td></td>';

View File

@ -280,6 +280,11 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
$sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
$sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
$parameters = array();
$hookmanager->executeHooks('printFieldListSelect', $parameters);
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
if ($selected_soc > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
@ -291,6 +296,11 @@ if ($modecompta == 'CREANCES-DETTES') {
} elseif ($selected_cat) { // Into a specific category
$sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
}
$parameters = array();
$hookmanager->executeHooks('printFieldListFrom', $parameters);
$sql .= $hookmanager->resPrint;
$sql .= " WHERE l.fk_facture = f.rowid";
$sql .= " AND f.fk_statut in (1,2)";
$sql .= " AND l.product_type in (0,1)";
@ -333,6 +343,11 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= " AND soc.rowid=".$selected_soc;
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$parameters = array();
$hookmanager->executeHooks('printFieldListWhere', $parameters);
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type";
$sql .= $db->order($sortfield, $sortorder);
@ -394,6 +409,11 @@ if ($modecompta == 'CREANCES-DETTES') {
print '<td colspan="5" class="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListeTitle', $parameters);
print $hookmanager->resPrint;
print '</td></tr>';
// Array header

View File

@ -85,10 +85,15 @@ $arrayfields = array(
't.rowid' =>array('checked'=>1, 'position'=>10, 'label'=>"Ref",),
't.label' =>array('checked'=>1, 'position'=>20, 'label'=>"Label"),
't.datev' =>array('checked'=>1, 'position'=>30, 'label'=>"PeriodEndDate"),
't.fk_typepayment' =>array('checked'=>1, 'position'=>50, 'label'=>"Type"),
't.fk_typepayment' =>array('checked'=>1, 'position'=>50, 'label'=>"DefaultPaymentMode"),
't.amount' =>array('checked'=>1, 'position'=>90, 'label'=>"Amount"),
't.status' =>array('checked'=>1, 'position'=>90, 'label'=>"Status"),
);
if (!empty($conf->banque->enabled)) {
$arrayfields['t.fk_account'] = array('checked'=>1, 'position'=>60, 'label'=>"DefaultBankAccount");
}
$arrayfields = dol_sort_array($arrayfields, 'position');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -139,11 +144,14 @@ $bankline = new AccountLine($db);
llxHeader('', $langs->trans("VATDeclarations"));
$sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment as type, t.num_payment, pst.code as payment_code,';
$sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment as type, t.fk_account,';
$sql.= ' ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,';
$sql.= ' t.num_payment, pst.code as payment_code,';
$sql .= ' SUM(ptva.amount) as alreadypayed';
$sql .= ' FROM '.MAIN_DB_PREFIX.'tva as t';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pst ON t.fk_typepayment = pst.id';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_vat as ptva ON ptva.fk_tva = t.rowid";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pst ON (t.fk_typepayment = pst.id)';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON (t.fk_account = ba.rowid)';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_vat as ptva ON (ptva.fk_tva = t.rowid)";
$sql .= ' WHERE t.entity IN ('.getEntity($object->element).')';
if (!empty($search_ref)) {
@ -168,7 +176,7 @@ if (!empty($search_type) && $search_type > 0) {
$sql .= ' AND t.fk_typepayment='.$search_type;
}
if (!empty($search_account) && $search_account > 0) {
$sql .= ' AND b.fk_account='.$search_account;
$sql .= ' AND t.fk_account='.$search_account;
}
if (!empty($search_amount)) {
$sql .= natural_search('t.amount', price2num(trim($search_amount)), 1);
@ -177,7 +185,7 @@ if ($search_status != '' && $search_status >= 0) {
$sql .= " AND t.paye = ".$db->escape($search_status);
}
$sql .= " GROUP BY t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment, t.num_payment, pst.code";
$sql .= " GROUP BY t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment, t.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, t.num_payment, pst.code";
$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
@ -353,6 +361,13 @@ if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
print '</td>';
}
// Filter: Bank Account
if (!empty($arrayfields['t.fk_account']['checked'])) {
print '<td class="liste_titre left">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>';
}
// Filter: Amount
if (!empty($arrayfields['t.amount']['checked'])) {
print '<td class="liste_titre right">';
@ -396,6 +411,9 @@ if (!empty($arrayfields['t.datev']['checked'])) {
if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_typepayment']['label'], $_SERVER['PHP_SELF'], 't.fk_typepayment', '', $param, '', $sortfield, $sortorder, 'left ');
}
if (!empty($arrayfields['t.fk_account']['checked'])) {
print_liste_field_titre($arrayfields['t.fk_account']['label'], $_SERVER['PHP_SELF'], 't.fk_account', '', $param, '', $sortfield, $sortorder, 'left ');
}
if (!empty($arrayfields['t.amount']['checked'])) {
print_liste_field_titre($arrayfields['t.amount']['label'], $_SERVER['PHP_SELF'], 't.amount', '', $param, '', $sortfield, $sortorder, 'right ');
}
@ -462,30 +480,36 @@ while ($i < min($num, $limit)) {
// Type
if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).'</td>';
print '<td>';
if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account
/*if (!empty($arrayfields['ba.label']['checked'])) {
if (!empty($arrayfields['t.fk_account']['checked'])) {
print '<td>';
if ($obj->fk_bank > 0) {
$bankstatic->id = $obj->bid;
if ($obj->fk_account > 0) {
$bankstatic->id = $obj->fk_account;
$bankstatic->ref = $obj->bref;
$bankstatic->number = $obj->bnumber;
$bankstatic->iban = $obj->iban;
$bankstatic->bic = $obj->bic;
$bankstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$bankstatic->account_number = $obj->account_number;
$bankstatic->clos = $obj->clos;
$accountingjournal->fetch($obj->fk_accountancy_journal);
$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
//$accountingjournal->fetch($obj->fk_accountancy_journal);
//$bankstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
$bankstatic->label = $obj->blabel;
print $bankstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}*/
}
// Amount
if (!empty($arrayfields['t.amount']['checked'])) {

View File

@ -75,6 +75,7 @@ if (!$sortorder) {
$tva_static = new Tva($db);
$tva = new Tva($db);
$accountlinestatic = new AccountLine($db);
$payment_vat_static = new PaymentVAT($db);
$sal_static = new PaymentSalary($db);
@ -119,17 +120,21 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "ptva.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "ptva.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "bank.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATDeclaration", $_SERVER["PHP_SELF"], "tva.label", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("TypeContrib", $_SERVER["PHP_SELF"], "tva.fk_type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "tva.datev", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "ptva.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "pc.num_paiement", "", $param, '', $sortfield, $sortorder, '', 'ChequeOrTransferNumber');
if (!empty($conf->banque->enabled)) {
print_liste_field_titre("BankTransactionLine", $_SERVER["PHP_SELF"], "ptva.fk_bank", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "bank.ref", "", $param, '', $sortfield, $sortorder);
}
//print_liste_field_titre("TypeContrib", $_SERVER["PHP_SELF"], "tva.fk_type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "tva.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "ptva.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print "</tr>\n";
$sql = "SELECT tva.rowid, tva.label as label, b.fk_account";
$sql = "SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
$sql .= ", tva.datev";
$sql .= ", tva.amount as total,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaye, ptva.num_paiement as num_payment,";
@ -175,22 +180,10 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$payment_vat_static->ref = $obj->pid;
print '<tr class="oddeven">';
// Ref payment
print '<td>'.$payment_vat_static->getNomUrl(1)."</td>\n";
// Date payment
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
// Type payment
print '<td>';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
}
print $obj->num_payment.'</td>';
// Account
print '<td>';
$account = new Account($db);
$account->fetch($obj->fk_account);
print $account->getNomUrl(1);
print '</td>';
// Label
print '<td>';
$tva->id = $obj->rowid;
@ -198,11 +191,41 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$tva->label = $obj->label;
print $tva->getNomUrl(1, '20');
print '</td>';
// Type
//print '<td><a href="../tva/list.php?filtre=tva.fk_type:'.$obj->type.'">'.$obj->type_label.'</a></td>';
// Date
$date = $obj->datev;
print '<td>'.dol_print_date($date, 'day').'</td>';
// Date payment
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
// Type payment
print '<td>';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
}
print '</td>';
// Chq number
print '<td>'.$obj->num_payment.'</td>';
if (!empty($conf->banque->enabled)) {
// Bank transaction
print '<td>';
$accountlinestatic->id = $obj->fk_bank;
print $accountlinestatic->getNomUrl(1);
print '</td>';
// Account
print '<td>';
$account = new Account($db);
$account->fetch($obj->fk_account);
print $account->getNomUrl(1);
print '</td>';
}
// Type
//print '<td><a href="../tva/list.php?filtre=tva.fk_type:'.$obj->type.'">'.$obj->type_label.'</a></td>';
// Expected to pay
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
// Paid
@ -222,6 +245,10 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print '<td class="liste_total right"></td>'; // A total here has no sense
//print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
if (!empty($conf->banque->enabled)) {
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
}
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td class="liste_total right">'.price($totalpaye)."</td>";

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
*
* 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
@ -93,12 +94,14 @@ class box_members_by_type extends ModeleBoxes
$MembersToValidate = array();
$MembersValidated = array();
$MemberUpToDate = array();
$MembersExcluded = array();
$MembersResiliated = array();
$SommeA = 0;
$SommeB = 0;
$SommeC = 0;
$SommeD = 0;
$SumToValidate = 0;
$SumValidated = 0;
$SumUpToDate = 0;
$SumResiliated = 0;
$SumExcluded = 0;
$AdherentType = array();
@ -132,6 +135,9 @@ class box_members_by_type extends ModeleBoxes
if ($objp->statut == 1) {
$MembersValidated[$objp->rowid] = $objp->somme;
}
if ($objp->statut == -2) {
$MembersExcluded[$objp->rowid] = $objp->somme;
}
if ($objp->statut == 0) {
$MembersResiliated[$objp->rowid] = $objp->somme;
}
@ -181,16 +187,22 @@ class box_members_by_type extends ModeleBoxes
'td' => 'class="right"',
'text' => $langs->trans("UpToDate"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("MembersStatusExcluded"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("MembersStatusResiliated"),
);
$line++;
foreach ($AdherentType as $key => $adhtype) {
$SommeA += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
$SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
$SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
$SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
$SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
$SumValidated += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0;
$SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0;
$SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0;
$SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $adhtype->getNomUrl(1, dol_size(32)),
@ -211,6 +223,11 @@ class box_members_by_type extends ModeleBoxes
'text' => (isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(1, 1, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersExcluded[$key]) && $MembersExcluded[$key] > 0 ? $MembersExcluded[$key] : '') . ' ' . $staticmember->LibStatut(-2, 1, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(0, 1, 0, 3),
@ -232,22 +249,27 @@ class box_members_by_type extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeA.' '.$staticmember->LibStatut(-1, 1, 0, 3),
'text' => $SumToValidate.' '.$staticmember->LibStatut(-1, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeB.' '.$staticmember->LibStatut(1, 1, 0, 3),
'text' => $SumValidated.' '.$staticmember->LibStatut(1, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeC.' '.$staticmember->LibStatut(1, 1, $now, 3),
'text' => $SumUpToDate.' '.$staticmember->LibStatut(1, 1, $now, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeD.' '.$staticmember->LibStatut(0, 1, 0, 3),
'text' => $SumExcluded.' '.$staticmember->LibStatut(-2, 1, 0, 3),
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SumResiliated.' '.$staticmember->LibStatut(0, 1, 0, 3),
'asis' => 1
);
}

View File

@ -9,14 +9,14 @@
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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

View File

@ -278,6 +278,9 @@ class pdf_einstein extends ModelePDFCommandes
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Set nblines with the new command lines content after hook
$nblines = count($object->lines);
// Create pdf instance
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance

View File

@ -323,6 +323,9 @@ class pdf_eratosthene extends ModelePDFCommandes
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Set nblines with the new command lines content after hook
$nblines = count($object->lines);
// Create pdf instance
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -206,6 +207,7 @@ class modFacture extends DolibarrModules
//--------
$r = 1;
$alias_product_accounting = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "pa" : "p";
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = 'CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r] = 'invoice';
@ -226,7 +228,7 @@ class modFacture extends DolibarrModules
'fd.subprice'=>"LineUnitPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT",
'fd.total_ttc'=>"LineTotalTTC", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode',
'fd.product_type'=>"TypeOfLineServiceOrProduct", 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel',
'p.accountancy_code_sell'=>'ProductAccountancySellCode'
$alias_product_accounting . '.accountancy_code_sell'=>'ProductAccountancySellCode'
);
if (!empty($conf->multicurrency->enabled)) {
$this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency';
@ -249,7 +251,7 @@ class modFacture extends DolibarrModules
'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric",
'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date",
'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text',
'p.accountancy_code_sell'=>'Text'
$alias_product_accounting . '.accountancy_code_sell'=>'Text'
);
if (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->INVOICE_SHOW_POS)) {
$this->export_TypeFields_array[$r]['f.module_source'] = 'Text';
@ -261,7 +263,7 @@ class modFacture extends DolibarrModules
's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.label'=>"invoice_line", 'fd.description'=>"invoice_line",
'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line",
'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line',
'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', 'p.accountancy_code_sell'=>'product',
'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_accounting . '.accountancy_code_sell'=>'product',
'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user'
);
$this->export_special_array[$r] = array('none.rest'=>'getRemainToPay');
@ -293,6 +295,9 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] .= ' , '.MAIN_DB_PREFIX.'facturedet as fd';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet_extrafields as extra2 on fd.rowid = extra2.fk_object';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')';

View File

@ -1,13 +1,13 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2020-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -176,6 +176,7 @@ class modProduct extends DolibarrModules
//--------
$r = 0;
$alias_product_accounting = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "pa" : "p";
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
@ -185,9 +186,9 @@ class modProduct extends DolibarrModules
'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",
'p.description'=>"Description", 'p.url'=>"PublicUrl",
'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry',
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
$alias_product_accounting . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_accounting . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
$alias_product_accounting . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_accounting . '.accountancy_code_buy'=>"ProductAccountancyBuyCode",
$alias_product_accounting . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_accounting . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
'p.weight'=>"Weight", 'p.weight_units'=>"WeightUnits", 'p.length'=>"Length", 'p.length_units'=>"LengthUnits", 'p.width'=>"Width", 'p.width_units'=>"WidthUnits", 'p.height'=>"Height", 'p.height_units'=>"HeightUnits",
'p.surface'=>"Surface", 'p.surface_units'=>"SurfaceUnits", 'p.volume'=>"Volume", 'p.volume_units'=>"VolumeUnits",
@ -230,8 +231,8 @@ class modProduct extends DolibarrModules
'p.ref'=>"Text", 'p.label'=>"Text",
'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
'p.description'=>"Text", 'p.url'=>"Text",
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
$alias_product_accounting . '.accountancy_code_sell'=>"Text", $alias_product_accounting . '.accountancy_code_sell_intra'=>"Text", $alias_product_accounting . '.accountancy_code_sell_export'=>"Text",
$alias_product_accounting . '.accountancy_code_buy'=>"Text", $alias_product_accounting . '.accountancy_code_buy_intra'=>"Text", $alias_product_accounting . '.accountancy_code_buy_export'=>"Text",
'p.note'=>"Text", 'p.note_public'=>"Text",
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric",
'p.customcode'=>'Text',
@ -293,6 +294,9 @@ class modProduct extends DolibarrModules
}
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
}
@ -386,9 +390,9 @@ class modProduct extends DolibarrModules
$this->export_permission[$r] = array(array("produit", "export"));
$this->export_fields_array[$r] = array(
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
$alias_product_accounting . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_accounting . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
$alias_product_accounting . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_accounting . '.accountancy_code_buy'=>"ProductAccountancyBuyCode",
$alias_product_accounting . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_accounting . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
@ -403,8 +407,8 @@ class modProduct extends DolibarrModules
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
$this->export_TypeFields_array[$r] = array(
'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
$alias_product_accounting . '.accountancy_code_sell'=>"Text", $alias_product_accounting . '.accountancy_code_sell_intra'=>"Text", $alias_product_accounting . '.accountancy_code_sell_export'=>"Text",
$alias_product_accounting . '.accountancy_code_buy'=>"Text", $alias_product_accounting . '.accountancy_code_buy_intra'=>"Text", $alias_product_accounting . '.accountancy_code_buy_export'=>"Text",
'p.note'=>"Text", 'p.note_public'=>"Text",
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
@ -419,8 +423,8 @@ class modProduct extends DolibarrModules
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
$this->export_entities_array[$r] = array(
'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
$alias_product_accounting . '.accountancy_code_sell'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_sell_intra'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_sell_export'=>'virtualproduct',
$alias_product_accounting . '.accountancy_code_buy'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_buy_intra'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_buy_export'=>'virtualproduct',
'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct",
'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
@ -441,7 +445,10 @@ class modProduct extends DolibarrModules
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct"));
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
$this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -143,6 +143,7 @@ class modService extends DolibarrModules
//--------
$r = 0;
$alias_product_accounting = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "pa" : "p";
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
@ -152,9 +153,9 @@ class modService extends DolibarrModules
'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",
'p.description'=>"Description", 'p.url'=>"PublicUrl",
'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry',
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
$alias_product_accounting . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_accounting . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
$alias_product_accounting . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_accounting . '.accountancy_code_buy'=>"ProductAccountancyBuyCode",
$alias_product_accounting . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_accounting . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.width'=>"Width", 'p.height'=>"Height", 'p.surface'=>"Surface", 'p.volume'=>"Volume",
'p.duration'=>"Duration",
@ -194,9 +195,9 @@ class modService extends DolibarrModules
$this->export_TypeFields_array[$r] = array(
'p.ref'=>"Text", 'p.label'=>"Text",
'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
'p.description'=>"Text", 'p.url'=>"Text", 'p.accountancy_code_sell'=>"Text",
'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text", 'p.accountancy_code_buy'=>"Text",
'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
'p.description'=>"Text", 'p.url'=>"Text",
$alias_product_accounting . '.accountancy_code_sell'=>"Text", $alias_product_accounting . '.accountancy_code_sell_intra'=>"Text", $alias_product_accounting . '.accountancy_code_sell_export'=>"Text",
$alias_product_accounting . '.accountancy_code_buy'=>"Text", $alias_product_accounting . '.accountancy_code_buy_intra'=>"Text", $alias_product_accounting . '.accountancy_code_buy_export'=>"Text",
'p.note'=>"Text", 'p.note_public'=>"Text",
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric",
'p.customcode'=>'Text',
@ -256,6 +257,9 @@ class modService extends DolibarrModules
}
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
}
@ -347,9 +351,9 @@ class modService extends DolibarrModules
$this->export_permission[$r] = array(array("service", "export"));
$this->export_fields_array[$r] = array(
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
$alias_product_accounting . '.accountancy_code_sell'=>"ProductAccountancySellCode", $alias_product_accounting . '.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
$alias_product_accounting . '.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", $alias_product_accounting . '.accountancy_code_buy'=>"ProductAccountancyBuyCode",
$alias_product_accounting . '.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", $alias_product_accounting . '.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
@ -364,8 +368,8 @@ class modService extends DolibarrModules
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
$this->export_TypeFields_array[$r] = array(
'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
$alias_product_accounting . 'p.accountancy_code_sell'=>"Text", $alias_product_accounting . '.accountancy_code_sell_intra'=>"Text", $alias_product_accounting . '.accountancy_code_sell_export'=>"Text",
$alias_product_accounting . 'p.accountancy_code_buy'=>"Text", $alias_product_accounting . '.accountancy_code_buy_intra'=>"Text", $alias_product_accounting . '.accountancy_code_buy_export'=>"Text",
'p.note'=>"Text", 'p.note_public'=>"Text",
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
@ -380,8 +384,8 @@ class modService extends DolibarrModules
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
$this->export_entities_array[$r] = array(
'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
$alias_product_accounting . '.accountancy_code_sell'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_sell_intra'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_sell_export'=>'virtualproduct',
$alias_product_accounting . '.accountancy_code_buy'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_buy_intra'=>'virtualproduct', $alias_product_accounting . '.accountancy_code_buy_export'=>'virtualproduct',
'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct",
'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
@ -402,6 +406,9 @@ class modService extends DolibarrModules
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct"));
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) {
$this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_accounting as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity);
}
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile

View File

@ -290,7 +290,7 @@ if (empty($reshook)) {
}
if ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise($user, $_POST['remise_percent']);
$result = $object->set_remise($user, price2num(GETPOST('remise_percent')));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}

View File

@ -56,8 +56,12 @@
insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0, 0, '0',0,'-');
-- Algeria Regions (id country=13)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 13, 1301, '', 0, 'Algerie');
-- Austria Regions (id country=41)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 41, 4101, '', 0, 'Österreich', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 41, 4101, '', 0, 'Österreich');
-- Belgium Regions (id country=2)
@ -188,8 +192,7 @@ insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (10,102
-- Region USA (id country=11)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 11, 1101, '', 0, 'United-States', 1);
-- Regions Algeria (id country=13)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 13, 1301, '', 0, 'Algerie', 1);
-- Region Canada (id country=14)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 14, 1401, '', 0, 'Canada', 1);

View File

@ -140,6 +140,19 @@ insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (201,'11','',2,'NAMUR','Namur');
-- Canada Provinces & Territories (id country=14)
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'ON','',1,'','Ontario');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'QC','',1,'','Quebec');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'NS','',1,'','Nova Scotia');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'NB','',1,'','New Brunswick');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'MB','',1,'','Manitoba');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'BC','',1,'','British Columbia');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'PE','',1,'','Prince Edward Island');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'SK','',1,'','Saskatchewan');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'AB','',1,'','Alberta');
insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (1401,'NL','',1,'','Newfoundland and Labrador');
-- Departements France (id country=1)
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 1,'971','97105',3,'GUADELOUPE','Guadeloupe');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 2,'972','97209',3,'MARTINIQUE','Martinique');
@ -583,18 +596,6 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('112', 5209, '', 0, '', 'General Federico Román', 1);
-- Provinces Canada (id country=14)
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'ON','',1,'','Ontario');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'QC','',1,'','Quebec');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'NS','',1,'','Nova Scotia');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'NB','',1,'','New Brunswick');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'MB','',1,'','Manitoba');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'BC','',1,'','British Columbia');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'PE','',1,'','Prince Edward Island');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'SK','',1,'','Saskatchewan');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'AB','',1,'','Alberta');
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (1401,'NL','',1,'','Newfoundland and Labrador');
-- Provinces Spain (id country=4) in order of province (for logical pick list)
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('VI', '419', '01', 19, 'ALAVA', 'Álava');
INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES ('AB', '404', '02', 4, 'ALBACETE', 'Albacete');

View File

@ -279,6 +279,35 @@ DELETE FROM llx_boxes_def WHERE file IN ('box_graph_ticket_by_severity', 'box_ti
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_nb_tickets_type.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_nb_tickets_type.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_new_vs_close_ticket.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_new_vs_close_ticket.php' AND entity = 1);
create table llx_product_perentity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_product integer,
entity integer DEFAULT 1 NOT NULL, -- multi company id
accountancy_code_sell varchar(32), -- Selling accountancy code
accountancy_code_sell_intra varchar(32), -- Selling accountancy code for vat intracommunity
accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export
accountancy_code_buy varchar(32), -- Buying accountancy code
accountancy_code_buy_intra varchar(32), -- Buying accountancy code for vat intracommunity
accountancy_code_buy_export varchar(32) -- Buying accountancy code for vat import
)ENGINE=innodb;
ALTER TABLE llx_product_perentity ADD INDEX idx_product_perentity_fk_product (fk_product);
ALTER TABLE llx_product_perentity ADD UNIQUE INDEX uk_product_perentity (fk_product, entity);
create table llx_societe_perentity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_soc integer,
entity integer DEFAULT 1 NOT NULL, -- multi company id
-- code_compta varchar(24), -- code compta client
-- code_compta_fournisseur varchar(24), -- code compta founisseur
accountancy_code_sell varchar(32), -- Selling accountancy code
accountancy_code_buy varchar(32) -- Buying accountancy code
)ENGINE=innodb;
ALTER TABLE llx_societe_perentity ADD INDEX idx_societe_perentity_fk_soc (fk_soc);
ALTER TABLE llx_societe_perentity ADD UNIQUE INDEX uk_societe_perentity (fk_soc, entity);
CREATE TABLE llx_eventorganization_conferenceorboothattendee(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
@ -323,4 +352,3 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee_extrafields ADD INDE
ALTER TABLE llx_c_ticket_category ADD COLUMN public integer DEFAULT 0;

View File

@ -0,0 +1,21 @@
-- ===================================================================
-- Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_product_perentity ADD INDEX idx_product_perentity_fk_product (fk_product);
ALTER TABLE llx_product_perentity ADD UNIQUE INDEX uk_product_perentity (fk_product, entity);

View File

@ -0,0 +1,30 @@
-- ========================================================================
-- Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_product_perentity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_product integer,
entity integer DEFAULT 1 NOT NULL, -- multi company id
accountancy_code_sell varchar(32), -- Selling accountancy code
accountancy_code_sell_intra varchar(32), -- Selling accountancy code for vat intracommunity
accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export
accountancy_code_buy varchar(32), -- Buying accountancy code
accountancy_code_buy_intra varchar(32), -- Buying accountancy code for vat intracommunity
accountancy_code_buy_export varchar(32) -- Buying accountancy code for vat import
)ENGINE=innodb;

View File

@ -0,0 +1,21 @@
-- ===================================================================
-- Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_societe_perentity ADD INDEX idx_societe_perentity_fk_soc (fk_soc);
ALTER TABLE llx_societe_perentity ADD UNIQUE INDEX uk_societe_perentity (fk_soc, entity);

View File

@ -0,0 +1,28 @@
-- ========================================================================
-- Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ========================================================================
create table llx_societe_perentity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_soc integer,
entity integer DEFAULT 1 NOT NULL, -- multi company id
-- code_compta varchar(24), -- code compta client
-- code_compta_fournisseur varchar(24), -- code compta founisseur
accountancy_code_sell varchar(32), -- Selling accountancy code
accountancy_code_buy varchar(32) -- Buying accountancy code
)ENGINE=innodb;

View File

@ -181,6 +181,12 @@ ProfId3FR=Prof Id 3 (NAF, old APE)
ProfId4FR=Prof Id 4 (RCS/RM)
ProfId5FR=Prof Id 5 (numéro EORI)
ProfId6FR=-
ProfId1ShortFR=SIREN
ProfId2ShortFR=SIRET
ProfId3ShortFR=NAF
ProfId4ShortFR=RCS
ProfId5ShortFR=EORI
ProfId6ShortFR=-
ProfId1GB=Registration Number
ProfId2GB=-
ProfId3GB=SIC

View File

@ -1060,6 +1060,7 @@ YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode
Inventory=Inventory
AnalyticCode=Analytic code
TMenuMRP=MRP
ShowCompanyInfos=Show company infos
ShowMoreInfos=Show More Infos
NoFilesUploadedYet=Please upload a document first
SeePrivateNote=See private note

View File

@ -12,8 +12,9 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2020 Demarest Maxime <maxime@indelog.fr>
* Copyright (C) 2020 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2020 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -55,7 +56,7 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) {
* only be guaranted by escaping data during output.
*
* @param string $val Value brut found int $_GET, $_POST or PHP_SELF
* @param string $type 1=GET, 0=POST, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test)
* @param string $type 0=POST, 1=GET, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test)
* @return int >0 if there is an injection, 0 if none
*/
function testSqlAndScriptInject($val, $type)
@ -149,7 +150,7 @@ function testSqlAndScriptInject($val, $type)
$inj += preg_match('/"/i', $val); // We refused " in GET parameters value.
}
if ($type == 2) {
$inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces.
$inj += preg_match('/[;"<>]/', $val); // PHP_SELF is a file system (or url path without parameters). It can contains spaces.
}
return $inj;
@ -1981,6 +1982,20 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
}
$dropdownBody = '';
$dropdownBody .= '<span id="topmenulogincompanyinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans("ShowCompanyInfos").'</span>';
$dropdownBody .= '<div id="topmenulogincompanyinfo" >';
if (!empty($conf->global->MAIN_INFO_SIREN)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).'</span>';
if (!empty($conf->global->MAIN_INFO_SIRET)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).'</span>';
if (!empty($conf->global->MAIN_INFO_APE)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).'</span>';
if (!empty($conf->global->MAIN_INFO_RCS)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).'</span>';
if (!empty($conf->global->MAIN_INFO_PROFID5)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).'</span>';
if (!empty($conf->global->MAIN_INFO_PROFID6)) $dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6Short", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).'</span>';
if (!empty($conf->global->MAIN_INFO_TVAINTRA)) $dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).'</span>';
$dropdownBody .= '</div>';
$dropdownBody .= '<br>';
$dropdownBody .= '<span id="topmenuloginmoreinfo-btn"><i class="fa fa-caret-right"></i> '.$langs->trans("ShowMoreInfos").'</span>';
$dropdownBody .= '<div id="topmenuloginmoreinfo" >';
@ -2137,6 +2152,10 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$("#topmenu-login-dropdown").toggleClass("open");
});
$("#topmenulogincompanyinfo-btn").on("click", function() {
$("#topmenulogincompanyinfo").slideToggle();
});
$("#topmenuloginmoreinfo-btn").on("click", function() {
$("#topmenuloginmoreinfo").slideToggle();
});';

View File

@ -8,7 +8,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2021 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
@ -660,12 +660,14 @@ class Product extends CommonObject
$sql .= ", price_base_type";
$sql .= ", tobuy";
$sql .= ", tosell";
$sql .= ", accountancy_code_buy";
$sql .= ", accountancy_code_buy_intra";
$sql .= ", accountancy_code_buy_export";
$sql .= ", accountancy_code_sell";
$sql .= ", accountancy_code_sell_intra";
$sql .= ", accountancy_code_sell_export";
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= ", accountancy_code_buy";
$sql .= ", accountancy_code_buy_intra";
$sql .= ", accountancy_code_buy_export";
$sql .= ", accountancy_code_sell";
$sql .= ", accountancy_code_sell_intra";
$sql .= ", accountancy_code_sell_export";
}
$sql .= ", canvas";
$sql .= ", finished";
$sql .= ", tobatch";
@ -685,12 +687,14 @@ class Product extends CommonObject
$sql .= ", '".$this->db->escape($this->price_base_type)."'";
$sql .= ", ".$this->status;
$sql .= ", ".$this->status_buy;
$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
}
$sql .= ", '".$this->db->escape($this->canvas)."'";
$sql .= ", ".((!isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished);
$sql .= ", ".((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch);
@ -718,6 +722,34 @@ class Product extends CommonObject
$error++;
$this->error = $this->db->lasterror();
}
// update accountancy for this entity
if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_accounting (";
$sql .= " fk_product";
$sql .= ", entity";
$sql .= ", accountancy_code_buy";
$sql .= ", accountancy_code_buy_intra";
$sql .= ", accountancy_code_buy_export";
$sql .= ", accountancy_code_sell";
$sql .= ", accountancy_code_sell_intra";
$sql .= ", accountancy_code_sell_export";
$sql .= ") VALUES (";
$sql .= $this->id;
$sql .= ", " . $conf->entity;
$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
$sql .= ")";
$result = $this->db->query($sql);
if (!$result) {
$error++;
$this->error = 'ErrorFailedToInsertAccountancyForEntity';
}
}
} else {
$error++;
$this->error = 'ErrorFailedToGetInsertedId';
@ -1051,12 +1083,14 @@ class Product extends CommonObject
$sql .= ", fk_state = ".($this->state_id > 0 ? (int) $this->state_id : 'null');
$sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null');
$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
$sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
$sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
$sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
$sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
$sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
$sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
}
$sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null");
$sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
$sql .= ", fk_unit= ".(!$this->fk_unit ? 'NULL' : (int) $this->fk_unit);
@ -1083,6 +1117,36 @@ class Product extends CommonObject
$action = 'update';
// update accountancy for this entity
if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "product_accounting WHERE fk_product = " . $this->id . " AND entity = " . $conf->entity);
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_accounting (";
$sql .= " fk_product";
$sql .= ", entity";
$sql .= ", accountancy_code_buy";
$sql .= ", accountancy_code_buy_intra";
$sql .= ", accountancy_code_buy_export";
$sql .= ", accountancy_code_sell";
$sql .= ", accountancy_code_sell_intra";
$sql .= ", accountancy_code_sell_export";
$sql .= ") VALUES (";
$sql .= $this->id;
$sql .= ", " . $conf->entity;
$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
$sql .= ")";
$result = $this->db->query($sql);
if (!$result) {
$error++;
$this->error = 'ErrorFailedToUpdateAccountancyForEntity';
}
}
// Actions on extra fields
if (!$error) {
$result = $this->insertExtraFields();
@ -2096,16 +2160,22 @@ class Product extends CommonObject
return -1;
}
$sql = "SELECT rowid, ref, ref_ext, label, description, url, note_public, note as note_private, customcode, fk_country, fk_state, price, price_ttc,";
$sql .= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,";
$sql .= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,";
$sql .= " length, length_units, width, width_units, height, height_units,";
$sql .= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
$sql .= " accountancy_code_buy, accountancy_code_buy_intra, accountancy_code_buy_export,";
$sql .= " accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,";
$sql .= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,";
$sql .= " fk_price_expression, price_autogen, model_pdf";
$sql = "SELECT p.rowid, p.ref, p.ref_ext, p.label, p.description, p.url, p.note_public, p.note as note_private, p.customcode, p.fk_country, p.fk_state, p.price, p.price_ttc,";
$sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,";
$sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,";
$sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,";
$sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished,";
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
} else {
$sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,";
}
$sql .= " p.stock,p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.fk_unit,";
$sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf";
$sql .= " FROM ".MAIN_DB_PREFIX."product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
if ($id) {
$sql .= " WHERE rowid = ".(int) $id;
} else {

View File

@ -11,7 +11,7 @@
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2020-2021 Open-DSI <support@open-dsi.fr>
*
* 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
@ -191,6 +191,8 @@ if (empty($conf->global->PRODUIT_MULTIPRICES)) {
$isInEEC = isInEEC($mysoc);
$alias_product_accounting = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa";
// Definition of fields for lists
$arrayfields = array(
'p.ref'=>array('label'=>"Ref", 'checked'=>1),
@ -226,12 +228,12 @@ $arrayfields = array(
'p.tobatch'=>array('label'=>"ManageLotSerial", 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>60),
'p.fk_country'=>array('label'=>"Country", 'checked'=>0, 'position'=>100),
'p.fk_state'=>array('label'=>"State", 'checked'=>0, 'position'=>101),
'p.accountancy_code_sell'=>array('label'=>"ProductAccountancySellCode", 'checked'=>0, 'position'=>400),
'p.accountancy_code_sell_intra'=>array('label'=>"ProductAccountancySellIntraCode", 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>401),
'p.accountancy_code_sell_export'=>array('label'=>"ProductAccountancySellExportCode", 'checked'=>0, 'position'=>402),
'p.accountancy_code_buy'=>array('label'=>"ProductAccountancyBuyCode", 'checked'=>0, 'position'=>403),
'p.accountancy_code_buy_intra'=>array('label'=>"ProductAccountancyBuyIntraCode", 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>404),
'p.accountancy_code_buy_export'=>array('label'=>"ProductAccountancyBuyExportCode", 'checked'=>0, 'position'=>405),
$alias_product_accounting . '.accountancy_code_sell'=>array('label'=>"ProductAccountancySellCode", 'checked'=>0, 'position'=>400),
$alias_product_accounting . '.accountancy_code_sell_intra'=>array('label'=>"ProductAccountancySellIntraCode", 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>401),
$alias_product_accounting . '.accountancy_code_sell_export'=>array('label'=>"ProductAccountancySellExportCode", 'checked'=>0, 'position'=>402),
$alias_product_accounting . '.accountancy_code_buy'=>array('label'=>"ProductAccountancyBuyCode", 'checked'=>0, 'position'=>403),
$alias_product_accounting . '.accountancy_code_buy_intra'=>array('label'=>"ProductAccountancyBuyIntraCode", 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>404),
$alias_product_accounting . '.accountancy_code_buy_export'=>array('label'=>"ProductAccountancyBuyExportCode", 'checked'=>0, 'position'=>405),
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'p.tosell'=>array('label'=>$langs->transnoentitiesnoconv("Status").' ('.$langs->transnoentitiesnoconv("Sell").')', 'checked'=>1, 'position'=>1000),
@ -358,8 +360,12 @@ if ($search_type != '' && $search_type != '-1') {
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';
$sql .= ' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,';
$sql .= ' p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,';
$sql .= ' p.tobatch,';
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
} else {
$sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export, pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,";
}
$sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock, p.cost_price,';
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, fk_country, fk_state,';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -380,6 +386,9 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
}
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)";
}
@ -484,22 +493,22 @@ if ($search_finished >= 0 && $search_finished !== '') {
$sql .= " AND p.finished = ".((int) $search_finished);
}
if ($search_accountancy_code_sell) {
$sql .= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell);
$sql .= natural_search($alias_product_accounting . '.accountancy_code_sell', $search_accountancy_code_sell);
}
if ($search_accountancy_code_sell_intra) {
$sql .= natural_search('p.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
$sql .= natural_search($alias_product_accounting . '.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
}
if ($search_accountancy_code_sell_export) {
$sql .= natural_search('p.accountancy_code_sell_export', $search_accountancy_code_sell_export);
$sql .= natural_search($alias_product_accounting . '.accountancy_code_sell_export', $search_accountancy_code_sell_export);
}
if ($search_accountancy_code_buy) {
$sql .= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy);
$sql .= natural_search($alias_product_accounting . '.accountancy_code_buy', $search_accountancy_code_buy);
}
if ($search_accountancy_code_buy_intra) {
$sql .= natural_search('p.accountancy_code_buy_intra', $search_accountancy_code_buy_intra);
$sql .= natural_search($alias_product_accounting . '.accountancy_code_buy_intra', $search_accountancy_code_buy_intra);
}
if ($search_accountancy_code_buy_export) {
$sql .= natural_search('p.accountancy_code_buy_export', $search_accountancy_code_buy_export);
$sql .= natural_search($alias_product_accounting . '.accountancy_code_buy_export', $search_accountancy_code_buy_export);
}
// Add where from extra fields
@ -510,8 +519,12 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // No
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,";
$sql .= " p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
$sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,';
$sql .= ' p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.pmp, p.cost_price, p.stock,';
$sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock,';
if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
} else {
$sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export, pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,";
}
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ', p.fk_unit, cu.label';
@ -991,23 +1004,23 @@ if ($resql) {
print '<td class="liste_titre center">'.$formcompany->select_state($search_state, $search_country).'</td>';
}
// Accountancy code sell
if (!empty($arrayfields['p.accountancy_code_sell']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
}
if (!empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell_intra']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_intra" value="'.dol_escape_htmltag($search_accountancy_code_sell_intra).'"></td>';
}
if (!empty($arrayfields['p.accountancy_code_sell_export']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell_export']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_export" value="'.dol_escape_htmltag($search_accountancy_code_sell_export).'"></td>';
}
// Accountancy code buy
if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
}
if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy_intra']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_intra" value="'.dol_escape_htmltag($search_accountancy_code_buy_intra).'"></td>';
}
if (!empty($arrayfields['p.accountancy_code_buy_export']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy_export']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_export" value="'.dol_escape_htmltag($search_accountancy_code_buy_export).'"></td>';
}
// Extra fields
@ -1154,23 +1167,23 @@ if ($resql) {
if (!empty($arrayfields['p.fk_state']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_state']['label'], $_SERVER["PHP_SELF"], "p.fk_state", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.accountancy_code_sell']['checked'])) {
print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell']['checked'])) {
print_liste_field_titre($arrayfields[$alias_product_accounting . '.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"], $alias_product_accounting . ".accountancy_code_sell", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) {
print_liste_field_titre($arrayfields['p.accountancy_code_sell_intra']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell_intra", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell_intra']['checked'])) {
print_liste_field_titre($arrayfields[$alias_product_accounting . '.accountancy_code_sell_intra']['label'], $_SERVER["PHP_SELF"], $alias_product_accounting . ".accountancy_code_sell_intra", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.accountancy_code_sell_export']['checked'])) {
print_liste_field_titre($arrayfields['p.accountancy_code_sell_export']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_sell_export", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell_export']['checked'])) {
print_liste_field_titre($arrayfields[$alias_product_accounting . '.accountancy_code_sell_export']['label'], $_SERVER["PHP_SELF"], $alias_product_accounting . ".accountancy_code_sell_export", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) {
print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy']['checked'])) {
print_liste_field_titre($arrayfields[$alias_product_accounting . '.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], $alias_product_accounting . ".accountancy_code_buy", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked'])) {
print_liste_field_titre($arrayfields['p.accountancy_code_buy_intra']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy_intra", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy_intra']['checked'])) {
print_liste_field_titre($arrayfields[$alias_product_accounting . '.accountancy_code_buy_intra']['label'], $_SERVER["PHP_SELF"], $alias_product_accounting . ".accountancy_code_buy_intra", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.accountancy_code_buy_export']['checked'])) {
print_liste_field_titre($arrayfields['p.accountancy_code_buy_export']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy_export", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy_export']['checked'])) {
print_liste_field_titre($arrayfields[$alias_product_accounting . '.accountancy_code_buy_export']['label'], $_SERVER["PHP_SELF"], $alias_product_accounting . ".accountancy_code_buy_export", "", $param, '', $sortfield, $sortorder);
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -1695,38 +1708,38 @@ if ($resql) {
}
}
// Accountancy code sell
if (!empty($arrayfields['p.accountancy_code_sell']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell']['checked'])) {
print '<td>'.$obj->accountancy_code_sell.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell_intra']['checked'])) {
print '<td>'.$obj->accountancy_code_sell_intra.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['p.accountancy_code_sell_export']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_sell_export']['checked'])) {
print '<td>'.$obj->accountancy_code_sell_export.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy code buy
if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy']['checked'])) {
print '<td>'.$obj->accountancy_code_buy.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy_intra']['checked'])) {
print '<td>'.$obj->accountancy_code_buy_intra.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['p.accountancy_code_buy_export']['checked'])) {
if (!empty($arrayfields[$alias_product_accounting . '.accountancy_code_buy_export']['checked'])) {
print '<td>'.$obj->accountancy_code_buy_export.'</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -235,7 +235,7 @@ $title = $langs->trans('Salaries');
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, ";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
$sql .= " pst.code as payment_code,";
$sql .= " SUM(ps.amount) as alreadypayed";
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
@ -270,7 +270,7 @@ if ($search_amount) {
$sql .= natural_search("s.amount", $search_amount, 1);
}
if ($search_account > 0) {
$sql .= " AND b.fk_account=".((int) $search_account);
$sql .= " AND s.fk_account=".((int) $search_account);
}
if ($search_status != '' && $search_status >= 0) {
$sql .= " AND s.paye = ".$db->escape($search_status);
@ -280,7 +280,7 @@ if ($search_type_id) {
}
$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary, u.fk_soc, u.statut,";
$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,";
$sql .= " ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label,";
$sql .= " ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos,";
$sql .= " pst.code";
$sql .= $db->order($sortfield, $sortorder);
@ -409,10 +409,6 @@ print '<tr class="liste_titre_filter">';
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$db->escape($search_ref).'">';
print '</td>';
// Employee
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
print '</td>';
// Label
print '<td class="liste_titre"><input type="text" class="flat width150" name="search_label" value="'.$db->escape($search_label).'"></td>';
@ -436,6 +432,11 @@ print $form->selectDate($search_date_end_to ? $search_date_end_to : -1, 'search_
print '</div>';
print '</td>';
// Employee
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
print '</td>';
// Type
print '<td class="liste_titre left">';
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
@ -475,10 +476,10 @@ print '</tr>'."\n";
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("DefaultPaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
if (!empty($conf->banque->enabled)) {
print_liste_field_titre("DefaultBankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
@ -541,12 +542,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$totalarray['nbfield']++;
}
// Employee
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
// Label payment
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
if (!$i) {
@ -565,8 +560,16 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$totalarray['nbfield']++;
}
// Employee
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).'</td>';
print '<td>';
if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -578,7 +581,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
//$accountstatic->fetch($obj->fk_bank);
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->label = $obj->blabel;
$accountstatic->number = $obj->bnumber;
$accountstatic->iban = $obj->iban;
$accountstatic->bic = $obj->bic;
$accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$accountstatic->account_number = $obj->account_number;
$accountstatic->clos = $obj->clos;
if (!empty($conf->accounting->enabled)) {
$accountstatic->account_number = $obj->account_number;

View File

@ -77,6 +77,8 @@ $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'int');
$search_fk_bank = GETPOST('search_fk_bank', 'int');
$search_chq_number = GETPOST('search_chq_number', 'int');
$filtre = GETPOST("filtre", 'restricthtml');
@ -141,6 +143,8 @@ if (empty($reshook)) {
$search_date_end = '';
$search_amount = "";
$search_account = '';
$search_fk_bank = '';
$search_chq_number = '';
$search_type_id = "";
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
@ -171,6 +175,7 @@ $salstatic = new Salary($db);
$paymentsalstatic = new PaymentSalary($db);
$userstatic = new User($db);
$accountstatic = new Account($db);
$accountlinestatic = new AccountLine($db);
$now = dol_now();
@ -180,7 +185,7 @@ $title = $langs->trans('SalariesPayments');
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
$sql .= " s.rowid, s.fk_user, s.amount, s.salary, sal.rowid as id_salary, sal.label, s.datep as datep, b.datev as datev, s.fk_typepayment as type, s.num_payment, s.fk_bank,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
$sql .= " pst.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as sal ON (sal.rowid = s.fk_salary)";
@ -201,6 +206,9 @@ if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_
if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
if ($search_account > 0) $sql .= " AND b.fk_account=".((int) $search_account);
if ($search_fk_bank) $sql .= " AND s.fk_bank=".((int) $search_fk_bank);
if ($search_chq_number) $sql .= natural_search(array('s.num_payment'), $search_chq_number);
if ($search_type_id > 0) {
$sql .= " AND s.fk_typepayment=".$search_type_id;
}
@ -245,8 +253,10 @@ if ($search_type_id) $param .= '&search_type_id='.urlencode($search_type_id);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
if ($search_ref_salary) $param .= '&search_ref_salary='.urlencode($search_ref_salary);
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
if ($search_user) $param .= '&search_user='.urlencode($search_user);
if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_fk_bank) $param .= '&search_fk_bank='.urlencode($search_fk_bank);
if ($search_chq_number) $param .= '&search_chq_number='.urlencode($search_chq_number);
if ($search_account) $param .= '&search_account='.urlencode($search_account);
if ($search_date_start) $param .= '&search_date_startday='.urlencode(GETPOST('search_date_startday', 'int')).'&search_date_startmonth='.urlencode(GETPOST('search_date_startmonth', 'int')).'&search_date_startyear='.urlencode(GETPOST('search_date_startyear', 'int'));
if ($search_date_end) $param .= '&search_date_endday='.urlencode(GETPOST('search_date_endday', 'int')).'&search_date_endmonth='.urlencode(GETPOST('search_date_endmonth', 'int')).'&search_date_endyear='.urlencode(GETPOST('search_date_endyear', 'int'));
@ -292,10 +302,6 @@ print '<tr class="liste_titre_filter">';
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$db->escape($search_ref).'">';
print '</td>';
// Employee
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
print '</td>';
// Salary
print '<td class="liste_titre center">';
print '<input class="flat" type="text" size="3" name="search_ref_salary" value="'.$db->escape($search_ref_salary).'">';
@ -314,12 +320,24 @@ print '</td>';
// Date value
print '<td class="liste_titre center">';
print '</td>';
// Employee
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).'">';
print '</td>';
// Type
print '<td class="liste_titre left">';
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
print '</td>';
// Account
// Chq number
print '<td class="liste_titre right"><input name="search_chq_number" class="flat" type="text" size="8" value="'.$db->escape($search_chq_number).'"></td>';
if (!empty($conf->banque->enabled)) {
// Bank transaction
print '<td class="liste_titre center">';
print '<input class="flat" type="text" size="3" name="search_fk_bank" value="'.$db->escape($search_fk_bank).'">';
print '</td>';
// Account
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>';
@ -345,14 +363,18 @@ print '</tr>'."\n";
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Salary", $_SERVER["PHP_SELF"], "sal.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "b.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "pst.code", "", $param, 'class="left"', $sortfield, $sortorder);
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "s.num_payment", "", $param, '', $sortfield, $sortorder, '', 'ChequeOrTransferNumber');
if (!empty($conf->banque->enabled)) {
print_liste_field_titre("BankTransactionLine", $_SERVER["PHP_SELF"], "s.fk_bank", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -407,10 +429,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print "<td>".$paymentsalstatic->getNomUrl(1)."</td>\n";
if (!$i) $totalarray['nbfield']++;
// Employee
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
if (!$i) $totalarray['nbfield']++;
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
if (!$i) $totalarray['nbfield']++;
@ -426,18 +444,37 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datev), 'day')."</td>\n";
if (!$i) $totalarray['nbfield']++;
// Employee
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
if (!$i) $totalarray['nbfield']++;
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).'</td>';
if (!$i) $totalarray['nbfield']++;
// Chq number
print '<td>'.$obj->num_payment.'</td>';
if (!$i) $totalarray['nbfield']++;
// Account
if (!empty($conf->banque->enabled)) {
// Bank transaction
print '<td>';
$accountlinestatic->id = $obj->fk_bank;
print $accountlinestatic->getNomUrl(1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
print '<td>';
if ($obj->fk_bank > 0) {
//$accountstatic->fetch($obj->fk_bank);
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
$accountstatic->iban = $obj->iban;
$accountstatic->bic = $obj->bic;
$accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code);
$accountstatic->clos = $obj->clos;
if (!empty($conf->accounting->enabled)) {
$accountstatic->account_number = $obj->account_number;

View File

@ -58,7 +58,8 @@ if ($action == 'addcontact' && $permissiontoedit) {
if ($result > 0 && $id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$result = $object->add_contact($contactid, GETPOST("type"), GETPOST("source"));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $object->add_contact($contactid, $typeid, GETPOST("source"));
}
if ($result >= 0) {

View File

@ -277,14 +277,14 @@ a.top-menu-dropdown-link {
text-decoration: none;
}
#topmenuloginmoreinfo-btn{
#topmenuloginmoreinfo-btn, #topmenulogincompanyinfo-btn {
display: block;
text-aling: right;
color:#666;
cursor: pointer;
}
#topmenuloginmoreinfo{
#topmenuloginmoreinfo, #topmenulogincompanyinfo {
display: none;
clear: both;
font-size: 0.95em;

View File

@ -283,14 +283,14 @@ a.top-menu-dropdown-link {
text-decoration: none;
}
#topmenuloginmoreinfo-btn{
#topmenuloginmoreinfo-btn, #topmenulogincompanyinfo-btn {
display: block;
text-aling: right;
color:#666;
cursor: pointer;
}
#topmenuloginmoreinfo{
#topmenuloginmoreinfo, #topmenulogincompanyinfo {
display: none;
clear: both;
font-size: 0.95em;

View File

@ -105,7 +105,7 @@ if ($id) {
print '<div class="underbanner clearboth"></div>';
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="fichecenter">';