Merge branch 'develop' into 14a22

This commit is contained in:
Laurent Destailleur 2021-03-29 20:35:35 +02:00 committed by GitHub
commit a4987c6e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
154 changed files with 1878 additions and 1055 deletions

View File

@ -7,6 +7,7 @@ English Dolibarr ChangeLog
For users:
----------
NEW: Several security issues after a second private bug bounty campaign.
For developers:

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

@ -84,12 +84,10 @@ if (!empty($canvas)) {
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('membercard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
if ($id > 0) {
// Fetch object
if ($id > 0 || !empty($ref)) {
// Load member
$result = $object->fetch($id);
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
@ -97,9 +95,9 @@ if ($id > 0) {
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
@ -110,6 +108,8 @@ if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
/*

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

@ -42,9 +42,6 @@ $ref = GETPOST('ref', 'alphanohtml');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
$result = restrictedArea($user, 'adherent', $id);
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -63,8 +60,6 @@ if (!$sortfield) {
$sortfield = "name";
}
$form = new Form($db);
$object = new Adherent($db);
$membert = new AdherentType($db);
$result = $object->fetch($id, $ref);
@ -74,6 +69,33 @@ if ($result < 0) {
}
$upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
// Fetch object
if ($id > 0 || !empty($ref)) {
// Load member
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to determine what the current user can do on the members
$canaddmember = $user->rights->adherent->creer;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
/*
* Actions

View File

@ -26,7 +26,16 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$status = GETPOST('status', 'int');
$cotis = GETPOST('cotis', 'int');
$sortfield = GETPOST('sortfield', 'alphanohtml');
$sortorder = GETPOST('sortorder', 'aZ09');
// Security check
if (empty($conf->adherent->enabled)) {
accessforbidden();
}
if (!$user->rights->adherent->export) {
accessforbidden();
}
@ -46,19 +55,10 @@ if (empty($sortorder)) {
if (empty($sortfield)) {
$sortfield = "d.login";
}
if (!isset($statut)) {
$statut = 1;
}
if (!isset($cotis)) {
// by default, members must be up to date of subscription
$cotis = 1;
}
$sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = ".$statut;
$sql .= " WHERE d.statut = ".((int) $status);
if ($cotis == 1) {
$sql .= " AND datefin > '".$db->idate($now)."'";
}
@ -70,6 +70,7 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '';
print_barre_liste($langs->trans("HTPasswordExport"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0);
print "<hr>\n";

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

@ -32,7 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page
$langs->loadLangs(array("companies", "members", "ldap", "admin"));
$rowid = GETPOST('id', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alphanohtml');
$action = GETPOST('action', 'aZ09');
// Protection
@ -42,12 +43,34 @@ if ($user->socid > 0) {
}
$object = new Adherent($db);
$result = $object->fetch($rowid);
if (!$result) {
dol_print_error($db, "Failed to get adherent: ".$object->error);
exit;
// Fetch object
if ($id > 0 || !empty($ref)) {
// Load member
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to determine what the current user can do on the members
$canaddmember = $user->rights->adherent->creer;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
/*
* Actions

View File

@ -33,9 +33,7 @@ $langs->loadLangs(array("companies", "members", "bills"));
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
// Security check
$result = restrictedArea($user, 'adherent', $id);
$ref = GETPOST('ref', 'alphanohtml');
$object = new Adherent($db);
$result = $object->fetch($id);
@ -46,6 +44,34 @@ if ($result > 0) {
$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
// Fetch object
if ($id > 0 || !empty($ref)) {
// Load member
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to determine what the current user can do on the members
$canaddmember = $user->rights->adherent->creer;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
/*
* Actions
*/

View File

@ -42,7 +42,9 @@ $langs->loadLangs(array("companies", "bills", "members", "users", "mails", 'othe
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$rowid = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');
$id = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');
$rowid = $id;
$ref = GETPOST('ref', 'alphanohtml');
$typeid = GETPOST('typeid', 'int');
$cancel = GETPOST('cancel');
@ -66,10 +68,6 @@ if (!$sortorder) {
$sortorder = "DESC";
}
// Security check
$result = restrictedArea($user, 'adherent', $rowid, '', 'cotisation');
$object = new Adherent($db);
$extrafields = new ExtraFields($db);
$adht = new AdherentType($db);
@ -82,29 +80,6 @@ $errmsg = '';
$defaultdelay = 1;
$defaultdelayunit = 'y';
if ($rowid) {
// Load member
$result = $object->fetch($rowid);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $user is the user editing, $object->user_id is the user's id linked to the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to know what current user can do on members
$canaddmember = $user->rights->adherent->creer;
// Define variables to know what current user can do on properties of a member
if ($rowid) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('subscription'));
@ -117,6 +92,33 @@ $datefrom = 0;
$dateto = 0;
$paymentdate = -1;
// Fetch object
if ($id > 0 || !empty($ref)) {
// Load member
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to determine what the current user can do on the members
$canaddmember = $user->rights->adherent->creer;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
/*
* Actions

View File

@ -30,71 +30,100 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
$adherent = new adherent($db);
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alphanohtml');
$object = new adherent($db);
// Fetch object
if ($id > 0 || !empty($ref)) {
// Load member
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to determine what the current user can do on the members
$canaddmember = $user->rights->adherent->creer;
// Define variables to determine what the current user can do on the properties of a member
if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Security check
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas);
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
$result = $adherent->fetch($id);
if ($result <= 0) {
dol_print_error($adherent->error);
exit;
}
/*
* Actions
*/
$physicalperson = 1;
// None
/*
* View
*/
$company = new Societe($db);
if ($adherent->socid) {
$result = $company->fetch($adherent->socid);
if ($object->socid) {
$result = $company->fetch($object->socid);
}
// We create VCard
$v = new vCard();
$v->setProdId('Dolibarr '.DOL_VERSION);
$v->setUid('DOLIBARR-ADHERENTID-'.$adherent->id);
$v->setName($adherent->lastname, $adherent->firstname, "", $adherent->civility, "");
$v->setFormattedName($adherent->getFullName($langs, 1));
$v->setUid('DOLIBARR-ADHERENTID-'.$object->id);
$v->setName($object->lastname, $object->firstname, "", $object->civility, "");
$v->setFormattedName($object->getFullName($langs, 1));
$v->setPhoneNumber($adherent->phone_pro, "TYPE=WORK;VOICE");
//$v->setPhoneNumber($adherent->phone_perso,"TYPE=HOME;VOICE");
$v->setPhoneNumber($adherent->phone_mobile, "TYPE=CELL;VOICE");
$v->setPhoneNumber($adherent->fax, "TYPE=WORK;FAX");
$v->setPhoneNumber($object->phone_pro, "TYPE=WORK;VOICE");
//$v->setPhoneNumber($object->phone_perso,"TYPE=HOME;VOICE");
$v->setPhoneNumber($object->phone_mobile, "TYPE=CELL;VOICE");
$v->setPhoneNumber($object->fax, "TYPE=WORK;FAX");
$country = $adherent->country_code ? $adherent->country : '';
$country = $object->country_code ? $object->country : '';
$v->setAddress("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK;POSTAL");
$v->setLabel("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK");
$v->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL");
$v->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK");
$v->setEmail($adherent->email);
$v->setNote($adherent->note_public);
$v->setTitle($adherent->poste);
$v->setEmail($object->email);
$v->setNote($object->note_public);
$v->setTitle($object->poste);
// Data from linked company
if ($company->id) {
$v->setURL($company->url, "TYPE=WORK");
if (!$adherent->phone_pro) {
if (!$object->phone_pro) {
$v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
}
if (!$adherent->fax) {
if (!$object->fax) {
$v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
}
if (!$adherent->zip) {
if (!$object->zip) {
$v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
}
// when company e-mail is empty, use only adherent e-mail
if (empty(trim($company->email))) {
// was set before, don't set twice
} elseif (empty(trim($adherent->email))) {
} elseif (empty(trim($object->email))) {
// when adherent e-mail is empty, use only company e-mail
$v->setEmail($company->email);
} elseif (strtolower(end(explode("@", $adherent->email))) == strtolower(end(explode("@", $company->email)))) {
} elseif (strtolower(end(explode("@", $object->email))) == strtolower(end(explode("@", $company->email)))) {
// when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second)
$v->setEmail($adherent->email);
$v->setEmail($object->email);
// support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($company->email, 'INTERNET');
@ -103,7 +132,7 @@ if ($company->id) {
$v->setEmail($company->email);
// support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($adherent->email, 'INTERNET');
$v->setEmail($object->email, 'INTERNET');
}
// Si adherent lie a un tiers non de type "particulier"
@ -113,9 +142,9 @@ if ($company->id) {
}
// Personal informations
$v->setPhoneNumber($adherent->phone_perso, "TYPE=HOME;VOICE");
if ($adherent->birth) {
$v->setBirthday($adherent->birth);
$v->setPhoneNumber($object->phone_perso, "TYPE=HOME;VOICE");
if ($object->birth) {
$v->setBirthday($object->birth);
}
$db->close();

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'));
@ -1387,7 +1387,7 @@ if (empty($reshook)) {
} elseif ($action == 'swapstatut') {
// Toggle the status of a contact
if ($object->fetch($id) > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}

View File

@ -3843,7 +3843,7 @@ class PropaleLigne extends CommonObjectLine
$sql .= ' pd.date_start, pd.date_end, pd.product_type';
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
$sql .= ' WHERE pd.rowid = '.$rowid;
$sql .= ' WHERE pd.rowid = '.((int) $rowid);
$result = $this->db->query($sql);
if ($result) {

View File

@ -93,7 +93,7 @@ if ($action == 'addcontact' && $user->rights->propale->creer) {
} elseif ($action == 'swapstatut' && $user->rights->propale->creer) {
// Toggle the status of a contact
if ($object->id > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
}
} elseif ($action == 'deletecontact' && $user->rights->propale->creer) {
// Deletes a contact

View File

@ -843,31 +843,31 @@ if ($resql) {
if ($user->rights->societe->client->voir || $socid) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view products
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
$moreforfilter .= '</div>';
}
$parameters = array();

View File

@ -33,7 +33,7 @@ if (!empty($conf->facture->enabled)) {
}
// Security check
$socid = $_GET["socid"];
$socid = GETPOST("socid", 'int');
if ($user->socid > 0) {
$action = '';
$socid = $user->socid;

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

@ -1370,7 +1370,7 @@ if (empty($reshook)) {
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
if ($object->id > 0) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}

View File

@ -4126,7 +4126,7 @@ class OrderLine extends CommonOrderLine
$sql .= ' cd.date_start, cd.date_end';
$sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
$sql .= ' WHERE cd.rowid = '.$rowid;
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
$result = $this->db->query($sql);
if ($result) {
$objp = $this->db->fetch_object($result);

View File

@ -75,14 +75,14 @@ if ($action == 'addcontact' && $user->rights->commande->creer) {
} elseif ($action == 'swapstatut' && $user->rights->commande->creer) {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
} elseif ($action == 'deletecontact' && $user->rights->commande->creer) {
// Efface un contact
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -806,39 +806,39 @@ if ($resql) {
if ($user->rights->societe->client->voir || $socid) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view other users
if ($user->rights->user->user->lire) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
$moreforfilter .= '</div>';
}
if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Warehouse').': ';
$moreforfilter .= $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1);
$tmptitle = $langs->trans('Warehouse');
$moreforfilter .= img_picto($tmptitle, 'warehouse', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle);
$moreforfilter .= '</div>';
}
$parameters = array();

View File

@ -211,7 +211,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_thirdparty_user = '';
$search_num_releve = '';
$search_conciliated = '';
$thirdparty = '';
$search_account = "";
if ($id > 0 || !empty($ref)) {
@ -992,9 +991,9 @@ if ($resql) {
// Bank line
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('RubriquesTransactions').' : ';
$tmptitle = $langs->trans('RubriquesTransactions');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, $search_bid, 'parent', null, null, 1);
$moreforfilter .= $form->selectarray('search_bid', $cate_arbo, $search_bid, 1, 0, 0, '', 0, 0, 0, '', '', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_bid', $cate_arbo, $search_bid, $tmptitle, 0, 0, '', 0, 0, 0, '', '', 1);
$moreforfilter .= '</div>';
}
}
@ -1561,12 +1560,12 @@ if ($resql) {
// Debit
if (!empty($arrayfields['b.debit']['checked'])) {
print '<td class="nowrap right">';
print '<td class="nowrap right"><span class="amount">';
if ($objp->amount < 0) {
print price($objp->amount * -1);
$totalarray['totaldeb'] += $objp->amount;
}
print "</td>\n";
print "</span></td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1577,12 +1576,12 @@ if ($resql) {
// Credit
if (!empty($arrayfields['b.credit']['checked'])) {
print '<td class="nowrap right">';
print '<td class="nowrap right"><span class="amount">';
if ($objp->amount > 0) {
print price($objp->amount);
$totalarray['totalcred'] += $objp->amount;
}
print "</td>\n";
print "</span></td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1717,9 +1716,9 @@ if ($resql) {
print '<td class="left tdoverflowmax50" title="'.$langs->trans("Totalforthispage").'">'.$langs->trans("Totalforthispage").'</td>';
}
} elseif ($totalarray['totaldebfield'] == $i) {
print '<td class="right">'.price(-1 * $totalarray['totaldeb']).'</td>';
print '<td class="right"><span class="amount">'.price(-1 * $totalarray['totaldeb']).'</span></td>';
} elseif ($totalarray['totalcredfield'] == $i) {
print '<td class="right">'.price($totalarray['totalcred']).'</td>';
print '<td class="right"><span class="amount">'.price($totalarray['totalcred']).'</span></td>';
} elseif ($i == $posconciliatecol) {
print '<td class="center">';
if ($user->rights->banque->consolidate && $action == 'reconcile') {

View File

@ -82,8 +82,8 @@ if ($result) {
print '<tr class="oddeven">';
print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
print '<td class="right">'.$objp->nombre.'</td>';
print '<td class="right">'.price(abs($objp->somme))."</td>";
print '<td class="right">'.price(abs(price2num($objp->somme / $objp->nombre, 'MT')))."</td>";
print '<td class="right"><span class="amount">'.price(abs($objp->somme))."</span></td>";
print '<td class="right"><span class="amount">'.price(abs(price2num($objp->somme / $objp->nombre, 'MT')))."</span></td>";
print "</tr>";
$i++;
$total += abs($objp->somme);

View File

@ -346,7 +346,7 @@ if (empty($numref)) {
$balancestart[$objp->numr] = $obj->amount;
$db->free($resql);
}
print '<td class="right">'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, $conf->currency).'</td>';
print '<td class="right"><span class="amount">'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, $conf->currency).'</span></td>';
// Calculate end amount
$sql = "SELECT sum(b.amount) as amount";
@ -359,7 +359,7 @@ if (empty($numref)) {
$content[$objp->numr] = $obj->amount;
$db->free($resql);
}
print '<td class="right">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, $conf->currency).'</td>';
print '<td class="right"><span class="amount">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, $conf->currency).'</span></td>';
print '<td class="center">';
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {

View File

@ -671,7 +671,7 @@ if ($result) {
if ($arrayfields['debit']['checked']) {
print '<td class="nowrap right">';
if ($obj->sens == 0) {
print price($obj->amount);
print '<span class="amount">'.price($obj->amount).'</span>';
$totalarray['val']['total_deb'] += $obj->amount;
}
if (!$i) {
@ -687,7 +687,7 @@ if ($result) {
if ($arrayfields['credit']['checked']) {
print '<td class="nowrap right">';
if ($obj->sens == 1) {
print price($obj->amount);
print '<span class="amount">'.price($obj->amount).'</span>';
$totalarray['val']['total_cred'] += $obj->amount;
}
if (!$i) {

View File

@ -31,14 +31,17 @@
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
@ -66,7 +69,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
@ -83,11 +86,13 @@ $hookmanager->initHooks(array('cashcontrol')); // Note that conf->hooks_modules
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
//$extrafields->fetch_name_optionals_label($object->table_element_line);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) {
reset($object->fields); // Reset is required to avoid key() to return null.
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
}
if (!$sortorder) {
@ -95,12 +100,16 @@ if (!$sortorder) {
}
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
}
}
// List of fields to search into when doing a "search in all"
@ -161,6 +170,10 @@ if (empty($reshook)) {
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
foreach ($object->fields as $key => $val) {
$search[$key] = '';
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key.'_dtstart'] = '';
$search[$key.'_dtend'] = '';
}
}
$toselect = '';
$search_array_options = array();
@ -198,9 +211,7 @@ $title = $langs->trans('CashControl');
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
foreach ($object->fields as $key => $val) {
$sql .= 't.'.$key.', ';
}
$sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@ -210,24 +221,48 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/, $/', '', $sql);
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
if ($object->ismultientitymanaged == 1) {
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
} else {
$sql .= " WHERE 1 = 1";
}
foreach ($search as $key => $val) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) {
if ($search[$key] == '-1' || $search[$key] === '0') {
$search[$key] = '';
}
$mode_search = 2;
}
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
}
}
}
}
}
if ($search_all) {
@ -241,20 +276,20 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
$sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY "
foreach($object->fields as $key => $val)
{
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/','', $sql);
*/
$sql.= " GROUP BY ";
foreach($object->fields as $key => $val) {
$sql.='t.'.$key.', ';
}
// Add fields from extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql);
*/
$sql .= $db->order($sortfield, $sortorder);
@ -269,10 +304,12 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
}
}
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
$sql .= $db->plimit($limit + 1, $offset);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
@ -284,10 +321,10 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
}
// Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".dol_buildpath('/compta/cashcontrol/cashcontrol_card.php', 1).'?id='.$id);
header("Location: ".DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$id);
exit;
}
@ -295,7 +332,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url);
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
@ -322,13 +359,23 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
foreach ($search as $key => $val) {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
} else {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
@ -341,7 +388,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
@ -365,11 +412,11 @@ $objecttmp = new CashControl($db);
$trackid = 'cashfence'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) {
if ($search_all) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
}
$moreforfilter = '';
@ -396,7 +443,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Fields title search
@ -417,8 +464,17 @@ foreach ($object->fields as $key => $val) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} else {
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
}
print '</td>';
}
@ -442,7 +498,7 @@ print '</tr>'."\n";
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@ -462,6 +518,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
print '</tr>'."\n";
@ -481,24 +538,19 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
while ($i < min($num, $limit)) {
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
break; // Should not happen
}
// Store properties in $object
$object->id = $obj->rowid;
foreach ($object->fields as $key => $val) {
if (property_exists($obj, $key)) {
$object->$key = $obj->$key;
}
}
$object->setVarsFromFetchObj($obj);
// Show here line of result
print '<tr class="oddeven">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
@ -511,7 +563,7 @@ while ($i < min($num, $limit)) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
@ -519,10 +571,8 @@ while ($i < min($num, $limit)) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
} else {
print $object->showOutputField($val, $key, $obj->$key, '');
print $object->showOutputField($val, $key, $object->$key, '');
}
print '</td>';
if (!$i) {
@ -532,21 +582,21 @@ while ($i < min($num, $limit)) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
$totalarray['val']['t.'.$key] += $obj->$key;
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap" align="center">';
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
@ -587,6 +637,7 @@ print '</div>'."\n";
print '</form>'."\n";
/*
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
$hidegeneratedfilelistifempty = 1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
@ -601,11 +652,12 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
$urlsource .= str_replace('&amp;', '&', $param);
$filedir = $diroutputmassaction;
$genallowed = $user->rights->monmodule->read;
$delallowed = $user->rights->monmodule->create;
$genallowed = $permissiontoread;
$delallowed = $permissiontoadd;
print $formfile->showdocuments('massfilesarea_monmodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
}
*/
// End of page
llxFooter();

View File

@ -54,7 +54,31 @@ class CashControl extends CommonObject
*/
public $picto = 'cash-register';
/**
* 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key.
* 'picto' is code of a picto to show before value in forms
* 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM)
* 'position' is the sort order of field.
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
* 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
* 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
*
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
*/
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15),
@ -62,10 +86,10 @@ class CashControl extends CommonObject
'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>19),
'posnumber' =>array('type'=>'varchar(30)', 'label'=>'Terminal', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>20, 'css'=>'center'),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24),
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25),
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30),
'cheque' =>array('type'=>'price', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33),
'card' =>array('type'=>'price', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36),
'opening' =>array('type'=>'price', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25, 'csslist'=>'amount'),
'cash' =>array('type'=>'price', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'csslist'=>'amount'),
'cheque' =>array('type'=>'price', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'csslist'=>'amount'),
'card' =>array('type'=>'price', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36, 'csslist'=>'amount'),
'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'),
'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'),
'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60, 'css'=>'center'),

View File

@ -204,7 +204,7 @@ if ($resql) {
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").'</td>';
print '<td></td><td></td><td></td><td class="right">'.price($cashcontrol->opening).'</td>';
print '<td></td><td></td><td></td><td class="right"><span class="amount">'.price($cashcontrol->opening).'</span></td>';
print '</tr>';
$first = "no";
}*/

View File

@ -206,7 +206,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
// Type
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->label.'</a></td>';
// Expected to pay
print '<td class="right">'.price($obj->total).'</td>';
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;
@ -323,7 +323,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$tva_static->ref = $obj->label;
print "<td>".$tva_static->getNomUrl(1)."</td>\n";
print '<td class="right">'.price($obj->amount_tva)."</td>";
print '<td class="right"><span class="amount">'.price($obj->amount_tva)."</span></td>";
// Ref payment
$ptva_static->id = $obj->rowid;
@ -359,7 +359,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
}
// Paid
print '<td class="right">'.price($obj->amount)."</td>";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>";
print "</tr>\n";
$i++;
@ -442,7 +442,7 @@ while ($j < $numlt) {
print "<td>".$obj->label."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>";
// Ref payment
$ptva_static->id = $obj->rowid;
@ -450,7 +450,7 @@ while ($j < $numlt) {
print '<td class="left">'.$ptva_static->getNomUrl(1)."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->dp), 'day')."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>";
print "</tr>\n";
$i++;

View File

@ -268,7 +268,7 @@ print '<br><br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="border centpercent">';
print '<tr height="24">';
print '<tr>';
print '<td class="center">'.$langs->trans("Year").'</td>';
print '<td class="center">'.$langs->trans("Number").'</td>';
print '<td class="center">'.$langs->trans("AmountTotal").'</td>';
@ -280,14 +280,16 @@ foreach ($data as $val) {
$year = $val['year'];
while ($year && $oldyear > $year + 1) { // If we have empty year
$oldyear--;
print '<tr height="24">';
print '<tr>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.'">'.$oldyear.'</a></td>';
print '<td class="right">0</td>';
print '<td class="right">0</td>';
print '<td class="right">0</td>';
print '</tr>';
}
print '<tr height="24">';
// Total
print '<tr>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a></td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';

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);
}
}
}
@ -2773,7 +2773,7 @@ if (empty($reshook)) {
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
@ -4733,8 +4733,8 @@ if ($action == 'create') {
if (!empty($conf->banque->enabled)) {
print '<td class="right"></td>';
}
print '<td class="right">'.price($prev_invoice->total_ht).'</td>';
print '<td class="right">'.price($prev_invoice->total_ttc).'</td>';
print '<td class="right"><span class="amount">'.price($prev_invoice->total_ht).'</span></td>';
print '<td class="right"><span class="amount">'.price($prev_invoice->total_ttc).'</span></td>';
print '<td class="right">'.$prev_invoice->getLibStatut(3, $tmptotalpaidforthisinvoice).'</td>';
print '</tr>';
}
@ -4753,8 +4753,8 @@ if ($action == 'create') {
if (!empty($conf->banque->enabled)) {
print '<td class="right"></td>';
}
print '<td class="right">'.price($object->total_ht).'</td>';
print '<td class="right">'.price($object->total_ttc).'</td>';
print '<td class="right"><span class="amount">'.price($object->total_ht).'</span></td>';
print '<td class="right"><span class="amount">'.price($object->total_ttc).'</span></td>';
print '<td class="right">'.$object->getLibStatut(3, $object->getSommePaiement()).'</td>';
print '</tr>';
@ -4808,8 +4808,8 @@ if ($action == 'create') {
if (!empty($conf->banque->enabled)) {
print '<td class="right"></td>';
}
print '<td class="right">'.price($next_invoice->total_ht).'</td>';
print '<td class="right">'.price($next_invoice->total_ttc).'</td>';
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
print '</tr>';
}
@ -4914,7 +4914,7 @@ if ($action == 'create') {
}
print '</td>';
}
print '<td class="right">'.price($sign * $objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($sign * $objp->amount).'</span></td>';
print '<td class="center">';
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletepayment&token='.newToken().'&paiement_id='.$objp->rowid.'">';
@ -4972,7 +4972,7 @@ if ($action == 'create') {
print $invoice->getNomUrl(0);
print '</span>';
print '</td>';
print '<td class="right">'.price($obj->amount_ttc).'</td>';
print '<td class="right"><span class="amount">'.price($obj->amount_ttc).'</span></td>';
print '<td class="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=unlinkdiscount&discountid='.$obj->rowid.'">'.img_delete().'</a>';
print '</td></tr>';
@ -4994,7 +4994,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
print '</span>';
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5014,7 +5014,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
print '</span>';
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5028,7 +5028,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
print '</span>';
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5037,7 +5037,7 @@ if ($action == 'create') {
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
print $langs->trans("Billed");
print '</td><td class="right">'.price($object->total_ttc).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price($object->total_ttc).'</span></td><td>&nbsp;</td></tr>';
// Remainder to pay
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
@ -5047,7 +5047,7 @@ if ($action == 'create') {
}
print '</span>';
print '</td>';
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayeraffiche).'</td>';
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'"><span class="amount">'.price($resteapayeraffiche).'</span></td>';
print '<td class="nowrap">&nbsp;</td></tr>';
// Retained warranty : usualy use on construction industry
@ -5076,10 +5076,10 @@ if ($action == 'create') {
// Total already paid back
print '<tr><td colspan="'.$nbcols.'" class="right">';
print $langs->trans('AlreadyPaidBack');
print ' :</td><td class="right">'.price($sign * $totalpaye).'</td><td>&nbsp;</td></tr>';
print ' :</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td>&nbsp;</td></tr>';
// Billed
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($sign * $object->total_ttc).'</td><td>&nbsp;</td></tr>';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right"><span class="amount">'.price($sign * $object->total_ttc).'</span></td><td>&nbsp;</td></tr>';
// Remainder to pay back
print '<tr><td colspan="'.$nbcols.'" class="right">';

View File

@ -2019,7 +2019,7 @@ class FactureLigneRec extends CommonInvoiceLine
$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql .= ' WHERE l.rowid = '.$rowid;
$sql .= ' WHERE l.rowid = '.((int) $rowid);
$sql .= ' ORDER BY l.rang';
dol_syslog('FactureRec::fetch', LOG_DEBUG);

View File

@ -283,44 +283,42 @@ class Facture extends CommonInvoice
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>1),
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>5),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>25),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>10),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>12),
//'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
//'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>50),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datef' =>array('type'=>'date', 'label'=>'DateInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'date_valid' =>array('type'=>'date', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75),
'datef' =>array('type'=>'date', 'label'=>'DateInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
'date_valid' =>array('type'=>'date', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateDue', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'paye' =>array('type'=>'smallint(6)', 'label'=>'InvoicePaidCompletely', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>91),
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LT1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LT2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>155),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>92),
'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>93),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>95, 'isameasure'=>1),
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>100, 'isameasure'=>1),
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LT1', 'enabled'=>1, 'visible'=>-1, 'position'=>110, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LT2', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>1, 'position'=>130, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>166),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>167),
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>168),
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateDue', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
@ -335,8 +333,8 @@ class Facture extends CommonInvoice
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>275),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1),
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290, 'isameasure'=>1),
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295, 'isameasure'=>1),
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300, 'isameasure'=>1),
@ -344,8 +342,10 @@ class Facture extends CommonInvoice
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315),
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>320),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
);
// END MODULEBUILDER PROPERTIES
@ -2289,7 +2289,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
@ -4982,7 +4982,7 @@ class FactureLigne extends CommonInvoiceLine
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
$sql .= ' WHERE fd.rowid = '.$rowid;
$sql .= ' WHERE fd.rowid = '.((int) $rowid);
$result = $this->db->query($sql);
if ($result) {

View File

@ -82,7 +82,7 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
}
} elseif ($action == 'swapstatut' && $user->rights->facture->creer) {
// Toggle the status of a contact
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact' && $user->rights->facture->creer) {
// Deletes a contact
$result = $object->delete_contact($lineid);

View File

@ -285,7 +285,7 @@ function getDraftTable($maxCount = 500, $socid = 0)
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap">'.$objectstatic->getNomUrl(1).'</td>';
$result .= '<td>'.$companystatic->getNomUrl(1, 'customer', 24).'</td>';
$result .= '<td class="right">'.price($obj->total_ht).'</td>';
$result .= '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
$result .= '</tr>';
$i++;
@ -299,7 +299,7 @@ function getDraftTable($maxCount = 500, $socid = 0)
} elseif ($total > 0) {
$result .= '<tr class="liste_total">';
$result .= '<td colspan="2" class="right">'.$langs->trans("Total").'</td>';
$result .= '<td class="right">'.price($total).'</td>';
$result .= '<td class="right"><span class="amount">'.price($total).'</span></td>';
$result .= '</tr>';
}
@ -508,7 +508,7 @@ function getOpenTable($maxCount = 500, $socid = 0)
$result .= '<td class="left">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
$result .= '<td class="right">'.dol_print_date($db->jdate($obj->df), 'day').'</td>';
$result .= '<td class="right">'.price($obj->total_ttc).'</td>';
$result .= '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
$result .= '</tr>';

View File

@ -125,22 +125,22 @@ $permissiondellink = $user->rights->facture->creer; // Used by the include of ac
$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php
$arrayfields = array(
'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'f.total_tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>0),
'f.fk_cond_reglement'=>array('label'=>$langs->trans("PaymentTerm"), 'checked'=>0),
'recurring'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
'f.frequency'=>array('label'=>$langs->trans("Frequency"), 'checked'=>1),
'f.unit_frequency'=>array('label'=>$langs->trans("FrequencyUnit"), 'checked'=>1),
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDoneShort"), 'checked'=>1),
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGenerationShort"), 'checked'=>1),
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecutionShort"), 'checked'=>1),
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>100),
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'f.titre'=>array('label'=>"Ref", 'checked'=>1),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
'f.total_tva'=>array('label'=>"AmountVAT", 'checked'=>1),
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>1),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
'f.fk_cond_reglement'=>array('label'=>"PaymentTerm", 'checked'=>0),
'recurring'=>array('label'=>"RecurringInvoiceTemplate", 'checked'=>1),
'f.frequency'=>array('label'=>"Frequency", 'checked'=>1),
'f.unit_frequency'=>array('label'=>"FrequencyUnit", 'checked'=>1),
'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1),
'f.date_last_gen'=>array('label'=>"DateLastGenerationShort", 'checked'=>1),
'f.date_when'=>array('label'=>"NextDateToExecutionShort", 'checked'=>1),
'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>100),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -655,7 +655,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.total_ht']['checked'])) {
print '<td class="nowrap right">'.price($objp->total_ht).'</td>'."\n";
print '<td class="nowrap right amount">'.price($objp->total).'</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -665,7 +665,7 @@ if ($resql) {
$totalarray['val']['f.total_ht'] += $objp->total_ht;
}
if (!empty($arrayfields['f.total_tva']['checked'])) {
print '<td class="nowrap right">'.price($objp->total_tva).'</td>'."\n";
print '<td class="nowrap right amount">'.price($objp->total_vat).'</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -675,7 +675,7 @@ if ($resql) {
$totalarray['val']['f.total_tva'] += $objp->total_tva;
}
if (!empty($arrayfields['f.total_ttc']['checked'])) {
print '<td class="nowrap right">'.price($objp->total_ttc).'</td>'."\n";
print '<td class="nowrap right amount">'.price($objp->total_ttc).'</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -189,33 +189,33 @@ $arrayfields = array(
'f.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5),
'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>-1, 'position'=>10),
'f.type'=>array('label'=>"Type", 'checked'=>0, 'position'=>15),
'f.date'=>array('label'=>"DateInvoice", 'checked'=>1, 'position'=>20),
'f.datef'=>array('label'=>"DateInvoice", 'checked'=>1, 'position'=>20),
'f.date_valid'=>array('label'=>"DateValidation", 'checked'=>0, 'position'=>22),
'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1, 'position'=>25),
'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>30),
'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>40),
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>40),
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>41),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>50),
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>51),
's.town'=>array('label'=>"Town", 'checked'=>1, 'position'=>55),
's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>55),
's.zip'=>array('label'=>"Zip", 'checked'=>1, 'position'=>60),
'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>65),
'country.code_iso'=>array('label'=>"Country", 'checked'=>0, 'position'=>70),
'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>75),
'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>80),
'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1, 'position'=>85),
'f.module_source'=>array('label'=>"Module", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>90),
'f.pos_source'=>array('label'=>"Terminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>91),
'f.module_source'=>array('label'=>"POSModule", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>90),
'f.pos_source'=>array('label'=>"POSTerminal", 'checked'=>($contextpage == 'poslist' ? 1 : 0), 'enabled'=>((empty($conf->cashdesk->enabled) && empty($conf->takepos->enabled) && empty($conf->global->INVOICE_SHOW_POS)) ? 0 : 1), 'position'=>91),
'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>95),
'f.total_tva'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>100),
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj == "1"), 'position'=>110),
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj == "1"), 'position'=>120),
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>135),
'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140),
'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>160),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165),
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171),
'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180),
'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>190),
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>200),
@ -235,7 +235,24 @@ $arrayfields = array(
if ($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_RETAINED_WARRANTY) {
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>86);
}
// Overwrite $arrayfields from columns into ->fields (transition before removal of $arrayoffields)
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
$visible = (int) dol_eval($val['visible'], 1);
$newkey = '';
if (array_key_exists($key, $arrayfields)) { $newkey = $key; } elseif (array_key_exists('t.'.$key, $arrayfields)) { $newkey = 't.'.$key; } elseif (array_key_exists('f.'.$key, $arrayfields)) { $newkey = 'f.'.$key; } elseif (array_key_exists('s.'.$key, $arrayfields)) { $newkey = 's.'.$key; }
if ($newkey) {
$arrayfields[$newkey] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=>$val['help']
);
}
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -434,7 +451,7 @@ $sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_pub
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql .= ' f.fk_user_author,';
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
$sql .= ' f.datef as df, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
$sql .= ' f.datef, f.date_valid, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
$sql .= ' f.datec as date_creation, f.tms as date_update, f.date_closing as date_closing,';
$sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,';
@ -942,31 +959,31 @@ if ($resql) {
if ($user->rights->societe->client->voir || $socid) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
$moreforfilter .= '</div>';
}
$parameters = array();
@ -985,6 +1002,7 @@ if ($resql) {
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
// Show the massaction checkboxes only when this page is not opend from the Extended POS
if ($massactionbutton && $contextpage != 'poslist') {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
@ -1028,7 +1046,7 @@ if ($resql) {
print '</td>';
}
// Date invoice
if (!empty($arrayfields['f.date']['checked'])) {
if (!empty($arrayfields['f.datef']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
@ -1291,7 +1309,7 @@ if ($resql) {
if (!empty($arrayfields['f.type']['checked'])) {
print_liste_field_titre($arrayfields['f.type']['label'], $_SERVER["PHP_SELF"], 'f.type', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.date']['checked'])) {
if (!empty($arrayfields['f.datef']['checked'])) {
print_liste_field_titre($arrayfields['f.date']['label'], $_SERVER['PHP_SELF'], 'f.datef', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.date_valid']['checked'])) {
@ -1456,7 +1474,7 @@ if ($resql) {
$facturestatic->paye = $obj->paye;
$facturestatic->fk_soc = $obj->fk_soc;
$facturestatic->date = $db->jdate($obj->df);
$facturestatic->date = $db->jdate($obj->datef);
$facturestatic->date_valid = $db->jdate($obj->date_valid);
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
@ -1576,9 +1594,9 @@ if ($resql) {
}
// Date
if (!empty($arrayfields['f.date']['checked'])) {
if (!empty($arrayfields['f.datef']['checked'])) {
print '<td align="center" class="nowraponall">';
print dol_print_date($db->jdate($obj->df), 'day');
print dol_print_date($db->jdate($obj->datef), 'day');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1755,7 +1773,7 @@ if ($resql) {
// Amount HT
if (!empty($arrayfields['f.total_ht']['checked'])) {
print '<td class="right nowraponall">'.price($obj->total_ht)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->total_ht)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1766,7 +1784,7 @@ if ($resql) {
}
// Amount VAT
if (!empty($arrayfields['f.total_tva']['checked'])) {
print '<td class="right nowraponall">'.price($obj->total_tva)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->total_vat)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1777,7 +1795,7 @@ if ($resql) {
}
// Amount LocalTax1
if (!empty($arrayfields['f.total_localtax1']['checked'])) {
print '<td class="right nowraponall">'.price($obj->total_localtax1)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->total_localtax1)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1788,7 +1806,7 @@ if ($resql) {
}
// Amount LocalTax2
if (!empty($arrayfields['f.total_localtax2']['checked'])) {
print '<td class="right nowraponall">'.price($obj->total_localtax2)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->total_localtax2)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1799,7 +1817,7 @@ if ($resql) {
}
// Amount TTC
if (!empty($arrayfields['f.total_ttc']['checked'])) {
print '<td class="right nowraponall">'.price($obj->total_ttc)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->total_ttc)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@ -1826,11 +1844,11 @@ if ($resql) {
}
if (!empty($arrayfields['f.retained_warranty']['checked'])) {
print '<td align="right">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : '&nbsp;').'</td>';
print '<td align="right amount">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : '&nbsp;').'</td>';
}
if (!empty($arrayfields['dynamount_payed']['checked'])) {
print '<td class="right nowraponall">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : '&nbsp;').'</td>'; // TODO Use a denormalized field
print '<td class="right nowraponall amount">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : '&nbsp;').'</td>'; // TODO Use a denormalized field
if (!$i) {
$totalarray['nbfield']++;
}
@ -1842,7 +1860,7 @@ if ($resql) {
// Pending amount
if (!empty($arrayfields['rtp']['checked'])) {
print '<td class="right nowraponall">';
print '<td class="right nowraponall amount">';
print (!empty($remaintopay) ? price($remaintopay, 0, $langs) : '&nbsp;');
print '</td>'; // TODO Use a denormalized field
if (!$i) {
@ -1874,27 +1892,27 @@ if ($resql) {
}
// Amount HT
if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
print '<td class="right nowraponall">'.price($obj->multicurrency_total_ht)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount VAT
if (!empty($arrayfields['f.multicurrency_total_vat']['checked'])) {
print '<td class="right nowraponall">'.price($obj->multicurrency_total_vat)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_vat)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount TTC
if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) {
print '<td class="right nowraponall">'.price($obj->multicurrency_total_ttc)."</td>\n";
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ttc)."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) {
print '<td class="right nowraponall">'.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : '&nbsp;').'</td>'; // TODO Use a denormalized field
print '<td class="right nowraponall amount">'.(!empty($multicurrency_totalpay) ?price($multicurrency_totalpay, 0, $langs) : '&nbsp;').'</td>'; // TODO Use a denormalized field
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -384,9 +384,9 @@ foreach ($data as $val) {
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['nb_diff']).'</td>';
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
print '<td class="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['total_diff']).'</td>';
print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($val['avg'], 'MT'), 1).'</span></td>';
print '<td class="right" style="'.(($val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['avg_diff']).'</td>';
print '</tr>';
$oldyear = $year;

View File

@ -351,7 +351,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
print '<td class="nowrap tdoverflowmax100">';
print $companystatic->getNomUrl(1, 'supplier');
print '</td>';
print '<td class="right">'.price($obj->total_ttc).'</td>';
print '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '</tr>';
$tot_ttc += $obj->total_ttc;
$i++;
@ -620,7 +620,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
print $thirdpartystatic->getNomUrl(1, 'supplier');
print '</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($obj->total_ht).'</td>';
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
}
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
@ -951,7 +951,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
print $societestatic->getNomUrl(1, 'customer');
print '</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($obj->total_ht).'</td>';
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
}
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
print '<td class="nowrap right">'.price($obj->total_ttc - $obj->tot_fttc).'</td>';
@ -974,10 +974,10 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($tot_ht).'</td>';
print '<td class="right"><span class="amount">'.price($tot_ht).'</span></td>';
}
print '<td class="nowrap right">'.price($tot_ttc).'</td>';
print '<td class="nowrap right">'.price($tot_tobill).'</td>';
print '<td class="nowrap right"><span class="amount">'.price($tot_ttc).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price($tot_tobill).'</span></td>';
print '<td>&nbsp;</td>';
print '</tr>';
print '</table></div><br>';
@ -1110,10 +1110,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
print '</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->datelimite), 'day').'</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($obj->total_ht).'</td>';
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
}
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
print '<td class="nowrap right">'.price($obj->am).'</td>';
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price($obj->am).'</span></td>';
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
print '</tr>';
@ -1139,10 +1139,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc - $totalam).')</font> </td>';
print '<td>&nbsp;</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($total_ht).'</td>';
print '<td class="right"><span class="amount">'.price($total_ht).'</span></td>';
}
print '<td class="nowrap right">'.price($total_ttc).'</td>';
print '<td class="nowrap right">'.price($totalam).'</td>';
print '<td class="nowrap right"><span class="amount">'.price($total_ttc).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price($totalam).'</span></td>';
print '<td>&nbsp;</td>';
print '</tr>';
} else {
@ -1260,10 +1260,10 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
print '<td class="nowrap tdoverflowmax100">'.$societestatic->getNomUrl(1, 'supplier').'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->date_lim_reglement), 'day').'</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($obj->total_ht).'</td>';
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
}
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
print '<td class="nowrap right">'.price($obj->am).'</td>';
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price($obj->am).'</span></td>';
print '<td>'.$facstatic->getLibStatut(3, $obj->am).'</td>';
print '</tr>';
$total_ht += $obj->total_ht;

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

@ -91,7 +91,7 @@ if ($result) {
$i++;
}
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
print '<td class="right">'.price($total).'</td></tr>';
print '<td class="right"><span class="amount">'.price($total).'</span></td></tr>';
print "</table>";
$db->free($result);

View File

@ -492,8 +492,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($subtot_coll_total_ht, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_coll_vat, 'MT')).'</span></td>';
print '</tr>';
}
@ -505,8 +505,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
print '</tr>';
}
@ -643,8 +643,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($subtot_paye_total_ht, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_paye_vat, 'MT')).'</span></td>';
print '</tr>';
}
@ -656,8 +656,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
print '</tr>';
}

View File

@ -713,17 +713,17 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
// Price
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
print '<td class="right"><span class="amount">'.price($sign * $objp->total_ttc).'</span></td>';
// Received + already paid
print '<td class="right">'.price($sign * $paiement);
print '<td class="right"><span class="amount">'.price($sign * $paiement);
if ($creditnotes) {
print '<span class="opacitymedium">+'.price($creditnotes).'</span>';
}
if ($deposits) {
print '<span class="opacitymedium">+'.price($deposits).'</span>';
}
print '</td>';
print '</span></td>';
// Remain to take or to pay back
print '<td class="right">'.price($sign * $remaintopay).'</td>';
@ -901,7 +901,7 @@ if (!GETPOST('action', 'aZ09')) {
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
print '<td>'.$objp->paiement_type.' '.$objp->num_payment."</td>\n";
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td>&nbsp;</td>';
print '</tr>';

View File

@ -365,13 +365,13 @@ if ($resql) {
print '</td>';
}
// Expected to pay
print '<td class="right">'.price($objp->total_ttc).'</td>';
print '<td class="right"><span class="amount">'.price($objp->total_ttc).'</span></td>';
// Amount payed
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
// Remain to pay
print '<td class="right">'.price($remaintopay).'</td>';
print '<td class="right"><span class="amount">'.price($remaintopay).'</span></td>';
// Status
print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';

View File

@ -462,7 +462,7 @@ if ($action == 'new') {
print '<td>'.$value["numero"]."</td>\n";
print '<td>'.$value["emetteur"]."</td>\n";
print '<td>'.$value["banque"]."</td>\n";
print '<td class="right">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</td>';
print '<td class="right"><span class="amount">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</span></td>';
// Link to payment
print '<td class="center">';
@ -639,7 +639,7 @@ if ($action == 'new') {
print '<td class="center">'.($objp->num_chq ? $objp->num_chq : '&nbsp;').'</td>';
print '<td>'.dol_trunc($objp->emetteur, 24).'</td>';
print '<td>'.dol_trunc($objp->banque, 24).'</td>';
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
// Link to payment
print '<td class="center">';
$paymentstatic->id = $objp->pid;

View File

@ -131,7 +131,7 @@ if ($resql) {
print '<td>'.dol_print_date($db->jdate($objp->db), 'day').'</td>';
print '<td class="nowraponall">'.$accountstatic->getNomUrl(1).'</td>';
print '<td class="right">'.$objp->nbcheque.'</td>';
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td class="right">'.$checkdepositstatic->LibStatut($objp->statut, 3).'</td>';
print '</tr>';

View File

@ -228,7 +228,7 @@ if ($resql) {
print '<td class="right">'.$objp->nbcheque.'</td>';
// Amount
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
// Statut
print '<td class="right">';

View File

@ -547,7 +547,7 @@ while ($i < min($num, $limit)) {
// Amount
if (!empty($arrayfields['p.amount']['checked'])) {
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -120,7 +120,7 @@ if ($resql) {
print '<td><a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.'</a></td>';
print '<td width="80" align="center">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
print "<td>$objp->paiement_type $objp->num_payment</td>\n";
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td class="center">';
if ($objp->statut == 0) {

View File

@ -266,11 +266,11 @@ if ($action == 'create') {
print "<td align=\"center\"><b>!!!</b></td>\n";
}
print '<td class="right">'.price($objp->amount)."</td>";
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>";
print '<td class="right">'.price($sumpaid)."</td>";
print '<td class="right"><span class="amount">'.price($sumpaid)."</span></td>";
print '<td class="right">'.price($objp->amount - $sumpaid)."</td>";
print '<td class="right"><span class="amount">'.price($objp->amount - $sumpaid)."</span></td>";
print '<td class="center">';
if ($sumpaid < $objp->amount) {

View File

@ -262,11 +262,11 @@ if ($action == 'create') {
print "<td align=\"center\"><b>!!!</b></td>\n";
}
print '<td class="right">'.price($objp->amount)."</td>";
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>";
print '<td class="right">'.price($sumpaid)."</td>";
print '<td class="right"><span class="amount">'.price($sumpaid)."</span></td>";
print '<td class="right">'.price($objp->amount - $sumpaid)."</td>";
print '<td class="right"><span class="amount">'.price($objp->amount - $sumpaid)."</span></td>";
print '<td class="center">';

View File

@ -207,11 +207,11 @@ if ($resql) {
// Label
print '<td>'.$objp->label.'</td>';
// Expected to pay
print '<td class="right">'.price($objp->sc_amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->sc_amount).'</span></td>';
// Status
print '<td class="center">'.$socialcontrib->getLibStatut(4, $objp->amount).'</td>';
// Amount paid
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print "</tr>\n";
if ($objp->paye == 1) { // If at least one invoice is paid, disable delete
$disable_delete = 1;

View File

@ -263,11 +263,11 @@ if ($resql) {
// Label
print '<td>'.$objp->label.'</td>';
// Expected to pay
print '<td class="right">'.price($objp->tva_amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->tva_amount).'</span></td>';
// Status
print '<td class="center">'.$tva->getLibStatut(4, $objp->amount).'</td>';
// Amount payed
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print "</tr>\n";
if ($objp->paye == 1) { // If at least one invoice is paid, disable delete
$disable_delete = 1;

View File

@ -84,9 +84,9 @@ print '</a>';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("AmountToWithdraw").'</td>';
print '<td class="right">';
print '<td class="right"><span class="amount">';
print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto');
print '</td></tr></table></div><br>';
print '</span></td></tr></table></div><br>';
@ -216,8 +216,8 @@ if ($result) {
print $bprev->getNomUrl(1);
print "</td>\n";
print '<td>'.dol_print_date($db->jdate($obj->datec), "dayhour")."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right">'.$bprev->getLibStatut(3)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td class="right"><span class="amount">'.$bprev->getLibStatut(3)."</span></td>\n";
print "</tr>\n";
$i++;

View File

@ -423,7 +423,7 @@ if ($id > 0 || $ref) {
print $thirdparty->getNomUrl(1);
print "</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td class="right">';

View File

@ -503,7 +503,7 @@ if ($result)
print '<td class="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
print '<td class="right">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</span></td>\n";
print "</tr>\n";
$i++;

View File

@ -281,10 +281,10 @@ if ($resql) {
print "</td>\n";
// Amount of invoice
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
// Amount requested
print '<td class="right">'.price($obj->amount_requested)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount_requested)."</span></td>\n";
// Status of requests
print '<td class="center">';

View File

@ -222,7 +222,7 @@ if ($resql) {
print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print '<td class="center">'.yn($obj->afacturer).'</td>';
@ -240,7 +240,7 @@ if ($resql) {
if ($num > 0) {
print '<tr class="liste_total"><td>&nbsp;</td>';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="right">'.price($total)."</td>\n";
print '<td class="right"><span class="amount">'.price($total)."</span></td>\n";
print '<td colspan="3">&nbsp;</td>';
print "</tr>\n";
}

View File

@ -84,9 +84,9 @@ print '</a>';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("AmountToWithdraw").'</td>';
print '<td class="right">';
print '<td class="right"><span class="amount">';
print price($bprev->SommeAPrelever('direct-debit'), '', '', 1, -1, -1, 'auto');
print '</td></tr></table></div><br>';
print '</span></td></tr></table></div><br>';
@ -218,7 +218,7 @@ if ($result) {
print $bprev->getNomUrl(1);
print "</td>\n";
print '<td>'.dol_print_date($db->jdate($obj->datec), "dayhour")."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td class="right">'.$bprev->getLibStatut(3)."</td>\n";
print "</tr>\n";

View File

@ -301,7 +301,7 @@ if ($id) {
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">';
print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name."</a></td>\n";
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
print '<td class="right">';
$invoicestatic->fetch($obj->facid);

View File

@ -266,7 +266,7 @@ if ($result) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td>&nbsp;</td>';

View File

@ -205,7 +205,7 @@ if ($result) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print '<td class="right">';
print $bon->LibStatut($obj->statut, 3);

View File

@ -286,7 +286,7 @@ if ($id > 0) {
$totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
// Balance
print '<td class="right">'.price($data['balance'])."</td>\n";
print '<td class="right"><span class="amount">'.price($data['balance'])."</span></td>\n";
// Author
print '<td class="nowrap right">';

View File

@ -311,7 +311,7 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven">';
print '<td>&nbsp;</td>';
print '<td>'.$objp->pcg_type.($objp->name ? ' ('.$objp->name.')' : '')."</td>\n";
print '<td class="right">'.price($objp->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>\n";
$total_ht += (isset($objp->amount) ? $objp->amount : 0);
@ -350,7 +350,7 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr>';
print '<td></td>';
print '<td class="tdoverflowmax200"> &nbsp; &nbsp; '.length_accountg($cpt['account_number']).' - '.$cpt['account_label'].'</td>';
print '<td class="right">'.price($resultN).'</td>';
print '<td class="right"><span class="amount">'.price($resultN).'</span></td>';
print "</tr>\n";
}
}
@ -420,9 +420,9 @@ if ($modecompta == 'BOOKKEEPING') {
print "<td>".$langs->trans("Bills").' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$objp->socid.'">'.$objp->name."</td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price($objp->amount_ht)."</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount_ht)."</span></td>\n";
}
print '<td class="right">'.price($objp->amount_ttc)."</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount_ttc)."</span></td>\n";
$total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0);
$total_ttc += $objp->amount_ttc;
@ -465,9 +465,9 @@ if ($modecompta == 'BOOKKEEPING') {
print "<td>".$langs->trans("Bills")." ".$langs->trans("Other")." (".$langs->trans("PaymentsNotLinkedToInvoice").")\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price($objp->amount_ht)."</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount_ht)."</span></td>\n";
}
print '<td class="right">'.price($objp->amount_ttc)."</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount_ttc)."</span></td>\n";
$total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0);
$total_ttc += $objp->amount_ttc;
@ -557,9 +557,9 @@ if ($modecompta == 'BOOKKEEPING') {
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/don/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price($obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
}
print '<td class="right">'.price($obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
print '</tr>';
$i++;
}
@ -638,9 +638,9 @@ if ($modecompta == 'BOOKKEEPING') {
print "<td>".$langs->trans("Bills")." <a href=\"".DOL_URL_ROOT."/fourn/facture/list.php?socid=".$objp->socid."\">".$objp->name."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price(-$objp->amount_ht)."</td>\n";
print '<td class="right"><span class="amount">'.price(-$objp->amount_ht)."</span></td>\n";
}
print '<td class="right">'.price(-$objp->amount_ttc)."</td>\n";
print '<td class="right"><span class="amount">'.price(-$objp->amount_ttc)."</span></td>\n";
$total_ht -= (isset($objp->amount_ht) ? $objp->amount_ht : 0);
$total_ttc -= $objp->amount_ttc;
@ -733,9 +733,9 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print '<td>'.$obj->label.'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
}
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
print '</tr>';
$i++;
}
@ -820,9 +820,9 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print '<td>'.$obj->label.'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
}
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
print '</tr>';
$i++;
}
@ -903,9 +903,9 @@ if ($modecompta == 'BOOKKEEPING') {
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
}
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
print '</tr>';
$i++;
}
@ -989,9 +989,9 @@ if ($modecompta == 'BOOKKEEPING') {
print "<td>".$langs->trans("ExpenseReport")." <a href=\"".DOL_URL_ROOT."/expensereport/list.php?search_user=".$obj->userid."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price(-$obj->amount_ht).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount_ht).'</span></td>';
}
print '<td class="right">'.price(-$obj->amount_ttc).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount_ttc).'</span></td>';
print '</tr>';
}
} else {
@ -1050,9 +1050,9 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Debit")."</td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
}
print '<td class="right">'.price(-$obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price(-$obj->amount)."</span></td>\n";
print "</tr>\n";
// Credit (payment received from customer for example)
@ -1067,9 +1067,9 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Credit")."</td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price($obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
}
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
print "</tr>\n";
// Total
@ -1117,9 +1117,9 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$loan_static->getNomUrl(1).' - '.$obj->label."</td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right">'.price(-$obj->amount).'</td>';
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
}
print '<td class="right">'.price(-$obj->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price(-$obj->amount)."</span></td>\n";
print "</tr>\n";
$subtotal_ht -= $obj->amount;
$subtotal_ttc -= $obj->amount;
@ -1205,7 +1205,7 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATToPay")."</td>\n";
print '<td class="right">&nbsp;</td>'."\n";
print '<td class="right">'.price($amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
print "</tr>\n";
// VAT to retreive
@ -1263,7 +1263,7 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print '<td>'.$langs->trans("VATToCollect")."</td>\n";
print '<td class="right">&nbsp;</td>'."\n";
print '<td class="right">'.price($amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
print "</tr>\n";
} else {
// VAT really already paid
@ -1319,7 +1319,7 @@ if ($modecompta == 'BOOKKEEPING') {
if ($modecompta == 'CREANCES-DETTES') {
print '<td <class="right"></td>'."\n";
}
print '<td class="right">'.price($amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
print "</tr>\n";
// VAT really received
@ -1375,7 +1375,7 @@ if ($modecompta == 'BOOKKEEPING') {
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right"></td>'."\n";
}
print '<td class="right">'.price($amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
print "</tr>\n";
}
}

View File

@ -500,18 +500,18 @@ if ($modecompta == 'CREANCES-DETTES') {
}
print '</td>';
print '<td class="right">'.price($totCat['NP']).'</td>';
print '<td class="right">'.price($totCat['N']).'</td>';
print '<td class="right"><span class="amount">'.price($totCat['NP']).'</span></td>';
print '<td class="right"><span class="amount">'.price($totCat['N']).'</span></td>';
// Each month
foreach ($totCat['M'] as $k => $v) {
if (($k + 1) >= $date_startmonth) {
print '<td class="right">'.price($v).'</td>';
print '<td class="right"><span class="amount">'.price($v).'</span></td>';
}
}
foreach ($totCat['M'] as $k => $v) {
if (($k + 1) < $date_startmonth) {
print '<td class="right">'.price($v).'</td>';
print '<td class="right"><span class="amount">'.price($v).'</span></td>';
}
}
@ -531,20 +531,20 @@ if ($modecompta == 'CREANCES-DETTES') {
print ' - ';
print $cpt['account_label'];
print '</td>';
print '<td class="right">'.price($resultNP).'</td>';
print '<td class="right">'.price($resultN).'</td>';
print '<td class="right"><span class="amount">'.price($resultNP).'</span></td>';
print '<td class="right"><span class="amount">'.price($resultN).'</span></td>';
// Make one call for each month
foreach ($months as $k => $v) {
if (($k + 1) >= $date_startmonth) {
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
print '<td class="right">'.price($resultM).'</td>';
print '<td class="right"><span class="amount">'.price($resultM).'</span>/td>';
}
}
foreach ($months as $k => $v) {
if (($k + 1) < $date_startmonth) {
$resultM = $totPerAccount[$cpt['account_number']]['M'][$k];
print '<td class="right">'.price($resultM).'</td>';
print '<td class="right"><span class="amount">'.price($resultM).'</span></td>';
}
}
print "</tr>\n";

View File

@ -677,7 +677,7 @@ if ($id > 0) {
}
print '</td>';
}
print '<td class="right">'.price($objp->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$i++;

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">'.price($obj->total).'</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

@ -675,7 +675,7 @@ if ($id) {
}
print '</td>';
}
print '<td class="right">'.price($objp->amount)."</td>\n";
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$i++;

View File

@ -558,8 +558,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($subtot_coll_total_ht, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_coll_vat, 'MT')).'</span></td>';
print '</tr>';
}
}
@ -748,8 +748,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($subtot_paye_total_ht, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_paye_vat, 'MT')).'</span></td>';
print '</tr>';
}
}

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,13 +191,43 @@ 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">'.price($obj->total).'</td>';
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
// Paid
print '<td class="right">';
if ($obj->totalpaye) {
@ -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

@ -595,8 +595,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($subtot_coll_total_ht, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_coll_vat, 'MT')).'</span></td>';
print '</tr>';
}
@ -831,8 +831,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num($subtot_paye_total_ht, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_paye_vat, 'MT')).'</span></td>';
print '</tr>';
}
@ -844,8 +844,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>';
}
print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
print '<td class="right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
print '<td class="nowrap right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
print '</tr>';
}

View File

@ -54,6 +54,8 @@ $langs->loadLangs(array("contracts", "orders", "companies", "bills", "products",
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$socid = GETPOST('socid', 'int');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@ -113,7 +115,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) {
$result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
$result = $object->active_line($user, GETPOST('ligne', 'int'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@ -127,7 +129,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
}
if (!$error) {
$result = $object->close_line($user, GETPOST('ligne'), GETPOST('dateend'), urldecode(GETPOST('comment')));
$result = $object->close_line($user, GETPOST('ligne', 'int'), GETPOST('dateend'), urldecode(GETPOST('comment')));
if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
@ -931,10 +933,10 @@ if (empty($reshook)) {
}
} elseif ($action == 'swapstatut') {
// bascule du statut d'un contact
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} elseif ($action == 'deletecontact') {
// Efface un contact
$result = $object->delete_contact(GETPOST('lineid'));
$result = $object->delete_contact(GETPOST('lineid', 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
@ -1747,25 +1749,25 @@ if ($action == 'create') {
'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid', 'int'), $langs->trans("MoveToAnotherContract"), $langs->trans("ConfirmMoveToAnotherContract"), "confirm_move", $formquestion);
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}
/*
* Confirmation de la validation activation
*/
if ($action == 'active' && !$_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
if ($action == 'active' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment', 'alpha');
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
}
/*
* Confirmation de la validation fermeture
*/
if ($action == 'closeline' && !$_REQUEST["cancel"] && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
if ($action == 'closeline' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment', 'alpha');
@ -1843,8 +1845,8 @@ if ($action == 'create') {
}
// Form to activate line
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.GETPOST('ligne').'&amp;action=active" method="post">';
if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
print '<form name="active" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;ligne='.GETPOST('ligne', 'int').'&amp;action=active" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
@ -1893,7 +1895,7 @@ if ($action == 'create') {
print '</form>';
}
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne')) {
if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) {
/**
* Disable a contract line
*/

View File

@ -85,7 +85,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) {
// bascule du statut d'un contact
if ($action == 'swapstatut' && $user->rights->contrat->creer) {
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db, $object->error);
}
@ -94,7 +94,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) {
// Delete contact
if ($action == 'deletecontact' && $user->rights->contrat->creer) {
$object->fetch($id);
$result = $object->delete_contact($_GET["lineid"]);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);

View File

@ -488,24 +488,24 @@ $moreforfilter = '';
if ($user->rights->societe->client->voir || $socid) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
$moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
$tmpttile = $langs->trans('ThirdPartiesOfSaleRepresentative');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmpttile, 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view other users
if ($user->rights->user->user->lire) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$tmpttile = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmpttile, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '</div>';
}
// If the user can view categories of products
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
$tmpttile = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmpttile, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}

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

@ -1338,7 +1338,7 @@ abstract class CommonObject
$sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,";
$sql .= " tc.code, tc.libelle";
$sql .= " FROM (".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc)";
$sql .= " WHERE ec.rowid =".$rowid;
$sql .= " WHERE ec.rowid =".((int) $rowid);
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element = '".$this->db->escape($this->element)."'";
@ -3067,7 +3067,7 @@ abstract class CommonObject
$sql .= ' AND rang = '.($rang - 1);
if ($this->db->query($sql)) {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.($rang - 1);
$sql .= ' WHERE rowid = '.$rowid;
$sql .= ' WHERE rowid = '.((int) $rowid);
if (!$this->db->query($sql)) {
dol_print_error($this->db);
}
@ -3098,7 +3098,7 @@ abstract class CommonObject
$sql .= ' AND rang = '.($rang + 1);
if ($this->db->query($sql)) {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.($rang + 1);
$sql .= ' WHERE rowid = '.$rowid;
$sql .= ' WHERE rowid = '.((int) $rowid);
if (!$this->db->query($sql)) {
dol_print_error($this->db);
}

View File

@ -1931,9 +1931,9 @@ class Form
}
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
$sql .= " ORDER BY u.firstname ASC";
$sql .= " ORDER BY u.statut DESC, u.firstname ASC, u.lastname ASC";
} else {
$sql .= " ORDER BY u.lastname ASC";
$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
}
dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
@ -7341,7 +7341,7 @@ class Form
/**
* Show a multiselect dropbox from an array.
* Show a multiselect dropbox from an array. If a saved selection of fields exists for user (into $user->conf->MAIN_SELECTEDFIELDS_contextofpage), we use this one instead of default.
*
* @param string $htmlname Name of HTML field
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
@ -7357,8 +7357,9 @@ class Form
return '';
}
$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved seleteced properties
if (!empty($user->conf->$tmpvar)) {
$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
if (!empty($user->conf->$tmpvar)) { // A list of fields was already customized for user
$tmparray = explode(',', $user->conf->$tmpvar);
foreach ($array as $key => $val) {
//var_dump($key);
@ -7369,6 +7370,12 @@ class Form
$array[$key]['checked'] = 0;
}
}
} else { // There is no list of fields already customized for user
foreach ($array as $key => $val) {
if ($array[$key]['checked'] < 0) {
$array[$key]['checked'] = 0;
}
}
}
$lis = '';
@ -7387,7 +7394,8 @@ class Form
$langs->load($val['langfile']);
}
$lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
// Note: $val['checked'] <> 0 means we must show the field into the combo list
$lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) && $val['checked'] != '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
}
}

View File

@ -49,11 +49,13 @@ class FormCategory extends Form
$categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1);
$categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -";
$tmptitle = $langs->trans("Category");
$filter = '';
$filter .= '<div class="divsearchfield">';
$filter .= img_picto($langs->trans("Categories"), 'category', 'class="pictofixedwidth"');
$filter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
//$filter .= $langs->trans('Categories').": ";
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300");
$filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300", 0, 0, '', '', $tmptitle);
$filter .= "</div>";
return $filter;

View File

@ -481,7 +481,12 @@ class FormOther
$sql_usr .= $hookmanager->resArray[1];
}
}
$sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
$sql_usr .= " ORDER BY statut DESC, firstname ASC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
} else {
$sql_usr .= " ORDER BY statut DESC, lastname ASC, firstname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
}
//print $sql_usr;exit;
$resql_usr = $this->db->query($sql_usr);

View File

@ -2243,6 +2243,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$modulepart = 'user';
}
//print 'dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity;
dol_syslog('dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity);
// We define $accessallowed and $sqlprotectagainstexternals
@ -2727,7 +2728,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
} elseif ($modulepart == 'export' && !empty($conf->export->dir_temp)) {
// Wrapping for export module
// Note that a test may not be required because we force the dir of download on the directory of the user that export
$accessallowed = $user->rights->export->run;
$accessallowed = $user->rights->export->lire;
$original_file = $conf->export->dir_temp.'/'.$fuser->id.'/'.$original_file;
} elseif ($modulepart == 'import' && !empty($conf->import->dir_temp)) {
// Wrapping for import module

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
@ -634,8 +634,8 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
$out = checkVal($out, $check, $filter, $options);
}
// Sanitizing for special parameters. There is no reason to allow the backtopage parameter to contains an external URL.
if ($paramname == 'backtopage' || $paramname == 'backtolist') {
// Sanitizing for special parameters. There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL.
if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') {
$out = str_replace('\\', '/', $out);
$out = str_replace(array(':', ';', '@'), '', $out);
@ -746,12 +746,14 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
case 'alpha': // No html and no ../ and "
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
if (!is_array($out)) {
$out = dol_string_nohtmltag($out, 0);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = trim($out);
do {
$oldstringtoclean = $out;
// Remove html tags
$out = dol_string_nohtmltag($out, 0);
// Remove also other dangerous string sequences
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
// Note &#38, '&#0000038', '&#x26'... is a simple char like '&' alone but there is no reason to accept such way to encode input data.
$out = str_ireplace(array('&#38', '&#0000038', '&#x26', '&quot', '&#34', '&#0000034', '&#x22', '"', '&#47', '&#0000047', '&#x2F', '../'), '', $out);
} while ($oldstringtoclean != $out);
@ -760,25 +762,28 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
break;
case 'alphawithlgt': // No " and no ../ but we keep balanced < > tags with no special chars inside. Can be used for email string like "Name <email>"
if (!is_array($out)) {
$out = dol_html_entity_decode($out, ENT_COMPAT | ENT_HTML5, 'UTF-8');
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = trim($out);
do {
$oldstringtoclean = $out;
// Remove html tags
$out = dol_html_entity_decode($out, ENT_COMPAT | ENT_HTML5, 'UTF-8');
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
// Note &#38, '&#0000038', '&#x26'... is a simple char like '&' alone but there is no reason to accept such way to encode input data.
$out = str_ireplace(array('&#38', '&#0000038', '&#x26', '&quot', '&#34', '&#0000034', '&#x22', '"', '&#47', '&#0000047', '&#x2F', '../'), '', $out);
} while ($oldstringtoclean != $out);
}
break;
case 'restricthtml': // Recommended for most html textarea
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
// We should also exclude non expected attributes
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
$out = dol_string_onlythesehtmlattributes($out);
}
do {
$oldstringtoclean = $out;
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
// We should also exclude non expected attributes
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
$out = dol_string_onlythesehtmlattributes($out);
}
} while ($oldstringtoclean != $out);
break;
case 'custom':
if (empty($filter)) {

View File

@ -90,20 +90,27 @@ function loan_prepare_head($object)
/**
* Calculate remaining loan mensuality and interests
*
* @param int $mens Value of this mensuality (interests include, set 0 if we don't paid interests for this mensuality)
* @param float $capital Remaining capital for this mensuality
* @param float $rate Loan rate
* @param int $echance Actual loan term
* @param int $nbterm Total number of term for this loan
* @return array Array with remaining capital, interest, and mensuality for each remaining terms
* @param float $mens Value of this mensuality (interests include, set 0 if we don't paid interests for this mensuality)
* @param float $capital Remaining capital for this mensuality
* @param float $rate Loan rate
* @param int $numactualloadterm Actual loan term
* @param int $nbterm Total number of term for this loan
* @return array Array with remaining capital, interest, and mensuality for each remaining terms
*/
function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
function loanCalcMonthlyPayment($mens, $capital, $rate, $numactualloadterm, $nbterm)
{
global $conf, $db;
require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php';
$object = new LoanSchedule($db);
$output = array();
// Sanitize data in case of
$mens = price2num($mens);
$capital = price2num($capital);
$rate = price2num($rate);
$numactualloadterm = ((int) $numactualloadterm);
$nbterm = ((int) $nbterm);
// If mensuality is 0 we don't pay interests and remaining capital not modified
if ($mens == 0) {
$int = 0;
@ -113,18 +120,18 @@ function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
$int = round($int, 2, PHP_ROUND_HALF_UP);
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
}
$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
$output[$numactualloadterm] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens);
$echance++;
$numactualloadterm++;
$capital = $cap_rest;
while ($echance <= $nbterm) {
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $echance + 1), 2, PHP_ROUND_HALF_UP);
while ($numactualloadterm <= $nbterm) {
$mens = round($object->calcMonthlyPayments($capital, $rate, $nbterm - $numactualloadterm + 1), 2, PHP_ROUND_HALF_UP);
$int = ($capital * ($rate / 12));
$int = round($int, 2, PHP_ROUND_HALF_UP);
$cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP);
$output[$echance] = array(
$output[$numactualloadterm] = array(
'cap_rest' => $cap_rest,
'cap_rest_str' => price($cap_rest, 0, '', 1, -1, -1, $conf->currency),
'interet' => $int,
@ -133,7 +140,7 @@ function loanCalcMonthlyPayment($mens, $capital, $rate, $echance, $nbterm)
);
$capital = $cap_rest;
$echance++;
$numactualloadterm++;
}
return $output;

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

@ -78,14 +78,14 @@ class modExport extends DolibarrModules
$r++;
$this->rights[$r][0] = 1201;
$this->rights[$r][1] = 'Lire les exports';
$this->rights[$r][1] = 'Read exports';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 1202;
$this->rights[$r][1] = 'Creer/modifier un export';
$this->rights[$r][1] = 'Creeate/modify export';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer';

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';
}
@ -277,7 +281,7 @@ class modService extends DolibarrModules
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("produit", "export"));
$this->export_permission[$r] = array(array("service", "export"));
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel",
'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
@ -311,7 +315,7 @@ class modService extends DolibarrModules
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("produit", "export"));
$this->export_permission[$r] = array(array("service", "export"));
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
's.nom'=>'ThirdParty',
'pr.price_base_type'=>"PriceBase",
@ -344,12 +348,12 @@ class modService extends DolibarrModules
$r++;
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("produit", "export"));
$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

@ -292,7 +292,7 @@ if ($resql) {
}
print "</td>\n";
}
print '<td class="right">'.price($objp->amount).'</td>';
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td class="right">'.$donationstatic->LibStatut($objp->status, 5).'</td>';
print '<td></td>';
print "</tr>";

Some files were not shown because too many files have changed in this diff Show More